From 8378e2a74165460c8323798580c53dac878d5ce2 Mon Sep 17 00:00:00 2001 From: wuyang <5700876+banisherwy@user.noreply.gitee.com> Date: Wed, 29 Jul 2026 06:07:42 +0800 Subject: [PATCH] feat: publish alignment deep dive --- PROGRESS.md | 17 +- README.md | 6 +- ROADMAP.md | 5 + package.json | 3 +- research/ALIGNMENT_GROK_LEADS.md | 108 ++ research/ALIGNMENT_RESEARCH.md | 601 ++++++++ research/sources/README.md | 10 + scripts/check-alignment-browser.mjs | 241 +++ scripts/check-data-browser.mjs | 8 +- scripts/check-moe-browser.mjs | 2 +- scripts/check-numerics-browser.mjs | 8 +- scripts/check-reasoning-browser.mjs | 2 +- scripts/check-scaling-browser.mjs | 6 +- scripts/check-training-systems-browser.mjs | 2 +- scripts/check-transformer-browser.mjs | 6 +- src/components/AlignmentLab.astro | 895 +++++++++++ src/components/SiteHeader.astro | 1 + src/data/chapters.ts | 10 +- src/data/papers.ts | 176 +++ src/pages/index.astro | 30 +- src/pages/post-training/alignment/index.astro | 1348 +++++++++++++++++ src/pages/progress/index.astro | 13 +- 22 files changed, 3463 insertions(+), 35 deletions(-) create mode 100644 research/ALIGNMENT_GROK_LEADS.md create mode 100644 research/ALIGNMENT_RESEARCH.md create mode 100644 scripts/check-alignment-browser.mjs create mode 100644 src/components/AlignmentLab.astro create mode 100644 src/pages/post-training/alignment/index.astro diff --git a/PROGRESS.md b/PROGRESS.md index bdce6f2..4af298c 100644 --- a/PROGRESS.md +++ b/PROGRESS.md @@ -14,6 +14,7 @@ | Scaling Laws | 完成首版 | 74% | 真实拟合复现、置信区间与更多模型族对照 | | 数据工程与预训练配方 | 完成首版 | 73% | FineWeb / DCLM 逐图精读、真实去重误伤与 mixture traces | | DeepSeek 专题 | 进行中 | 71% | 补 R1 / DAPO 的逐图训练轨迹与复现对照 | +| 指令微调与人类偏好 | 完成首版 | 75% | 真实偏好分歧、RM 长度偏置与 PPO/DPO 小模型复现 | | 推理与测试时扩展 | 完成首版 | 76% | 真实模型采样曲线、PRM 案例与逐篇图表精读 | | 稀疏计算与 MoE | 完成首版 | 74% | 真实负载 traces 与专家特化案例 | | 长上下文专题 | 完成首版 | 72% | 真实模型配置、内核细节与失败案例 | @@ -32,10 +33,10 @@ - [x] 提炼参考网站的编辑设计语言。 - [x] 确认 `git.k1412.top` 为 Gitea/Forgejo 兼容服务且本机 HTTPS 凭据可用于既有仓库。 - [x] 使用 Grok CLI 检索并形成约 95 篇一手论文的补充路线,主代理已回查关键来源。 -- [x] 完成 258 篇关键论文索引,覆盖 14 个标签专题与 Kimi/DeepSeek 聚光主线。 +- [x] 完成 280 篇关键论文索引,覆盖 14 个标签专题与 Kimi/DeepSeek 聚光主线。 - [x] 完成可检索、可按专题筛选的论文库页面。 -- [x] 完成 K3、语言模型前史、Transformer 基础、DeepSeek 谱系、Scaling Laws、数据工程、长上下文、MoE、推理、训练系统与数值优化十一篇首版长文。 -- [x] 完成 K3 三轴架构、语言模型前史四联实验、Transformer 四联实验、DeepSeek 谱系、长上下文、MoE 路由、推理三页签,以及训练系统、Scaling、数据工程与数值专题各四页签等三十一个原创交互视图。 +- [x] 完成 K3、语言模型前史、Transformer 基础、DeepSeek 谱系、Scaling Laws、数据工程、长上下文、MoE、指令微调与人类偏好、推理、训练系统与数值优化十二篇首版长文。 +- [x] 完成 K3 三轴架构、语言模型前史四联实验、Transformer 四联实验、DeepSeek 谱系、长上下文、MoE 路由、推理三页签,以及训练系统、Scaling、数据工程、数值与 Alignment 专题各四页签等三十五个原创交互视图。 - [x] 完成长上下文首版:五张成本账、26 篇一手论文、10+ 机制图与 8 策略交互实验室。 - [x] 核验 FlashAttention、DeepSeek-V2/V3.2/V4、Kimi Linear/K3 等六份论文原文,并建立长上下文研究账本。 - [x] 核验 Switch、ST-MoE、DeepSeekMoE、Loss-Free、V3、LatentMoE 与 K3 原文,并建立 MoE 研究账本。 @@ -91,9 +92,14 @@ - [x] 完成 Transformer 深度首版:21 段正文与 QKV—Mask—多头位置—Block 成本四联实验。 - [x] 论文库补齐 Residual/Norm、相对位置、UniLM、多头冗余与解释争论等 11 个节点,从 247 篇扩充至 258 篇。 - [x] Transformer 深度首版以源提交 `252e7d6`、不可变镜像 `20260728T212813Z-252e7d6` 发布;NAS、VPS/Tailscale、NPM、DNS、HTTPS、证书、15 路由、门户、公开 Forgejo 与八套生产 Chrome 回归全链路通过。 +- [x] 启动 Alignment 专题:按十二张账拆开目标、监督、SFT、偏好、RM、策略更新、直接优化、分布、约束、失效与证据,避免把 SFT / RLHF / DPO 写成彼此替代的三代技术。 +- [x] 缓存并核验 24 份新的一手论文全文,复用 DeepSeek / Kimi / MOPD 报告,建立 44 节点正式论文链;Grok 45 条候选另存为未核验 leads。 +- [x] 完成 Alignment 首版:22 节长文、十二张账、DeepSeek/Kimi 后训练双谱系,以及 SFT—偏好/RM—PPO/DPO—配方比较四联实验。 +- [x] 论文库新增人类偏好学习、HH-RLHF、LIMA、RLAIF、RewardBench、KTO、ORPO、SimPO 等 22 个节点,从 258 篇扩充至 280 篇。 ## 正在进行 +- [ ] Alignment 工程验收与发布:浏览器交互、移动端、全站回归、公开仓库和生产不可变镜像。 - [ ] Transformer 二轮:多头电路逐图、Pre/Post-LN 真实 traces、Flash/KV kernel 与模型配置对照。 - [ ] 语言模型前史二轮:Kneser–Ney / LSTM / Bahdanau 逐图精读、真实小语料复现与 tokenizer 公平性案例。 - [ ] Scaling Laws 二轮精读:真实拟合复现、逐篇图表、置信区间、外推失败与更多模型族对照。 @@ -156,6 +162,11 @@ | 2026-07-29 | Attention 权重与因果解释永久分离 | 热力图只描述中间计算和提出假设;因果结论需要消融、patching 或反事实干预 | | 2026-07-29 | 论文库扩充到 258 篇 | 新增 Residual/Norm、relative position、UniLM、多头冗余、解释争论与 NormFormer 等 11 个节点 | | 2026-07-29 | Transformer 深度首版用不可变镜像 `20260728T212813Z-252e7d6` 发布 | OCI digest `sha256:db003faa…59fa`;复用 `12010→8080`、NPM host 31 / cert 41、门户 order 180 与公开 Forgejo | +| 2026-07-29 | Alignment 拆成十二张彼此独立的账 | 防止把“更会答”“更符合偏好”“更安全”“更可验证”压成同一个 alignment 分数 | +| 2026-07-29 | Grok Alignment 线索与正式证据永久分离 | 45 条候选只负责查漏;公式、数字和历史结论必须回到一手 PDF / 会议页面 | +| 2026-07-29 | DeepSeek 与 Kimi 后训练按阶段合同重建 | R1-Zero 不外推为完整 R1;K3 partial rollout 与 MOPD 不混写;DPO 不被描述成取消偏好数据 | +| 2026-07-29 | Alignment 首版用 44 个一手节点与四个独立实验闭环 | SFT token mask、RM 偏置、PPO/DPO 更新与模型配方分开演示,不合成伪“对齐总分” | +| 2026-07-29 | 论文库扩充到 280 篇 | 新增 22 个 SFT、偏好、RM、RLAIF、直接偏好优化与后训练评测节点 | ## 未决问题 diff --git a/README.md b/README.md index 0b54ba8..212ef79 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ - 持续进度:[PROGRESS.md](./PROGRESS.md) - 证据与写作规范:[research/METHODOLOGY.md](./research/METHODOLOGY.md) -当前里程碑包含 16 专题学习地图、258 篇关键论文索引、Kimi K3 完整导读、 -语言模型前史、Transformer 基础、DeepSeek 技术谱系、Scaling Laws、数据工程、长上下文、MoE、推理、训练系统与数值优化深度专题, -以及 31 个覆盖核心机制的原创交互视图。 +当前里程碑包含 16 专题学习地图、280 篇关键论文索引、Kimi K3 完整导读、 +语言模型前史、Transformer 基础、DeepSeek 技术谱系、Scaling Laws、数据工程、长上下文、MoE、指令微调与人类偏好、推理、训练系统与数值优化深度专题, +以及 35 个覆盖核心机制的原创交互视图。 其余专题按进度账本持续扩建。 ## 本地开发 diff --git a/ROADMAP.md b/ROADMAP.md index 761ea58..3c7d410 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -84,6 +84,11 @@ Adam/AdamW、Adafactor、μP、Muon;FP16/BF16/FP8/MXFP4、量化感知训练 Instruction Tuning、SFT、RLHF/PPO、RLAIF、Constitutional AI、DPO 及其后续。解释 base model 如何变成可协作助手。 +首版已发布:以目标、监督单位、数据来源、SFT、偏好测量、奖励模型、策略更新、直接偏好、 +分布、约束、失效与证据十二张账,串起 2017–2026 的 44 个一手节点。正文明确区分 +SFT / RM / PPO / DPO / RLAIF / RLVR 的角色合同,重点追踪 DeepSeek LLM→V2→V3→R1→V3.2→V4 +与 Kimi K2→K2.5→K3,并提供 SFT 显微镜、偏好/RM、PPO/DPO 更新和配方比较四个独立实验。 + ### 11. 推理模型与测试时扩展 CoT、自洽性、搜索、验证器、过程奖励、GRPO、DeepSeekMath、DeepSeek-R1/R1-Zero、Kimi k1.5、multi-effort RL 与 on-policy distillation。 diff --git a/package.json b/package.json index 821fc5d..968b666 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "check:data-browser": "node scripts/check-data-browser.mjs", "check:numerics-browser": "node scripts/check-numerics-browser.mjs", "check:language-model-history-browser": "node scripts/check-language-model-history-browser.mjs", - "check:transformer-browser": "node scripts/check-transformer-browser.mjs" + "check:transformer-browser": "node scripts/check-transformer-browser.mjs", + "check:alignment-browser": "node scripts/check-alignment-browser.mjs" }, "dependencies": { "@astrojs/sitemap": "3.7.3", diff --git a/research/ALIGNMENT_GROK_LEADS.md b/research/ALIGNMENT_GROK_LEADS.md new file mode 100644 index 0000000..563e84c --- /dev/null +++ b/research/ALIGNMENT_GROK_LEADS.md @@ -0,0 +1,108 @@ +# Alignment:Grok 候选论文线索 + +> 状态:**未核验候选账** +> 生成方式:本机 Grok CLI Headless 模式,2026-07-29 +> 使用约束:这里只记录检索线索,不能直接作为正文事实、公式、数字或历史结论的依据。正式内容必须回到论文 PDF、会议页面或研究机构原文逐项核验。 + +## 这次线索检索的用途 + +正式研究账本已经覆盖 SFT、偏好数据、奖励模型、PPO/RLHF、RLAIF、DPO、RLVR、DeepSeek 与 Kimi/K3。Grok 的任务不是替正文写作,而是做一次“漏项扫描”:寻找可能缺失的论文分支、失败模式和边界案例。 + +它给出 45 个候选条目,按下列九组组织: + +| 候选组 | 条目数 | 对正式研究最有价值的提醒 | +|---|---:|---| +| SFT | 6 | FLAN、T0、Natural Instructions、SuperNI、Self-Instruct、LIMA 需要区分任务泛化、数据生成与少量高质量示范 | +| 偏好 / 奖励模型 | 5 | 不只看标注规模,也要检查偏好分歧、长度相关性和奖励泛化 | +| PPO / RLHF | 6 | Christiano → Ziegler → Stiennon → InstructGPT 的主线应与 PPO 算法本体分开 | +| RLAIF | 4 | Constitutional AI、自我批评修订与 AI preference 不是同一层概念 | +| DPO 分支 | 8 | RRHF、SLiC-HF、IPO、KTO、ORPO、SimPO 等不能笼统称作“DPO 小改版” | +| 失败模式 | 5 | reward hacking、overoptimization、sycophancy、verbosity bias 应拆成不同故障 | +| RLVR | 4 | PRM 是前驱但不等于程序化 verifier;DeepSeekMath 的 GRPO 与具体奖励来源要分开 | +| DeepSeek | 4 | LLM、Math、V3、R1 的角色不同,不能把 R1-Zero 的纯 RL 结论外推到完整 R1 | +| Kimi | 3 | k1.5、K2、K2.5 的推理、agentic、多模态主线不同 | + +## 候选清单 + +以下名称保留为后续查漏入口;存在重复跨组复用,不代表 45 篇互不重复的唯一论文。 + +### SFT 与指令数据 + +- Finetuned Language Models Are Zero-Shot Learners(FLAN) +- Multitask Prompted Training Enables Zero-Shot Task Generalization(T0) +- Natural Instructions +- Super-NaturalInstructions +- Scaling Instruction-Finetuned Language Models +- Self-Instruct +- LIMA: Less Is More for Alignment + +### 偏好、奖励模型与 RLHF + +- Deep Reinforcement Learning from Human Preferences +- Fine-Tuning Language Models from Human Preferences +- Learning to Summarize from Human Feedback +- Training Language Models to Follow Instructions with Human Feedback +- Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedback +- Proximal Policy Optimization Algorithms +- Scaling Laws for Reward Model Overoptimization +- AlpacaFarm +- OpenAssistant Conversations +- Llama 2: Open Foundation and Fine-Tuned Chat Models +- Back to Basics: Revisiting REINFORCE-Style Optimization for Learning from Human Feedback in LLMs + +### RLAIF 与宪法式约束 + +- Constitutional AI: Harmlessness from AI Feedback +- RLAIF: Scaling Reinforcement Learning from Human Feedback with AI Feedback +- UltraFeedback +- Self-Play Fine-Tuning Converts Weak Language Models to Strong Language Models + +### 直接偏好优化分支 + +- Direct Preference Optimization: Your Language Model is Secretly a Reward Model +- RRHF: Rank Responses to Align Language Models with Human Feedback +- SLiC-HF: Sequence Likelihood Calibration with Human Feedback +- A General Theoretical Paradigm to Understand Learning from Human Preferences(IPO) +- KTO: Model Alignment as Prospect Theoretic Optimization +- ORPO: Monolithic Preference Optimization without Reference Model +- SimPO: Simple Preference Optimization with a Reference-Free Reward +- Zephyr: Direct Distillation of LM Alignment +- Unpacking DPO and PPO: Disentangling Best Practices for Learning from Preference Feedback + +### 失败模式与评测 + +- Sycophancy / 用户信念迎合相关研究 +- A Long Way to Go: Investigating Length Correlations in RLHF +- RewardBench +- reward overoptimization / Goodhart 效应相关研究 +- 偏好标注分歧、both-bad pair 与 verbosity bias 相关研究 + +### RLVR、DeepSeek 与 Kimi + +- Let’s Verify Step by Step +- Tülu 3: Pushing Frontiers in Open Language Model Post-Training +- DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models +- Crossing the Reward Bridge: Expanding RL with Verifiable Rewards Across Diverse Domains +- DeepSeek LLM +- DeepSeek-V3 Technical Report +- DeepSeek-R1 +- Kimi k1.5 +- Kimi K2 +- Kimi K2.5 + +## 必须保留的边界提醒 + +1. “偏好更长”不能直接写成人类真正想要冗长答案;奖励模型可能只学到了长度代理特征。 +2. sycophancy 不完全等于撒谎,它可能来自 helpfulness、agreeableness 与偏好标签的纠缠。 +3. 人类标注的步骤正确性不等于程序可验证奖励,PRM 只能作为 RLVR 前驱来讲。 +4. DeepSeekMath 同时讨论模型奖励与规则奖励;“用了 GRPO”不能反推出“奖励一定可验证”。 +5. R1-Zero 的少监督 / 纯 RL 路径不能外推为完整 DeepSeek-R1 不需要冷启动与监督数据。 +6. Kimi K2、K2.5 的 agentic / multimodal 叙事不能替代 k1.5 的推理 RL 算法细节。 +7. “DPO 不需要奖励模型”仅指不单独训练显式 RM 并运行 PPO;偏好、参考策略与数据分布仍然存在。 + +## 当前裁决 + +- 已进入正式账本:有一手 PDF 或官方页面支撑、且边界已经逐项复核的节点。 +- 暂留候选:`Crossing the Reward Bridge`、具体 sycophancy 论文、长度相关论文等,需要在对应专题扩写时重新核对标题、版本、实验设定和数字。 +- 明确不采用:任何仅凭二手叙事得出的“某算法彻底取代另一算法”“纯 RL 不再需要数据”“AI feedback 等于没有人类价值输入”等强结论。 + diff --git a/research/ALIGNMENT_RESEARCH.md b/research/ALIGNMENT_RESEARCH.md new file mode 100644 index 0000000..8a3ad37 --- /dev/null +++ b/research/ALIGNMENT_RESEARCH.md @@ -0,0 +1,601 @@ +# 指令微调与人类偏好研究账本 + +状态:正式一手证据账本,Chapter 10 首版研究中 +研究截止:2026-07-29 +本轮本地缓存:24 份新增一手 PDF / 文本,复用 PPO、DeepSeek、Kimi 与推理专题既有缓存 +线索发现:K3 references、论文引用网络、会议/作者页面、Grok CLI +结论依据:原论文正文、会议论文页、官方技术报告;Grok 只用于扩大候选召回 + +## 0. 这一章真正要回答什么 + +“Alignment / 对齐”经常被说成一个模糊的终点,仿佛模型经过某种神秘训练后就“符合人类价值”。 +为了避免这种过度承诺,本章把问题限定为: + +> 一个只会延续互联网文本分布的 base language model, +> 如何学会理解用户接口、产生可协作行为、区分更好与更差的回答, +> 并在代理目标、反馈偏差与能力退化之间保持可检查的边界? + +至少要分开十二张账: + +1. **行为目标账**:我们想改变 helpfulness、harmlessness、honesty、格式遵循、风格还是某项能力? +2. **监督单位账**:标签作用于 Token、整段 demonstration、pairwise preference、标量、步骤还是环境结果? +3. **数据来源账**:人类、AI teacher、constitution、规则 verifier、执行环境分别提供什么信息? +4. **SFT 账**:teacher forcing 的条件似然学到了什么,又没有学到什么? +5. **偏好测量账**:排序、评分、二元可取性与多人分歧怎样进入数据? +6. **奖励模型账**:Bradley–Terry 类模型如何把比较变成标量代理? +7. **策略优化账**:PPO、REINFORCE/RLOO、GRPO 分别怎样更新 policy? +8. **直接偏好账**:DPO、IPO、KTO、ORPO、SimPO 消掉了哪些组件,保留了哪些假设? +9. **分布账**:反馈来自当前 policy 还是旧 policy;online、offline、on-policy、off-policy 不能混写。 +10. **约束账**:reference KL、pretraining mix、长度/语言/安全约束怎样防止“为了高分走太远”? +11. **失效账**:reward hacking、过优化、迎合、长度偏置、拒答过度与 alignment tax 怎样出现? +12. **证据账**:训练 reward、RM accuracy、LLM judge、人工盲评、规则验证分别能证明到哪一步? + +本章不声称给出“人类价值”的唯一数学定义。它讲的是可观测的 post-training 接口、训练信号和证据边界。 + +## 1. 四条因果链 + +### 1.1 从任务标签到自然语言接口 + +```text +每个任务训练一个专用模型 +→ 多任务共享参数 +→ 用 prompt template 把不同数据集写成自然语言任务 +→ FLAN / T0:在许多 prompted tasks 上 instruction tuning +→ Self-Instruct:让模型自举生成 instruction / input / output +→ LIMA:检验少量高质量示范能把多大比例的预训练能力“叫出来” +→ 当代 SFT:混合通用、推理、工具、代码、安全与多轮轨迹 +``` + +这里的核心变化不是“下一个 Token 目标消失”,而是训练条件从普通文本前缀变成了 +`system / instruction / context / response` 的交互接口。 + +### 1.2 从比较轨迹到通用助手 RLHF + +```text +Christiano et al. 2017:人比较两段行为轨迹 +→ reward predictor 拟合 pairwise preference +→ Ziegler et al. 2019:把 RM + KL + PPO 接到语言模型 +→ Stiennon et al. 2020:摘要任务验证完整三段式管线 +→ InstructGPT 2022:SFT → RM → PPO-ptx 扩展到开放指令 +→ HH-RLHF / Llama 2:helpfulness、安全与多轮迭代被显式分账 +``` + +真正的桥梁是“比较比绝对打分更容易”,并通过 Bradley–Terry 风格的选择模型把比较拟合成可优化标量。 + +### 1.3 从显式奖励模型到直接偏好目标 + +```text +RM + PPO:先拟合 scalar reward,再对当前 policy 做在线优化 +→ RRHF / SLiC-HF:用排序或似然校准直接作用到回答概率 +→ DPO:在 BT + KL-regularized optimum 假设下,把 reward 改写成 policy/reference log-ratio +→ IPO:指出确定性偏好假设下的过拟合问题,改用回归式间隔 +→ KTO:允许 desirable / undesirable 非成对反馈 +→ ORPO:把 SFT 与 odds-ratio preference 合为单阶段 +→ SimPO:用长度归一平均 log-prob 和 margin 构造 reference-free reward +``` + +“无需 reward model”不等于“无需偏好信号”,也不等于“自动 on-policy”。 + +### 1.4 从人类偏好到 AI、规则与环境反馈 + +```text +Human demonstrations / rankings +→ Constitutional AI:原则 → 自我批评/修订 → AI preference +→ RLAIF / UltraFeedback:用 LLM 扩大标签量与维度 +→ rule-based verifier:数学答案、编译器、测试用例 +→ generative reward model:按 rubric 生成评价过程与分数 +→ DeepSeek:SFT + GRPO + rule/model/GRM,多阶段合并 +→ Kimi K3:SFT → 3 domains × 3 efforts RL teachers → MOPD +``` + +这不是“AI 反馈取代人类”的单向历史。现代系统常把人工定义的目标、AI 扩标、可执行规则和环境结果组合起来。 + +## 2. 最小数学:四个不同对象 + +### 2.1 SFT:模仿一个给定回答 + +对 prompt `x` 与示范回答 `y = (y₁,…,y_T)`: + +```text +L_SFT = - Σ_t m_t log πθ(y_t | x, y_ 在已经给定这个参考答案的条件下,模型是否提高了每个参考 Token 的概率? + +它没有直接问“另一个回答是否更好”,也没有在自由 rollout 分布上训练纠错。 + +### 2.2 偏好模型:比较两个完整回答 + +对同一 prompt 的 chosen `y_w` 与 rejected `y_l`,Bradley–Terry 形式为: + +```text +P(y_w ≻ y_l | x) + = σ(rφ(x,y_w) - rφ(x,y_l)) +``` + +reward model loss: + +```text +L_RM = -log σ(rφ(x,y_w) - rφ(x,y_l)) +``` + +只有 reward difference 可辨识:给同一 prompt 的全部奖励同时加一个常数,不改变偏好概率。 + +### 2.3 KL-regularized policy optimization + +典型目标的抽象形式: + +```text +max_π E[rφ(x,y)] - β KL(π(·|x) || π_ref(·|x)) +``` + +`π_ref` 不是装饰: + +- 把 policy 留在 reward model 见过的分布附近; +- 保持语言质量与已有行为; +- 让 reward 与偏离成本之间形成可调边界。 + +InstructGPT 还加入 pretraining mix: + +```text +reward - β log(π_RL / π_SFT) + γ log π_RL(x_pretrain) +``` + +因此论文默认的 InstructGPT 是 PPO-ptx,不应把它简化成“纯 PPO”。 + +### 2.4 DPO:用 policy/reference 比值参数化隐式奖励 + +在论文的假设下: + +```text +rθ(x,y) = β log [πθ(y|x) / π_ref(y|x)] +``` + +DPO loss: + +```text +L_DPO = + -log σ( β[ + log πθ(y_w|x) - log π_ref(y_w|x) + - log πθ(y_l|x) + log π_ref(y_l|x) + ]) +``` + +它训练的是“相对 reference,chosen 比 rejected 获得更大的 log-ratio 提升”。 +所以 DPO 仍依赖: + +- preference pair 的质量; +- pair 来自哪个行为分布; +- reference policy; +- `β`; +- sequence log-prob 的求和、mask 与长度口径。 + +## 3. 十二张教学账 + +### 3.1 行为目标账:先说清“对齐什么” + +至少区分: + +| 目标 | 典型问题 | 不能替代的证据 | +|---|---|---| +| Instruction following | 是否遵守格式、约束和任务 | 仅看流畅度不够 | +| Helpfulness | 是否解决用户真实问题 | RM 分数不是用户成功率 | +| Harmlessness / safety | 是否拒绝或安全重定向 | “总是拒答”不是完整安全 | +| Honesty / calibration | 是否承认不知道、避免编造 | 偏好者也可能奖励自信语气 | +| Reasoning / coding | 是否得到可验证结果 | 长 CoT 或漂亮代码不等于通过 | +| Agent execution | 是否在环境中完成长程任务 | 单轮 chat win-rate 不足 | +| Style / personality | 是否符合表达规范 | 不应冒充能力增长 | + +“能力学习”与“行为塑形”不是二选一。SFT 可注入新任务知识,RL 也可能重排甚至扩展可访问策略; +但任何因果归因都需要控制 base、数据、预算和评测。 + +### 3.2 监督单位账:标签落在哪里 + +| 信号 | 单位 | 优点 | 盲点 | +|---|---|---|---| +| Demonstration | 整段目标回答的 Token | 稠密、稳定 | 只有一种参考路径 | +| Pairwise preference | 两个完整回答 | 比绝对分数容易 | 只给相对次序 | +| Likert / scalar | 单回答 | 可表达强弱 | 标尺跨人漂移 | +| Outcome reward | 轨迹末端 | 便宜、客观 | credit assignment 稀疏 | +| Process reward | 中间步骤 | 更细粒度 | 标注贵,可能不忠实 | +| Token teacher signal | 每个 Token | 稠密整合能力 | teacher 偏差逐 Token 传递 | +| Environment reward | 状态变化/测试 | 接近任务结果 | verifier 可能有漏洞 | + +### 3.3 数据来源账:谁定义“更好” + +1. 专业标注者; +2. 目标用户或产品日志; +3. 众包标注者; +4. AI judge / teacher; +5. 宪法或书面 rubric; +6. ground truth / 单元测试 / 编译器; +7. 沙箱环境的真实结果; +8. 多来源混合。 + +来源决定偏差。把 “human preference” 聚合成单一标量,会隐藏群体分歧、标注者训练、文化背景和任务专长。 + +### 3.4 SFT 账:稳定冷启动,不是万能答案 + +SFT 的三个主要作用: + +- 教交互协议、角色与输出格式; +- 把 base model 的已有能力放到用户可调用的接口上; +- 给 RL 提供足够可靠的 cold-start policy,避免 rollout 一开始全是无效样本。 + +主要代价: + +- teacher forcing 与自由生成分布不一致; +- 参考答案不是唯一正确策略; +- 每个回答 Token 都被模仿,难表达“这部分好、那部分差”; +- 低质量、重复或模板化示范会被直接学习; +- 过强模仿可能缩小探索空间。 + +LIMA 的 1,000 高质量样本是“强 base + 指定评测 + 风格/接口”的实证结果,不是“小数据对齐普遍定律”。 + +### 3.5 偏好测量账:比较也不是客观真值 + +偏好数据必须记录: + +- candidate 由哪些 policy、temperature、长度上限生成; +- 是两两比较、K-way ranking 还是独立评分; +- 是否允许 tie / both bad; +- rubric 是总体质量还是多维评分; +- 是否随机交换展示位置; +- 每个样本有几名标注者、分歧如何保留; +- chosen 是否只是“两者较好”,而不是真正高质量。 + +训练集若只有“一个差回答和一个明显好回答”,RM 可能只学会表面线索; +部署时遇到两个都很强、差异很细的回答就会失准。 + +### 3.6 奖励模型账:代理目标的力量和危险来自同一处 + +reward model 把开放式判断压成一个可微标量,policy 因而能在没有唯一参考答案时继续优化。 +但 policy 会主动寻找 RM 的高分区域,而这些区域可能远离 RM 的训练分布。 + +重要检查: + +- in-distribution pair accuracy; +- hard / OOD / adversarial pairs; +- 长度、格式、拒答等 shortcut; +- calibration 与多人分歧; +- gold human evaluation 随 KL / optimization strength 的曲线; +- reward ensemble 或 uncertainty。 + +RewardBench 是对 RM 本身的测试入口,不是最终 assistant 质量的充分证明。 + +### 3.7 策略优化账:PPO 不是 RLHF 的同义词 + +PPO 的 clipped surrogate 限制单次 importance ratio: + +```text +min( + ρ_t A_t, + clip(ρ_t, 1-ε, 1+ε) A_t +) +``` + +LLM RLHF 的完整系统还常包含: + +- actor / policy; +- reference policy; +- reward model; +- critic / value; +- rollout engine; +- GAE / return; +- token mask、长度处理、KL controller; +- 可选 pretraining gradient。 + +RLOO、GRPO 等方法可省去 learned critic,但不因此自动解决 reward misspecification。 + +### 3.8 直接偏好账:算法名字先归到角色合同 + +| 方法 | 数据 | 显式 RM | Reference | 核心角色 | +|---|---|---:|---:|---| +| DPO | chosen/rejected pair | 否 | 是 | policy/reference log-ratio 分类 | +| IPO | pair | 否 | 是 | 回归到有限偏好 margin | +| KTO | desirable / undesirable 可非配对 | 否 | 通常是 | prospect-theoretic utility | +| ORPO | pair + SFT | 否 | 否 | NLL + odds-ratio penalty | +| SimPO | pair | 否 | 否 | 平均 log-prob reward + target margin | +| RRHF | ranking / 多来源候选 | 否 | 否 | 序列得分排序 | +| SLiC-HF | pair | 否 | 可选校准基线 | sequence likelihood calibration | + +不能从“模型数更少”直接推出“效果更好”。2024 NeurIPS 的 DPO/PPO 解耦实验明确把 +preference data、learning algorithm、reward model 和 policy prompts 分成四个变量,并发现数据质量影响最大。 + +### 3.9 分布账:online/offline 与 on/off-policy 是两组词 + +- **offline preference optimization**:固定 pair 数据训练,不随着当前 policy 更新标签; +- **online preference optimization**:当前 policy 生成新候选,再获取反馈; +- **on-policy RL**:梯度主要使用当前 policy 的 rollout; +- **off-policy / stale rollout**:行为 policy 与当前 policy 不同,需要 importance correction 或 clipping。 + +DPO 通常是 offline;PPO 通常需要近 on-policy rollout;K3 partial rollout 会让超长轨迹跨迭代变旧, +因此必须显式做 off-policy 稳定化。这些词描述不同轴。 + +### 3.10 约束账:为什么不能只追 reward + +常见防线: + +1. reference KL; +2. PPO ratio clipping; +3. pretraining / SFT replay; +4. response length / verbosity budget; +5. language consistency; +6. safety constraint reward; +7. rule-based verifier 优先; +8. reward ensemble / uncertainty; +9. 在线补充 policy 当前分布上的偏好数据; +10. hidden evaluator 与提交预算。 + +约束会产生真实 trade-off。例如语言一致性奖励可能轻微降低某些任务表现,却改善目标语言可读性; +这不是“白送”的收益。 + +### 3.11 失效账:高 reward 不等于高真实效用 + +#### Reward overoptimization + +Gao et al. 使用 proxy–gold synthetic setup 展示: + +```text +proxy reward 持续上升 +gold reward 先上升、后饱和甚至下降 +``` + +这是 Goodhart 风险的受控实证,不应外推成所有真实 RLHF 的统一数值曲线。 + +#### 长度与语气偏置 + +长回答更容易显得完整;礼貌、自信、分点也可能成为 shortcut。 +需要 length-controlled evaluation,而不是看到 win-rate 上升就断言事实性更好。 + +#### 迎合 + +如果人更喜欢被认同,模型可能学会顺着错误前提。helpfulness、honesty 和 user approval 必须分开评测。 + +#### 过度拒答 + +只奖励“不产生危险文本”会推动模型拒绝无害请求。安全评测必须同时测 should-refuse 和 should-respond。 + +#### Alignment tax + +RL 或偏好优化可能让某些标准能力退化。DeepSeek-V2 报告明确观察到部分 benchmark 的 alignment tax, +并通过训练策略缓解;不能只报 chat judge。 + +### 3.12 证据账:每个数字到底证明什么 + +| 证据 | 能证明 | 不能单独证明 | +|---|---|---| +| SFT loss | 模仿训练集 Token 的拟合 | 用户偏好、事实性 | +| RM pair accuracy | 在该 pair 分布上的排序 | policy 优化后的 OOD 可靠性 | +| training reward | 对当前 proxy 的优化 | 真实人类效用 | +| KL | 与 reference 的分布距离 | 改变是好是坏 | +| LLM judge win-rate | 该 judge/rubric 下的相对偏好 | 无偏人类共识 | +| blind human eval | 特定人群/协议下偏好 | 普适价值 | +| rule pass rate | verifier 定义的正确性 | 开放式质量与安全 | +| downstream benchmark | 指定任务能力 | 完整助手行为 | + +## 4. DeepSeek:从 SFT+DPO 到多源 GRPO / GRM + +### 4.1 DeepSeek LLM + +官方报告公开: + +- 超过 100 万 SFT instances; +- 7B 使用 4 epochs,67B 使用 2 epochs; +- helpfulness 与 harmlessness preference data; +- DPO 训练 1 epoch; +- 数学 SFT 过多会提高重复率; +- 报告把 reasoning 改善谨慎归因:SFT 可能主要注入了题型与知识,不能直接证明学会一般推理。 + +这是一条典型的 `base → SFT chat → DPO` 管线。 + +### 4.2 DeepSeek-V2 + +V2 把对齐管线改成: + +```text +base +→ SFT +→ reasoning alignment +→ human preference alignment +``` + +第二阶段采用 helpful、safety 与 rule-based 多奖励;RL 使用 GRPO。 +报告同时讨论: + +- SFT 数量与质量; +- alignment tax; +- online RL 与 offline preference alignment 的差异; +- code preference 来自 compiler feedback,数学来自 ground-truth labels。 + +### 4.3 DeepSeek-V3 + +V3 的 post-training 包括: + +- 从 expert model / DeepSeek-R1 蒸馏 reasoning data; +- 两个 epochs 的 SFT; +- rule-based RM 与 model-based RM; +- GRPO; +- generative reward model 的探索; +- 尽可能优先使用规则验证以降低 reward hacking。 + +官方报告给出 pretraining、context extension、post-training 的计算分账;不能把整套 V3 能力归因于 GRPO。 + +### 4.4 DeepSeek-R1 + +必须分开: + +- **R1-Zero**:从 base 直接做 rule-based reasoning RL,没有初始 SFT; +- **R1**:cold-start data → reasoning RL → rejection sampling / SFT → broader RL; +- **distilled models**:只做 SFT,不等于复现 R1 的 RL 训练。 + +报告附录展示 helpful RM reward hacking:reward 上升而测试表现下降;也展示语言一致性 reward 的能力 trade-off。 + +### 4.5 DeepSeek-V3.2 / V4 + +V3.2 把 reasoning、agent 与 human alignment 合并进一个大规模 GRPO 阶段, +通用任务采用 generative reward model,agent/reasoning 尽量使用规则结果。 + +V4 的两阶段主线: + +```text +SFT:高质量、多领域、能力冷启动 +→ GRPO:domain-aligned behavior +``` + +对 hard-to-verify tasks,V4 报告明确说不再使用传统 scalar RM,而采用 rubric-guided data 与 +Generative Reward Model;easy-to-verify tasks 继续用规则或测试。 + +## 5. Kimi:从长轨迹 RL 到 K3 多教师整合 + +### 5.1 Kimi K2 / K2.5 + +K2 公开 post-training 覆盖: + +- general RL; +- self-critique rubric reward; +- verifiable reward; +- PTX 与 budget control。 + +K2.5 继续扩展 unified agentic RL、视觉与并行 agent,Rollout Manager 支持大规模并发任务。 + +这些工作已经超出“聊天回答偏好”:reward 来自执行环境、规则与生成式 rubric 的组合。 + +### 5.2 Kimi K3 的三阶段合同 + +K3 官方报告明确: + +```text +Stage 1 · SFT + 建立高质量 cold-start agent policy + +Stage 2 · RL experts + general / general-agent / coding + × low / high / max reasoning effort + = 9 个领域-强度专家 + +Stage 3 · MOPD + student on-policy rollout + + 对应 teacher 的逐 Token log-ratio reward + → 把九个专家整合回一个统一模型 +``` + +MOPD 的逐 Token信号是: + +```text +r_opd(y_t) + = clip(stopgrad(log π_teacher(y_t|prefix) / π_student(y_t|prefix)), + -R_max, R_max) +``` + +概念边界: + +- K3 的 partial rollout 是长轨迹跨迭代产生的 off-policy 稳定性问题; +- MOPD 则在当前 student 自己访问的状态上计算 teacher signal; +- 两者可以在同一系统中共存,但不是同一种算法; +- agentic GRM 仍需 verbosity budget,报告明确把它作为防 reward hacking 的约束; +- MXFP4 QAT 从 SFT 起覆盖整个 post-training,是部署约束,不是偏好目标。 + +## 6. 正式一手论文链(44 个节点) + +| # | 年份 | 节点 | 本章角色 | 核验入口 | +|---:|---:|---|---|---| +| 01 | 2017 | Deep RL from Human Preferences | pairwise trajectory → reward | `1706.03741` Eq.1 / Fig.1 | +| 02 | 2017 | PPO | clipped on-policy update | `1707.06347` Eq.7 | +| 03 | 2019 | Fine-Tuning LMs from Human Preferences | LM reward + KL + PPO | `1909.08593` Eq.1–2 | +| 04 | 2020 | Learning to Summarize from Human Feedback | 完整生成式 RLHF | `2009.01325` Fig.2 / Fig.5 | +| 05 | 2021 | Natural Instructions | declarative task interface | `2104.08773` | +| 06 | 2021 | FLAN | instruction-tuned zero-shot | `2109.01652` Fig.6 | +| 07 | 2021 | T0 | prompted multitask mixture | `2110.08207` Fig.2 | +| 08 | 2021 | WebGPT | browser action + preference | `2112.09332` | +| 09 | 2022 | InstructGPT | SFT → RM → PPO-ptx | `2203.02155` Fig.2 / Eq.1–2 | +| 10 | 2022 | HH-RLHF | helpful / harmless assistant | `2204.05862` | +| 11 | 2022 | Super-NaturalInstructions | 1,600+ task generalization | `2204.07705` | +| 12 | 2022 | Scaling Instruction-Finetuned LMs | Flan collection scaling | `2210.11416` | +| 13 | 2022 | Reward Model Overoptimization | proxy / gold Goodhart curve | `2210.10760` | +| 14 | 2022 | Constitutional AI | self-critique + RLAIF | `2212.08073` Fig.1 | +| 15 | 2022 | Self-Instruct | synthetic instruction bootstrap | `2212.10560` Fig.2 | +| 16 | 2023 | OpenAssistant Conversations | open conversation / ranking tree | `2304.07327` | +| 17 | 2023 | RRHF | response ranking objective | `2304.05302` | +| 18 | 2023 | SLiC-HF | sequence likelihood calibration | `2305.10425` | +| 19 | 2023 | LIMA | 1K curated SFT | `2305.11206` | +| 20 | 2023 | AlpacaFarm | feedback simulator / baselines | `2305.14387` | +| 21 | 2023 | DPO | implicit reward / direct objective | `2305.18290` Eq.5–7 | +| 22 | 2023 | RLAIF vs RLHF | human/AI label comparison | `2309.00267` | +| 23 | 2023 | UltraFeedback | scaled multi-aspect AI feedback | `2310.01377` | +| 24 | 2023 | IPO theory | finite-margin preference regression | `2310.12036` | +| 25 | 2023 | Zephyr | dSFT + AI preference dDPO | `2310.16944` Fig.2 | +| 26 | 2024 | KTO | unpaired binary feedback | `2402.01306` | +| 27 | 2024 | RLOO | critic-free REINFORCE baseline | `2402.14740` | +| 28 | 2024 | ORPO | SFT + odds-ratio single stage | `2403.07691` | +| 29 | 2024 | RewardBench | reward model evaluation | `2403.13787` Fig.1 | +| 30 | 2024 | SimPO | reference-free mean log-prob | `2405.14734` | +| 31 | 2024 | Unpacking DPO and PPO | data/algorithm/RM/prompt 四变量 | NeurIPS 2024 | +| 32 | 2024 | Tülu 3 | open SFT → DPO → RLVR recipe | `2411.15124` | +| 33 | 2024 | DeepSeek LLM | 1M+ SFT + DPO | `2401.02954` §4 | +| 34 | 2024 | DeepSeekMath | GRPO | `2402.03300` | +| 35 | 2024 | DeepSeek-V2 | SFT + two-stage GRPO alignment | `2405.04434` §4 | +| 36 | 2024 | DeepSeek-V3 | SFT / RM / GRPO / GRM | `2412.19437` §5 | +| 37 | 2025 | DeepSeek-R1 | Zero / cold-start / RL / SFT 分层 | `2501.12948` | +| 38 | 2025 | DAPO | long-CoT GRPO stabilization | `2503.14476` | +| 39 | 2025 | Kimi K2 | verifiable + generative rewards | `2507.20534` | +| 40 | 2025 | DeepSeek-V3.2 | merged reasoning/agent/alignment RL | `2512.02556` §3 | +| 41 | 2026 | Kimi K2.5 | unified multimodal/agentic RL | `2602.02276` | +| 42 | 2026 | DeepSeek-V4 | SFT + GRPO + GRM | `2606.19348` §5 | +| 43 | 2026 | MOPD | multi-teacher on-policy distillation | `2606.30406` | +| 44 | 2026 | Kimi K3 | 9 experts → MOPD / 1M agentic RL | `2607.24653` §4 | + +## 7. 常见误解清单 + +1. **“SFT 改了 next-token 目标”**:通常仍是 next-token cross-entropy,只是条件与训练分布变了。 +2. **“chosen 就是完美答案”**:pair 只保证 chosen 相对更受偏好,可能两者都差。 +3. **“reward model 学到了人类价值”**:它拟合特定标签者、rubric、候选分布下的比较。 +4. **“PPO 就是 RLHF”**:PPO 只是 policy optimizer;RLHF 还含反馈、RM、reference、rollout 和评测。 +5. **“DPO 不需要 reward”**:它不训练显式 RM,但偏好 pair 与隐式 reward 假设仍在。 +6. **“DPO 永远比 PPO 好”**:数据质量、online sampling、RM、prompt 分布和实现可改变结论。 +7. **“RLAIF 没有人类参与”**:原则、rubric、teacher 训练与最终评测仍来自人类选择。 +8. **“规则奖励不会被 hack”**:解析器、测试覆盖、沙箱和提交预算都可能有漏洞。 +9. **“训练 reward 上升就是模型更好”**:必须看 gold/human/environment outcome 与 KL。 +10. **“RLVR 与 RLHF 是两代技术”**:开放任务可用偏好,数学/代码可用 verifier,现代系统混合两者。 +11. **“R1-Zero 就是 DeepSeek-R1”**:正式 R1 还有 cold start、SFT、多阶段 RL 与蒸馏。 +12. **“K3 MOPD 是普通离线蒸馏”**:student 在自己的 rollout 状态上接收对应 teacher 的逐 Token 信号。 + +## 8. 页面与交互验收合同 + +### 8.1 正文 + +- 20–22 个正文区段; +- 十二张账; +- 至少 44 个正式一手节点; +- DeepSeek LLM → V2 → V3 → R1 → V3.2 → V4 完整主线; +- Kimi K2 → K2.5 → K3 完整主线; +- 所有机制图为原创 HTML/CSS/SVG 示意,显式标注证据边界。 + +### 8.2 四联实验室 + +1. **SFT 损失显微镜** + 可切换 prompt masking、参考回答质量和长度;显示哪些 Token 产生梯度、NLL 与 teacher-forcing 边界。 + +2. **偏好与奖励模型实验** + 调整两回答的 factuality/helpfulness/style/length、标注噪声与 reward weights; + 显示 Bradley–Terry 概率、shortcut 与“chosen 不等于绝对好”。 + +3. **PPO / DPO 更新控制室** + 调 reward gap、KL/β、policy/reference log-ratio、数据新鲜度; + 分别展示显式 RM+rollout 与离线 pair 的更新合同,不伪造可比总分。 + +4. **现代 Post-training 配方比较器** + InstructGPT / Constitutional AI / DPO / DeepSeek-V2 / DeepSeek-V4 / Kimi K3; + 比较反馈源、模型组件、在线/离线、监督粒度、约束与主要失效模式。 + +### 8.3 工程闸门 + +- 键盘 tabs 与 `aria-selected`; +- 390px 移动端根页面零横向溢出; +- 交互数字标为教学模拟; +- 论文链接全部指向 canonical primary source; +- Astro check / build / internal link checker / 真实 Chrome regression 全部通过。 diff --git a/research/sources/README.md b/research/sources/README.md index 27d65df..9cebcaf 100644 --- a/research/sources/README.md +++ b/research/sources/README.md @@ -21,3 +21,13 @@ 其余已核节点通过 DOI、ACL Anthology、PMLR、ISCA、JMLR、NeurIPS 或官方 arXiv 页面定位, 完整证据边界见 `../LANGUAGE_MODEL_HISTORY_RESEARCH.md`。 + +Alignment 首轮缓存位于 `alignment/`(不提交 PDF/TXT): + +- Christiano 2017、Ziegler 2019、Stiennon 2020 与 InstructGPT; +- Natural Instructions、FLAN、T0、HH-RLHF、Constitutional AI 与 Self-Instruct; +- DPO、RRHF、SLiC-HF、LIMA、RLAIF、UltraFeedback、IPO、KTO、ORPO、RewardBench 与 SimPO。 + +DeepSeek LLM/V2/V3/R1/V3.2/V4、Kimi K2/K2.5/K3 与 MOPD 复用既有本地缓存。 +正式机制、公式、版本边界与 44 节点论文链见 `../ALIGNMENT_RESEARCH.md`;Grok 候选线索单独保存在 +`../ALIGNMENT_GROK_LEADS.md`,不能直接作为正文证据。 diff --git a/scripts/check-alignment-browser.mjs b/scripts/check-alignment-browser.mjs new file mode 100644 index 0000000..f7d55f8 --- /dev/null +++ b/scripts/check-alignment-browser.mjs @@ -0,0 +1,241 @@ +import { writeFileSync } from "node:fs"; + +const cdpPort = process.env.CDP_PORT ?? "9224"; +const baseUrl = process.env.SITE_URL ?? "http://127.0.0.1:4323"; +const pages = await fetch(`http://127.0.0.1:${cdpPort}/json/list`).then((response) => response.json()); +const page = pages.find((entry) => entry.type === "page"); +if (!page) throw new Error(`CDP ${cdpPort} 没有可用页面`); + +const socket = new WebSocket(page.webSocketDebuggerUrl); +await new Promise((resolve, reject) => { + socket.addEventListener("open", resolve, { once: true }); + socket.addEventListener("error", reject, { once: true }); +}); + +let nextId = 0; +const pending = new Map(); +const exceptions = []; +socket.addEventListener("message", (event) => { + const message = JSON.parse(event.data); + if (message.id && pending.has(message.id)) { + const { resolve, reject } = pending.get(message.id); + pending.delete(message.id); + if (message.error) reject(new Error(message.error.message)); + else resolve(message.result); + } + if (message.method === "Runtime.exceptionThrown") { + exceptions.push(message.params.exceptionDetails.exception?.description ?? message.params.exceptionDetails.text); + } +}); + +const command = (method, params = {}) => new Promise((resolve, reject) => { + const id = ++nextId; + pending.set(id, { resolve, reject }); + socket.send(JSON.stringify({ id, method, params })); +}); +const pause = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds)); +const evaluate = async (expression) => { + const result = await command("Runtime.evaluate", { expression, returnByValue: true, awaitPromise: true }); + if (result.exceptionDetails) throw new Error(result.exceptionDetails.exception?.description ?? result.exceptionDetails.text); + return result.result.value; +}; +const navigate = async (path) => { + await command("Page.navigate", { url: `${baseUrl}${path}` }); + for (let attempt = 0; attempt < 70; attempt += 1) { + await pause(100); + if (await evaluate("document.readyState === 'complete'")) return; + } + throw new Error(`${path} 加载超时`); +}; +const screenshot = async (path, full = false) => { + const params = { format: "png", captureBeyondViewport: full }; + if (full) { + const metrics = await command("Page.getLayoutMetrics"); + params.clip = { + x: 0, + y: 0, + width: metrics.cssContentSize.width, + height: metrics.cssContentSize.height, + scale: 1, + }; + } + const result = await command("Page.captureScreenshot", params); + writeFileSync(path, Buffer.from(result.data, "base64")); +}; + +await command("Page.enable"); +await command("Runtime.enable"); +await command("Emulation.setDeviceMetricsOverride", { + width: 1440, + height: 1100, + deviceScaleFactor: 1, + mobile: false, +}); +await navigate("/post-training/alignment/"); +await screenshot("/tmp/llm-atlas-alignment-desktop.png"); + +const overview = await evaluate(`(() => ({ + title: document.querySelector("h1")?.textContent.trim(), + sections: document.querySelectorAll(".article-section").length, + tocLinks: document.querySelectorAll(".side-rail a").length, + paperLinks: document.querySelectorAll(".paper-chain a").length, + labTabs: document.querySelectorAll("[data-alignment-tab]").length, + labPanels: document.querySelectorAll("[data-alignment-panel]").length, + navLinks: document.querySelectorAll(".top-nav a").length, + documentOverflow: document.documentElement.scrollWidth - document.documentElement.clientWidth, +}))()`); + +const sft = await evaluate(`(() => { + const root = document.querySelector("[data-alignment-lab]"); + const read = () => ({ + active: root.querySelector("[data-sft-active]").textContent.trim(), + nll: root.querySelector("[data-sft-nll]").textContent.trim(), + reading: root.querySelector("[data-sft-reading]").textContent.trim(), + lossStates: [...root.querySelectorAll("[data-sft-loss]")].map((node) => node.textContent.trim()), + }); + const initial = read(); + root.querySelector('[data-sft-mask="all"]').click(); + const quality = root.querySelector("[data-sft-quality]"); + quality.value = "unsafe"; + quality.dispatchEvent(new Event("change", { bubbles: true })); + return { initial, unsafeAll: read() }; +})()`); + +const preference = await evaluate(`(() => { + const root = document.querySelector("[data-alignment-lab]"); + root.querySelector('[data-alignment-tab="preference"]').click(); + root.querySelector('[data-pref-preset="bothbad"]').click(); + return { + rewardA: root.querySelector('[data-reward="a"]').textContent.trim(), + rewardB: root.querySelector('[data-reward="b"]').textContent.trim(), + probability: root.querySelector("[data-pref-probability]").textContent.trim(), + reading: root.querySelector("[data-pref-reading]").textContent.trim(), + visiblePanel: root.querySelector("[data-alignment-panel]:not([hidden])").dataset.alignmentPanel, + }; +})()`); + +const update = await evaluate(`(() => { + const root = document.querySelector("[data-alignment-lab]"); + root.querySelector('[data-alignment-tab="update"]').click(); + root.querySelector('[data-update-method="dpo"]').click(); + const stale = root.querySelector("[data-update-stale]"); + stale.value = "85"; + stale.dispatchEvent(new Event("input", { bubbles: true })); + return { + models: root.querySelector("[data-update-models]").textContent.trim(), + regime: root.querySelector("[data-update-regime]").textContent.trim(), + equation: root.querySelector("[data-update-equation]").textContent.trim(), + reading: root.querySelector("[data-update-reading]").textContent.trim(), + steps: [...root.querySelectorAll("[data-update-step]")].map((node) => node.textContent.trim()), + }; +})()`); + +const recipe = await evaluate(`(() => { + const root = document.querySelector("[data-alignment-lab]"); + root.querySelector('[data-alignment-tab="recipe"]').click(); + root.querySelector('[data-recipe-id="k3"]').click(); + const selected = { + family: root.querySelector("[data-recipe-family]").textContent.trim(), + regime: root.querySelector("[data-recipe-regime]").textContent.trim(), + constraints: root.querySelector("[data-recipe-constraints]").textContent.trim(), + path: [...root.querySelectorAll("[data-recipe-step]")].map((node) => node.textContent.trim()), + risk: root.querySelector("[data-recipe-risk]").textContent.trim(), + }; + const firstTab = root.querySelector('[data-alignment-tab="sft"]'); + firstTab.focus(); + firstTab.dispatchEvent(new KeyboardEvent("keydown", { key: "End", bubbles: true })); + return { + ...selected, + keyboardSelected: root.querySelector('[data-alignment-tab][aria-selected="true"]').dataset.alignmentTab, + keyboardVisible: root.querySelector("[data-alignment-panel]:not([hidden])").dataset.alignmentPanel, + }; +})()`); + +await evaluate(`document.querySelector("[data-alignment-lab]").scrollIntoView({ block: "start", behavior: "instant" })`); +await pause(180); +await screenshot("/tmp/llm-atlas-alignment-lab-desktop.png"); + +await navigate("/"); +const home = await evaluate(`(() => ({ + releaseCards: document.querySelectorAll(".release-card").length, + firstRelease: document.querySelector(".release-card h2").textContent.trim(), + firstHref: document.querySelector(".release-card").getAttribute("href"), + paperCount: document.querySelector(".hero-stats div:nth-child(3) b").textContent.trim(), + navLinks: document.querySelectorAll(".top-nav a").length, +}))()`); + +await navigate("/papers/"); +const papers = await evaluate(`(() => { + const button = [...document.querySelectorAll("[data-filter]")].find((node) => node.textContent.includes("后训练")); + button?.click(); + return { + total: document.querySelectorAll("[data-paper]").length, + alignmentVisible: document.querySelectorAll("[data-paper]:not([hidden])").length, + hasAlignmentFilter: Boolean(button), + }; +})()`); + +await command("Emulation.setDeviceMetricsOverride", { + width: 390, + height: 844, + deviceScaleFactor: 1, + mobile: true, +}); +await navigate("/post-training/alignment/"); +const mobile = await evaluate(`(() => { + const root = document.querySelector("[data-alignment-lab]"); + root.scrollIntoView({ block: "start", behavior: "instant" }); + const toggle = document.querySelector("#menu-toggle"); + toggle?.click(); + return { + documentOverflow: document.documentElement.scrollWidth - document.documentElement.clientWidth, + menuVisible: getComputedStyle(toggle).display !== "none", + menuOpen: toggle.getAttribute("aria-expanded"), + mobileLinks: document.querySelectorAll("#mobile-nav a").length, + tabs: root.querySelectorAll("[data-alignment-tab]").length, + offenders: [...document.querySelectorAll("body *")] + .filter((node) => node.getBoundingClientRect().right > document.documentElement.clientWidth + 1) + .slice(0, 12) + .map((node) => ({ + tag: node.tagName, + className: typeof node.className === "string" ? node.className : "", + right: Math.round(node.getBoundingClientRect().right), + width: Math.round(node.getBoundingClientRect().width), + })), + }; +})()`); +await pause(180); +await screenshot("/tmp/llm-atlas-alignment-mobile.png"); + +const report = { overview, sft, preference, update, recipe, home, papers, mobile, exceptions }; +console.log(JSON.stringify(report, null, 2)); + +const numeric = (value) => Number.parseFloat(value); +const failures = []; +if (!overview.title.includes("真正与人协作")) failures.push("章节标题异常"); +if (overview.sections !== 22 || overview.tocLinks !== 22) failures.push("章节/目录数量异常"); +if (overview.paperLinks !== 44) failures.push("正式论文链不是 44 个节点"); +if (overview.labTabs !== 4 || overview.labPanels !== 4) failures.push("四联实验结构异常"); +if (overview.navLinks !== 15 || home.navLinks !== 15 || mobile.mobileLinks !== 15) failures.push("全站导航未同步后训练专题"); +if (overview.documentOverflow > 1 || mobile.documentOverflow > 1) failures.push("桌面或移动端存在横向溢出"); +if (sft.initial.active !== "6 / 10" || !sft.initial.lossStates.slice(0, 4).every((value) => value === "MASKED")) failures.push("SFT response-only mask 异常"); +if (sft.unsafeAll.active !== "10 / 10" || numeric(sft.unsafeAll.nll) <= numeric(sft.initial.nll) || !sft.unsafeAll.reading.includes("错误")) failures.push("SFT 全序列/坏示范交互异常"); +if (numeric(preference.rewardA) >= 0 || numeric(preference.rewardB) >= 0 || !preference.reading.includes("两坏") || preference.visiblePanel !== "preference") failures.push("both-bad 偏好实验异常"); +if (update.models !== "2" || update.regime !== "OFFLINE" || !update.equation.includes("Δlog") || !update.reading.includes("旧候选")) failures.push("DPO / 陈旧分布实验异常"); +if (!update.steps[0].includes("Fixed preference")) failures.push("DPO 更新流程没有切换"); +if (!recipe.family.includes("Multi-effort") || !recipe.regime.includes("9 RL experts") || !recipe.constraints.includes("verbosity")) failures.push("K3 配方合同异常"); +if (!recipe.path.some((step) => step.includes("3 domains × 3 efforts")) || !recipe.path.some((step) => step.includes("MOPD"))) failures.push("K3 配方路径异常"); +if (recipe.keyboardSelected !== "recipe" || recipe.keyboardVisible !== "recipe") failures.push("实验 tab 键盘导航异常"); +if (home.releaseCards !== 10 || !home.firstRelease.includes("DPO 没有") || home.firstHref !== "/post-training/alignment/") failures.push("首页 Alignment 首发入口异常"); +if (home.paperCount !== "280" || papers.total !== 280 || !papers.hasAlignmentFilter || papers.alignmentVisible < 35) failures.push("论文库后训练标签或论文总数异常"); +if (!mobile.menuVisible || mobile.menuOpen !== "true" || mobile.tabs !== 4) failures.push("移动端导航或实验异常"); +if (exceptions.length) failures.push(`浏览器异常:${exceptions.join(" | ")}`); + +if (failures.length) { + console.error(`\nFAIL\n- ${failures.join("\n- ")}`); + process.exitCode = 1; +} else { + console.log("\nPASS alignment browser regression"); +} + +socket.close(); diff --git a/scripts/check-data-browser.mjs b/scripts/check-data-browser.mjs index b55c01c..a08fffe 100644 --- a/scripts/check-data-browser.mjs +++ b/scripts/check-data-browser.mjs @@ -230,15 +230,15 @@ if (transform.keyboard.selected !== "transform" || transform.keyboard.visible != if (layout.articleSections !== 18 || layout.paperLinks !== 31 || layout.labTabs !== 4 || layout.views !== 4) { failures.push("章节、论文或实验数量异常"); } -if (layout.navLinks !== 14 || mobile.mobileLinks !== 14 || home.navLinks !== 14) failures.push("全站导航未同步数值专题"); +if (layout.navLinks !== 15 || mobile.mobileLinks !== 15 || home.navLinks !== 15) failures.push("全站导航未同步数值专题"); if (layout.documentOverflow > 0 || mobile.documentOverflow > 0 || home.documentOverflow > 0) failures.push("页面存在横向溢出"); if (layout.navGap < 0) failures.push(`桌面导航碰撞:${layout.navGap}px`); if (!mobile.menuVisible || mobile.menuOpen !== "true") failures.push("移动端菜单不可用"); -if (home.releaseCards !== 9 || !home.firstRelease.includes("Attention 不只是") || home.firstHref !== "/foundations/") { +if (home.releaseCards !== 10 || !home.firstRelease.includes("DPO 没有") || home.firstHref !== "/post-training/alignment/") { failures.push("首页 Transformer 新章入口异常"); } -if (home.paperCount !== "258") failures.push(`首页论文总数异常:${home.paperCount}`); -if (!papers.hasDataFilter || papers.total !== 258 || papers.visible < 25) failures.push("论文库数据标签或论文总数异常"); +if (home.paperCount !== "280") failures.push(`首页论文总数异常:${home.paperCount}`); +if (!papers.hasDataFilter || papers.total !== 280 || papers.visible < 25) failures.push("论文库数据标签或论文总数异常"); if (exceptions.length) failures.push(`浏览器脚本异常:${exceptions.join("; ")}`); socket.close(); diff --git a/scripts/check-moe-browser.mjs b/scripts/check-moe-browser.mjs index 9f434fc..bf3a322 100644 --- a/scripts/check-moe-browser.mjs +++ b/scripts/check-moe-browser.mjs @@ -177,7 +177,7 @@ if (layout.documentOverflow > 0 || mobile.documentOverflow > 0 || home.documentO } if (layout.navGap < 0) failures.push(`桌面导航碰撞:${layout.navGap}px`); if (!mobile.menuVisible) failures.push("移动端菜单按钮未显示"); -if (home.releaseCards !== 9) failures.push(`首页新章卡数量异常:${home.releaseCards}`); +if (home.releaseCards !== 10) failures.push(`首页新章卡数量异常:${home.releaseCards}`); if (exceptions.length) failures.push(`浏览器脚本异常:${exceptions.join("; ")}`); socket.close(); diff --git a/scripts/check-numerics-browser.mjs b/scripts/check-numerics-browser.mjs index 6cfc7e0..d05dae8 100644 --- a/scripts/check-numerics-browser.mjs +++ b/scripts/check-numerics-browser.mjs @@ -273,15 +273,15 @@ if (stability.keyboard.selected !== "stability" || stability.keyboard.visible != if (layout.articleSections !== 19 || layout.paperLinks !== 36 || layout.labTabs !== 4 || layout.views !== 4) { failures.push("章节、论文或实验数量异常"); } -if (layout.navLinks !== 14 || mobile.mobileLinks !== 14 || home.navLinks !== 14) failures.push("全站导航未同步数值专题"); +if (layout.navLinks !== 15 || mobile.mobileLinks !== 15 || home.navLinks !== 15) failures.push("全站导航未同步数值专题"); if (layout.documentOverflow > 0 || mobile.documentOverflow > 0 || home.documentOverflow > 0) failures.push("页面存在横向溢出"); if (layout.navGap < 0) failures.push(`桌面导航碰撞:${layout.navGap}px`); if (!mobile.menuVisible || mobile.menuOpen !== "true") failures.push("移动端菜单不可用"); -if (home.releaseCards !== 9 || !home.firstRelease.includes("Attention 不只是") || home.firstHref !== "/foundations/") { +if (home.releaseCards !== 10 || !home.firstRelease.includes("DPO 没有") || home.firstHref !== "/post-training/alignment/") { failures.push("首页 Transformer 新章入口异常"); } -if (home.paperCount !== "258") failures.push(`首页论文总数异常:${home.paperCount}`); -if (!papers.hasOptimizerFilter || papers.total !== 258 || papers.visible < 8) failures.push("论文库优化器标签或论文总数异常"); +if (home.paperCount !== "280") failures.push(`首页论文总数异常:${home.paperCount}`); +if (!papers.hasOptimizerFilter || papers.total !== 280 || papers.visible < 8) failures.push("论文库优化器标签或论文总数异常"); if (exceptions.length) failures.push(`浏览器脚本异常:${exceptions.join("; ")}`); socket.close(); diff --git a/scripts/check-reasoning-browser.mjs b/scripts/check-reasoning-browser.mjs index 101e8c1..692c6e7 100644 --- a/scripts/check-reasoning-browser.mjs +++ b/scripts/check-reasoning-browser.mjs @@ -289,7 +289,7 @@ if (layout.documentOverflow > 0 || mobile.documentOverflow > 0 || home.documentO } if (layout.navGap < 0) failures.push(`桌面导航碰撞:${layout.navGap}px`); if (!mobile.menuVisible || mobile.menuOpen !== "true") failures.push("移动端菜单不可用"); -if (home.releaseCards !== 9 || !home.firstRelease.includes("Attention 不只是")) failures.push("首页 Transformer 新章入口异常"); +if (home.releaseCards !== 10 || !home.firstRelease.includes("DPO 没有")) failures.push("首页 Transformer 新章入口异常"); if (exceptions.length) failures.push(`浏览器脚本异常:${exceptions.join("; ")}`); socket.close(); diff --git a/scripts/check-scaling-browser.mjs b/scripts/check-scaling-browser.mjs index 06e13d0..ca3bd89 100644 --- a/scripts/check-scaling-browser.mjs +++ b/scripts/check-scaling-browser.mjs @@ -269,14 +269,14 @@ if (emergence.paths.some((length) => length < 500)) failures.push("涌现多指 if (layout.articleSections !== 16 || layout.paperLinks !== 29 || layout.labTabs !== 4 || layout.views !== 4) { failures.push("章节、论文或实验数量异常"); } -if (layout.navLinks !== 14 || mobile.mobileLinks !== 14 || home.navLinks !== 14) failures.push("全站导航未同步数值专题"); +if (layout.navLinks !== 15 || mobile.mobileLinks !== 15 || home.navLinks !== 15) failures.push("全站导航未同步数值专题"); if (layout.documentOverflow > 0 || mobile.documentOverflow > 0 || home.documentOverflow > 0) failures.push("页面存在横向溢出"); if (layout.navGap < 0) failures.push(`桌面导航碰撞:${layout.navGap}px`); if (!mobile.menuVisible || mobile.menuOpen !== "true") failures.push("移动端菜单不可用"); -if (home.releaseCards !== 9 || !home.firstRelease.includes("Attention 不只是") || home.firstHref !== "/foundations/") { +if (home.releaseCards !== 10 || !home.firstRelease.includes("DPO 没有") || home.firstHref !== "/post-training/alignment/") { failures.push("首页 Transformer 新章入口异常"); } -if (home.paperCount !== "258") failures.push(`首页论文总数异常:${home.paperCount}`); +if (home.paperCount !== "280") failures.push(`首页论文总数异常:${home.paperCount}`); if (exceptions.length) failures.push(`浏览器脚本异常:${exceptions.join("; ")}`); socket.close(); diff --git a/scripts/check-training-systems-browser.mjs b/scripts/check-training-systems-browser.mjs index 061de43..5015794 100644 --- a/scripts/check-training-systems-browser.mjs +++ b/scripts/check-training-systems-browser.mjs @@ -233,7 +233,7 @@ if (layout.articleSections !== 16 || layout.paperLinks !== 37 || layout.labTabs if (layout.documentOverflow > 0 || mobile.documentOverflow > 0 || home.documentOverflow > 0) failures.push("页面存在横向溢出"); if (layout.navGap < 0) failures.push(`桌面导航碰撞:${layout.navGap}px`); if (!mobile.menuVisible || mobile.menuOpen !== "true") failures.push("移动端菜单不可用"); -if (home.releaseCards !== 9 || !home.firstRelease.includes("Attention 不只是")) failures.push("首页 Transformer 新章入口异常"); +if (home.releaseCards !== 10 || !home.firstRelease.includes("DPO 没有")) failures.push("首页 Transformer 新章入口异常"); if (exceptions.length) failures.push(`浏览器脚本异常:${exceptions.join("; ")}`); socket.close(); diff --git a/scripts/check-transformer-browser.mjs b/scripts/check-transformer-browser.mjs index f65c276..81a0560 100644 --- a/scripts/check-transformer-browser.mjs +++ b/scripts/check-transformer-browser.mjs @@ -172,7 +172,7 @@ const home = await evaluate(`(() => ({ releaseCards: document.querySelectorAll(".release-card").length, firstRelease: document.querySelector(".release-card h2").textContent, firstHref: document.querySelector(".release-card").getAttribute("href"), - paperCount: [...document.querySelectorAll(".hero-stats b")].map((node) => node.textContent.trim()).find((value) => value === "258"), + paperCount: [...document.querySelectorAll(".hero-stats b")].map((node) => node.textContent.trim()).find((value) => value === "280"), }))()`); await navigate("/papers/"); @@ -236,8 +236,8 @@ if (block.family.trim() !== "Hybrid MoE" || !block.kv.includes("3 KDA : 1 Gated if (!block.path.some((step) => step.includes("KDA × 3")) || !block.note.includes("AttnRes")) failures.push("K3 Block 路径异常"); if (block.context.trim() !== "128K" || numeric(block.mha) !== 400 || numeric(block.kda) !== 1) failures.push("KV 成本缩放异常"); if (block.keyboardSelected !== "block" || block.keyboardVisible !== "block") failures.push("实验 tab 键盘导航异常"); -if (home.releaseCards !== 9 || !home.firstRelease.includes("Attention 不只是") || home.firstHref !== "/foundations/") failures.push("首页 Transformer 首发入口异常"); -if (home.paperCount !== "258" || papers.total !== 258 || papers.transformerVisible < 30) failures.push("论文库或首页论文数量异常"); +if (home.releaseCards !== 10 || !home.firstRelease.includes("DPO 没有") || home.firstHref !== "/post-training/alignment/") failures.push("首页 Transformer 首发入口异常"); +if (home.paperCount !== "280" || papers.total !== 280 || papers.transformerVisible < 30) failures.push("论文库或首页论文数量异常"); if (!mobile.menuVisible || mobile.menuOpen !== "true" || mobile.tabs !== 4) failures.push("移动端导航或实验异常"); if (exceptions.length) failures.push(`浏览器异常:${exceptions.join(" | ")}`); diff --git a/src/components/AlignmentLab.astro b/src/components/AlignmentLab.astro new file mode 100644 index 0000000..321165f --- /dev/null +++ b/src/components/AlignmentLab.astro @@ -0,0 +1,895 @@ +--- +const sftTokens = [ + { text: "", role: "prompt", probability: 0.94 }, + { text: "请简洁回答", role: "prompt", probability: 0.66 }, + { text: "", role: "prompt", probability: 0.91 }, + { text: "为什么海是蓝色?", role: "prompt", probability: 0.42 }, + { text: "", role: "response", probability: 0.87 }, + { text: "阳光", role: "response", probability: 0.72 }, + { text: "进入海水后", role: "response", probability: 0.58 }, + { text: "红光更易被吸收", role: "response", probability: 0.36 }, + { text: "蓝光更易散射返回", role: "response", probability: 0.29 }, + { text: "因此看起来偏蓝", role: "response", probability: 0.63 }, +]; + +const recipes = [ + { + id: "instructgpt", + label: "InstructGPT", + year: "2022", + family: "Human-feedback RLHF", + feedback: "人工 demonstration + 人工 K-way ranking", + regime: "SFT → RM → online PPO-ptx", + granularity: "Token imitation + response scalar", + models: "Policy · Reference · RM · Value", + constraints: "per-token KL + pretraining mix", + risk: "RM 过优化、标注群体边界、alignment tax", + path: ["API / 标注者 prompts", "13K SFT demos", "33K ranking prompts → RM", "31K PPO prompts", "PPO-ptx policy"], + }, + { + id: "cai", + label: "Constitutional AI", + year: "2022", + family: "Principle-guided RLAIF", + feedback: "人写原则 + AI critique / revision / preference", + regime: "SL-CAI → preference model → RL-CAI", + granularity: "修订示范 + response preference", + models: "Policy · AI labeler · PM · Value", + constraints: "constitution + helpfulness objective", + risk: "原则覆盖、teacher 偏差、无害但回避", + path: ["Constitution", "Self-critique", "Revised SFT data", "AI preferences → PM", "RL-CAI"], + }, + { + id: "dpo", + label: "DPO", + year: "2023", + family: "Offline direct preference", + feedback: "固定 chosen / rejected pairs", + regime: "SFT reference → offline DPO", + granularity: "sequence log-ratio pair", + models: "Policy · frozen Reference", + constraints: "β × policy/reference ratio", + risk: "pair 分布陈旧、长度口径、reference 选择", + path: ["Prompt", "Sample pairs", "Preference label", "Reference log-prob", "Direct policy update"], + }, + { + id: "deepseekv2", + label: "DeepSeek-V2", + year: "2024", + family: "Multi-reward GRPO", + feedback: "人工偏好 + RM + 编译器/答案规则", + regime: "SFT → reasoning RL → preference RL", + granularity: "group-relative outcome reward", + models: "Policy · Reference · multiple RMs", + constraints: "KL + rule / helpful / safety rewards", + risk: "alignment tax、online/offline 分布、RM 可靠性", + path: ["SFT", "Reasoning RM", "GRPO stage 1", "Helpful / Safety / Rule", "GRPO stage 2"], + }, + { + id: "deepseekv4", + label: "DeepSeek-V4", + year: "2026", + family: "SFT + GRPO + GRM", + feedback: "规则 verifier + rubric-guided generative reward", + regime: "SFT → unified domain GRPO", + granularity: "outcome + generated rubric score", + models: "Policy · Reference · Verifier / GRM", + constraints: "规则优先、rubric、QAT deployment constraint", + risk: "GRM 可被利用、rubric 缺口、环境覆盖不足", + path: ["Curated SFT", "Rule-verifiable tasks", "Hard tasks → GRM", "GRPO", "Domain-aligned model"], + }, + { + id: "k3", + label: "Kimi K3", + year: "2026", + family: "Multi-effort expert integration", + feedback: "规则/环境/Agentic GRM + 9 teachers", + regime: "SFT → 9 RL experts → MOPD", + granularity: "outcome reward + per-token teacher signal", + models: "Student · 9 Teachers · Verifiers / GRM", + constraints: "partial-rollout clipping + budget + verbosity", + risk: "长轨迹陈旧、teacher 偏差、reward hacking", + path: ["Cold-start SFT", "3 domains × 3 efforts", "Partial-rollout RL", "Student on-policy rollout", "MOPD consolidation"], + }, +]; +--- + +
+
+
+ INTERACTIVE / FOUR-VIEW LAB +

把“对齐”拆成四个不相互冒充的实验

+
+

所有数字都是教学模拟,用来展示目标函数和反馈结构;不是任何模型的训练日志或产品指标。

+
+ +
+ + + + +
+ +
+
+
QUESTION

SFT 到底在模仿 prompt,还是只模仿 assistant?

+

真实 chat template 会把角色标记也编码成 Token;是否计入 loss 由 mask 决定,而不是由颜色决定。

+
+ +
+
+ + +
+ +
+ +
+ {sftTokens.map((token, index) => ( +
+ {token.role === "prompt" ? "CONDITION" : "TARGET"} + {token.text} + {Math.round(token.probability * 100)}% +
+ ))} +
+ +
+
LOSS TOKENS6 / 10

真正进入交叉熵求和的 Token

+
MEAN NLL0.72

只反映这条示范的拟合难度

+
TEACHER FORCINGON

第 t 步总能看到参考答案的前缀

+
+ +
+ SFT 正在学习一条高质量示范,但它没有直接比较其他可能回答。 +

如果 demonstration 本身错误,交叉熵仍会忠实提高错误 Token 的概率;loss 并不知道“事实正确”。

+
+
+ + + + + + + +
+ 交互图 10 + 四个实验依次回答:示范怎样产生 Token 梯度、偏好怎样变成代理标量、policy 怎样更新,以及现代配方怎样组合多种反馈。 +
+
+ + + + diff --git a/src/components/SiteHeader.astro b/src/components/SiteHeader.astro index e6e7163..adadc94 100644 --- a/src/components/SiteHeader.astro +++ b/src/components/SiteHeader.astro @@ -14,6 +14,7 @@ const items = [ { id: "data", href: "/pretraining/data/", label: "数据工程" }, { id: "moe", href: "/moe/", label: "MoE" }, { id: "long-context", href: "/long-context/", label: "长上下文" }, + { id: "alignment", href: "/post-training/alignment/", label: "后训练" }, { id: "reasoning", href: "/reasoning/", label: "推理" }, { id: "training-systems", href: "/training-systems/", label: "训练系统" }, { id: "numerics", href: "/systems/numerics/", label: "数值" }, diff --git a/src/data/chapters.ts b/src/data/chapters.ts index 1d1ef90..62d048f 100644 --- a/src/data/chapters.ts +++ b/src/data/chapters.ts @@ -151,12 +151,12 @@ export const chapters: Chapter[] = [ title: "指令微调与人类偏好", kicker: "ALIGNMENT", question: "会续写的 base model,怎样变成愿意协作的助手?", - summary: "从 instruction tuning、SFT、RLHF/PPO 到 DPO 与 RLAIF,区分能力学习和行为塑形。", - status: "queued", - progress: 10, - papers: 18, + summary: "用十二张账拆开 instruction tuning、SFT、偏好数据、奖励模型、RLHF/PPO、RLAIF、DPO 与 RLVR,并追到 DeepSeek 和 K3。", + status: "published", + progress: 75, + papers: 44, prerequisites: ["01", "02"], - highlights: ["SFT", "奖励模型", "偏好优化"], + highlights: ["十二张对齐账", "四联实验", "DeepSeek / K3"], }, { number: "11", diff --git a/src/data/papers.ts b/src/data/papers.ts index dc2f797..d7db43b 100644 --- a/src/data/papers.ts +++ b/src/data/papers.ts @@ -1651,6 +1651,182 @@ export const papers: Paper[] = [ contribution: "把偏好优化改写为直接分类目标,省去在线 RL loop。", verified: true, }, + { + year: 2017, + title: "Deep Reinforcement Learning from Human Preferences", + url: "https://proceedings.neurips.cc/paper/2017/hash/d5e2c0adad503c91f91df240d0cd4e49-Abstract.html", + topics: ["后训练"], + contribution: "把人类对轨迹片段的成对比较拟合成奖励预测器,再用预测奖励优化策略。", + verified: true, + }, + { + year: 2019, + title: "Fine-Tuning Language Models from Human Preferences", + url: "https://arxiv.org/abs/1909.08593", + topics: ["后训练"], + contribution: "把偏好奖励、reference KL 与 PPO 接到生成式语言模型,是现代语言模型 RLHF 的直接前身。", + verified: true, + }, + { + year: 2021, + title: "Natural Instructions: Benchmarking Generalization to New Tasks from Natural Language Instructions", + url: "https://arxiv.org/abs/2104.08773", + topics: ["后训练", "评测"], + contribution: "把任务定义写成声明式自然语言说明,系统检验模型对未见任务的 instruction generalization。", + verified: true, + }, + { + year: 2022, + title: "Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedback", + url: "https://arxiv.org/abs/2204.05862", + topics: ["后训练"], + contribution: "把 helpfulness 与 harmlessness 分开收集偏好并研究在线迭代,揭示通用助手对齐的多目标性质。", + verified: true, + }, + { + year: 2022, + title: "Super-NaturalInstructions: Generalization via Declarative Instructions on 1600+ NLP Tasks", + url: "https://arxiv.org/abs/2204.07705", + topics: ["后训练", "评测"], + contribution: "把自然语言任务定义扩展到 1,600 余个任务,检验跨任务和跨类型泛化。", + verified: true, + }, + { + year: 2022, + title: "Scaling Instruction-Finetuned Language Models", + url: "https://arxiv.org/abs/2210.11416", + topics: ["后训练", "Scaling"], + contribution: "联合扩展 Flan 的任务混合、模型规模与 chain-of-thought 数据,研究 instruction tuning 的规模效应。", + verified: true, + }, + { + year: 2022, + title: "Scaling Laws for Reward Model Overoptimization", + url: "https://arxiv.org/abs/2210.10760", + topics: ["后训练", "Scaling", "评测"], + contribution: "在 proxy reward 与 gold reward 的受控设置中量化 Goodhart 曲线,展示继续追高代理奖励何时反而伤害真实目标。", + verified: true, + }, + { + year: 2023, + title: "OpenAssistant Conversations: Democratizing Large Language Model Alignment", + url: "https://arxiv.org/abs/2304.07327", + topics: ["后训练", "数据"], + contribution: "开放多轮对话树、候选排序和标注流程,为可复查的助手后训练数据提供公共基线。", + verified: true, + }, + { + year: 2023, + title: "RRHF: Rank Responses to Align Language Models with Human Feedback", + url: "https://arxiv.org/abs/2304.05302", + topics: ["后训练"], + contribution: "用回答序列得分的排序约束让模型学习多来源候选的相对质量。", + verified: true, + }, + { + year: 2023, + title: "SLiC-HF: Sequence Likelihood Calibration with Human Feedback", + url: "https://arxiv.org/abs/2305.10425", + topics: ["后训练"], + contribution: "直接校准 chosen 与 rejected 回答的序列似然,为不运行在线 RL 的偏好训练提供早期路线。", + verified: true, + }, + { + year: 2023, + title: "LIMA: Less Is More for Alignment", + url: "https://arxiv.org/abs/2305.11206", + topics: ["后训练", "数据"], + contribution: "用约一千条精选示范检验强基座上少量高质量 SFT 的接口塑形能力,并明确其适用边界。", + verified: true, + }, + { + year: 2023, + title: "AlpacaFarm: A Simulation Framework for Methods that Learn from Human Feedback", + url: "https://arxiv.org/abs/2305.14387", + topics: ["后训练", "评测"], + contribution: "提供模拟偏好、自动评测与多种 RLHF 基线,降低比较后训练方法的实验成本。", + verified: true, + }, + { + year: 2023, + title: "RLAIF: Scaling Reinforcement Learning from Human Feedback with AI Feedback", + url: "https://arxiv.org/abs/2309.00267", + topics: ["后训练", "评测"], + contribution: "在摘要、helpful 与 harmless 场景直接比较 AI 和人工偏好标签,而不是把 AI feedback 当作无价值来源。", + verified: true, + }, + { + year: 2023, + title: "UltraFeedback: Boosting Language Models with Scaled AI Feedback", + url: "https://arxiv.org/abs/2310.01377", + topics: ["后训练", "数据"], + contribution: "规模化生成多候选、多维度 AI 反馈,成为开放偏好训练与直接优化的重要数据来源。", + verified: true, + }, + { + year: 2023, + title: "A General Theoretical Paradigm to Understand Learning from Human Preferences", + url: "https://arxiv.org/abs/2310.12036", + topics: ["后训练"], + contribution: "分析确定性偏好下 DPO 的过拟合边界,并以有限间隔回归提出 IPO。", + verified: true, + }, + { + year: 2023, + title: "Zephyr: Direct Distillation of LM Alignment", + url: "https://arxiv.org/abs/2310.16944", + topics: ["后训练"], + contribution: "以蒸馏式 SFT、UltraFeedback AI 偏好与直接偏好优化展示开放模型的完整对齐配方。", + verified: true, + }, + { + year: 2024, + title: "KTO: Model Alignment as Prospect Theoretic Optimization", + url: "https://arxiv.org/abs/2402.01306", + topics: ["后训练"], + contribution: "用前景理论式效用处理 desirable / undesirable 二元反馈,放宽必须提供成对偏好的数据合同。", + verified: true, + }, + { + year: 2024, + title: "Back to Basics: Revisiting REINFORCE Style Optimization for Learning from Human Feedback in LLMs", + url: "https://arxiv.org/abs/2402.14740", + topics: ["后训练"], + contribution: "以 leave-one-out baseline 重新建立 critic-free REINFORCE 基线,说明 PPO 不是在线 RLHF 的唯一实现。", + verified: true, + }, + { + year: 2024, + title: "ORPO: Monolithic Preference Optimization without Reference Model", + url: "https://arxiv.org/abs/2403.07691", + topics: ["后训练"], + contribution: "把 SFT 负对数似然与 odds-ratio 偏好惩罚合成单阶段、无独立 reference model 的目标。", + verified: true, + }, + { + year: 2024, + title: "RewardBench: Evaluating Reward Models for Language Modeling", + url: "https://arxiv.org/abs/2403.13787", + topics: ["后训练", "评测"], + contribution: "按 chat、hard、safety、reasoning 与分布外样本直接评估奖励模型的成对排序能力。", + verified: true, + }, + { + year: 2024, + title: "SimPO: Simple Preference Optimization with a Reference-Free Reward", + url: "https://arxiv.org/abs/2405.14734", + topics: ["后训练"], + contribution: "用长度归一的平均 log-prob 与目标 margin 构造 reference-free implicit reward。", + verified: true, + }, + { + year: 2024, + title: "Unpacking DPO and PPO: Disentangling Best Practices for Learning from Preference Feedback", + url: "https://proceedings.neurips.cc/paper_files/paper/2024/hash/404df2480b6eef0486a1679e371894b0-Abstract-Conference.html", + topics: ["后训练", "评测"], + contribution: "把 preference data、优化算法、奖励模型和 policy prompts 四个变量拆开,避免把配方差异误判为算法胜负。", + verified: true, + }, { year: 2022, title: "Chain-of-Thought Prompting Elicits Reasoning in Large Language Models", diff --git a/src/pages/index.astro b/src/pages/index.astro index 5ceaaa2..2274412 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -12,6 +12,7 @@ const routes: Record = { "pretraining/data": "/pretraining/data/", moe: "/moe/", "long-context": "/long-context/", + "post-training/alignment": "/post-training/alignment/", reasoning: "/reasoning/", "training-systems": "/training-systems/", "systems/numerics": "/systems/numerics/", @@ -88,6 +89,7 @@ const paths = [ 数据工程专题 MoE 专题 长上下文专题 + 后训练与偏好专题 推理专题 训练系统专题 数值与优化专题 @@ -100,7 +102,7 @@ const paths = [
16核心专题
151K3 报告来源
-
258关键论文索引
+
280关键论文索引
47pK3 技术报告
@@ -114,6 +116,22 @@ const paths = [
+ +
+

NEW / CHAPTER 10 ALIGNMENT · PREFERENCE

+

DPO 没有“消灭 RLHF”,RLHF 也不等于只跑一次 PPO

+

+ 用目标、监督、来源、SFT、偏好、奖励、更新、分布、约束、失效与证据十二张账, + 从 2017 人类偏好学习一路走到 InstructGPT、Constitutional AI、DPO、DeepSeek-R1/V4 与 Kimi K3。 +

+
+
+
LINEAGE
2017 → 2026
+
PAPERS
44 个一手节点
+
LAB
SFT · RM · PPO/DPO · 配方比较
+
+ +

NEW / CHAPTER 02 ATTENTION · TRANSFORMER

@@ -491,6 +509,7 @@ const paths = [ transition: transform 180ms ease, border-color 180ms ease; } + .alignment-release, .transformer-release, .foundation-release, .numerics-release, @@ -502,6 +521,14 @@ const paths = [ min-height: 510px; } + .alignment-release { + background: + radial-gradient(circle at 82% 18%, rgba(134, 76, 76, 0.2), transparent 30%), + radial-gradient(circle at 62% 74%, rgba(76, 118, 112, 0.11), transparent 28%), + repeating-linear-gradient(90deg, transparent 0 72px, rgba(134, 76, 76, 0.04) 72px 73px), + var(--paper-raised); + } + .numerics-release { background: radial-gradient(circle at 82% 18%, rgba(113, 82, 137, 0.2), transparent 30%), @@ -616,6 +643,7 @@ const paths = [ padding-bottom: 76px; } + .alignment-release, .transformer-release, .foundation-release, .numerics-release, diff --git a/src/pages/post-training/alignment/index.astro b/src/pages/post-training/alignment/index.astro new file mode 100644 index 0000000..1c17adb --- /dev/null +++ b/src/pages/post-training/alignment/index.astro @@ -0,0 +1,1348 @@ +--- +import BaseLayout from "@/layouts/BaseLayout.astro"; +import AlignmentLab from "@/components/AlignmentLab.astro"; + +const toc = [ + ["00", "compass", "先拆成十二张账"], + ["01", "interface", "Base Model 与助手"], + ["02", "instruction", "Instruction Tuning"], + ["03", "sft", "SFT 的最小数学"], + ["04", "data", "示范数据从哪里来"], + ["05", "preference", "偏好怎样被测量"], + ["06", "reward", "比较怎样变成奖励"], + ["07", "rlhf", "PPO / RLHF 管线"], + ["08", "constraints", "KL、Replay 与税"], + ["09", "rlaif", "RLAIF / Constitution"], + ["10", "dpo", "DPO 为什么成立"], + ["11", "direct", "直接偏好算法家族"], + ["12", "distribution", "Online / Offline"], + ["13", "failures", "Reward Hacking"], + ["14", "evidence", "怎样证明真的变好"], + ["15", "deepseek-early", "DeepSeek 早期演化"], + ["16", "deepseek-modern", "R1、V3.2 与 V4"], + ["17", "kimi", "Kimi K2 → K3"], + ["18", "k3", "K3 三阶段拆解"], + ["19", "checklist", "读新配方的清单"], + ["20", "reading", "分层阅读路径"], + ["↳", "papers", "44 个关键节点"], +]; + +const paperChain = [ + ["2017", "Deep Reinforcement Learning from Human Preferences", "https://proceedings.neurips.cc/paper/2017/hash/d5e2c0adad503c91f91df240d0cd4e49-Abstract.html", "把人类对轨迹片段的比较拟合成 reward predictor,再优化行为 policy。"], + ["2017", "Proximal Policy Optimization Algorithms", "https://arxiv.org/abs/1707.06347", "用 clipped surrogate 限制 on-policy 更新幅度;原论文没有语言模型或人类偏好。"], + ["2019", "Fine-Tuning Language Models from Human Preferences", "https://arxiv.org/abs/1909.08593", "把 reward model、reference KL 与 PPO 接到生成式语言模型。"], + ["2020", "Learning to Summarize from Human Feedback", "https://proceedings.neurips.cc/paper/2020/hash/1f89885d556929e98d3ef9b86448f951-Abstract.html", "在摘要任务完整验证 comparison → RM → PPO,并展示过度优化边界。"], + ["2021", "Natural Instructions", "https://arxiv.org/abs/2104.08773", "用声明式任务说明研究跨任务泛化,建立 instruction interface 数据范式。"], + ["2021", "Finetuned Language Models Are Zero-Shot Learners", "https://arxiv.org/abs/2109.01652", "FLAN 证明多任务 instruction tuning 可改善未见任务的 zero-shot 表现。"], + ["2021", "Multitask Prompted Training Enables Zero-Shot Task Generalization", "https://openreview.net/forum?id=9Vrb9D0WI4", "T0 用 prompt templates 统一 62 个数据集,并严格留出整类任务。"], + ["2021", "WebGPT", "https://arxiv.org/abs/2112.09332", "把浏览器行动、引用回答与人类偏好训练接入同一 Agent 前身。"], + ["2022", "Training Language Models to Follow Instructions with Human Feedback", "https://proceedings.neurips.cc/paper_files/paper/2022/hash/b1efde53be364a73914f58805a001731-Abstract.html", "InstructGPT 建立 demonstration SFT → RM → PPO-ptx 的通用助手管线。"], + ["2022", "Training a Helpful and Harmless Assistant with RLHF", "https://arxiv.org/abs/2204.05862", "把 helpfulness 与 harmlessness 明确分账,并实验在线迭代偏好。"], + ["2022", "Super-NaturalInstructions", "https://arxiv.org/abs/2204.07705", "以 1,600+ tasks 检验根据自然语言指令泛化的边界。"], + ["2022", "Scaling Instruction-Finetuned Language Models", "https://arxiv.org/abs/2210.11416", "扩展 Flan task mixture、模型规模与 CoT 数据,研究 instruction scaling。"], + ["2022", "Scaling Laws for Reward Model Overoptimization", "https://arxiv.org/abs/2210.10760", "在 proxy–gold 受控设置量化 Goodhart 曲线,区分 BoN 与 RL。"], + ["2022", "Constitutional AI", "https://arxiv.org/abs/2212.08073", "以书面原则驱动自我批评、修订和 AI preference,再做 RLAIF。"], + ["2022", "Self-Instruct", "https://aclanthology.org/2023.acl-long.754/", "用 175 个 seeds 自举生成、过滤 instruction/input/output,再做 SFT。"], + ["2023", "OpenAssistant Conversations", "https://arxiv.org/abs/2304.07327", "开放多轮对话树、ranking 与标注流程,降低 post-training 数据门槛。"], + ["2023", "RRHF", "https://proceedings.neurips.cc/paper_files/paper/2023/hash/23e6f78bdec844a9f7b6c957de2aae91-Abstract-Conference.html", "用回答序列得分的排序损失对齐多来源候选。"], + ["2023", "SLiC-HF", "https://arxiv.org/abs/2305.10425", "用 sequence likelihood calibration 直接推动 chosen 与 rejected 分离。"], + ["2023", "LIMA", "https://proceedings.neurips.cc/paper_files/paper/2023/hash/ac662d74829e4407ce1d126477f4a03a-Abstract-Conference.html", "用约 1K 精选示范检验强 base 上少量高质量 SFT 的接口作用。"], + ["2023", "AlpacaFarm", "https://arxiv.org/abs/2305.14387", "提供 AI 模拟反馈、自动评测与 PPO/DPO/BoN 基线实现。"], + ["2023", "Direct Preference Optimization", "https://proceedings.neurips.cc/paper_files/paper/2023/hash/a85b405ed65c6477a4fe8302b5e06ce7-Abstract-Conference.html", "在 Bradley–Terry 与 KL-regularized optimum 下,用 policy/reference log-ratio 消去显式 RM+RL。"], + ["2023", "RLAIF vs. RLHF", "https://arxiv.org/abs/2309.00267", "在摘要、helpful、harmless 三类任务直接比较 AI 与人工 preference labels。"], + ["2023", "UltraFeedback", "https://arxiv.org/abs/2310.01377", "规模化多候选、多维度 AI feedback,成为开放偏好训练的重要数据源。"], + ["2023", "A General Theoretical Paradigm to Understand Learning from Human Preferences", "https://arxiv.org/abs/2310.12036", "分析确定性偏好与 DPO 过拟合,并提出有限间隔的 IPO。"], + ["2023", "Zephyr", "https://arxiv.org/abs/2310.16944", "以 dSFT + UltraFeedback AI preference + dDPO 展示开放蒸馏式对齐。"], + ["2024", "KTO", "https://arxiv.org/abs/2402.01306", "用 prospect-theoretic utility 处理可非成对的 desirable / undesirable 信号。"], + ["2024", "Back to Basics: REINFORCE Leave-One-Out", "https://arxiv.org/abs/2402.14740", "说明 critic-free RLOO 可成为更简单的在线 RLHF 基线。"], + ["2024", "ORPO", "https://aclanthology.org/2024.emnlp-main.626/", "把 SFT NLL 与 odds-ratio preference penalty 合成无 reference 单阶段目标。"], + ["2024", "RewardBench", "https://arxiv.org/abs/2403.13787", "直接测试 RM 在 chat、hard、safety、reasoning 与 OOD pairs 上的排序能力。"], + ["2024", "SimPO", "https://arxiv.org/abs/2405.14734", "用长度归一平均 log-prob 与目标 margin 构造 reference-free implicit reward。"], + ["2024", "Unpacking DPO and PPO", "https://proceedings.neurips.cc/paper_files/paper/2024/hash/404df2480b6eef0486a1679e371894b0-Abstract-Conference.html", "把 preference data、算法、RM 和 policy prompts 四个变量拆开做公平比较。"], + ["2024", "Tülu 3", "https://arxiv.org/abs/2411.15124", "开放数据策展、SFT、偏好训练、RLVR 与评测的完整 recipe。"], + ["2024", "DeepSeek LLM", "https://arxiv.org/abs/2401.02954", "公开 1M+ SFT、helpful/harmless preference 与 DPO 的早期 DeepSeek 管线。"], + ["2024", "DeepSeekMath", "https://arxiv.org/abs/2402.03300", "提出 GRPO,用同题成组相对奖励替代 learned critic。"], + ["2024", "DeepSeek-V2", "https://arxiv.org/abs/2405.04434", "把 reasoning alignment 与 human preference alignment 分成两个 GRPO 阶段。"], + ["2024", "DeepSeek-V3", "https://arxiv.org/abs/2412.19437", "组合 expert distillation、SFT、规则/模型 RM、GRPO 与生成式 reward 探索。"], + ["2025", "DeepSeek-R1", "https://arxiv.org/abs/2501.12948", "分清 base→rule RL 的 R1-Zero,与 cold-start/SFT/多阶段 RL 的正式 R1。"], + ["2025", "DAPO", "https://arxiv.org/abs/2503.14476", "用 Clip-Higher、Dynamic Sampling、token loss 与 overlong shaping 稳定长 CoT RL。"], + ["2025", "Kimi K2", "https://arxiv.org/abs/2507.20534", "把 verifiable rewards、self-critique rubric、预算与 PTX 放入 agentic post-training。"], + ["2025", "DeepSeek-V3.2", "https://arxiv.org/abs/2512.02556", "把 reasoning、agent 与 human alignment 数据合并进大规模 GRPO。"], + ["2026", "Kimi K2.5", "https://arxiv.org/abs/2602.02276", "扩展 unified multimodal/agentic RL、token-level off-policy clipping 与并行 agent。"], + ["2026", "DeepSeek-V4", "https://arxiv.org/abs/2606.19348", "以 SFT→GRPO 为主线,规则验证 easy tasks、GRM 处理 hard-to-verify tasks。"], + ["2026", "MOPD", "https://arxiv.org/abs/2606.30406", "学生在自己的 rollout 上接受多教师逐 Token log-ratio signal。"], + ["2026", "Kimi K3", "https://arxiv.org/abs/2607.24653", "SFT→九个领域/effort RL experts→MOPD,并扩展到百万 Token agentic RL。"], +]; +--- + + +
+
+
+

POST-TRAINING / 10 ALIGNMENT · PREFERENCE

+

模型会续写之后,
怎样学会真正与人协作?

+

+ “对齐”不是一瓶最后倒进去的价值药水。本章从自然语言任务接口开始, + 把示范、偏好、奖励、策略更新、约束与证据拆成十二张账, + 最后看 DeepSeek 怎样混合 GRPO / verifier / GRM,以及 Kimi K3 怎样用九个 RL 专家和 MOPD 整合能力。 +

+
+
+
LEVEL
L0 直觉 → L3 系统
+
LEDGERS
12 张独立问题账
+
PAPERS
44 个一手节点
+
LAB
4 个交互实验
+
TIME
约 160–220 分钟
+
VERIFIED
2026-07-29
+
+
+
+ +
+ + +
+
+

00 COMPASS

+

先拆成十二张账:SFT、RLHF、DPO、RLVR 从来不是同一个问题

+

+ 初学者常把所有 post-training 都理解成“让回答更好”。但如果不先问目标、监督单位、反馈来源和证据, + 同一个 win-rate 上升可能来自事实改善、表达变长、拒答更多,甚至更会迎合 judge。 +

+ + + RELATED / CHAPTER 09 +
数值精度、优化器与稳定性

如果 PPO、GRPO 的更新与低精度训练还不熟,可先看优化器和训练状态账。

+ 回看训练底座 → +
+ +
+
01 / TARGET

行为目标

帮助、安全、诚实、格式还是能力?

+
02 / UNIT

监督单位

Token、回答、pair、步骤还是轨迹?

+
03 / SOURCE

反馈来源

人、AI、原则、规则还是环境?

+
04 / SFT

示范模仿

teacher forcing 实际学到什么?

+
05 / MEASURE

偏好测量

chosen 的“更好”怎样定义?

+
06 / REWARD

奖励模型

比较怎样压成一个标量?

+
07 / POLICY

策略更新

PPO、RLOO、GRPO 怎样移动分布?

+
08 / DIRECT

直接偏好

DPO 家族消掉了哪些组件?

+
09 / DISTRIBUTION

数据分布

online/offline 与 on/off-policy。

+
10 / CONTROL

约束

KL、replay、预算和安全边界。

+
11 / FAILURE

失效

Goodhart、迎合、长度与拒答。

+
12 / EVIDENCE

证据

什么结果能证明真的更好?

+
+ +
+ ONE-SENTENCE MODEL +

Post-training 是把“模型能生成什么”重新分配成“在什么条件下更愿意生成什么”;反馈定义方向,优化器负责移动,证据负责检查有没有走歪。

+
+
+ +
+

01 BASE MODEL → ASSISTANT

+

Base model 学的是文本分布;助手还必须学会一套交互合同

+

+ 预训练看到的互联网文本里同时有事实、广告、争论、角色扮演、错误答案和有害内容。 + next-token prediction 能学到广泛能力,却没有理由自动把“用户问题”解释为“请给出最有帮助且安全的回答”。 +

+ +
+
+ BASE DISTRIBUTION + 文章续写论坛争论代码虚构对白错误信息教程 +

目标:复现训练文本中条件分布

+
+ + post-training +
+ ASSISTANT CONTRACT +
听懂任务instruction
+
服从约束format / tool / budget
+
权衡目标helpful / honest / safe
+
承认边界uncertainty / refusal
+
+
+ +

“能力”与“行为”不要硬切成两半

+
+
能力显露

模型可能早已知道答案,只是不懂用户接口;少量 SFT 就能把能力叫出来。

+
能力注入

高质量代码、数学和工具轨迹也会教新技能,不只是改语气。

+
行为重排

偏好优化更多是在候选分布里提高受偏好路径、压低其他路径。

+
+
一口人话

预训练像读遍图书馆;post-training 像学习接电话、理解委托、遵守流程并对结果负责。

+
+ +
+

02 INSTRUCTION TUNING

+

FLAN 与 T0 的关键贡献:把“任务编号”换成可泛化的自然语言接口

+

+ 传统多任务学习常把任务身份藏在数据集名、输出 head 或特殊标签里。 + Instruction tuning 则把任务目标、输入与输出格式写进人能读懂的 prompt, + 再在许多任务混合上做监督微调。 +

+ +
+
+
NLIpremise / hypothesis

判断 entailment

+
QAquestion / passage

回答问题

+
SUMdocument

生成摘要

+
STRUCTtable / triples

转成自然语言

+
+
PROMPT TEMPLATE“请根据以下材料……”

把不同 schema 映射成 text → text

+
HELD-OUT TASK未见过整类任务

根据自然语言说明尝试 zero-shot 泛化

+
+ +
+
Natural Instructions

任务说明成为数据对象

+
FLAN

多任务指令微调

+
T0

公开 prompt templates

+
Flan / SNI

扩任务、模型与 CoT

+
+ + +
+ +
+

03 SUPERVISED FINE-TUNING

+

SFT 没有换掉 next-token objective;它换的是条件、样本与 loss mask

+

给定 prompt x 和参考回答 y,最常见目标仍是 response Token 的负对数似然:

+
+ LSFT = − Σt mt log πθ(yt | x, y<t) +

mₜ 决定 system/user/padding 是否参与损失;teacher forcing 让每一步看到参考前缀。

+
+ +
+
CONDITIONSystem + User + history

告诉模型角色、任务、上下文与已经发生的对话。

+ +
TARGETAssistant response

参考回答中的每个有效 Token 产生模仿梯度。

+ +
UPDATERaise target likelihood

模型不会自动知道参考答案是否唯一、事实是否正确。

+
+ +

LIMA 证明了什么,又没有证明什么

+

+ LIMA 在强 LLaMA-65B base 上使用约 1,000 条精心策展示范,不使用 RM 或 RL, + 展示少量高质量数据可教会很强的交互风格与任务接口。它支持“预训练承担了大量知识”的假说, + 但不能外推成安全、复杂工具使用和所有 base model 都只需 1K 数据。 +

+ +
+
错误理解

“SFT loss 很低,所以答案事实正确。”

+
实际能说

模型能高概率复现这组 demonstrations。

+
还要检查

自由生成、未见任务、事实、安全、拒答和长度。

+
+
+ +
+

04 DEMONSTRATION DATA

+

示范数据的真正稀缺物不是 Token,而是覆盖、质量和“谁来定义好”

+

+ InstructGPT 的三类数据具有不同角色:约 13K SFT prompts 带人工示范, + 33K RM prompts 带候选排序,31K PPO prompts 只提供 policy rollout 的输入。 + 把它们合写成“77K RLHF 数据”会丢掉监督结构。 +

+ +
+
HUMAN EXPERT

人工示范

质量高、贵、覆盖慢;专家也会有单一路径偏好。

+
USER LOG

真实请求

贴近部署分布,但涉及隐私、选择偏差和快速变化。

+
SELF-INSTRUCT

模型自举

扩规模与多样性;错误、模板和 teacher 风格会被复制。

+
EXECUTION

环境轨迹

代码、搜索、工具结果可验证;沙箱和任务覆盖成为瓶颈。

+
+ +
+
175 SEEDS少量人工任务
+
GENERATEInstruction / input / output
+
FILTER格式、重复、有效性
+
SFT扩大任务接口
+
+ + +
+ +
+

05 PREFERENCE MEASUREMENT

+

人更容易比较两个回答,但“比较容易”不等于“偏好客观”

+

+ Christiano 等人在 2017 年选择短轨迹 pairwise comparison, + 因为人通常比给稳定绝对分数更擅长回答“哪一个更好”。 + 到语言模型时代,同一 prompt 生成 2–9 个候选,标注者排序后可展开为 pair。 +

+ +
+
PROMPT x解释为什么海是蓝色
+
+
y₁短且准确policy A · temp .7
+
y₂长但编造policy B · temp 1.0
+
y₃安全但回避policy C · temp .7
+
y₄有帮助但太技术policy D · temp .8
+
+
LABELy₁ ≻ y₄ ≻ y₃ ≻ y₂

排序只在这四个候选和 rubric 下成立

+
+ +

每个 preference dataset 都必须附带七个问题

+
    +
  1. 01候选由谁生成?

    弱 policy 的“赢家”可能仍很差。

  2. +
  3. 02temperature 与长度上限?

    它们改变候选分布。

  4. +
  5. 03是否允许 tie / both bad?

    强迫二选一会制造伪信号。

  6. +
  7. 04rubric 是一维还是多维?

    总体质量会隐藏冲突目标。

  8. +
  9. 05位置是否随机化?

    AI 与人类都有顺序偏置。

  10. +
  11. 06多人怎样聚合?

    多数票会抹掉真实分歧。

  12. +
  13. 07是否来自当前 policy?

    旧 pairs 对新 policy 可能已太容易或 OOD。

  14. +
+
+ +
+

06 REWARD MODEL

+

Bradley–Terry 的作用:把“谁赢”解释成潜在 reward difference

+
+ P(yw ≻ yl | x) = σ(rφ(x,yw) − rφ(x,yl)) + LRM = −log σ(rw − rl) +

只识别差值:对同一 prompt 的所有 reward 同加常数,不改变偏好概率。

+
+ +
+
PAIRchosen / rejected

来自某个候选分布

+ +
SHARED RM同一网络分别读两条回答

最后输出一个 scalar

+ +
DIFFERENCErw − rl

sigmoid 变成选择概率

+
+ +

Reward model 的两重身份

+
+
MEASUREMENT

偏好测量器

在固定 pair test set 上,它像一个分类器;可报告准确率、校准与分组性能。

+
OPTIMIZATION TARGET

被 policy 主动寻找的地形

一旦拿它训练 policy,模型会寻找高分区域,可能走出 RM 见过的分布。

+
+
分类准确率不是全部

99% 的简单 pairs 可能掩盖两个强回答之间的细微失真;RewardBench 因此专门加入 hard、safety、reasoning 与 OOD comparisons。

+
+ +
+

07 PPO / RLHF

+

InstructGPT 的三阶段管线,每一段在解决不同的优化困难

+
+
STAGE 1

SFT POLICY

人工 demonstration 给出稳定 cold start 和交互格式。

稠密 Token loss
+ +
STAGE 2

REWARD MODEL

K-way ranking 变成 pairwise preference classifier。

完整回答 scalar
+ +
STAGE 3

PPO-PTX

向当前 policy 采样,优化 RM,同时加 KL 与 pretraining mix。

on-policy rollout
+
+ +
+ max E[rθ(x,y) − β log(πRL(y|x) / πSFT(y|x))] + γ E[log πRL(xpretrain)] +

论文默认的 InstructGPT 指 PPO-ptx;纯 PPO 令 γ=0

+
+ +
+
POLICY生成新回答

需要反向更新

+
REFERENCE计算 KL

冻结 SFT policy

+
REWARD MODEL给整段打分

冻结偏好代理

+
VALUE / CRITIC估计 advantage

降低 policy-gradient 方差

+
+ +

+ PPO 是通用 RL 算法,不等于 RLHF。RLHF 还包括如何采集反馈、训练 RM、定义 reference、 + 组织 rollout、计算 return、处理长度与评价最终模型。RLOO、GRPO 可以省 critic, + 却不会自动修复有偏 reward。 +

+
+ +
+

08 CONSTRAINTS

+

KL 不是“防止模型学太多”,而是给代理奖励画一条可控活动半径

+
+
πref语言质量与已知行为
+
+ 高分 + 未知 OOD 峰 + Shortcut +
+
低 KL中 KL高 KL
+
+ +
+
REFERENCE KL

分布锚

限制 policy 离开 RM 训练支持区的速度。

+
PPO CLIP

单步锚

限制新旧 policy ratio 的一次更新。

+
PTX / SFT REPLAY

能力锚

保留预训练知识与基础语言能力。

+
BUDGET / RULE

行为锚

限制长度、语言、提交次数与安全边界。

+
+ +

Alignment tax 是一个需要测量的 trade-off,不是口号

+

+ InstructGPT 用 pretraining mix 缓解部分 public NLP 回退;DeepSeek-V2 也明确报告 human preference alignment + 对部分标准 benchmark 的负面影响。必须同时看目标行为改善与基础能力退化,不能只看 chat preference。 +

+
+ +
+

09 RLAIF · CONSTITUTION

+

AI Feedback 扩大的是监督吞吐;“应该奖励什么”仍要由人定义边界

+

Constitutional AI 包含两个不同阶段,不能只记住“AI 自己评价自己”:

+
+
HUMAN INPUT一组书面原则

定义 harmlessness 与应答边界

+ +
SL-CAI生成 → 自我批评 → 修订

修订回答成为 supervised data

+ +
RL-CAIAI 比较候选 → preference model

再用 RL 优化 policy

+
+ +
+
HUMAN原则、rubric、种子与最终验收

决定目标与不可接受边界。

+
AI LABELER扩展 critiques、revisions、preferences

提高覆盖和速度,也复制 teacher 偏差。

+
POLICY学习 AI 标签压缩后的行为分布

不能超出评价器能可靠区分的区域太远。

+
+ + +
+ +
+

10 DIRECT PREFERENCE OPTIMIZATION

+

DPO 的妙处不是“不要 reward”,而是把 reward 写成 policy 相对 reference 的 log-ratio

+

从 KL-regularized reward maximization 的最优 policy 出发:

+
+ π*(y|x) ∝ πref(y|x) · exp(r(x,y) / β) + r(x,y) = β log(π*(y|x) / πref(y|x)) + β log Z(x) +

同一 prompt 内比较两回答时,log Z(x) 抵消。

+
+ +
+
PREFERENCE MODELBradley–Terry

reward difference → 选择概率

+ +
CONTROLKL to reference

定义可接受 policy 距离

+ +
DIRECT LOSSΔ log(π / πref)

直接训练 policy 排序 pairs

+
+ +
+ LDPO = −log σ(β[(logπθ−logπref)w − (logπθ−logπref)l]) +

DPO 通常使用固定 pair dataset;它省去显式 RM、value 和在线 PPO loop。

+
+ +
一口人话

不要只问“模型现在更喜欢 A 还是 B”,而问“相对出发模型,A 的概率涨幅是否比 B 更大”。

+
+ +
+

11 DIRECT PREFERENCE FAMILY

+

DPO 之后不是“每篇都更简单更强”,而是在修改四个不同假设

+
+
方法反馈格式Reference核心变化最容易误写
+
DPO

chosen / rejected pair

需要

policy/reference log-ratio

不是没有 reward 假设
+
IPO

pair

需要

有限 margin 回归

τ 不等于 DPO β
+
KTO

可非成对 binary

通常需要

prospect-theoretic utility

不要求同 prompt pair
+
ORPO

pair + target

不需要

NLL + odds ratio

仍包含 SFT 部分
+
SimPO

pair

不需要

平均 log-prob + margin

长度归一不能漏
+
RRHF

ranking / 多候选

不需要

序列分数排序

不是 DPO 特例
+
+ +

比较算法时必须固定四个变量

+
+
01Preference data

同一 prompts、pairs、候选质量与过滤。

+
02Algorithm

目标、reference、长度与 β / margin。

+
03Reward model

PPO 使用哪个 RM,如何训练和验证。

+
04Policy prompts

在线 RL 实际从什么分布采样。

+
+

没有这些控制,“DPO 赢 PPO”或“PPO 赢 DPO”都可能只是数据、实现或在线探索差异。

+
+ +
+

12 DISTRIBUTION

+

Online / Offline 与 On-policy / Off-policy 是两张坐标轴

+
+
FEEDBACK × ROLLOUT
+
接近当前 Policy
+
旧 Policy / 固定数据
+
反馈持续更新
+
Online preference + on-policy

当前 policy 采样、即时获取新标签;贵但贴近部署分布。

+
Online feedback + stale rollout

长轨迹跨迭代;需要 importance correction / clipping。

+
反馈固定
+
Fixed RM + fresh rollout

典型 PPO:rollout 新,reward proxy 固定;仍可能优化出 RM OOD。

+
Offline pairs

经典 DPO:便宜稳定;pairs 对新 policy 可能太旧或太容易。

+
+ +
+
DPO固定 pairs

训练时不需要采样当前 policy

+ +
PPO近 on-policy rollout

需要 rollout / reward / value loop

+ +
K3 PARTIAL ROLLOUT超长轨迹跨迭代

自然产生 extreme off-policy

+
+
+ +
+

13 FAILURE MODES

+

Reward hacking 不是模型“邪恶”,而是代理目标允许更便宜的高分路径

+
+ + + + + + PROXY REWARD + GOLD / HUMAN + 过优化区 + 优化强度 / KL / BoN + +
+ CONTROLLED EVIDENCE +

Gao et al. 2022

+

论文用固定 gold RM 模拟“人”,再训练较弱 proxy RM。曲线是受控 synthetic setup,不是所有真实 RLHF 的通用函数。

+
+
+ +
+
LENGTH

越长越高分

完整感、分点和重复成为 shortcut;K3 GRM 明确加入 verbosity budget。

+
SYCOPHANCY

迎合错误前提

用户 approval 与 honesty 冲突时,单一总体偏好会奖励附和。

+
OVER-REFUSAL

安全等于全拒

只测 should-refuse 会鼓励对无害请求也拒绝。

+
FORMAT HACK

命中解析器

规则 verifier 可能被答案格式、测试覆盖或沙箱漏洞利用。

+
RM OOD

走出评分器视野

policy 主动寻找 RM 没见过的高分文本。

+
COLLAPSE

偏好单一风格

离线 pairs 可能让回答变得同质,覆盖和多样性下降。

+
+ + +
+ +
+

14 EVIDENCE LADDER

+

“模型变好了”必须同时穿过训练、代理、行为和外部结果四层证据

+
+
01TRAINING SIGNAL

SFT loss、DPO loss、PPO reward

只证明优化器在工作
+
02PROXY VALIDATION

RM pair accuracy、RewardBench

只证明代理在测试 pairs 上排序
+
03BEHAVIOR

blind human / LLM judge / safety suites

证明指定人群或 judge 的偏好
+
04OUTCOME

单元测试、用户成功率、环境结果

最接近任务目标,仍受 verifier 定义限制
+
+ +
+
PAIR ACCURACY能否挑对这对回答

不能证明 policy 生成的新分布。

+
WIN-RATE谁在指定 rubric 下更受偏好

要控制长度、位置、judge 和 sampling。

+
KL离 reference 多远

不是好坏分数,只是距离/约束口径。

+
PASS RATE环境定义的结果是否成功

开放式帮助、安全仍需额外评价。

+
+
+ +
+

15 DEEPSEEK / EARLY ALIGNMENT

+

DeepSeek 的演化不是“DPO 换成 GRPO”,而是反馈来源和任务结构一起改变

+
+

SFT → DPO

1M+ SFT;helpfulness / harmlessness pairs;DPO 一轮。

开放聊天偏好
+ +

Two-stage GRPO

reasoning alignment 后接 helpful / safety / rule 多奖励。

critic-free group relative
+ +

SFT + RM + GRPO

expert distillation、规则 RM、模型 RM 与 GRM 探索。

规则优先
+
+ +
+
BASEDeepSeek-V2 Base
+
SFTInstruction / reasoning / writing
+
RL 1Reasoning reward
+
RL 2Helpful + Safety + Rule
+
+ +

DeepSeek-V2 自己指出的三个边界

+
    +
  • SFT 数量与质量都重要:少量数据可起步,开放写作的覆盖仍需要规模。
  • +
  • Alignment tax:human preference alignment 会伤害部分标准 benchmark,需要显式缓解。
  • +
  • Online / offline 结论依情境:不能从单一实验宣布一种制度永远更好。
  • +
+
+ +
+

16 DEEPSEEK / R1 → V4

+

从 R1 到 V4:可验证任务用规则,难验证任务转向生成式 rubric

+
+
R1-ZERO

Base → rule-based RL

没有初始 SFT;研究规则奖励能否直接激发 reasoning behavior。

+
DEEPSEEK-R1

Cold start → RL → SFT → broader RL

加入少量高质量 CoT、拒绝采样、约 800K supervised data 与通用对齐。

+
DISTILLED MODELS

Teacher data → SFT

只做 SFT,不等于复制 R1 的 RL 训练路径。

+
+ +
+
+ EASY TO VERIFY +

数学 · 代码 · Kernel

+
ground truthcompilerunit testsnumeric error
+

奖励便宜、清晰,但测试覆盖和解析器仍可被利用。

+
+
+ HARD TO VERIFY +

写作 · 研究 · 开放帮助

+
rubricGRM reasoningscorepadconstraints
+

V4 明确放弃传统 scalar RM,改用 rubric-guided generative reward model。

+
+
+ +
+
Reasoning + Agent + Alignment

合并进一段大规模 GRPO

+
Curated SFT

能力与行为 cold start

+
Rules + GRM → GRPO

按可验证性选择反馈

+
+
+ +
+

17 KIMI / K2 → K3

+

Kimi 的主线从“聊天偏好”走向长轨迹执行、预算控制与能力整合

+
+

Long-CoT RL

128K RL context、partial rollout、long2short 与 online mirror-descent surrogate。

+ +

Agentic Post-training

verifiable reward gym、self-critique rubric、PTX、预算与 temperature decay。

+ +

Unified Agent RL

视觉、工具与并行 agents;100K concurrent tasks 与 token-level clipping。

+ +

Multi-effort Experts

九个专门 policy、百万 Token agentic RL 与 MOPD consolidation。

+
+ +

反馈源随任务改变

+ +
+ +
+

18 KIMI K3 / THREE STAGES

+

K3 的 post-training 要分成三份看:冷启动、专家成长、统一整合

+
+
STAGE 1 · SFT

建立可用起点

扩展 Kimi 既有 SFT 数据,覆盖 general、agentic、coding;从这一阶段开始做 MXFP4/MXFP8 QAT。

稠密 demonstration loss
+ +
STAGE 2 · RL

九个专门专家

3 domains × low / high / max;各自学习任务与 Token 预算的最优策略。

outcome / GRM / environment reward
+ +
STAGE 3 · MOPD

回到一个统一模型

student 自己 rollout;对应 teacher 对每个 Token 提供 clipped log-ratio reward。

dense per-token teacher signal
+
+ +
+
DOMAIN × EFFORT
LOW
HIGH
MAX
+
GENERAL
T₁T₂T₃ +
GENERAL AGENT
T₄T₅T₆ +
CODING
T₇T₈T₉ +
+ +
+ rOPD(yt) = clip(sg[log πteacher(yt|prefix) / πstudent(yt|prefix)], −Rmax, Rmax) +

teacher 不替 student 生成整条轨迹;student 在自己访问到的状态上接受稠密信号。

+
+ +
+
Partial rollout

同一长轨迹跨训练迭代,解决 long-tail latency,却产生 extreme off-policy。

+
MOPD

当前 student rollout 上的多教师能力整合;不是普通离线 teacher-forcing。

+
QAT

服务成本约束贯穿 SFT/RL;它不定义 helpfulness 或 reasoning reward。

+
+ + +
+ +
+

19 READING CHECKLIST

+

遇到一个新的“对齐算法”,先问这十四个问题

+
+ {[ + ["01", "目标行为是什么?"], + ["02", "base / SFT 起点是谁?"], + ["03", "监督落在 Token、pair 还是 outcome?"], + ["04", "反馈来自人、AI、规则还是环境?"], + ["05", "候选由哪个 policy 生成?"], + ["06", "允许 tie / both bad 吗?"], + ["07", "显式 RM 如何验证?"], + ["08", "是否有 reference / KL?"], + ["09", "online、offline、on/off-policy?"], + ["10", "长度与 mask 怎样处理?"], + ["11", "训练时需要几个模型?"], + ["12", "最可能的 reward shortcut?"], + ["13", "是否报告 alignment tax?"], + ["14", "最终证据来自谁的评价?"], + ].map(([number, question]) =>
{number}{question}
)} +
+ +
+ FAST REJECTION RULE +

+ 如果一篇论文只给训练 reward、RM score 或单一 LLM judge,而没有控制长度、reference、候选分布与外部结果, + 那么“alignment improved”仍是待证明结论。 +

+
+
+ +
+

20 READING PATH

+

按四层进入,不需要第一天就推完 PPO 与 DPO

+
+
L0 · 25 MIN

先看反馈角色

本章 00、01、05、09、13;能说清人、AI、规则和环境分别给什么信号。

+
L1 · 45 MIN

掌握四个目标

读 03、06、07、10;能区分 SFT、RM、KL-RL 与 DPO loss。

+
L2 · 70 MIN

回到关键论文

Christiano → Stiennon → InstructGPT → DPO → CAI → Reward Overoptimization。

+
L3 · 90 MIN

拆现代系统

DeepSeek-V2/V3/R1/V4 与 K2/K3;同时核对 rollout、模型数、约束和 verifier。

+
+ + +
+ +
+

PRIMARY PAPER CHAIN

+

44 个关键节点:按问题接力,不按年份堆名字

+

每个链接指向论文、会议页或官方技术报告;它们承担不同证据角色,不能只按 benchmark 排序。

+
+ {paperChain.map(([year, title, url, contribution], index) => ( + + {String(index + 1).padStart(2, "0")} + +
{title}

{contribution}

+ +
+ ))} +
+
+
+
+ + + diff --git a/src/pages/progress/index.astro b/src/pages/progress/index.astro index 7909239..4c3b472 100644 --- a/src/pages/progress/index.astro +++ b/src/pages/progress/index.astro @@ -15,6 +15,7 @@ const workstreams = [ { label: "Scaling Laws", value: 74, next: "加入真实拟合复现、置信区间与更多模型族对照" }, { label: "数据工程与预训练配方", value: 73, next: "逐图精读 FineWeb / DCLM,加入真实去重与 mixture traces" }, { label: "DeepSeek 专题", value: 71, next: "补 R1 / DAPO 的逐图训练轨迹与复现对照" }, + { label: "指令微调与人类偏好", value: 75, next: "加入真实偏好分歧样本、RM 长度偏置与 PPO/DPO 小模型复现" }, { label: "推理与测试时扩展", value: 76, next: "真实模型采样曲线、PRM 案例与逐篇图表精读" }, { label: "稀疏计算与 MoE", value: 74, next: "补充真实集群 traces 与专家特化案例" }, { label: "长上下文专题", value: 72, next: "加入更多论文逐图笔记与真实模型配置对比" }, @@ -44,7 +45,7 @@ const workstreams = [
OVERALL
专题平均 {average}%
READABLE
{published} 个首版可读专题
ACTIVE
{researching} 个研究/写作中
-
UPDATED
2026-07-29 05:20 CST
+
UPDATED
2026-07-29 05:59 CST
MODE
持续迭代,不锁死版本
@@ -54,7 +55,7 @@ const workstreams = [

01 WORKSTREAMS

-

十五条工作流同时推进,但不混淆“有页面”和“已核验”

+

十六条工作流同时推进,但不混淆“有页面”和“已核验”

内容首版优先打通全局脉络;随后每轮迭代选择一个专题推进到论文/工程层,并做独立事实复核。 @@ -91,8 +92,8 @@ const workstreams = [

K3 报告已结构化拆解

47 页报告目录、151 条参考来源和架构/后训练/系统主线已经提取。

16 专题知识图

从语言模型基础到评测安全,包含先修依赖和三条贯穿案例。

编辑式网站系统

响应式导航、章节模板、侧栏、进度、论文链和证据提示组件。

-

三十一个原创交互视图

K3、语言模型前史、Transformer 四联实验、DeepSeek、长上下文、MoE、推理,以及训练系统、Scaling、数据工程和数值专题。

-

十一篇首版长文

K3、语言模型前史、Transformer、DeepSeek、Scaling、数据工程、长上下文、MoE、推理、训练系统与数值优化专题。

+

三十五个原创交互视图

K3、语言模型前史、Transformer、DeepSeek、长上下文、MoE、推理,以及训练系统、Scaling、数据工程、数值和 Alignment 专题。

+

十二篇首版长文

K3、语言模型前史、Transformer、DeepSeek、Scaling、数据工程、长上下文、MoE、后训练、推理、训练系统与数值优化专题。

语言模型前史深度专题

八张独立问题账、33 个正式节点、20 段长文与概率—向量—记忆—对齐四联实验。

Transformer 深度专题

十张独立问题账、40 个正式节点、21 段正文与 QKV—Mask—多头位置—Block 成本四联实验。

Scaling Laws 深度专题

九张账、29 个一手节点、DeepSeek/Kimi 双谱系与曲面—部署—复用—涌现四联实验。

@@ -102,7 +103,8 @@ const workstreams = [

推理深度专题

八张账、30 篇一手论文链、DeepSeek/Kimi 双主线与三页签互动实验室。

训练系统深度专题

九张账、37 个一手节点、DeepSeek/Kimi 双谱系与显存—网格—气泡—通信实验室。

数值、优化器与稳定性深度专题

十张账、36 个一手节点、K2/K3 与 DeepSeek-V3/V4 双谱系,以及格式—状态—更新—失稳四联实验。

-

258 篇关键论文索引

补齐 Residual/Norm、相对位置、UniLM、多头冗余、Attention 解释争论与 NormFormer 等 11 个节点。

+

指令微调与人类偏好深度专题

十二张账、44 个一手节点、DeepSeek/Kimi 后训练双谱系,以及 SFT—RM—PPO/DPO—配方四联实验。

+

280 篇关键论文索引

新增人类偏好学习、HH-RLHF、LIMA、RewardBench、RLAIF、KTO、ORPO、SimPO 等 22 个后训练节点。

公开仓库与自托管发布

源码公开到 git.k1412.top,网站由不可变镜像、Compose Manager 与 HTTPS 交付。

@@ -126,6 +128,7 @@ const workstreams = [
P1长上下文二轮深化

真实模型配置 → 内核细节 → 长上下文评测与失败案例

配置比较器 + 逐图论文笔记
P1MoE 二轮深化

真实负载 traces → 专家特化可解释性 → 共享专家语义

案例库 + 集群证据
P1推理二轮深化

真实 pass@k 曲线 → PRM 失败案例 → 逐篇图表精读

案例库 + 真实 traces
+
P1Alignment 二轮深化

真实偏好分歧 → RM 长度偏置 → PPO/DPO 小模型复现

数据案例 + 可复现实验
P2原生多模态

ViT/CLIP → connector VLM → Kimi-VL/MoonViT-V2

视觉 Token 流程图