Alignment 道练习题
18 道题 · 0 已解决
Alignment 是预训练之后的阶段,模型在此阶段学习如何更倾向于人类真正想要的答案。通常你会向模型展示成对的回答(一个被偏好,一个被拒绝),在使其概率向更好的回答靠拢的同时,保持其与原始模型接近。这些题目将偏好训练中的公式转化为实际代码。你将使用 Bradley-Terry loss 训练 reward model,通过 pairwise accuracy 进行评分,从样本中估计 KL divergence,计算 DPO loss 及其 gradient weights,编写 IPO, KTO 和 SimPO loss,构建带有 KL penalty 的 per-token RLHF rewards,并组装包含 GAE 和 value clipping 的完整 PPO loss,以及 GRPO group-relative advantages。从 Bradley-Terry loss 和 KL estimation 的 Easy 题目开始。然后进行 DPO 及其变体,最后完成 PPO 和 GRPO。Post-training 是当前大部分 LLM 工作发生的领域,研究和 fine-tuning 岗位的面试官会期望你解释 DPO 与 PPO 的区别,以及 KL term 的作用是什么。
简单 7
- Train a reward model with the Bradley-Terry loss
- Score a reward model by pairwise preference accuracy
- Estimate KL divergence from samples three ways
- Compute the IPO preference loss
- Add label smoothing to the DPO loss (conservative DPO)
- Compute batched GRPO advantages and filter zero-signal groups
- Compute RLOO leave-one-out baselines
中等 6
困难 5
- GRPO: group-relative advantages with the PPO clipped objectivePro
- Full PPO loss with GAE, advantage whitening and value clippingPro
- Compute the DPO gradient weights by handPro
- Compute a token-level clipped policy loss with asymmetric clippingPro
- Compute the DPO loss directly from policy and reference logitsPro