Abstract
Recent advancements in large language models (LLMs) have raised concerns about inference costs, increasing the need for research into model compression. While knowledge distillation (KD) is a prominent method for this, research on KD for generative language models like LLMs is relatively sparse, and the approach of distilling student-friendly knowledge, which has shown promising performance in KD for classification models, remains unexplored in generative language models. To explore this approach, we propose PromptKD, a simple yet effective method that utilizes prompt tuning—for the first time in KD—to enable generative language models to transfer student-friendly knowledge. Unlike previous works in classification that require fine-tuning the entire teacher model for extracting student-friendly knowledge, PromptKD achieves similar effects by adding a small number of prompt tokens and tuning only the prompt with student guidance. Extensive experiments on instruction-following datasets show that PromptKD achieves state-of-the-art performance while adding only 0.0007% of the teacher's parameters as prompts. Further analysis suggests that distilling student-friendly knowledge alleviates exposure bias effectively throughout the entire training process, leading to performance enhancements.
Introduction
As Large Language Models (LLMs) continue to scale, the computational resources required for inference have become a significant barrier to widespread deployment. Knowledge Distillation (KD), where a smaller "student" model is trained to mimic the behavior of a larger "teacher" model, offers a path toward efficient model compression. However, applying KD to generative models presents unique challenges that standard classification-based KD does not encounter.
Specifically, generative KD suffers from two primary issues: the Capacity Gap and Exposure Bias. The capacity gap occurs when a teacher model is so complex that the student lacks the parameters to effectively model the teacher's distribution—akin to a primary school student trying to learn from a doctoral thesis. Exposure bias refers to the discrepancy between training (where the model sees ground-truth text) and inference (where the model generates text based on its own previous, potentially erroneous, outputs).
The PromptKD Framework
To address these challenges, we introduce PromptKD, a novel framework that utilizes prompt tuning to extract "student-friendly" knowledge from a teacher model. Rather than forcing the student to match a teacher that is fundamentally out of its league, PromptKD adapts the teacher to the student's level.
Adaptive Teaching via Prompt Tuning
Unlike previous student-friendly KD methods that require fine-tuning the entire teacher model—a process that is computationally prohibitive for LLMs—PromptKD employs Soft Prompt Tuning. By adding a tiny set of trainable prompt tokens (approximately 0.0007% of the teacher’s total parameters) to the input layer, we can "nudge" the teacher's output distribution without altering its core weights. This allows the teacher to remain high-performing while becoming more "relatable" to the student.
The Three-Step Distillation Cycle
The PromptKD training process operates in three distinct phases:
- Pseudo-Target Generation: The student model generates a response to a given instruction. This response serves as a "pseudo-target," representing the student's current generative capability.
- Prompt Tuning for Adaptive Teaching: The teacher’s soft prompts are updated to minimize the divergence between the teacher’s output and the student’s generated pseudo-target. This step effectively "dumbs down" the teacher's knowledge to a level the student can grasp.
- Student-Friendly Distillation: The student is then trained to match this adapted teacher distribution. To ensure the teacher does not lose its fundamental reasoning capabilities, a regularization loss ($L_{reg}$) is applied to prevent the teacher's distribution from drifting too far from its original state.
Experimental Results
We evaluated PromptKD across five diverse instruction-following datasets: Dolly, SelfInst, Vicuna, Super-NaturalInstructions (S-NI), and Unnatural Instructions (UnNI). The experiments utilized model families including GPT-2, OPT, and Llama.
Performance and Efficiency
PromptKD consistently achieved state-of-the-art (SOTA) performance, outperforming standard Supervised Fine-Tuning (SFT) and existing KD methods like MiniLLM and GKD. Notably, these gains were achieved with minimal overhead; the method only requires tuning roughly 11,000 parameters for a 1.5B teacher model.
Mitigating Exposure Bias
A key finding of our research is that PromptKD effectively neutralizes exposure bias. By training on student-generated sequences (pseudo-targets), the student learns how to recover from its own mistakes. Our analysis showed that while other KD methods see "Excess Accumulated Error" skyrocket as generated sequences grow longer, PromptKD maintains an error rate near zero.
Qualitative Analysis
Qualitative comparisons reveal that the PromptKD-adapted teacher provides more concise and direct responses. For example, when asked to list specific authors, the original teacher might provide a verbose, flowery narrative that the student struggles to replicate. The adapted teacher provides a clear, structured list that the student can easily mimic, leading to higher accuracy in the student's final outputs.
Conclusion
PromptKD demonstrates that "student-friendly" distillation is not only possible for generative models but also highly efficient. By using prompt tuning to bridge the capacity gap and pseudo-targets to mitigate exposure bias, PromptKD provides a scalable solution for compressing LLMs without sacrificing performance. Future work will explore task-agnostic applications of this method to further generalize its benefits across broader pre-training phases.
Summary updated