--- 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 怎样更新,以及现代配方怎样组合多种反馈。