arena-prepare-data
Prepare evaluation datasets: write prepare_data.py, wire loaders in config.yaml, smoke-test that rows load.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Prepare evaluation datasets: write prepare_data.py, wire loaders in config.yaml, smoke-test that rows load.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Operate the Open Arena REST API: start the server and make authenticated requests.
Run the arena evaluation sweep and interpret last_run.tsv and the leaderboard matrix.
Start and operate the autonomous reward-R&D experiment loop (setup, confirm, then run until interrupted).
Add or iterate on a custom reward in src/rewards/ and wire it into the sweep.
Configure an Open Arena sweep: author/edit config.yaml datasets, rewards, metrics, and experiments blocks.
| name | arena-prepare-data |
| description | Prepare evaluation datasets: write prepare_data.py, wire loaders in config.yaml, smoke-test that rows load. |
Read PREPARE_DATA.md end-to-end before writing any prep script — it covers the synalinks Generator pattern for synthetic data, schema vs ChatMessages choices, and every pitfall. Read README.md (Dataset providers table) and config.example.yaml (dataset entries) for reference YAML.
prepare_data.py ──► raw_data/<name>.jsonl ──► config.yaml (local/folder/…) ──► src/evaluate.py
prepare_data.py is a free-form script — fill it for the dataset's needs. The loaders in src/datasets/ read the files it produces. The platform has no synthetic-data engine; put generation, filtering, deduplication, and formatting here.
import json
from datasets import load_dataset
src = load_dataset("gsm8k", "main", split="test")
with open("raw_data/gsm8k_test.jsonl", "w") as f:
for row in src:
if not row["question"]:
continue
f.write(json.dumps({
"question": row["question"],
"answer": row["answer"].split("####")[-1].strip(),
}) + "\n")
Run it: uv run python prepare_data.py
Output convention: write files under raw_data/. Path is not enforced — any path works as long as config.yaml points to it.
See PREPARE_DATA.md (Using synalinks section) for the full pattern. Key points:
DataModel subclasses with Field(description=...).Input → Generator → Program and await program(input_instance) per seed.asyncio.run(main()) at the top — programs are async.temperature=0 for determinism.Generator can act as a quality filter (generate → judge → keep).datasets:
gsm8k_test:
type: local
path: raw_data/gsm8k_test.jsonl
input_schema:
type: object
properties:
question: { type: string }
required: [question]
input_template: |
{"question": {{ question | tojson }}}
output_schema:
type: object
properties:
answer: { type: string }
required: [answer]
output_template: |
{"answer": {{ answer | tojson }}}
batch_size: 8
limit: 100
reward:
name: exact_match
out_mask: [question] # mask input field re-attached by return_inputs=True
datasets:
cases:
type: folder
path: raw_data/cases
pattern: "*.json"
recursive: false
batch_size: 4
input_template: |
{"messages":[{"role":"user","content": {{ question | tojson }} }]}
output_template: |
{"role":"assistant","content": {{ answer | tojson }} }
folder rows expose every file's parsed dict plus _filename, _stem, _path metadata.
datasets:
mmlu_test:
type: huggingface
path: cais/mmlu
name: all
split: test
streaming: true
limit: 50
batch_size: 1
input_template: |
{"messages":[{"role":"user","content": {{ question | tojson }} }]}
output_template: |
{"role":"assistant","content": {{ ["A","B","C","D"][answer] | tojson }} }
reward:
name: exact_match
in_mask: [content]
input_schema / output_schema for structured tasks (multiple-choice, JSON, numeric). Rewards see clean fields; the LM is constrained to valid JSON.ChatMessages / ChatMessage) for free-form chat. y_pred.content carries the answer; use in_mask: [content] on comparison rewards.Do not pass both input_schema and input_data_model — the constructor raises.
After wiring, verify every dataset loads at least one batch:
uv run python -c "
import yaml
from src.datasets import load_dataset_from_yaml
cfg = yaml.safe_load(open('config.yaml'))
for n in cfg['experiments']['datasets']:
it = iter(load_dataset_from_yaml('config.yaml', name=n))
next(it); print('ok', n)
"
{{ field | tojson }}, never bare {{ field }}.StrictUndefined — templates fail loudly on missing keys. prepare_data.py must emit every key the template references.input_schema and input_data_model.len — pin limit: if a caller needs a bounded epoch.return_inputs=True leaks input fields into y_pred — comparison rewards need out_mask (schema datasets) or in_mask: [content] (chat-message defaults) to avoid scoring the prompt.batch_size and limit interactions — limit caps raw pre-repeat rows. Final batch count is ceil(limit * repeat / batch_size).--no-cache or rm -rf .open-arena/*/ after edits.Inside the autoresearch loop, prepare_data.py is not edited autonomously. Pause, propose the change to the human, and wait for explicit approval before touching it.