Abstract
Enhancing computational efficiency and reducing deployment costs for large language models (LLMs) have become critical challenges in various resource-constrained scenarios. In this work, we present DistilQwen2.5, a family of distilled, lightweight LLMs derived from the public Qwen2.5 models. These distilled models exhibit enhanced instruction-following capabilities compared to the original models based on a series of distillation techniques that incorporate knowledge from much larger LLMs. In our industrial practice, we first leverage powerful proprietary LLMs with varying capacities as multi-agent teachers to select, rewrite, and refine instruction-response pairs that are more suitable for student LLMs to learn. After standard fine-tuning, we further leverage a computationally efficient model fusion approach that enables student models to progressively integrate fine-grained hidden knowledge from their teachers. Experimental evaluations demonstrate that the distilled models possess significantly stronger capabilities than their original checkpoints. Additionally, we present use cases to illustrate the applications of our framework in real-world scenarios. To facilitate practical use, we have released all the DistilQwen2.5 models to the open-source community.
Introduction
Large Language Models (LLMs) have revolutionized natural language processing, yet their deployment remains a challenge due to high computational costs and memory requirements, especially on edge devices. Knowledge Distillation (KD) offers a path toward smaller, more efficient models by transferring knowledge from a large "teacher" model to a smaller "student." However, industrial-scale KD faces two significant hurdles: the quality of instruction-tuning data and the immense memory overhead of "white-box" distillation.
DistilQwen2.5 addresses these challenges through a family of lightweight models (0.5B to 7B parameters) that significantly outperform their original Qwen2.5 counterparts. By employing a two-stage distillation process—combining multi-agent data refinement with an efficient top-K logit distillation—these models demonstrate that small-scale LLMs can achieve remarkable instruction-following and reasoning capabilities.
Methodology
The DistilQwen2.5 framework utilizes a hybrid distillation strategy designed for both data quality and computational efficiency.
Multi-Agent Black-Box KD
The first stage focuses on data refinement. Powerful proprietary models, such as GPT-4o and Qwen-max, act as a "council" of agents to curate training data. This pipeline includes:
- Expansion and Rewriting: Agents generate diverse instructions and convert responses into Chain-of-Thought (CoT) formats to enhance reasoning.
- Selection and Verification: Agents filter low-quality pairs and verify factual accuracy, ensuring the student model learns from a "gold" dataset.
Efficient White-Box KD (Model Fusion)
To capture the teacher's internal probability distributions without the typical memory overhead, several optimizations were introduced:
- Offline Logit Generation: Teacher logits are pre-computed to avoid running the teacher and student simultaneously.
- Top-K Sparsification: Instead of storing the full vocabulary distribution, only the top $K=10$ probabilities are saved. Research indicated that these top 10 tokens cover over 97% of the probability mass, leading to a 3x–5x speedup in generation and reduced storage needs.
- Token Alignment: A mapping layer handles discrepancies between teacher and student vocabularies.
Experimental Evaluation
The models were trained on a combination of public datasets (OpenHermes 2.5, Cleaned Alpaca, LCCD) and a newly released DistilQwen-100k dataset. Evaluation focused on instruction-following and multi-turn conversation benchmarks.
The results show substantial gains across all model sizes. On AlpacaEval 2.0, the DistilQwen2.5-1.5B model achieved a score of 13.69, nearly doubling the original model's performance and rivaling larger models like Llama-3-8B.
On the IFEval benchmark, the 7B distilled version reached a score of 83.48, outperforming the original 7B model and demonstrating superior instruction-following capabilities.
Key Insights
- Capacity Gap: Using a massive 72B teacher does not always benefit a tiny 0.5B student more than a 14B teacher would, suggesting a "capacity gap" where the teacher's complexity exceeds the student's learning capacity.
- Potential in Small Models: The performance jump was most pronounced in the 0.5B and 1.5B models, indicating that smaller models have significant untapped potential that standard training fails to reach.
- Efficiency of Top-K: Focusing on the top 10 tokens effectively removes noise and makes industrial-scale white-box distillation feasible on standard hardware.
Conclusion
DistilQwen2.5 demonstrates a robust methodology for creating high-performance lightweight LLMs. While these models may inherit biases from their proprietary teachers, they represent a significant step forward in making advanced AI accessible for resource-constrained environments. Future work will explore dynamic model fusion and specialized domain performance.
Summary updated