You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(regen): update response regeneration docs for multi-turn support
Brings docs in line with shipped code from PRs #693 (multi-turn),
--reasoning-parser). Adds gsm8k to supported datasets, documents
--subset arg, and adds a multi-turn output example.
Signed-off-by: Sawyer Bowerman <sbowerma@redhat.com>
Copy file name to clipboardExpand all lines: docs/cli/response_regeneration.md
+11-3Lines changed: 11 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# response_regeneration
2
2
3
-
Regenerates assistant responses in existing datasets using a vLLM-served model. Given a dataset containing user prompts (e.g., Magpie, UltraChat), this pipeline extracts the prompts, sends them to a vLLM server, and produces a new dataset with the original prompts paired with freshly generated responses from the target model. This is useful for creating training data where you want a specific model's outputs in place of the original assistant responses.
3
+
Regenerates assistant responses in existing datasets using a vLLM-served model. Given a dataset containing conversations (e.g., Magpie, UltraChat, GSM8K), this pipeline extracts conversation turns, regenerates each assistant response turn-by-turn against the model's own prior outputs, and produces pre-tokenized training samples. For multi-turn conversations, each turn conditions on the regenerated history, producing on-policy training data.
4
4
5
5
The pipeline consists of two scripts:
6
6
@@ -33,6 +33,10 @@ Orchestrates the entire pipeline: starts a vLLM server (with optional data/tenso
33
33
34
34
-**`--tp-size`** (int) Tensor parallel size per replica (maps to vLLM's `--tensor-parallel-size`).
35
35
36
+
-**`--max-model-len`** (int) Maximum model context length (passed to `vllm serve --max-model-len`).
37
+
38
+
-**`--reasoning-parser`** (str) Reasoning parser for the vLLM server (passed to `vllm serve --reasoning-parser`).
39
+
36
40
-**`--keep-server`** (flag) Don't stop the vLLM server after processing completes.
37
41
38
42
All other arguments are passed through to `script.py`.
@@ -51,13 +55,15 @@ All other arguments are passed through to `script.py`.
51
55
52
56
## script.py
53
57
54
-
Extracts user prompts from a dataset, sends them to a vLLM chat completion endpoint, and writes out new prompt-response pairs with the target model's generated responses.
58
+
Extracts conversation turns from a dataset, regenerates each assistant response turn-by-turn via a vLLM chat completion endpoint, and writes out pre-tokenized training samples with generation boundaries marked in the loss mask.
55
59
56
60
### Features
57
61
62
+
-**Multi-turn support** — detects `messages`/`conversations` fields and regenerates each assistant turn against the model's own prior responses
58
63
-**Auto-detects model** from vLLM server (no need to specify `--model`)
59
-
-**Resume capability** to skip already-processed rows
64
+
-**Resume capability** to skip already-processed conversations
60
65
-**Async processing** with configurable concurrency
66
+
-**Automatic retries** with exponential backoff on transient failures
-**`--sampling-params`** (str, default: `None`) JSON object merged into each chat-completion request, e.g. `'{"temperature": 0.6, "top_p": 0.95, "seed": 0}'`. Unset keys use the server defaults.
95
101
102
+
-**`--max-retries`** (int, default: `3`) Max retry attempts per request on transient HTTP failures (408, 409, 425, 429, 5xx) with exponential backoff. Permanent errors (e.g., 400, 404) fail immediately.
103
+
96
104
#### Output Arguments
97
105
98
106
-**`--outfile`** (str, default: auto-generated) Output JSONL path. If not specified, auto-generated as `{dataset}_{model}.jsonl`.
Copy file name to clipboardExpand all lines: docs/user_guide/tutorials/response_regeneration.md
+26-3Lines changed: 26 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Response Regeneration
2
2
3
-
This tutorial walks you through regenerating assistant responses in an existing dataset using a target model served by vLLM. The resulting dataset pairs the original user prompts with freshly generated responses, which can be used as training data for speculator models with improved alignment to your target model.
3
+
This tutorial walks you through regenerating assistant responses in an existing dataset using a target model served by vLLM. For multi-turn conversations, the script regenerates each assistant turn sequentially against the model's own prior responses, producing on-policy training data with improved alignment to your target model.
4
4
5
5
## Overview
6
6
@@ -26,8 +26,8 @@ The simplest way to regenerate responses is using the `run_all.sh` script, which
26
26
This will:
27
27
28
28
1. Start a vLLM server with the specified model
29
-
2. Extract prompts from the dataset and generate new responses
30
-
3. Save results to a JSONL file (e.g., `magpie_Llama-3.3-70B-Instruct.jsonl`)
29
+
2. Extract conversation turns from the dataset and regenerate assistant responses turn-by-turn
30
+
3. Save pre-tokenized results to a JSONL file (e.g., `magpie_Llama-3.3-70B-Instruct.jsonl`)
31
31
4. Stop the server
32
32
33
33
### Multi-GPU Configurations
@@ -71,6 +71,29 @@ The output is a JSONL file with one pre-tokenized row per assistant turn. `loss_
71
71
}
72
72
```
73
73
74
+
For multi-turn datasets, later turns include the regenerated history as context. For example, the second turn of the same conversation would be:
75
+
76
+
```json
77
+
{
78
+
"id": "conv-abc_turn1",
79
+
"primary_id": "conv-abc",
80
+
"input_ids": [151644, 872, ...],
81
+
"loss_mask": [0, 0, ..., 1, 1],
82
+
"conversations": [
83
+
{"role": "user", "content": "What is the capital of France?"},
84
+
{"role": "assistant", "content": "The capital of France is Paris."},
85
+
{"role": "user", "content": "What about Germany?"},
86
+
{"role": "assistant", "content": "The capital of Germany is Berlin."}
A conversation with N assistant turns produces N rows, so expect more lines than input conversations. `conversations` is a review-only twin of `input_ids`; training drops it.
0 commit comments