AI Skills AI技能 2h ago Updated 1h ago 更新于 1小时前 50

SFT, RL and DPO: The Other Stack SFT、RL与DPO:另一套栈

Post-training (SFT, DPO, PPO, GRPO, RLVR) is the critical stage that transforms pre-trained base models into usable assistants, and it is where most practical model behavior is determined LoRA and its variants (QLoRA) are the dominant parameter-efficient fine-tuning methods, freezing base weights to drastically reduce training memory while producing portable adapters DPO has largely replaced RLHF by eliminating the need for a reward model and RL loop, optimizing a single closed-form objective ag 后训练(Post-training)是将预训练模型转化为可用助手的关键阶段,SFT、DPO、PPO、GRPO、RLVR是核心方法,各自适用于不同场景 LoRA适配器技术使后训练显存成本大幅降低,同时实现多适配器切换,成为SFT/DPO/RL方法的标准配置 GRPO+RLVR(可验证奖励)是强化学习推理训练的主流方案,DeepSeek-R1等开源推理模型均采用此路线 强化学习rollout本质是推理工作负载,后训练时间与推理服务栈性能直接相关,KV cache和量化策略同样影响训练效率

68
Hot 热度
76
Quality 质量
70
Impact 影响力

Analysis 深度分析

TL;DR

  • Post-training (SFT, DPO, PPO, GRPO, RLVR) is the critical stage that transforms pre-trained base models into usable assistants, and it is where most practical model behavior is determined
  • LoRA and its variants (QLoRA) are the dominant parameter-efficient fine-tuning methods, freezing base weights to drastically reduce training memory while producing portable adapters
  • DPO has largely replaced RLHF by eliminating the need for a reward model and RL loop, optimizing a single closed-form objective against a frozen reference model
  • GRPO with verifiable rewards (RLVR) is the leading approach for reasoning tasks, as demonstrated by DeepSeek-R1, and avoids the critic network overhead of classical PPO
  • Reinforcement learning rollouts are fundamentally inference workloads, meaning serving stack performance (KV cache management, quantization, batching) directly determines post-training run duration

Why It Matters

Post-training is where the majority of a model's useful behavior is encoded, yet it remains poorly understood by practitioners who conflate it with serving. The article bridges a critical gap by showing that RL-based post-training is inseparable from the serving stack—rollout generation consumes the same KV cache, memory bandwidth, and quantization tradeoffs that serving engineers manage daily. For AI practitioners, this means investing in serving infrastructure optimization pays direct dividends in training throughput, and choosing the right post-training method can eliminate entire categories of model components (reward models, critics) without sacrificing performance.

Technical Details

  • SFT (Supervised Fine-Tuning): Trains on curated prompt-response pairs using the same next-token prediction objective as pre-training. LoRA freezes base weights and trains small low-rank adapter matrices, reducing trainable parameters while keeping optimizer state minimal. QLoRA extends this by quantizing the frozen base to 4-bit, enabling large-model fine-tuning on consumer hardware.
  • DPO (Direct Preference Optimization): Optimizes a single classification loss using prompt-better-answer-worse-answer triples, comparing the trained model against a frozen reference copy. Eliminates the reward model and RL loop required by RLHF, operating under the Bradley-Terry model assumption for preferences.
  • GRPO (Group Relative Policy Optimization): Removes the critic network from PPO by sampling a group of G answers per prompt, scoring them, and using the group mean as the baseline for advantage computation. Reduces resident networks from four (PPO) to two (with verifier) or three (with learned reward model).
  • RLVR (Reinforcement Learning with Verifiable Rewards): Replaces learned reward models with programmatic verifiers (answer keys, unit tests, compilers) that produce binary 0/1 rewards. Prevents reward model drift but introduces exploitation risks where models find valid answers through invalid routes.
  • Serving-Training Connection: GRPO rollouts generate G answers per prompt for every batch item, creating serving-like workloads that hit the same KV cache and memory bandwidth limits. Quantization in rollouts carries dual costs: quality degradation (as in serving) plus broken reference-model comparison (unique to training).

Industry Insight

  • The SFT → DPO → GRPO/RLVR decision tree should guide method selection: start with SFT for format/tone/domain issues, add DPO when ranking is possible but ideal answers cannot be written, and only reach RLVR when correctness is programmatically verifiable. PPO should be considered last and rarely, given its four-network overhead.
  • Post-training infrastructure and serving infrastructure are now the same infrastructure. Teams that optimize their serving stack (KV cache efficiency, quantization, batching) directly reduce RL training costs and iteration cycles, making the two engineering functions more interdependent than ever.
  • The rise of RLVR and open reasoning models (DeepSeek-R1 lineage) signals a shift away from human-labeled preference data toward programmatic verification, reducing annotation costs while introducing new failure modes around reward hacking that require rigorous checker design rather than model-scale investment.

TL;DR

  • 后训练(Post-training)是将预训练模型转化为可用助手的关键阶段,SFT、DPO、PPO、GRPO、RLVR是核心方法,各自适用于不同场景
  • LoRA适配器技术使后训练显存成本大幅降低,同时实现多适配器切换,成为SFT/DPO/RL方法的标准配置
  • GRPO+RLVR(可验证奖励)是强化学习推理训练的主流方案,DeepSeek-R1等开源推理模型均采用此路线
  • 强化学习rollout本质是推理工作负载,后训练时间与推理服务栈性能直接相关,KV cache和量化策略同样影响训练效率

为什么值得看

本文系统梳理了LLM后训练的技术谱系,明确了SFT→DPO→GRPO/RLVR的选用逻辑,对AI工程师选择微调方案具有直接指导价值。同时揭示了后训练与推理服务的深层联系,帮助从业者理解训练-推理一体化优化的可能性。

技术解析

  • SFT(监督微调):基于标注数据直接训练,教授格式、指令遵循、语气和领域知识。LoRA通过冻结基础权重、仅训练低秩适配器矩阵,将显存消耗降低至原来的极小比例,且支持多适配器热切换。QLoRA进一步将基础模型量化至4bit,使大模型微调在消费级硬件上可行。

  • DPO(直接偏好优化):替代传统RLHF的离线方法,输入(prompt, 优答案, 劣答案)三元组,通过闭式目标函数直接优化策略,无需训练奖励模型或运行RL循环。核心机制是与冻结的参考模型对比,防止策略漂移。

  • GRPO(Group Relative Policy Optimization):PPO的简化版本,移除评论家网络(critic),改为对同一prompt采样一组答案(如8/16/32个),用组内均值作为基线计算优势值。仅需策略网络和参考网络两个主要组件,显存开销约为PPO的一半。

  • RLVR(可验证奖励强化学习):用程序验证器(数学答案键、单元测试、编译器)替代人类奖励模型,提供0/1二值奖励。避免了奖励模型漂移问题,且验证器代码可读可审计。与GRPO结合成为推理能力训练的标准配方。

  • 后训练-推理耦合机制:GRPO rollout阶段需为每个prompt生成G个答案,本质是大规模推理工作负载。KV cache决定batch size上限,前缀共享优化可显著提升效率。量化在训练中同时影响生成质量和参考对比可信度,需权衡。

行业启示

  • 方法选型应遵循数据可得性优先级:能写答案用SFT,能排序用DPO,可验证用GRPO+RLVR,PPO仅作为最后手段。大多数场景无需走到强化学习。

  • 训练-推理基础设施可统一规划:强化学习训练依赖推理栈性能,KV cache优化、量化策略、批处理调度等技术可直接复用,建议团队打通训练与推理工程能力。

  • 开源推理模型训练路线已趋同:GRPO+RLVR成为主流,验证器设计质量(如DeepSeek-R1的测试套件)成为核心竞争力,未来竞争将从模型架构转向训练数据与验证工程。

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

Fine-tuning 微调 LLM 大模型 Training 训练 Alignment 对齐 Inference 推理