Abstract
Despite the success of Large Language Models (LLMs), they still face challenges related to high inference costs and memory requirements. To address these issues, Knowledge Distillation (KD) has emerged as a popular method for model compression, with student-generated outputs (SGOs) being particularly notable for reducing the mismatch between training and inference. However, SGOs often produce noisy and biased sequences, which can lead to misguidance from the teacher model, especially in long sequences. To mitigate these challenges, we propose SWITCH (Studying WIth TeaCHer for Knowledge Distillation), a novel approach that strategically incorporates the teacher model during the student's sequence generation. SWITCH identifies discrepancies between the token probabilities of the teacher and student models, allowing the teacher to intervene selectively, particularly in long sequences that are more prone to teacher misguidance. Extensive experimental results across three model families and five instruction-following datasets show that SWITCH surpasses traditional KD methods, particularly excelling in the generation of long sequential data.
Introduction
To make Large Language Models (LLMs) more efficient for real-world deployment, researchers frequently employ Knowledge Distillation (KD). In this paradigm, a large "teacher" model trains a smaller "student" model to replicate its behavior. Modern KD techniques often utilize Student-Generated Outputs (SGOs), where the student generates its own text during training, and the teacher provides feedback on these specific sequences. This approach helps the student learn to handle its own errors, a process known as reducing "exposure bias."
However, a significant bottleneck exists: if the student model is substantially smaller than the teacher, it often produces noisy, biased, or nonsensical sequences. When the teacher attempts to provide feedback on these low-quality sequences, the resulting training signal becomes confusing or inaccurate—a phenomenon termed teacher misguidance. This problem is particularly acute in long sequences, where early minor errors accumulate into total incoherence, rendering the teacher's feedback useless for the student's learning.
Methodology: The SWITCH Framework
To address teacher misguidance, we propose SWITCH (Studying WIth TeaCHer), a framework that strategically incorporates the teacher model into the student’s generation phase through selective intervention.
Selective Intervention and Discrepancy
Instead of allowing the student to generate an entire sequence in isolation, SWITCH monitors the "disagreement" between the teacher and student at every token. The framework uses Jensen-Shannon Divergence (JSD) to measure the difference between the probability distributions of the teacher and student. JSD is chosen for its symmetric and bounded nature (between 0 and 1), providing a stable metric for discrepancy.
The "Switch" Mechanism
At each time step $t$, the system evaluates the JSD against a threshold $\tau_t$:
- Student Generation: If the JSD is low, the student is deemed confident and aligned with the teacher; the student generates the token.
- Teacher Intervention: If the JSD exceeds the threshold, the teacher model intervenes to generate the next token, steering the sequence back toward a "sane" path.
Exponentially Decaying Threshold
The core innovation of SWITCH is the exponentially decaying threshold, defined as $\tau_t = \tau_0 \cdot e^{-\lambda t}$. At the beginning of a sequence, the threshold is high, allowing the student to explore and learn from its own outputs. As the sequence length increases, the threshold drops, making teacher intervention more likely. This prevents the "hallucination spirals" that typically ruin long-form student generations, ensuring the teacher always provides feedback on sequences that remain within a reasonable distribution.
Experimental Setup
We evaluated SWITCH across three model families (GPT-2, OPT, and OpenLLaMA-2) and five diverse instruction-following benchmarks:
- Dolly & SelfInst: General instruction following.
- VicunaEval: Complex tasks including math and coding.
- S-NI (Super-Natural Instructions): A massive collection of NLP tasks.
- Unnatural Instructions: Synthesized instruction sets.
Key Results
SWITCH consistently outperformed state-of-the-art KD baselines, including GKD, MiniLLM, and DistiLLM.
Long Sequence Mastery
Analysis based on ground truth length confirms that SWITCH excels at long-form generation. On the Dolly dataset, for sequences longer than 11 tokens, SWITCH maintained high ROUGE-L scores while other SGO methods experienced significant performance degradation. For a GPT-2 120M student, SWITCH achieved a 26.2 ROUGE-L score on Dolly, compared to 23.8 for MiniLLM and 23.2 for standard KD.
Mitigating Misguidance
Quantitative analysis using Spearman’s correlation showed that sequences generated via SWITCH resulted in training losses that more accurately reflected the student's actual understanding. By keeping the generation "on track," SWITCH ensures the teacher's feedback remains relevant and high-quality throughout the sequence.
Discussion and Limitations
While SWITCH provides significant performance gains, it introduces some computational overhead. Because the teacher model must be active during the training-generation phase to calculate JSD, training takes approximately 1.8x longer than simpler methods like GKD. However, it is important to note that this overhead is confined to the training phase; the final student model's inference speed remains unaffected. Future work will explore applying selective teacher intervention to Reinforcement Learning from Human Feedback (RLHF) and other iterative alignment strategies.
Summary updated