Abstract
Knowledge distillation (KD) is a key technique for compressing large-scale language models (LLMs), yet prevailing logit-based methods typically employ static strategies that are misaligned with the dynamic learning process of student models. These methods typically treat all tokens indiscriminately and apply a single, fixed temperature, resulting in suboptimal knowledge transfer. To address these limitations, we propose LLM-Oriented Token-Adaptive Knowledge Distillation (AdaKD), a novel framework that adapts the distillation process to the real-time learning state of each token. AdaKD consists of two synergistic modules driven by a unified token difficulty metric. First, our Loss-Driven Adaptive Token Focusing (LATF) module dynamically adjusts the distillation focus by monitoring the student's learning stability, concentrating computational resources on the most valuable tokens at each training phase. Second, we introduce Inverse Difficulty Temperature Scaling (IDTS), a counterintuitive yet effective token-level temperature strategy. It employs low temperatures for difficult tokens for targeted error correction, and high temperatures for easy tokens to encourage students to learn from the teacher's complete and smooth output distribution, thereby enhancing generalization. As a plug-and-play framework, AdaKD can consistently improve the performance of various distillation methods on multiple model architectures and benchmarks.
Introduction
Knowledge Distillation (KD) is essential for deploying large language models (LLMs) on resource-constrained devices by teaching a smaller "student" model to mimic a larger "teacher" model. However, standard KD approaches often suffer from a "one-size-fits-all" inefficiency. They treat every token in a sequence with equal importance throughout the entire training process, wasting computational power on tokens the student has already mastered while failing to provide sufficient corrective signals for persistently difficult ones.
AdaKD (LLM-Oriented Token-Adaptive Knowledge Distillation) addresses these flaws by introducing a dynamic, token-level adaptive framework. By identifying which tokens a student struggles with in real-time, AdaKD focuses training resources where they are most needed and applies a novel temperature scaling strategy to maximize learning efficiency.
The AdaKD Framework
AdaKD is a plug-and-play framework driven by a unified Token Difficulty Metric based on the Hellinger distance between the teacher’s and student’s output distributions. Unlike common metrics like KL-Divergence, Hellinger distance is symmetric and sensitive to disagreements in low-probability candidates, making it a robust sensor for the student's learning state.
Loss-driven Adaptive Token Focusing (LATF)
Instead of training on all tokens, LATF dynamically selects the top-$r\%$ most difficult tokens. The ratio $r$ is not static; it utilizes a feedback loop based on the moving average of the training loss. If the student's learning is stable, the module narrows its focus to the hardest tokens. If the student struggles (indicated by loss spikes), it widens the focus to include easier tokens to maintain training stability.
Inverse Difficulty Temperature Scaling (IDTS)
IDTS introduces a counterintuitive temperature strategy. Traditional KD often uses a fixed temperature to smooth distributions. IDTS, however, applies low temperatures to hard tokens to provide a sharp, high-contrast signal for error correction. Conversely, it applies high temperatures to easy tokens, encouraging the student to learn the broader "dark knowledge" in the teacher's full distribution, which aids generalization.
Rationale: Understanding Token Dynamics
The motivation for AdaKD stems from the observation that token difficulty is highly dynamic and that gradients from "easy" tokens can be counterproductive.
As shown in the analysis above, tokens like "2007" remain difficult throughout training, while common words like "in" or "the" are mastered almost immediately. Crucially, gradients from "easy" tokens are often unstable and poorly aligned with the overall training direction. By filtering out these mastered tokens, LATF allows the model to focus on high-value information, while IDTS optimizes the information entropy for the remaining tokens.
Experimental Results
The authors validated AdaKD using the databricks-dolly-15k dataset for instruction-tuning across various model families, including Qwen2, OpenLLaMA2, and GPT-2. Evaluation across five major benchmarks (Dolly-eval, Self-Instruct, Vicuna-eval, S-NI, and UnNI) revealed consistent improvements:
- Performance Gains: On Qwen2-1.5B, AdaKD provided an average boost of +1.27 to +1.60 ROUGE-L points over standard distillation baselines.
- LLM-as-a-Judge: In pairwise comparisons judged by Qwen3-32B, AdaKD-trained models significantly outperformed baseline counterparts, particularly on complex instruction-following tasks.
- Efficiency: Despite its dynamic nature, AdaKD adds negligible overhead, with less than a 3.3% slowdown in training throughput because difficulty calculations are detached from the main backpropagation graph.
Conclusion
AdaKD represents a shift toward more intelligent, student-centric distillation. By acknowledging that not all tokens are created equal, the framework provides a more efficient and effective path for compressing LLMs without sacrificing performance. While currently focused on instruction-following, future work aims to extend this adaptive approach to reasoning and code generation tasks.
Summary updated