Abstract
Knowledge Distillation (KD) is a cornerstone technique for transferring capabilities from large teacher models to smaller, more efficient student models. However, the massive vocabulary size of modern Large Language Models (LLMs) makes storing full teacher distributions for large-scale pre-training datasets practically impossible. While sparse "Top-K" distillation is commonly used to mitigate storage costs, it introduces fundamental biases that degrade student performance and calibration. We introduce Random Sampling Knowledge Distillation (RS-KD), which utilizes importance sampling to create an unbiased estimate of the teacher's distribution. Our method achieves performance parity with full KD using as few as 12 tokens per step, reducing storage requirements by 25x and accelerating training by up to 2.6x.
The Challenge of Scale in LLM Distillation
In standard KD, a student model is trained to mimic the probability distributions (logits) of a large "teacher" model. For LLMs with vocabularies exceeding 100,000 tokens, caching the full distribution for a trillion-token dataset would require over 100 Petabytes of storage. To circumvent this, practitioners often store only the Top-K most likely tokens.
However, Top-K distillation is fundamentally flawed. By zeroing out the "tail" of the distribution, it forces the student to learn a truncated, over-confident version of the teacher. This leads to poor uncertainty estimation and a performance floor where the student may fail to outperform simple cross-entropy training on ground-truth labels.
Random Sampling Knowledge Distillation (RS-KD)
To address the bias of Top-K methods, researchers from Samsung Research proposed RS-KD. Instead of selecting the most probable tokens, the method uses importance sampling to select a small subset of tokens from the teacher's full distribution.
Unbiased Estimation and Gradient Preservation
By weighting the sampled tokens by the inverse of their sampling probability, RS-KD provides an unbiased estimator of the full KL divergence loss. Crucially, the authors demonstrate that this approach preserves the expected gradients at the logits. Empirically, the gradients produced by RS-KD with only 12 tokens show a 0.998 cosine similarity to the gradients of Full KD, whereas Top-K gradients are significantly skewed. This gradient alignment ensures that the student model follows the same optimization path as it would with the full teacher distribution.
Experimental Results
The researchers evaluated RS-KD using LLaMA-style and Qwen-style models ranging from 300M to 3B parameters, trained on up to 100B tokens from the FineWeb-edu dataset.
Performance and Efficiency
RS-KD consistently matches or exceeds the performance of Full KD across standard benchmarks (ARC-Easy, HellaSwag, PIQA, LAMBADA) while using only a fraction of the data. As shown in Figure 6, RS-KD reaches the performance of Full KD with significantly fewer tokens than competing sparse methods like Top-k or Naive Fix.
In terms of efficiency, RS-KD is 1.7x to 2.6x faster than Full KD and requires only 3.6 TB of storage for 100B tokens—a massive reduction compared to the estimated 10,000 TB for the full distribution and 90 TB for a Top-300 approach.
Calibration and Instruction Following
A key advantage of RS-KD is its impact on model calibration. While Top-K methods result in high Expected Calibration Error (ECE), RS-KD maintains an ECE of 0.2% to 0.8%, identical to Full KD. Furthermore, on instruction-following tasks (evaluated on Dolly, SelfInst, and Vicuna), RS-KD students outperformed Full KD counterparts (65.6 vs 62.2 average score), suggesting that the stochasticity of sampling may provide a beneficial regularizing effect during training.
Conclusion
Random Sampling Knowledge Distillation provides a mathematically sound and highly practical solution to the storage bottleneck in LLM distillation. By replacing biased Top-K selection with unbiased importance sampling, researchers can train high-performing, well-calibrated student models with minimal computational and storage overhead.
Summary updated