TL;DR
WASD (Wasserstein-based Knowledge Distillation) improves the efficiency of shrinking large language models by incorporating token-level semantic information into the training process. By using Sinkhorn divergence and a cost matrix derived from token embeddings, WASD recognizes that predicting a synonym is a "better" error than predicting an unrelated word, leading to student models with superior reasoning and instruction-following capabilities.
What Problem Does This Paper Address?
Large Language Models (LLMs) are incredibly capable but computationally expensive to run. Knowledge Distillation (KD) is a common technique to solve this: a large "teacher" model trains a smaller "student" model to mimic its output probability distributions.
However, standard KD methods rely on divergences like Kullback-Leibler (KL). These methods are "semantically blind"—they only compare probability values at specific vocabulary indices. If a teacher model assigns high probability to the token "sofa," a student model is penalized just as heavily for predicting "couch" (a synonym) as it is for predicting "apple" (completely unrelated). This lack of semantic awareness makes the distillation process brittle and ignores the rich relationships between words encoded in the model's embedding space.
Methods
The authors propose WASD, which leverages Optimal Transport (OT) theory to align distributions.
- Wasserstein Distance: Instead of just comparing indices, WASD measures the "cost" of transporting probability mass from the student's distribution to the teacher's.
- Semantic Cost Matrix: The cost of moving mass between two tokens is determined by the distance between their embeddings in the teacher model. Moving mass between "sofa" and "couch" is cheap, while moving it to "apple" is expensive.
- Sinkhorn Divergence: To make the heavy math of Optimal Transport computationally tractable for LLMs, the authors use entropy-regularized Sinkhorn iterations. Crucially, they use a debiased version to ensure that the student model actually converges to the teacher's distribution rather than a shifted version.
- Efficient Optimization: A major hurdle in OT-based learning is the need to backpropagate through the solver. The authors derive a gradient-equivalent objective using the envelope theorem, allowing them to optimize the student model efficiently without extra neural networks or complex backpropagation through the Sinkhorn iterations.
Datasets
The researchers evaluated WASD across several model families (GPT-2, OpenLLaMA2, Gemma, and Qwen2.5) using a wide array of benchmarks:
- General Instruction Following: Databricks-dolly-15k, Self-Instruct, Vicuna, Super-Natural Instructions (Super NI), and Unnatural Instructions (UnNI).
- Task-Specific Benchmarks: Flores-200 (Translation), DialogSum (Summarization), GSM8k (Mathematical Reasoning), and WizardCoder (Code Generation).
- Pretraining Data: OpenWebText was used for GPT-2 and OpenLLaMA2 experiments.
Key Insights and Ideas
- Semantic Smoothing: By using a cost matrix, WASD creates a smoother loss landscape. As seen in Figure 1a, standard divergences have sharp, index-based peaks, while WASD reflects the semantic relationships between tokens.
- The Importance of Debiasing: Pure entropy-regularized Wasserstein distance introduces a bias where the "optimal" student never quite reaches the teacher's distribution. The authors show that subtracting self-transport terms (the "debiasing" step) is essential for high-fidelity distillation.
- Quality-Diversity Trade-off: WASD allows models to maintain higher output quality even when generating more diverse text (e.g., at higher decoding temperatures). This suggests the student model learns a more robust understanding of the underlying meaning rather than just memorizing token patterns.
Key Results
WASD consistently outperformed established KD baselines across all tested tasks:
- Instruction Following: In a GPT-2 (1.5B to 0.1B) distillation task, WASD achieved an average ROUGE-L score of 22.47, significantly higher than standard KL divergence (17.17) and even recent state-of-the-art methods like AMiD (21.46).
- Mathematical & Code Reasoning: On GSM8k (math), WASD improved student accuracy to 24.87% (compared to 23.12% for CSD). On HumanEval (code), it reached 74.4% pass@1, outperforming all other distillation baselines.
- Training Dynamics: While WASD is more computationally intensive per step, it often converges faster in terms of total training epochs, as shown in the training curves.
Limitations and Future Work
- Computational Overhead: The Sinkhorn iterations add complexity. The authors note that WASD takes roughly twice the training time and uses 20% more GPU memory than standard KL-based distillation.
- Static Cost Matrix: Currently, the cost matrix is fixed based on the teacher's embeddings. The authors suggest that adaptive or task-specific cost matrices (e.g., emphasizing logical operators for math tasks) could further improve performance.
- Vocabulary Mismatch: The current study assumes the teacher and student share a vocabulary. While they show WASD can be integrated into cross-tokenizer frameworks like DSKD, more work is needed to optimize this for heterogeneous model architectures.
Summary updated