Skip to content

[WIP]Support challenger training and support continous sampling - #280

Open
tastelikefeet wants to merge 63 commits into
mainfrom
feat/challenger
Open

[WIP]Support challenger training and support continous sampling#280
tastelikefeet wants to merge 63 commits into
mainfrom
feat/challenger

Conversation

@tastelikefeet

Copy link
Copy Markdown
Collaborator

PR type

  • Bug Fix
  • New Feature
  • Document Updates
  • More Models or Datasets Support

PR information

Write the detail information belongs to this PR.

Experiment results

Paste your experiment result here(if needed).

tastelikefeet and others added 30 commits July 4, 2026 17:09
- config.py: E13 executor_thinking='off' to match the SEAM paper run
- run_ablate12.sh: dedicated E13 block (min_level=0 full pool, chunk=128,
  reward-trunc-penalty=0, eval R=1/T=0) reproducing the SEAM run config
- include the code-task/reflexion pipeline modules E13 imports at load time
  (main/trainer top-level import code_task/data_code/eval_reflexion)
…form)

- train_skill_v2.py: SKILL_GEN_FREEFORM/REGEN_FREEFORM_SYSTEM (a 'menu' prompt
  letting the skill model choose whatever form helps this problem — analysis,
  concept, pitfall, tiny example, blunt directive, even 'let's think step by
  step'), wired into style dispatch + --skill-style choices; the freeform prompt
  carries <skills></skills> wrapper examples so open-form outputs stay parseable
- config.py: E21 = bnpo/view-B/freeform (thinking on; see comment for why not off),
  STYLES + RUN_ORDER updated, self-check passes
- trainer.py: freeform shares narrative's 1100-char len budget
The BNPO family returned an already-normalized per-group token-mean with
num_tokens=0, so the framework's PER-TOKEN-MEAN path equal-weighted micro/dp
groups -> a double average (group token-mean, then equal weight over groups)
that sits between token-mean and sequence-mean and biases toward short
responses (degrades to pure sequence-mean as groups multiply). This diverged
from verl/SEAM's true token-mean and was non-orthogonal to skill-length study.

- grpo.py: BNPOLoss gains token_mean_scope='global'(default)|'micro'. 'global'
  returns the token SUM and reports num_tokens=sum(mask), routing into the
  framework SUM-loss path -> exact global token-mean, invariant to how the batch
  is split. 'micro' preserves the old behavior to reproduce E1-E20. Added a
  _loss_num_tokens hook (default 0) so GRPO/DRGRPO/OPSD are untouched. No public
  interface change; downstream grad + metric already branch on num_tokens.
- tests/loss/test_bnpo_token_mean.py: assert global is split-invariant (==true
  token-mean), micro reproduces the biased double-average, SEAM inherits global.
- run_ablate12.sh: E13(140G)/E21(80G) OOM'd in train forward at micro=8; set
  per-arm train_micro_batch defaults (E13=2xdp, E21=1xdp). The global token-mean
  fix makes shrinking micro mathematically equivalent, so effective batch and
  comparability are unchanged.
E13/E21 blocks referenced $TRAIN_MICRO_BATCH directly; under set -u an unset
env aborts with 'unbound variable'. Use ${TRAIN_MICRO_BATCH:-}.
tastelikefeet and others added 26 commits August 9, 2026 00:19
无共享存储时用 crc32(data_id) % SHARD_N 划分题池,两机无需通信即可
保证互不重叠:crc32 是纯函数,跨进程/跨机/跨重启恒定(hash() 受
PYTHONHASHSEED 影响,会造成重叠+遗漏)。分片在 resume 过滤之前执行。

- SHARD_N / SHARD_ID 环境变量,默认 1/0 即原单机路径
- RUN_ID 在 SHARD_N>1 时加 .sN 后缀,避免两机同秒启动撞同一个 run
- shard_tool.py: seed 导出已跑 data_id(B 机需要,否则会重跑 A 机做过的题)
  merge 合并多机产物(sft 按 data_id 去重 / candidates 按 (id,run,idx) /
  collect_log 加 src 标来源,因两机 chunk 都从 0 编号)
- 可控的失败轨迹输入机制 KOD_USE_TRAJ,默认关闭

验证:真实题池 SHARD_N=2/3/4 均无重叠无遗漏、难度无偏;seed+merge
往返 27096 条逐条等价;3 个 PYTHONHASHSEED 结果一致。
e18_collect_kod.py 把 cookbook/human 加进 sys.path 后 import e23_rubric,
但该目录此前 0 文件入库,导致新机器 clone 后启动即
ModuleNotFoundError: No module named 'e23_rubric'。

依赖链已静态遍历确认闭合:
  e18_collect_kod -> e18_{kodcode,multidiag,prompts,select}
                  -> e23_rubric -> e23_prompts
e23_bcb 由 e18 其他脚本引用,一并提交。
judge 的失败是静默的:pytest 缺失不会让进程崩,只会让每题判 incorrect,
表现为 baseline_accuracy=0 / n_wrong=64/64 / collected 恒 0。B 机因此白跑
10 小时 65 个 chunk。

自检照抄 e18_kodcode.run_tests 的真实结构(solution.py + test_solution.py
+ _run.py + subprocess/sys.executable),只有走同一条路径,'通过'才等价于
judge 会判通过。同时检查依赖版本、教师 API key、分片参数、resume 种子。
…kers

- sanitize sys.argv around LLMAgent construction: ms-agent's
  Config.parse_args() mis-parses a foreign argv in forked/Ray workers
  (assert crash on value tokens; silent flag mispairing otherwise)
- tolerate ms-agent >= 1.6.0 API changes: prepare_skills ->
  _ensure_auto_skills(), dropped ms_agent.hooks and
  _append_task_notifications, defensive ToolResult field forwarding
@tastelikefeet tastelikefeet changed the title Support challenger training and support continous sampling [WIP]Support challenger training and support continous sampling Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant