This topic describes how to prepare training and validation data for RLS. It covers text question answering, mathematical reasoning, visual question answering, and agent tasks. The math and agent sections provide real public samples from DAPO and SWE-bench Verified respectively, and explain how these samples map to the RLS format. Other paths and custom business IDs are examples. Replace them with your actual content during integration. Each record provides one initial question or task.
Construction workflow
Preparing a dataset for use with RLS typically follows this order:
-
Define the task type, input content, and scoring method.
-
Assign a stable business ID to each sample, then deduplicate the data and split it into a training set and a validation set.
-
Convert your data into the JSONL format defined in this topic.
-
Verify that the fields, answers, message content, and external resources are complete.
-
Configure the data files and an enabled task type, and run a trial with a small number of samples.
-
After you verify that the inputs, scoring, and sample tracing all meet expectations, use the production dataset.
Correct data formatting and task executability are two separate conditions. The scoring capability for task, along with the template, instance, and execution environment used by the agent, must already be configured in your environment. Defining your own task name does not automatically create the corresponding scoring or execution capability.
File format and directory
File format
Use JSONL files encoded in UTF-8, with one complete JSON object per line.
-
The file extension is
.jsonl. -
Each line corresponds to one sample. Do not wrap the lines in an outer array or
jobobject. -
Do not insert blank lines, comments, or unescaped newlines in the content of the file.
-
Write the file with a standard JSON serialization tool, and save newlines in the content as
\n. -
You usually do not need to generate token IDs in advance or manually add model-specific start and end tokens.
-
Use an explicit list of files for training and validation. Do not pass a data directory or a manifest file directly.
The examples later in this topic use a multi-line layout for readability. When you write actual JSONL, serialize each record onto a single line.
Recommended directory layout
We recommend that a single dataset directory contain the training files, validation files, and supporting documentation, structured as follows:
customer_dataset_v1/
├── train.jsonl
├── validation.jsonl
├── images/ # Used by image tasks
├── manifest.json # Recommended data version manifest
└── README.md # Field descriptions, splitting method, and scoring rules
Common fields
The following table lists the fields shared by all task types. Math, image and text, and agent tasks add their own specific fields on top of these:
|
Field |
Type |
Usage requirement |
Description |
|
|
string |
Required |
Select a task and scoring method that are already configured. |
|
|
string |
Required |
A non-empty question, user request, or task description. For the format requirements, see below. |
|
|
array |
Required for image and text tasks |
Carries the image and the question text in a single user message. When present, it serves as the actual message input. |
|
|
string |
Provide for tasks that have a ground-truth answer. |
A reference answer that matches the scoring method. |
|
|
string |
Required for the general math format |
The final ground-truth answer used for scoring. |
|
|
string |
Provide together with gt. |
The reference derivation. Use an empty string when no derivation is available. |
|
|
string |
Recommended |
A custom data source or version identifier. |
|
|
string |
Optional |
The capability category, such as math. |
|
|
object |
Recommended. Required for agent tasks. |
Sample identifiers, split information, or task execution parameters. |
|
|
integer |
Recommended |
The zero-based line index within the file. |
|
|
string |
Recommended |
The original sample ID, which is traceable across versions. |
|
|
string |
Recommended |
For example, train, validation, or test. |
|
|
boolean |
Optional |
Whether to enable the Chinese language penalty. It must align with the task objective. |
-
extra_info.indexis not a unique ID across files. Useextra_info.source_idto track the same question or task instance, and check for duplicates when you split the data. -
If you provide
messages, keep its contents in sync. Do not update onlypromptand keep the oldmessages. Keep the ground-truth answer in the scoring fields. Do not inadvertently append it to the user message that requires an answer. -
Original samples must not contain answers, rewards, scoring results, or temporary storage handles generated by a previous run.
Text math and rule-based scoring tasks
Use the math scoring format for tasks whose answers can be judged by established rules. The following example comes from a public dataset and shows how an upstream record maps to the RLS format.
Convert public samples
This example is taken from a public sample in DAPO-Math-17k: the original extra_info.index is 9a9b6eb4-a1cb-49d1-8c1e-62eaf2f74079, and the original reward_model.ground_truth is 34. The question specifies the angles, segment lengths, and ratios of a triangle and asks for the sum of the integers in the expression.
{
"task": "math_opensource/dapo",
"prompt": "In triangle $ABC$, $\sin \angle A = \frac{4}{5}$ and $\angle A < 90^\circ$. Let $D$ be a point outside triangle $ABC$ such that $\angle BAD = \angle DAC$ and $\angle BDC = 90^\circ$. Suppose that $AD = 1$ and that $\frac{BD}{CD} = \frac{3}{2}$. If $AB + AC$ can be expressed in the form $\frac{a\sqrt{b}}{c}$ where $a, b, c$ are pairwise relatively prime integers, find $a + b + c$.\nPlease reason step by step, and put your final answer within \boxed{}.",
"data_source": "math_dapo",
"ability": "math",
"answer": "34",
"gt": "34",
"gt_cot": "",
"extra_info": {
"index": 0,
"split": "train",
"source_id": "9a9b6eb4-a1cb-49d1-8c1e-62eaf2f74079"
}
}
Conversion notes: In the original DAPO record, prompt is a list that contains one user message, with instructions before and after the question that require the output to begin with Answer:. Here, the question text is extracted, and the output instruction is uniformly changed to require \boxed{}. The question conditions and the ground-truth answer remain unchanged. This JSON is the RLS integration format, not a verbatim copy of the upstream record.
|
Original field or content |
RLS field |
Handling |
|
|
|
Extract the question text and replace the output format instruction. |
|
|
|
Keep the string "34" |
|
No reference solution process is available |
|
Use an empty string; do not fabricate a derivation. |
|
The UUID in |
|
Keep the original identifier for cross-reference. |
|
Position within the file |
|
Use an integer line index, which distinguishes it from the original UUID. |
|
|
|
Keep the source identifier |
|
Configure during integration |
|
Use |
task uses the "scoring type/data name" format. math_opensource is the scoring interface identifier and must already be enabled in your environment. When you construct your own data, you can use a conventional data name, such as math_opensource/customer_math. The general math format requires both gt and gt_cot; when no reference derivation exists, set gt_cot to an empty string. answer and gt must express the same final answer.
task, gt_cot, ban_chinese, and other integration fields are not part of the original DAPO record. In the example, ban_chinese is a language policy for English tasks. You can adjust it based on the target language. It is not a prerequisite for using DAPO.
Construct answers
-
Always store the final answer as a string, such as "96", "1/2", or "A". Do not mix numbers, objects, or
null. -
Do not treat the complete solution process as the final answer. Put the reference derivation in
gt_cot. -
Handle empty answers, missing answers, and answers that become empty after scoring normalization separately. Do not include them in the production training set.
-
Define the scoring rules for units, numeric precision, the order of multiple-choice answers, and equivalent expressions.
-
Validate scoring separately for fractions, radicals, intervals, single-letter answers, and multiple-choice questions.
-
Do not judge scoring as correct only because the JSON is readable. Validate the scoring behavior with at least one set of correct answers and one set of clearly incorrect answers.
This format applies only to tasks whose answers can be scored by the selected rules. Open-ended question answering, writing, and complex business tasks require a separately configured scoring method. You cannot reuse math scoring by changing only the data name in task.
Generate JSONL from your own data
The following script uses only the Python standard library. It converts a source file, in which each line contains id, question, final_answer, and an optional solution, into the RLS format. The script writes to a new file and does not overwrite existing files.
import json
from pathlib import Path
source = Path("source_train.jsonl")
target = Path("customer_dataset_v1/train.jsonl")
target.parent.mkdir(parents=True, exist_ok=True)
seen = set()
with source.open(encoding="utf-8") as src, target.open("x", encoding="utf-8") as dst:
for index, line in enumerate(src):
row = json.loads(line)
uid = row.get("id")
question = row.get("question")
answer = row.get("final_answer")
solution = row.get("solution", "")
if not isinstance(uid, str) or not uid.strip() or uid in seen:
raise ValueError(f"Line {index + 1}: The sample ID is empty or duplicated")
if not isinstance(question, str) or not question.strip():
raise ValueError(f"Line {index + 1}: The question is empty")
if not isinstance(answer, str) or not answer.strip():
raise ValueError(f"Line {index + 1}: The final answer must be a non-empty string")
if not isinstance(solution, str):
raise ValueError(f"Line {index + 1}: The reference solution must be a string")
seen.add(uid)
sample = {
"task": "math_opensource/customer_math",
"prompt": question.strip() + "\nPut the final answer in \boxed{}.",
"answer": answer.strip(),
"gt": answer.strip(),
"gt_cot": solution,
"data_source": "customer_math_v1",
"ability": "math",
"extra_info": {"index": index, "source_id": uid, "split": "train"},
}
text = json.dumps(sample, ensure_ascii=False)
dst.write(text + "\n")
When you generate the validation set, use a separate source file and output path, and change split to validation. If the conversion fails partway through, the output may be incomplete. Regenerate it after you fix the issue, and do not submit an incomplete file for training.
Image and text tasks
Image tasks are expressed through image segments and text segments in the message content. The top level still uses the common fields:
{
"task": "math_opensource/customer_geometry",
"prompt": "Find the value of x in the figure. Put the final answer in \boxed{}.",
"messages": [
{
"role": "user",
"content": [
{"type": "image", "image": "/data/customer_dataset_v1/images/sample_000001.png"},
{"type": "text", "text": "Find the value of x in the figure. Put the final answer in \boxed{}."}
]
}
],
"answer": "3",
"gt": "3",
"gt_cot": "",
"extra_info": {"index": 0, "source_id": "image-000001", "split": "train"}
}
The image paths and answers in this example only illustrate the format. In practice, they must match the delivered images. This record uses general math scoring, and the images themselves are processed by a vision-capable model.
-
The image files must exist, be decodable, and be accessible at the corresponding path from all execution nodes.
-
The paths in this guide are local absolute paths. In practice, the mount location in the training environment prevails.
-
After you move the data directory, update the image paths in the messages accordingly and validate them again.
-
Writing an image file name separately at the top level does not replace the image segment in content.
-
Do not repeatedly add model placeholders such as the image tag in the text.
-
When you deliver the dataset, provide the image resources and their version information together.
Agent tasks
For agent tasks, the execution environment usually handles the interaction, runs tools, and returns the evaluation results. The dataset only needs to provide the task description and the instance location information, and does not necessarily require a static answer.
Convert public samples
This example is taken from the instance in SWE-bench Verified where instance_id is astropy__astropy-12907. The instance belongs to the public repository astropy/astropy, and the original task description field is problem_statement, which describes a separability matrix computation problem for a nested combination model. The record below keeps the entry point to the full task description and the real instance identifier; the prompt body is excerpted here.
{
"prompt": "Modeling's `separability_matrix` does not compute separability correctly for nested CompoundModels\n(The rest is the full issue description, including reproduction code, expected output, and actual output)",
"task": "swebench_verified-claudecode",
"extra_info": {
"agent_class": "agent_service_agent",
"template": "harbor-swe",
"agent_platform_params": {
"benchmark": "swe-bench-verified",
"instance_id": "astropy__astropy-12907",
"agent": "claude-code"
}
}
}
|
Content in the public data |
RLS field |
Handling |
|
|
|
Keep the full issue description, including the reproduction code and symptoms |
|
|
|
Keep |
|
Dataset selection |
|
Map to the |
|
Execution and scoring configuration |
|
Filled in from the RLS integration configuration; not an upstream raw data field |
|
|
Not added to prompt |
Managed by the execution and evaluation environment to avoid leaking the fix answer to the model |
In the example, the swebench_verified-claudecode, agent_service_agent, harbor-swe, and claude-code are integration configuration values that must already be configured and available in the customer environment. If the environment uses a different template or agent, replace them according to the actual integration agreement. Public datasets do not automatically provide these RLS configurations.
The public samples of SWE-bench Verified are in the test split. This example only illustrates field mapping and does not imply that the samples should be used as a training set by default. If they are used for training, results on the same instances can no longer be treated as independent validation results.
Parameter requirements
Fill in the fields specific to agent records according to the following requirements:
|
Field |
Requirement |
|
|
Use the full task identifier provided by the integrated environment; do not assume a naming rule |
|
|
A complete and unambiguous task description that matches the actual execution instance |
|
|
Specifies the access method of the agent service |
|
|
A published execution template suitable for the task |
|
|
An integrated task set that the execution environment can recognize |
|
|
An instance ID that actually exists in the task set |
|
|
An agent type supported by the execution environment |
Preparing JSONL does not automatically create execution instances, code repositories, images, or evaluation environments. For a new task set, integrate these resources first, and then prepare the data records that reference them.
The expected fix, hidden test answers, or scoring basis of a task must not leak into the model-visible prompt. If the evaluation is performed by the execution environment, filling in the fields does not require fabricating answer or gt.
The run configuration may override the template or parameters in a record. During a trial run, verify the task, template, and instance that are actually executed instead of only checking the JSONL on disk. For deduplication and cross-set splitting of agent data, we recommend the (benchmark, instance_id) composite key.
Configure training data
Merge the data snippet below into the existing training configuration; it is not a complete training launch file:
data:
train_files:
- /data/customer_dataset_v1/train.jsonl
val_files:
- /data/customer_dataset_v1/validation.jsonl
prompt_key: messages
Even if a data record contains only prompt, the integration format still uses prompt_key: messages, and the system converts the text prompt into conversation messages.
Replace the path with a file path that the execution environment can actually read. Configure parameters such as the model, scoring method, agent service, and input and output lengths separately for each task. When training with multiple files, specify the sampling strategy of each source; do not assume that an equal number of files means an equal proportion.
Data quality and splitting requirements
Deduplication and leakage prevention
-
Keep a stable ID for the same problem or the same instance instead of relying only on line numbers to decide whether two records are identical.
-
Split the training set and the validation set by the original problem or task instance. Rewrites of the same problem, different solutions, and repeated samples must stay on the same side.
-
Split the data before augmenting it to avoid the leakage caused by random splitting after augmentation.
-
Do not copy the same validation problem multiple times and treat the copies as more independent evaluation samples.
-
To generate multiple answers for each problem, use the sampling settings instead of duplicating the entire data file.
Check content and answers
-
Check for empty problems, garbled text, truncated bodies, duplicate instructions, and mismatched images.
-
Ground-truth answers must come from a reliable source, and a model must not fill in missing answers without review.
-
Make sure the output format in the prompt matches what the scorer expects.
-
Language penalties must match the target language; a Chinese task must not accidentally enable a setting that forbids Chinese.
-
Check the input length with the message template that the target model actually uses to avoid truncating key conditions.
Manage data versions
After each change to the content, paths, or splitting rules, generate a new version and recalculate the checksums. We recommend recording the following information in the manifest:
|
Information |
Content |
|
Data version |
An explicit version identifier |
|
File manifest |
Relative path, purpose, line count, byte size, and SHA256 |
|
Sample identification rules |
|
|
Splitting rules |
How the training set and the validation set are isolated |
|
Conversion rules |
Field mapping, answer normalization, and instruction addition rules |
|
Cleaning results |
The counts and reasons for discards, corrections, and deduplication |
|
Resource notes |
Image paths or agent execution resource requirements |
Pre-submission acceptance checks
Check files and fields
Confirm each item before submission:
-
Every file is UTF-8 JSONL, each line parses as a JSON object, and there are no blank lines.
-
taskis not empty, and the corresponding task and scoring method are enabled. -
promptis not empty; whenmessagesexists, the messages match the task description. -
The math answer fields have the correct types,
gtis not empty, andgt_cotis a string. -
Sample IDs are traceable, and no same-problem or same-instance overlap exists between the training set and the validation set.
-
Images are accessible and decodable, and the paths match the execution environment.
-
The agent template, task set, instance, and agent type are all valid.
-
Line counts, file sizes, and SHA256 values are recorded.
Run a trial with a small number of samples
Take a small number of samples from each task type and confirm the following:
-
The problem text and images that the model actually sees are correct.
-
Correct answers and incorrect answers are scored as expected, and exceptions are not mistaken for normal low scores.
-
The agent uses the expected instance and returns execution results and evaluation scores normally.
-
Every result can be traced back to its source sample.
-
The input length and the output budget suit the task, and key content is not truncated.
Scale up the data only after all of these checks pass.
FAQ
If data preparation or a trial run behaves abnormally, troubleshoot in the following directions:
|
Problem |
What to check |
|
The file cannot be parsed |
Whether a non-JSONL file, an array, multi-line JSON, blank lines, or corrupted records were passed in |
|
The task type does not exist |
Whether |
|
Modified |
Whether there is also an un-updated |
|
The math score is always zero |
Whether the answer format, normalization result, output format, and scoring capability match |
|
Images cannot be read |
Absolute paths, mount permissions, file integrity, and the visual capability of the model |
|
The agent cannot find the task |
Whether the template, task set, and instance are integrated; whether the run configuration overrides the parameters |
|
Validation results are abnormally high |
Whether same-problem leakage, target answers in the input, or duplicate validation samples exist |
|
Results cannot be reproduced after the file content is updated |
Whether the data version, conversion rules, splitting rules, and new checksums are saved |
Public sample sources
The two examples in this topic are converted from the following public samples:
|
Sample |
Public source |
Location information |
|
Math problem |
train split; the original |
|
|
Agent task |
test split; |
Use sample identifiers for cross-referencing instead of web page line numbers or ordering. This topic shows the RLS format results converted from the public samples above, and the field mapping and output instruction adjustments are marked in the corresponding sections. Follow the license terms of each public source when using and distributing the data.