层2: max_grad_norm 提进 DistillConfig(显式化静默稳定器)+ noclip 对照模式

首冒烟发现:sanity 的 loss 平滑、无预期毛刺,因 HF 默认 max_grad_norm=1.0 把
反向 KL 的梯度爆炸(§4.1,实测 grad_norm 14→2 是裁剪前范数)默默压平了——正是
本项目要堵的"静默行为"。

- configs.py: DistillConfig 加 max_grad_norm=1.0(默认=原 HF 行为),docstring 讲清
  它是 §4.1 爆炸的隐形稳定器、日志 grad_norm 是裁剪前值;__post_init__ 校验 >0
- train_whitebox.py: FULL 显式写出、TrainingArguments 传入;build_config 加 noclip
  模式(max_grad_norm=1e9≈关裁剪 + lr 5× + 15 步)暴露原始爆炸供教学对照
- .sh: 用法加 noclip 模式说明

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-19 08:34:14 -04:00
parent f1b6d1f668
commit 8b362eae09
3 changed files with 28 additions and 3 deletions
+3 -2
View File
@@ -2,8 +2,9 @@
# 层 2white-box OPD 训练(远程 gpu-a800-060 专用;本地不跑训练)。
#
# 用法(tmux 内执行,日志实时可查):
# bash scripts/train_whitebox.sh sanity # 50 步冒烟:首 prompt 自检 + KL loss +
# # 生成 token 数;预期见 loss 毛刺(梯度爆炸实况)
# bash scripts/train_whitebox.sh sanity # 50 步冒烟:首 prompt 自检 + KL loss + 生成数
# bash scripts/train_whitebox.sh noclip # §4.1 对照:15 步,关裁剪+抬 lr,暴露原始
# # 梯度爆炸(loss 毛刺);与 sanity 平滑曲线并排
# bash scripts/train_whitebox.sh # 正式:1k 子集 1 epoch
#
# 前置检查清单: