Efficient Knowledge Distillation for LLMs: Offline Top-K Logits and a Fused Chunked KL Loss
Abstract
Efficient knowledge distillation for small language models is achieved via cached teacher logits and a memory-linear chunked KL loss, enabling longer contexts and faster training.
Small language models are often the only option for deployment under tight latency, cost, and on-premises constraints, but they are rarely trained from scratch: a compressed model is usually recovered through knowledge distillation (KD). This recovery step largely decides the final quality, yet it is expensive. We present a practitioner's study of how to make distillation training efficient, organised around two systems contributions. First, we show that offline KD (caching the teacher's top-K logits once and training the student against the cache) matches online distillation at near-identical training loss while removing the teacher from memory, running about 29\% faster per iteration, and reaching up to 41\% higher throughput on a single H200 GPU. Second, we introduce a fused, chunked KL loss that never materialises the full vocabulary-sized logit tensor, making peak memory linear in the sequence length. This removes the memory spike that otherwise caps context length and lets us train at four times the context (32{,}768 tokens) on a single GPU. A separate output-head-only toy benchmark isolates the loss kernel and confirms its memory and iteration-rate scaling from 4K to 256K tokens. Together these make large-scale healing and hundreds of ablations affordable. We also report supporting ablations on loss design and sequence packing. We release our chunked-loss implementation: https://github.com/CompactifAI/Full-Chunked-KL-Loss.
Community
Knowledge distillation is how large open LLMs get compressed into deployable smaller models, but the standard approach is expensive: it keeps teacher and student loaded together and recomputes the teacher's full-vocabulary output at every step. Multiverse Computing's paper fixes this with two changes: caching the teacher's top-100 logits once so it never has to sit in memory with the student (offline distillation), and a fused, chunked KL loss that processes the sequence in slices instead of ever materializing the full vocabulary × sequence-length grid, keeping memory linear in context length. Together these cut peak memory roughly in half, enable 4× longer context on a single GPU, and deliver up to a 5× speedup at larger scale, all while matching the quality of standard online distillation.
Does offline KD with cached top-K logits actually hold up when the student is deployed against a different distribution than the teacher was distilled on? That's the part I keep coming back to — caching the teacher's logits once is a huge win for training cost, but it bakes in whatever the teacher saw at cache time. The fused chunked KL loss is the more interesting bit to me: it attacks the memory bottleneck that makes online distillation painful on a single GPU, which is exactly the constraint I hit when I try to distill something usable on-prem. I'd want to see how the top-K cutoff interacts with the chunked loss when the student's vocabulary or head size differs from the teacher's. If the cache is the bottleneck, the real question is how stale it can get before the student starts drifting.
For both offline and online KD to work well, it is important that the logits are computed on data that is in-distribution for the teacher. In other words, using random prompts and answers from open-source datasets is suboptimal. The best approach is to use the data that was originally used to train the teacher. If that data is not available, synthetic data can instead be generated using the teacher.
Our current loss assumes that the student and the teacher share the same vocabulary, which is typically the case when compressing models. It would be very interesting to explore efficient KL-based losses for distillation across different model families. I believe the Hugging Face research team experimented with this in the past.
This is an automated message from the Librarian Bot. I found the following papers similar to this paper.
The following papers were recommended by the Semantic Scholar API
- SpotAttention: Plug-In Block-Sparse Routing for Pretrained Long-Context Transformers (2026)
- StreamKL: Fast and Memory-Efficient KL Divergence for Boosting Attention Distillation (2026)
- Tevatron Meets Megatron: Expert-Parallel LLM Reranker Training on an Academic Budget (2026)
- ShortOPD: Recovering Pruned LLMs with Short-to-Long On-Policy Distillation (2026)
- Hidden Decoding at Scale: Latent Computation Scaling for Large Language Models (2026)
- Scaling Laws for Task-Specific LLM Distillation (2026)
- KVpop -- Key-Value Cache Compression with Predictive Online Pruning (2026)
Please give a thumbs up to this comment if you found it helpful!
If you want recommendations for any Paper on Hugging Face checkout this Space
You can directly ask Librarian Bot for paper recommendations by tagging it in a comment: @librarian-bot recommend
Get this paper in your agent:
hf papers read 2608.03796 Don't have the latest CLI?
curl -LsSf https://hf.co/cli/install.sh | bash Models citing this paper 2
MultiverseComputingCAI/LittleLamb
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper
Collections including this paper 0
No Collection including this paper
