SFT vs. Knowledge Distillation: Which Generalizes Better in Small LLMs?
From the publisher’s feed, collected in the ZeroLabs newsroom.
A 50,000-Sample Experiment: Distillation vs Fine-TuningOne question that keeps coming up whenever a team wants to ship a smaller language model to production for low latency and cost reduction is: “Should we distill knowledge from a larger teacher model, which is better at the particular task, or just fine-tune directly on my labeled data?”The answer to the question is interesting, as both approaches actually work well. By using LoRA, both methods could be cost-effective, fast to train, and capable of producing better results on the downstream task. So it seems the difference isn’t huge at first glance.Most of the comparisons between the knowledge distillation(KD) and supervised fine-tuning(SFT) are benchmark-focused, and my interest in this experiment is to know which technique generalizes better for the specific task and performs well on real-world distribution shifts and also with changing input styles.I haven’t gone deep into a large volume of research papers on this yet, but this is exactly the direction I want to explore. Most comparisons between knowledge distillation (KD) and supervised fine-tuning (SFT) seem heavily benchmark-focused, while I’m more interested in how these approaches behave under real-world distribution shifts and changing input styles.What really interests me is the generalization aspect not just whether a model performs well on a held-out test set, but whether it still produces semantically reliable outputs when the input drifts away from the training distribution. That’s the core motivation behind this research direction for me.To find a definitive answer, I ran the experiment. I took a 7B teacher and a 0.5B student, and trained the student two ways on the exact same data: once via KD, and once via SFT. Then, I evaluated them across four summarization benchmarks (one in-domain, three out-of-domain) using both ROUGE and BERTScore.The results were entirely unexpected. Along the way, I also stumbled into a subtle evaluation pitfall that is likely skewing half of the small-model papers currently being published.Here is the full breakdown of the setup, the dead ends, the actual results, and what they mean if you’re trying to deploy a small model that needs to survive in the real world.Source: Generated using Gemini AIPart 1: Why This Question MattersBefore diving into the experiment, let’s define our terms.Supervised Fine-Tuning (SFT): This is the standard recipe. You have a small model and a dataset of articles paired with human-written summaries. You train the model to produce those exact summaries.Knowledge Distillation (KD): In its modern LLM context, the recipe is almost identical. You use the same small model and the same articles. However, instead of training on human-written summaries, you ask a massive, highly capable model to summarize the articles, and train your small model to mimic those outputs.The intuition behind KD is that a teacher’s outputs carry richer information than static gold labels. When a 7B model writes, “The CEO stepped down amid mounting pressure,” it has selected those words from a vast distribution of valid, paraphrased options. We want the student to inherit that flexibility. Gold labels, conversely, simply dictate, “this exact sentence is correct,” hiding the broader space of acceptable alternatives.Both methods rely on supervised next-token prediction. The only difference is the author of the targets: a human or an AI.The core question is: Which target source produces a better student? And more importantly, better at what? Memorizing the exact label format, or producing high-quality summaries when the input distribution inevitably shifts?Part 2: The SetupThe temptation in this kind of benchmarking is to throw the kitchen sink at it — multiple model families, varied training scales, and endless decoding strategies. Resist that. The best insights come from a clean experiment that isolates a single variable.Here is the locked-down configuration:Models:Teacher: Qwen/Qwen2.5-7B-InstructStudent: Qwen/Qwen2.5-0.5B (Note: This is the base model, not the Instruct version. I will explain why below).Training Data: CNN/DailyMail. I sampled 10k and 50k subsets to test how scale impacts the results.Training Method: LoRA applied to both methods. Identical rank (r=32), alpha (α=64), dropout (0.1), and target modules (all attention + MLP projections). Identical effective batch size, learning rate, scheduler, epoch count, and seed. The only difference was the target text. SFT targeted human-written highlights; KD targeted the 7B teacher’s summaries.Evaluation Datasets:CNN/DailyMail (In-domain): The easy mode.XSum (Cross-domain): News, but restricted to single-sentence extreme summaries. Tests format shifting.SAMSum (Cross-domain): Messenger-style conversations. Tests domain transfer.DialogSum (Cross-domain): Longer, more formal conversations. Tests dialogue pattern robustness.The cross-domain datasets are the true acid test. While CNN/DM reveals which method best memorizes the training distribution, the other three reveal which method actually learned how to summarize.Metrics: ROUGE-1/2/L (lexical overlap) and BERTScore-F1 (semantic similarity).Part 3: The “Headroom” Problem (A Crucial Detour)My initial instinct was to use the instruction-tuned variant (Qwen2.5-0.5B-Instruct) as the student to create a more deployment-realistic baseline.I ran the zero-shot baseline:Teacher ROUGE-1: 36.4Student ROUGE-1: 32.7Gap: 3.7 pointsThis gap is too small. If the teacher only outperforms the untrained student by 3.7 points, even a flawless distillation process can only improve the student by that margin. Realistic improvements usually capture 30–60% of available headroom. In this scenario, the “winner” would be entirely lost in statistical noise.Alibaba aggressively instruction-tuned the 0.5B Qwen model, making it shockingly competent out of the box. That is fantastic for end-users, but disastrous for an experiment designed to measure the efficacy of a training method.The fix was switching to the base variant (Qwen2.5-0.5B). It hasn't been taught to follow chat prompts. Ask it to summarize, and it rambles, continues the article, and spits out 125 words of noise.Base Student Zero-Shot ROUGE-1: 8.6Now, we have a 25-point gap. This is a methodologically honest setup: start with a model that genuinely doesn’t know the task, and see what methodology teaches it best.The Lesson: The choice of baseline matters as much as the method you’re testing. A baseline that is too strong washes out your effect size.Part 4: The Naive Evaluation (And Why I Didn’t Believe It)Here are the initial results across the cross-domain datasets:Source: Author’s experiments. Figure created with Google Gemini.At first glance, this tells a nuanced story: KD wins on format shifts, SFT wins on dialogue, and they tie in-domain. I was ready to write this up.Then, as a sanity check, I added BERTScore a metric that measures semantic similarity rather than simple word overlap.Source: Author’s experiments. Figure created with Google Gemini.These are the exact same models evaluated on the exact same predictions. ROUGE claimed KD lost on SAMSum and tied on DialogSum. BERTScore claimed KD was catastrophically worse than SFT on three out of four datasets including a massive 34-point deficit on CNN/DM.When two metrics disagree this violently, someone is lying. I opened the prediction files to read the actual outputs.Part 5: The Degeneration ProblemHere is what the KD model actually outputted on a CNN/DM article (formatted for readability):“This story explores the growing medical marijuana revolution, highlighting how it has sparked a debate over the future of pharmaceuticals. The author discusses the challenges and potential benefits… [Valid Summary] …as well as the potential impact on the pharmaceutical industry.”””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””” 游戏副本 norge LOCK: (INVOKE”The first three sentences were perfect. Then, the model got stuck on " for a hundred tokens before emitting Korean, Chinese, and garbage XML tags until it hit its token limit.The SFT model had a different failure mode entirely:“Cook, 24, was overlooked for the Great Britain taekwondo squad. Cook has been awarded citizenship by Moldova in time to compete at London 2012. Cook has been awarded citizenship by Moldova in time to compete at London 2012. Cook has been awarded citizenship by Moldova in time to compete at London 2012…”Why did the metrics disagree? ROUGE counts unigram and bigram overlap. Neither the KD’s garbage XML nor the SFT’s endless repetitions matched the reference n-grams. Therefore, ROUGE only scored the “good” early sentences, declaring the models roughly tied.BERTScore, however, averages cosine similarity across every token. SFT’s repetitive English still contained semantic relevance to the article (Cook and taekwondo). KD’s noise tokens had zero semantic similarity. BERTScore violently penalized KD because its garbage was “worse” garbage, completely blinding the metric to the quality of the actual summary at the beginning.I wasn’t measuring summarization quality at all. I was measuring: “How well does your degeneration align with your reference vocabulary?”Part 6: Fixing the Evaluation (The Actual Contribution)Decoding degeneration in small LoRA-tuned models is a known problem. I applied standard inference-time controls:Repetition Penalty (1.15): Fixes the SFT repetition loop.Frequency Penalty (0.3): Fixes the KD punctuation spam.Stop Sequences: Hard-cuts generation upon detecting markers like """, non-English character runs, or restart attempts like \n\nArticle:.I also added a post-processing step to strip trailing non-ASCII runs and deduplicate rapidly repeating sentences.I re-ran the entire evaluation. Mean output lengths plummeted from 125+ words to a highly relevant 40–70 words. ROUGE shifted slightly. BERTScore shifted dramatically and finally agreed with ROUGE.The Lesson: Small, fine-tuned language models often degenerate during inference. A paper comparing two training approaches on a single metric without verifying generation quality is likely measuring degeneration modes rather than underlying model capability.Part 7: The Real ResultWith clean generations, the true capabilities of the models were revealed:In-Domain (CNN/DM)ROUGE-1: SFT wins by 4.47BERTScore: SFT wins by 4.25Cross-Domain, Format Shift (XSum)ROUGE-1: KD wins by 1.44BERTScore: KD wins by 11.87 (Massive margin)Cross-Domain, Dialogue (SAMSum)ROUGE-1: KD wins by 1.82BERTScore: KD wins by 10.77 (Massive margin)Cross-Domain, Dialogue (DialogSum)ROUGE-1: KD wins by 1.74BERTScore: KD wins by 9.87 (Massive margin)This gives us three highly defensible claims:SFT dominates in-domain. If your test distribution perfectly matches your training distribution, train on those exact labels.KD dominates out-of-domain. Whether facing different summary styles or entirely different data domains, distillation consistently wins.The KD advantage is 5–6× larger under BERTScore than ROUGE. Averaged across the out-of-domain datasets, KD beats SFT by roughly +1.7 ROUGE-1, but by a staggering +10.8 BERTScore. The teacher taught the student to paraphrase, which BERTScore captures and ROUGE artificially penalizes.Part 8: Why Does This Happen?Here is my working hypothesis:When summarizing a CNN/DM article, the 7B teacher produces an abstractive, paraphrased output, selecting words from a wide vocabulary. The human-written SFT labels, however, are highly structured bullet points that frequently copy-paste verbatim spans from the source text.When the SFT student trains on gold labels, it internalizes a rigid rule: “Summaries are bullet points that copy exact phrases.” This works perfectly on CNN/DM, but fails catastrophically when applied to messenger conversations.When the KD student trains, it learns a general principle: “Extract the main points and paraphrase them.” It remains flexible. When the test shifts to dialogue, the KD student successfully maps its paraphrasing skills, while the SFT student attempts to apply news-bullet formatting to a text message.ROUGE under-reports this advantage because cross-domain summaries use different vocabularies, penalizing both models. BERTScore utilizes contextual embeddings, proving that KD’s outputs are semantically vastly superior, even if the specific words differ.Part 9: Does Scale Change Anything?I ran the identical experiment at 10k and 50k training examples.Source: Author’s experiments. Figure created with Google Gemini.Scale does not fundamentally alter the outcome. SFT’s in-domain advantage widens slightly with more data, but the core narrative remains identical. Robustness across data scales is a strong indicator that this is a foundational dynamic, not a statistical artifact.Part 10: Lessons for Shipping Small ModelsIf you’re deciding between KD and SFT for your production stack, here is the playbook:Prioritize KD for out-of-distribution robustness. This covers almost all real-world production scenarios. Users are unpredictable; KD handles that unpredictability better.Use SFT for locked pipelines. If you are guaranteeing that production inputs will perfectly match your training data format, SFT is optimal.Always pair ROUGE with a semantic metric. ROUGE alone will under-report distillation’s true value by a factor of 5–6× out-of-domain. BERTScore is fast, free, and captures nuance that ROUGE completely misses.Verify generation quality visually. Spot-read 10 outputs per model. If you see wild repetitions or hundred-word rants, your metrics are measuring degeneration. Implement inference penalties before recording benchmarks.Choose your baselines carefully. Do not benchmark training methods on a model that already knows how to do the task.(Limitations Note: This study scopes a single model family (Qwen2.5), a specific task structure (summarization), and sequence-level KD. Results may vary across logit-based KD or different foundational architecture).Closing ThoughtsSmall language models are increasingly becoming the foundation of real-world AI systems. While frontier models attract most of the attention, production deployments often rely on the smaller models that are faster, cheaper, and easier to scale. The challenge is ensuring that these models remain reliable when faced with inputs that differ from the data they were trained on.The results of this study suggest that the choice of training methodology has a meaningful impact on that robustness. While supervised fine-tuning (SFT) achieved stronger in-domain performance, knowledge distillation (KD) consistently demonstrated better generalization across unseen domains and input formats. Perhaps more importantly, the experiments revealed how evaluation methodology can influence conclusions. Without inspecting generated outputs and accounting for generation artifacts, benchmark metrics may end up measuring degeneration behavior rather than true model capability.For practitioners building production AI systems, the key takeaway is simple: evaluate beyond a single benchmark, use both lexical and semantic metrics, and always inspect model outputs before trusting the numbers. Robustness often reveals itself only when models are tested outside their training distribution.I hope these findings contribute to the broader discussion around efficient model adaptation, evaluation, and deployment. If you’ve observed similar behaviors in your own experiments or have ideas for extending this work to other model families and tasks, I’d love to hear your thoughts.References[1] Hinton, G., Vinyals, O., & Dean, J. (2015). Distilling the Knowledge in a Neural Network. arXiv preprint arXiv:1503.02531.[2] Hu, E. J., Shen, Y., Wallis, P., Allen-Zhu, Z., Li, Y., Wang, S., Wang, L., & Chen, W. (2021). LoRA: Low-Rank Adaptation of Large Language Models. arXiv preprint arXiv:2106.09685.[3] Zhang, T., Kishore, V., Wu, F., Weinberger, K. Q., & Artzi, Y. (2019). BERTScore: Evaluating Text Generation with BERT. arXiv preprint arXiv:1904.09675.[4] Lin, C.-Y. (2004). ROUGE: A Package for Automatic Evaluation of Summaries. Proceedings of the ACL Workshop: Text Summarization Branches Out.[5] Qwen Team. (2024). Qwen2.5 Technical Report. arXiv.[6] Hermann, K. M., Kociský, T., Grefenstette, E., Espeholt, L., Kay, W., Suleyman, M., & Blunsom, P. (2015). Teaching Machines to Read and Comprehend. Advances in Neural Information Processing Systems (NeurIPS).[7] Narayan, S., Cohen, S. B., & Lapata, M. (2018). Don’t Give Me the Details, Just the Summary! Topic-Aware Convolutional Neural Networks for Extreme Summarization. Proceedings of EMNLP.[8] Gliwa, B., Mochol, I., Biesek, M., & Wawer, A. (2019). SAMSum Corpus: A Human-Annotated Dialogue Dataset for Abstractive Summarization. Proceedings of EMNLP-IJCNLP.[9] Chen, Y., Wu, L., Zaki, M. J., et al. (2021). DialogSum: A Real-Life Scenario Dialogue Summarization Dataset. Findings of ACL.ModelsKnowledge Distillation (KD) Model:https://huggingface.co/Harsha901/qwen2.5-0.5b-kd-merged-cnndm-50kSupervised Fine-Tuning (SFT) Model:https://huggingface.co/Harsha901/qwen2.5-0.5b-sft-merged-cnndm-50kDisclosureFigures and visualizations were generated using Google Gemini based on the author’s experimental results. All experiments, model training, evaluation, analysis, and conclusions were performed by the author.SFT vs. Knowledge Distillation: Which Generalizes Better in Small LLMs? was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.