AdaSwitch: Adaptive Switching Generation for Knowledge Distillation

Jingyu Peng, Maolin Wang, Hengyi Cai, Yuchen Li, Kai Zhang, Shuaiqiang Wang, Dawei Yin, Xiangyu Zhao · OpenReview

Abstract

Small language models (SLMs) are crucial for applications with strict latency and computational constraints, yet achieving high performance remains challenging. Knowledge distillation (KD) can transfer capabilities from large teacher models, but existing methods involve trade-offs: off-policy distillation provides high-quality supervision but introduces a training-inference mismatch, while on-policy approaches maintain consistency but rely on low-quality student outputs. To address these issues, we propose AdaSwitch, a novel approach that dynamically combines on-policy and off-policy generation at the token level. AdaSwitch allows the student to first explore its own predictions and then selectively integrate teacher guidance based on real-time quality assessment. This approach simultaneously preserves consistency and maintains supervision quality. Experiments on three datasets with two teacher-student LLM pairs demonstrate that AdaSwitch consistently improves accuracy, offering a practical and effective method for distilling SLMs with acceptable additional overhead.

Introduction

Training Small Language Models (SLMs) effectively often relies on Knowledge Distillation (KD), where a larger "teacher" model supervises a smaller "student" model. Historically, researchers have faced a binary choice between two flawed strategies:

  1. Off-policy Distillation: The student learns from sequences generated entirely by the teacher. While the supervision signal is high-quality, it creates a "training-inference mismatch." The student never learns to recover from its own errors because it only sees perfect teacher-generated paths during training.
  2. On-policy Distillation: The student learns from its own generated sequences. This ensures consistency between training and inference distributions. However, if the student is weak—particularly in early training stages—it generates low-quality "garbage" sequences, providing poor learning signals.

Existing hybrid methods attempt to bridge this gap but often do so at a coarse sequence level or by toggling between models at every token (e.g., Speculative Knowledge Distillation or SKD). The latter can result in "twisted" sequences that lack natural linguistic coherence, leading to overfitting on fragmented data.

Methodology: The AdaSwitch Framework

AdaSwitch introduces a two-stage sequence generation framework designed to balance exploration and guidance dynamically.

The Exploration Stage

The process begins with the student model generating a sequence autonomously. At each token generation step, the system monitors the divergence between the student's predicted distribution and the teacher's distribution using Kullback–Leibler (KL) divergence.

Adaptive Thresholding

A key innovation in AdaSwitch is the use of an adaptive threshold rather than a fixed one. The system maintains a sliding window of recent KL divergence values. A switch from student to teacher is triggered only when the current divergence significantly exceeds the moving average within this window (scaled by a multiplier $\tau$). This allows the model to adapt to the varying difficulty of different parts of a sequence; higher divergence is tolerated in inherently "harder" sections as long as it remains within a relative norm.

The AdaSwitch mechanism showing the transition from student exploration to teacher guidance using an adaptive KL divergence threshold.

The Guidance Stage

Once the student's output "strays" too far from the teacher's knowledge (divergence $> \text{threshold}$), the teacher model takes over to complete the remainder of the sequence. Crucially, this is a one-time switch. Once the teacher intervenes, it provides high-quality guidance until the end of the sequence. This "one-way" approach prevents the "twisted text" issue found in methods like SKD, ensuring the final part of the sequence is coherent and follows a natural distribution.

Experimental Setup

The researchers evaluated AdaSwitch using two state-of-the-art model families, Qwen 2.5 and Llama 3.1, across three diverse benchmarks:

  • DialogSum: Focused on dialogue summarization, evaluated via Rouge-L.
  • GSM8K: A standard benchmark for grade-school math word problems, evaluated via accuracy.
  • GSM-Plus: An adversarial version of GSM8K designed to test robustness against numerical or textual perturbations.

Key Results and Discussion

AdaSwitch consistently outperformed both pure on-policy/off-policy methods and existing hybrid baselines across all tested scenarios.

Performance comparison of AdaSwitch against various distillation methods across three datasets (Summ, GSM, GSM-Plus) using Llama and Qwen models.

Performance Gains

On the GSM8K benchmark, AdaSwitch showed remarkable improvements, increasing accuracy by 7.2% for Llama models and 11.8% for Qwen models compared to the next-best method. Its superior performance on the adversarial GSM-Plus dataset suggests that the student is learning robust reasoning patterns rather than simply memorizing teacher outputs.

Task-Dependent Adaptivity

The framework naturally adjusts to task difficulty. In complex mathematical reasoning (GSM), the switch rate remains high (often above 95%), indicating frequent teacher intervention. In contrast, for easier tasks like summarization, the student is allowed more autonomy. Furthermore, as training progresses, the switching point typically moves later in the sequence, demonstrating that the student is successfully learning to mimic the teacher for longer durations.

Efficiency and Overhead

While more computationally intensive than simple off-policy distillation, AdaSwitch is more efficient than previous token-level hybrids. It adds approximately 1.3x to 1.4x computational overhead during training compared to pure on-policy methods—notably faster than the 1.6x overhead of SKD. Importantly, this overhead is confined to the training phase; the resulting student model maintains standard inference speeds.

Conclusion and Future Work

AdaSwitch effectively resolves the tension between supervision quality and distributional consistency in knowledge distillation. By allowing for student exploration followed by a definitive switch to teacher guidance, it produces high-quality, coherent training data that significantly boosts SLM performance.

Future research directions include testing the framework on a broader array of tasks, such as code generation and creative writing, and further optimizing the training overhead to reduce the computational burden for resource-constrained environments.

Summary updated

BibTeX
@misc{peng2025adaswitch,
  author = {Jingyu Peng and Maolin Wang and Hengyi Cai and Yuchen Li and Kai Zhang and Shuaiqiang Wang and Dawei Yin and Xiangyu Zhao},
  title = {{AdaSwitch: Adaptive Switching Generation for Knowledge Distillation}},
  year = {2025},
  eprint = {2510.07842},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.07842},
}
Figure