Commit Graph

35 Commits

Author SHA1 Message Date
iomgaa eb56883267 层1 正式关账:判据全过、接口回看完成、疤痕档案与诊断工具箱入存档点
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 10:44:58 -04:00
iomgaa 872d4bd6a6 层1: diag_generate ruff 修复
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 10:37:28 -04:00
iomgaa e472a66959 层1: checkpoint 生成测试脚本(关账判据 3)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 10:37:13 -04:00
iomgaa 4f13365ffa 层1: 损失缩放终解——显式退出 HF 新式梯度累积契约(model_accepts_loss_kwargs=False)
第二幕根因:新式契约的 ×world_size 补偿在基类 compute_loss 尾部(v5
trainer.py:2028),整体重写会绕过它 → loss 与梯度 ÷4(sanity 0.244≈0.85/4)。
按 HF 文档建议(trainer.py:1977)退出新式契约回经典行为;docs/02 勘误改为
两幕全记录。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 10:25:11 -04:00
iomgaa ee16e29846 层1: 修复 HF 梯度累积契约坑——compute_loss 按新式契约返回 sum/num_items_in_batch
根因(探针定案):预训练模型真实 CE≈0.85,训练日志 7.5≈0.94×8(累积步数)。
Qwen3 forward 接受 loss_kwargs → Trainer 走新式契约不再除以累积步数,我们
返回裸 mean 导致日志与梯度同放大 8 倍。sft_loss 纯函数不动,适配收口在
compute_loss;docs/02 §5 勘误起点预期(~0.85)并记录此坑。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 10:18:09 -04:00
iomgaa 1976230250 层1: 损失探针脚本——预训练模型走管线逐行算 CE,区分数据问题与训练环节问题
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 10:14:31 -04:00
iomgaa ff572bf4b9 层1: collator 对齐诊断脚本——排查远程 loss 7.5 与 \50118 解码异常(逐环检验缓存/模板/分词/切片)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 10:05:46 -04:00
iomgaa a0faec0df7 层1: 修复远程 sanity OOM——per_device batch 8→2、累积 2→8(全局 64 不变)
根因:150k 大词表下显存大头是 (B,T,V) logits 链(fp32 ~20G@B=8)与逐层激活,
均正比于 B 而与 0.6B 参数量无关。docs/02 §2.6 旧显存估算勘误入档;
train_sft.sh 加 expandable_segments 防碎片。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 09:21:38 -04:00
iomgaa 68216ace22 docs: 第三章勘误——off-policy 切片是数据轨迹上的 KL 蒸馏而非混 SFT;补 prompt-only 下静默空转的说明
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 09:02:41 -04:00
iomgaa 1d272b6d6c docs: roadmap 索引同步(第三章已写待读)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 08:34:45 -04:00
iomgaa 3c1530a1db docs: 第三章——层 2 white-box OPD(式(2) 精读、standard 路径解剖、U1-U5 重构任务)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 08:34:29 -04:00
iomgaa 4621ebae31 层1/T2: max_tokens 放大至 16384(防截断,上限不计费);并发提到 16;进度行加速度与预计剩余时间
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 08:20:57 -04:00
iomgaa c5a3b7d0bb 层1/T5: 自包含训练脚本 train_sft.sh + train_sft.py;层 1 代码收口
- train_sft.py: FSDP 环境变量前置块(import 前,DDP 下无害);fail-fast 加载
  顺序(数据→tokenizer→模型);首样本自检打印(真 tokenizer 掩码边界肉眼核对);
  remove_unused_columns=False 等非显然约束逐条注释;sanity 模式 = replace 覆盖
- train_sft.sh: 显式 CUDA_VISIBLE_DEVICES 4 卡、PYTHONUNBUFFERED、HF 镜像/缓存
  改道 /data,前置检查清单(含 scp 数据命令)
- 本地验证:fail-fast 到 teacher 缓存缺失处显式报错(941/1000,59 条真实命中
  反向证明 prompt_key 契约端到端成立)
- roadmap 存档点:层 1 代码完成,进入运行阶段

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 08:16:24 -04:00
iomgaa 42a4349e69 层1/T2: 生成脚本接入本地已有的 DAPO 去重版 parquet(17917 行),补试跑说明
数据管线已用真实数据验证(加载→归一→seed 抽子集,5 条无报错)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 08:11:01 -04:00
iomgaa e72d07aced 层1: ars_opd 改为 editable 安装,修复脚本/调试器 import 失败
- pyproject.toml: 最小打包配置(依赖仍统一走 requirements*.txt)
- .vscode/launch.json: 调试当前文件 + teacher 生成两个配置,cwd 锚定仓库根
- setup_remote.sh 与 CLAUDE.md 常用命令同步 pip install -e

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 08:06:40 -04:00
iomgaa 20e6d97427 层1/T2: teacher.py 批量生成 + sha256 JSONL 缓存;teacher 改定 MiniMax-M3
- teacher.py: 通用 OpenAI 兼容客户端(配置驱动 base_url,替代 OpenRouter 专用);
  缓存即断点(逐条落盘+flush,重跑自动续传);单条失败先落盘其余、结束汇总显式报错;
  M3 思考段 <think>...</think> 入库前剥离(只剥开头一段)
- configs.py: 新增 TeacherGenConfig(采样参数显式化;连接三元组走 .env)
- scripts/generate_teacher_completions.py: 自包含生成脚本(本地跑,与训练侧
  同 seed 同子集约束已注明)
- teacher 决策变更同步:.env.example / docs/00 关键设定与存档点 / docs/02
- tests/test_teacher.py: 10 个单测(假客户端注入),含与 attach 的端到端契约闭环

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 07:52:53 -04:00
iomgaa f5bb852fde 层1/T4: trainer.py 掩码 SFT 损失 + 最小 HF Trainer 子类(docs/02 §2.4)
- sft_loss 纯张量函数:batch-min prompt_length、移位切片、labels 重掩码;
  空 batch/无 prompt 行显式报错(参考实现静默归零,差异已标注)
- SFTTrainer 只重写 compute_loss 与 log;不向模型传 labels(防内部损失
  绕过重掩码);日志并入每步有效 token 数供 sanity 监控
- tests/test_trainer.py: 7 个单测,含手算对拍、移位对齐、窗口外无关性、
  漏切重掩码

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 05:02:41 -04:00
iomgaa 5ea58ddf59 层1/T3: data.py 数据管线——加载、messages 归一、teacher 缓存挂接、双预算 collator(docs/02 §2.2-2.3)
- to_messages 三分支归一,except:pass 改显式报错(差异标注在注释)
- prompt_key: sha256 内容寻址,作为与 teacher.py 的缓存契约单点定义
- attach_teacher_completions: 缺键一次性报全,绝不静默跳过
- SFTCollator: 双预算截断 + 未截断长度定边界(坑二)+ -100 掩码 + 左 padding;
  prompt-only 行显式报错(层 2 接 on-policy 再放开)
- tests/test_data.py: 19 个单测,玩具字符级 tokenizer 覆盖超长解答/超长题目/
  enable_thinking 双取值/左 padding/缓存契约

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 04:51:19 -04:00
iomgaa 58d75cc56a 层1/T1: SFTConfig dataclass 与构造校验(docs/02 §4)
- ars_opd/configs.py: 冻结 dataclass,机器路径无默认强制显式传入;
  双预算/enable_thinking/lr 差异均按 §7 规范标注
- __post_init__ 构造即校验,防"completion 预算为零→loss 恒 0"静默空训练
- tests/test_configs.py: 6 个校验测试

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 04:40:45 -04:00
iomgaa 240f404416 工作模式变更入档:层 1 起 Claude 编写代码、用户精读提问;存档点同步
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 04:30:55 -04:00
iomgaa 6c128ad6f5 docs/02:FSDP 决策定案——DDP 到 1.7B,触发点写死(4B 或 seq>8K),env 坑今日消除(脚本头部前置块)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 04:21:30 -04:00
iomgaa 0bcfc6efd4 层 0 关账:两端环境验收通过(本地 4 passed + 远程 4 passed),存档点进入层 1
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 04:05:17 -04:00
iomgaa 12e2a8b0ae docs: 第二章——层1 SFT 基线开工文档(参考实现解剖+保留/替代/删除清单+任务表);CLAUDE.md 映射表补 data.py
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 03:51:06 -04:00
iomgaa 77f0419bad roadmap:训练数据定为 DAPO-Math-17K(对齐论文§5.1),登记 φ/β 两处论文-代码默认值背离
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 03:47:30 -04:00
iomgaa 9c0ec15716 setup_remote.sh 自清 pip 残留;存档点记录远程根分区结构性问题(/root/zym 507G)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 03:39:14 -04:00
iomgaa 991e277316 CLAUDE.md:日志不缓存升级为全局硬规则(含 conda run 事故伤疤标注)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 03:30:34 -04:00
iomgaa b679bcb24f 修复 setup_remote.sh:弃用 conda run(输出整体缓冲),改为直调环境内 pip/python 实现实时日志
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 03:28:13 -04:00
iomgaa f255d5613a docs: roadmap 增加存档点小节(断点恢复用),登记层 0 当前状态
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 03:20:12 -04:00
iomgaa 270a9ab291 层0:统一依赖清单 + 远程一键搭建脚本 + 密钥模板 2026-07-18 03:00:35 -04:00
iomgaa cccccc0ce6 docs: 新增研究方向记录(RI-1:OmniOPD × ZO-RGD 零阶黎曼优化的三个结合点)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 02:57:01 -04:00
iomgaa 72799a34dc tests: 预置 π̂ detach 命门守护测试(对应 docs/01 §3.4,层 3 接入真实 estimator)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 02:32:05 -04:00
iomgaa c9eddd5be8 docs: 修正 π̂ detach 失败机制的方向性错误(压低先验逃逸而非抬高自我强化),补充推导要点
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 02:23:49 -04:00
iomgaa d0bedd564c docs: 教学注释规范与接口回看规则入 CLAUDE.md;新增 CLAUDE.md 取舍决策附录
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-17 11:59:05 -04:00
iomgaa 8647c5a89d docs: 第一章——论文精读与参考实现全景映射(含实现与论文差异清单)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-17 11:29:20 -04:00
iomgaa 6dc13314d8 仓库骨架:README、CLAUDE.md、分层重构路线图(docs/00-roadmap.md)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-17 11:26:11 -04:00