data-gen-ebd/docs/data-format.md
amos c64c79b31d Run the Pi agent in Salty jobs over a one-time SSH tunnel and export SFT rows
rollout.salty_run keeps the gateway, grading and evidence on 36 and moves only the
agent step into a Salty job. The gateway listens on 127.0.0.1 with a per-attempt
bearer token; the job reaches it over port 22 with a restricted one-time key that is
removed after each attempt. rollout.batch gains --backend salty and repeatable
--credential-file, and writes pass/fail SFT exports through rollout.sft at the end.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 17:45:28 +08:00

33 lines
5.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 数据导出与任务难度
参考 [UltraData-RL-2609 的格式和难度校准](https://huggingface.co/datasets/openbmb/UltraData-RL-2609#-data-format)。本项目只建设采集系统,不执行模型训练。任务记录采用五字段 JSONL;模型原生请求、思考、工具反馈、候选和判分继续保存在证据归档中。
每行只有 `uuid`、`query`、`ground_truth`、`source`、`domain`。`uuid` 由冻结任务摘要生成,同题多次采集共用任务 UUID;`query` 包含完整题面和缺陷初态;`source` 保留真实任务来源,不写成 UltraData;首题 `domain=Code`。`ground_truth` 来自可信 verifier/gold 的实际行为校验,不从被测模型的提交或 PASS 推导答案。
UltraData 的 Code 使用 `call_type=std`、完整 stdin 字符串与 stdout。现有 frame-decoder v1 的合同是 argv 分片,另外检查退出码。因此本项目明确使用 `call_type=argv` 扩展:`inputs` 为参数数组的数组,`outputs` 为逐例 stdout,`exit_codes` 为逐例退出码,`fn_name=null`。五字段布局一致,评测需要本项目 C/argv 验收器。要完全采用 std 须另建 stdin 任务版本并重新校准,不能改写历史 v1 或丢弃退出码。
没有可移植 argv/std 参考的任务(例如私有测试程序直接链接候选)不提供 `dataset.json`,导出 `call_type=verifier`:`ground_truth` 只含 `fn_name=null`、`task_digest` 和 `verifier_digest`,表示评测必须使用同一身份的受保护 grader 包,不能离开本项目验收器复现。query 依次附上 template 的全部初始文件。
任务目录内 `dataset.json` 是可信作者冻结的目标快照,关联 task/verifier 摘要;导出器核对身份、字段、用例长度和类型。它是控制端评测材料,不挂入 Agent。当前快照由原始 verifier 对可信 gold 的 87 次实际运行采集,要求全部通过;题目初态、候选和 gold 源码不能充当 ground truth。
入口 `python3 -m rollout.export TASK --output DATASET.jsonl`,输出独占创建,已有文件不覆盖。今后 `rollout.archive` 自动将同一任务行封存为 `dataset.jsonl` 并纳入 manifest。任务 JSONL 包含判分依据,只提供给可信数据处理端;Agent 输入仍仅含公开题面和初态,不挂载归档盘。
## Agent 轨迹导出(SFT 对话格式)
参考 [UltraData-SFT-Agent-2609](https://huggingface.co/datasets/openbmb/UltraData-SFT-Agent-2609) 的 Code-Agent 格式:一条轨迹为一行,字段是 `uuid`、`messages`、`tools`、`source`、`domain`,另加本项目字段 `rollout`。只做格式转换,本项目不训练。
- 入口:`python3 -m rollout.sft BATCH... --output EXPORT_DIR`,扫描批次目录里所有 `pi-*`/`salty-*` 尝试,在新建的 `EXPORT_DIR` 中写出 `pass.jsonl`(成功)、`fail.jsonl`(失败)和 `skipped.json`(未导出的尝试及原因)。PASS 与 FAIL 分文件,不混放;目录已存在则拒绝,不覆盖旧导出。
- 自动导出:`rollout.batch` 每次结束(含中断、暂停)都在批次目录写出 `export-<时间>/`,与同次 `report-<时间>.json` 对应。`--backend salty` 让每道题在 Salty 上跑;`--credential-file` 可重复,新尝试分给当前占用最少的 Key。
- 准入:回执 `pi_evidence.status=VERIFIED`、`contamination=[]`、`cleanup=confirmed`,`status` 为 PASS 或 FAIL。不满足的尝试不导出,原因写进 `skipped.json`;INFRA_ERROR、UNVERIFIED 和污染轨迹都在这里。36 本机 Docker 的回执没有 `contamination` 字段(Agent 无 `/data` 与外网),视为无污染。
- `messages` 取最后一次实际发给模型的请求(按 pi/2 前缀增量还原、已经网关摘要核对),再接上最终的 assistant 回复。角色为 system / user / assistant / tool。assistant 的思考写在 `reasoning_content`;`tool_calls` 只保留 `type` 和 `function`,参数解析为 JSON 对象。tool 消息只保留 `role` 和 `content`,按调用顺序排列。`tools` 是同一请求里的工具定义。
- `uuid`=`Code_Agent_` 加原生轨迹 sha256;`source`=`embedded-rollout:<task_id>`;`domain`=`Code_Agent`。
- `rollout` 记录 `task_id`、`task_digest`、`verdict`(PASS/FAIL)、`model`、`image_id` 和 `trace_sha256`。FAIL 轨迹单独放在 `fail.jsonl`。
- 只导出 Agent 实际看到的内容:公开题面、工具输入输出和模型回复,不含判据、参考解、令牌或网关地址。
- 目前只支持 Chat Completions 轨迹(GLM);Qwen 使用的 Responses 格式会被拒绝。
## 难度准入
frame-decoder 是自编的链路回归题,归类 `SMOKE_ONLY`;它证明调用、工具、隔离评分和归档链路可以运行,不证明已产出有训练收益的数据集。一次成功只记录一次事实,不能写成稳定成功率或已掌握。
扩量先选有工程来源且答案可独立核验的任务,再对明确的目标模型重复采样,记录模型/任务版本、成功数、总数与环境故障。稳定掌握的题留作回归,不进入主采集池;有失败但能利用真实反馈改善的题优先。全失败的题先排查环境、题意和标签有效性,不能只靠增加难度或延长轨迹。每题的质量/难度处置作为旁路记录,保持这五个字段和参考目标不变。