EasyDistill: A Comprehensive Toolkit for Effective Knowledge Distillation of Large Language Models

Chengyu Wang, Junbing Yan, Wenrui Cai, Yuanhao Yue, Jun Huang · DOI

Introduction

While Large Language Models (LLMs) like GPT-4 and Qwen-72B have set new benchmarks for artificial intelligence, their massive scale presents significant barriers to real-world deployment. High computational costs and latency make them impractical for many real-time applications. Knowledge Distillation (KD)—the process of training a smaller "student" model to mimic a larger "teacher"—has emerged as the primary solution for model compression.

However, effective KD is a complex engineering challenge. It requires sophisticated data pipelines, specialized loss functions (such as matching probability distributions or logits), and advanced training stages like Reinforcement Learning from Human Feedback (RLHF). EasyDistill, an open-source toolkit from Alibaba, addresses these challenges by providing a unified, end-to-end pipeline for both "black-box" and "white-box" distillation.

The EasyDistill Framework

EasyDistill organizes the KD process into three modular pillars designed to simplify the transition from massive teachers to efficient students.

The EasyDistill architecture overview, showing the modular pillars of data synthesis, training algorithms, and model recipes.
  1. Data Synthesis & Augmentation: High-quality training data is the foundation of KD. The toolkit includes operators to expand seed instructions, refine responses, and generate Chain-of-Thought (CoT) data. This is particularly vital for "System 2" models designed for analytical reasoning.
  2. Diverse Training Algorithms:
    • Black-Box/White-Box Training: Supports standard Supervised Fine-Tuning (SFT) and logit-based distillation (KLD). To optimize memory, the system implements a "top-$k$ logit" approach, matching only the most likely tokens rather than the entire vocabulary distribution.
  3. Reinforcement Learning (RL): Includes PPO and GRPO (Group Relative Policy Optimization), which is highly effective for reasoning-heavy models.
  4. Preference Optimization: Features DPO and the novel CogPO (Cognitive Preference Optimization), which aligns a student’s reasoning trajectory with its own capacity rather than forcing it to perfectly mimic a much larger teacher.
  5. Multi-modal Support: The framework extends beyond text to support the distillation of vision-language models.

Specialized Datasets and Recipes

To facilitate community research, the authors released several high-value datasets, including DistilQwen_1M for general instruction following and OmniThought, a collection of 2 million CoT reasoning processes. These datasets include unique metadata like "Reasoning Verbosity" and "Cognitive Difficulty" scores to help models learn the process of thinking.

Beyond the toolkit itself, EasyDistill provides "Industrial Recipes"—pre-validated configurations for creating state-of-the-art small models across different generations and reasoning types.

A summary of the DistilQwen model series recipes, highlighting the teacher-student relationships and model types (System 1 vs. System 2).

Key Insights and Results

  • System 1 vs. System 2 Distillation: The toolkit distinguishes between "fast" intuitive models and "slow" reasoning models. Reasoning distillation requires capturing the CoT process, not just the final answer.
  • Efficiency via Top-k Logits: By distilling only the top 10 logits (which typically account for nearly all probability mass), the toolkit drastically reduces storage and computational overhead without sacrificing accuracy.
  • The Capacity Gap: The introduction of CogPO addresses the "capacity gap," where small models fail when trying to mimic the exact cognitive complexity of a giant model. CogPO allows the student to find a reasoning path suited to its own size.

The effectiveness of these methods is demonstrated by the DistilQwen2.5-3B-Code model, which achieved a score of 16.62 on LiveCodeBench V2, significantly outperforming the base 3B model. Furthermore, distilled 3B-parameter models achieved a 2.3x speedup in inference compared to larger counterparts while maintaining competitive performance.

Conclusion

EasyDistill democratizes LLM compression by abstracting the complexities of distributed training and advanced KD algorithms into a user-friendly CLI. By providing both the tools and the "recipes" for success, it enables researchers and developers to deploy high-performance, efficient models in diverse industrial environments. Future work will focus on expanding support for domain-specific recipes in fields like finance and healthcare.

Summary updated

BibTeX
@misc{wang2025easydistill,
  author = {Chengyu Wang and Junbing Yan and Wenrui Cai and Yuanhao Yue and Jun Huang},
  title = {{EasyDistill: A Comprehensive Toolkit for Effective Knowledge Distillation of Large Language Models}},
  year = {2025},
  eprint = {2505.20888},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.20888},
}
Figure