Enhancing Knowledge Distillation for LLMs with Response-Priming Prompting

Vijay Goyal, Mustafa Khan, Aprameya Tirupati, Harveer Saini, Michael Lam, Kevin ZhuarXiv 2024 · DOI

Abstract

Knowledge distillation (KD) is a critical technique for compressing large language models (LLMs) into efficient student models. However, standard KD often fails to bridge the "reasoning gap" in complex tasks like mathematics. This paper introduces "Response-Priming" prompts, which instruct teacher models to generate more learnable, step-by-step explanations. Using Llama 3.1 405B as a teacher and Llama 3.1 8B as a student, we demonstrate that specific priming strategies—particularly "Ground Truth" prompting—can yield a 55% performance boost on the GSM8K benchmark compared to standard distillation.

Introduction

Large Language Models (LLMs) like Llama 3.1 405B offer state-of-the-art performance but are computationally expensive to deploy. Knowledge Distillation (KD) aims to transfer this capability to smaller, more efficient "student" models. Traditional KD typically focuses on matching final outputs or raw logits. However, for complex multi-step reasoning tasks, such as those in the GSM8K (Grade School Math 8K) dataset, a simple answer like "42" provides insufficient signal for a student model to learn the underlying logic. This "reasoning gap" limits the effectiveness of small models (e.g., Llama 8B) in mathematical domains.

Methods: Response-Priming Pipeline

To address the reasoning gap, we propose a Response-Priming framework. Instead of standard unprompted queries, we use specific prompting strategies to "prime" the teacher’s output for optimal student learning. These strategies include Teacher Prompting (acting as a tutor), Ground Truth Prompting (explicitly informing the teacher it is training a smaller model), and Confidence Prompting (requiring the teacher to double-check its work).

Comparison of standard KD versus Response-Priming KD on a math reasoning task.

The technical setup utilizes Llama 3.1 405B (quantized to 6-bit) as the teacher and Llama 3.1 8B Instruct as the student. Training is performed using Low-Rank Adaptation (LoRA) with a loss function combining standard cross-entropy and Reverse KL Divergence. The latter is "mode-seeking," which encourages the student to be confident in the teacher's most likely correct predictions.

Key Results and Insights

The impact of response-priming was substantial. The "Ground Truth" strategy—where the teacher is told its role in training—emerged as the most effective, suggesting that frontier models can tailor explanations when their purpose is explicitly defined.

Performance of various KD strategies on the GSM8K benchmark.

As shown in the results, the Ground Truth KD strategy achieved a 48.14% accuracy on GSM8K, representing a 55% relative increase over standard, unprompted distillation (30.62%) and nearly a 400% increase over the base 8B model without distillation (12.20%).

Beyond accuracy, we analyzed the student's internal attention mechanisms. Successful distillation correlated with lower attention entropy in later layers, indicating more organized focus, and reduced self-attention focus, suggesting tokens integrated more contextual information from their neighbors.

Discussion and Limitations

While Response-Priming significantly enhances math reasoning, several questions remain for future work. The current study is limited to the GSM8K math benchmark; the generalizability to creative writing or coding is yet to be determined. Additionally, the dynamics of different teacher-student architecture pairs and the computational cost of hyperparameter tuning for the loss function present ongoing challenges. Finally, relying on teacher logits carries a risk of distilling hallucinations if the teacher generates incorrect reasoning steps.

Summary updated

BibTeX
@misc{goyal2024enhancing,
  author = {Vijay Goyal and Mustafa Khan and Aprameya Tirupati and Harveer Saini and Michael Lam and Kevin Zhu},
  title = {{Enhancing Knowledge Distillation for LLMs with Response-Priming Prompting}},
  year = {2024},
  eprint = {2412.17846},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.17846},
}
Figure