← Back to LLMs Mind Map
⚡ LLMsID: sft-basics

Supervised Fine-Tuning (SFT)

指令微调 SFT
🎯Core Definition
SFT (Supervised Fine-Tuning) fine-tunes the pretrained model on high-quality instruction–response pairs to turn a text-continuation engine into an instruction follower. Mechanism: the objective stays cross-entropy L=−∑log⁡P(y∣x)L = -\sum \log P(y|x) but on instruction data; typically 1–3 epochs at a low LR (~1e-5, far below pretraining) with global-batch packing. The core lesson is 'quality beats quantity': Alpaca replicated ChatGPT-level instruction following with only 52K GPT-generated samples.
💡Use Cases
giving general models conversational/instruction-following ability, domain adaptation (medical/legal/finance), and as the initial policy for RLHF.
⚡Key Problems Solved
pretrained models only continue text and ignore instructions. A few thousand to tens of thousands of high-quality pairs align behavior — far better than blindly scaling data; more than 3 epochs overfits instructions and hurts general ability (catastrophic forgetting). Compared with ~1.4T pretraining tokens, SFT uses ~7 orders of magnitude less data (52K vs 1.4T), slashing cost, while providing the starting policy for RLHF.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of Supervised Fine-Tuning (SFT).
Use Cases
In production engineering, what are the primary use cases for Supervised Fine-Tuning (SFT) and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
SFT vs pretraining: data, objective, epochs?
2
Why does quality beat quantity in SFT data?
3
Can SFT overfit? How to choose epochs and LR?
4
What is the relationship between SFT and RLHF/DPO?
5
How are instruction datasets built and filtered (human/LLM-generated)?
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "Supervised Fine-Tuning (SFT)"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardFlashAttentionNext Card →LoRA / QLoRA Low-Rank Adaptation

🔗 More LLMs Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/LLM/card/sft-basics
中文速览与面试要点

指令微调 SFT (Supervised Fine-Tuning (SFT))

定义: SFT(Supervised Fine-Tuning, 指令微调)用高质量'指令-回答'监督数据微调预训练模型, 把底座从'续写文本'变成'遵循指令'。机制: 目标函数仍是交叉熵 L = - P(y|x), 但数据换成指令对; 一般只训练 1-3 个 epoch、学习率 1e-5 量级(远低于预训练), 数据按全局 batch 拼接。核心经验是'数据质量 > 数量': Alpaca 仅用 52K 条 GPT 生成指令数据即复现 ChatGPT 级指令遵循。 使用场景: 让通用模型具备对话/指令能力、领域化(医疗/法律/金融)微调、作为 RLHF 的初始策略。 解决的问题: 预训练模型只会续写、不遵循指令。SFT 用几千到几万条高质量数据完成行为对齐, 效果远好于盲目堆量——epoch 超过 3 个会过拟合指令数据、损害通用能力(灾难性遗忘);相比预训练 1.4T tokens, SFT 数据量低约 7 个数量级(52K vs 1.4T), 训练成本骤降, 同时为 RLHF 提供良好初始策略。

核心要点

  • SFT 与预训练的区别(数据、目标、epoch)?
  • 为什么 SFT 数据质量 > 数量?
  • SFT 会过拟合吗? epoch 与学习率怎么选?
  • SFT 与 RLHF/DPO 的关系?
  • 指令数据如何构造与过滤(人工/LLM 生成)?