Back to LLMs Mind Map
中文·English
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=logP(yx)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.
🎯5 High-Frequency Exam Points
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
🎯
Test Your Knowledge: Practice Questions for "Supervised Fine-Tuning (SFT)"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardFlashAttentionNext CardLoRA / QLoRA Low-Rank Adaptation

🔗 More LLMs Knowledge Cards

Agent & Tool CallingAlignment Tax & Preference DataScaled Dot-Product AttentionAttention Variants MHA/MQA/GQA