DistiLLM-2: A Contrastive Approach Boosts the Distillation of LLMs

Jongwoo Ko, Tianyi Chen, Sungnyun Kim, Tianyu Ding, Luming Liang, Ilya Zharkov, Se-Young Yun · DOI

Introduction

Knowledge Distillation (KD) is a critical technique for compressing Large Language Models (LLMs) into efficient "student" models. While traditional KD focuses on loss function design (e.g., KL divergence) or data curation, it often overlooks the synergy between the data source—teacher-generated (TGO) vs. student-generated (SGO)—and the specific loss dynamics. Furthermore, applying preference-based methods like Direct Preference Optimization (DPO) to distillation frequently results in "reward hacking," where the student loses pre-trained knowledge while trying to suppress errors.

The CALD Framework

DistiLLM-2 introduces the Contrastive Approach for LLM Distillation (CALD). This framework treats teacher and student outputs as a contrastive pair, employing asymmetric loss dynamics to optimize performance.

Asymmetric Loss Dynamics

The core innovation lies in the "pull-up" and "push-down" effects:

  1. Skew KL (SKL): Applied to teacher responses to "pull up" the student's probability in regions where the teacher is confident.
  2. Skew Reverse KL (SRKL): Applied to student responses to "push down" the likelihood of the student's own errors.
Figure 2: Comparison of distillation objectives on toy and LLM datasets, showing theoretical motivation (a), NLL results (b), and ROUGE-L progression (c).

Adaptive Optimization

To handle varying sample difficulty, DistiLLM-2 utilizes a curriculum-based adaptive skew coefficient ($\alpha$) and a gradual $\beta$ scheduling. This ensures the model initially focuses on imitating the teacher before transitioning to correcting its own mistakes. To maintain efficiency, the framework uses a "batched" SGO approach, refreshing the student-generated data at the start of each epoch rather than at every step.

Experimental Results

DistiLLM-2 was evaluated across general instruction, math, code, and vision-language benchmarks.

Performance Gains

The framework consistently outperformed baselines like GKD and the original DistiLLM, showing improvements of +2.34% to +4.53% across model families including Qwen2, Mistral, and Gemma-2. Notably, a Qwen2.5-1.5B student distilled via DistiLLM-2 surpassed its 7B teacher on the MATH benchmark (44.82% vs. 42.94%).

Versatility and Speculative Decoding

Beyond standard benchmarks, DistiLLM-2 proved effective in recovering performance for 4-bit quantized models. It also significantly improved draft models for speculative decoding, achieving up to a 1.97x speedup.

Figure 5: Impact of the skew parameter on speculative decoding performance, illustrating the trade-off between NLL and winning rate.

Key Insights

  • Teacher Alignment > Data Quality: Surprisingly, aligning with the specific log-probability distribution of a direct teacher is more beneficial than seeing "perfect" data from a more powerful model like GPT-4.
  • Solving Reward Hacking: By using a linear formulation for their contrastive loss rather than the log-sigmoid used in DPO, DistiLLM-2 provides a natural regularization that prevents the model from "forgetting" its pre-training while trying to suppress errors.

Conclusion

DistiLLM-2 demonstrates that balancing imitation and contrastive error correction provides a robust path for creating high-performance small language models. Future work may involve integrating advanced reasoning capabilities from models like DeepSeek-R1 into this framework.

Summary updated

BibTeX
@inproceedings{ko2025distillm,
  author = {Jongwoo Ko and Tianyi Chen and Sungnyun Kim and Tianyu Ding and Luming Liang and Ilya Zharkov and Se-Young Yun},
  title = {{DistiLLM-2: A Contrastive Approach Boosts the Distillation of LLMs}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=rc65N9xIrY},
}
Figure