Knowledge distillation (KD) trains a student to match a teacher's output distribution. However, full-vocabulary KD requires costly output-head backpropagation. To reduce this cost, we introduce Distillation with Errors (DWE). Our key insight is that minibatch training already approximates the training gradient, so per-position backpropagation does not need to be exact. DWE therefore exploits the zero-sum structure of logit gradients to construct sparse paired gradient estimates whose expectation matches the full-vocabulary gradient. It then uses geometry-aware pairing and stratified sampling to further reduce estimation variance. We prove that the estimator is unbiased and evaluate DWE's gradient estimation accuracy and training efficiency. At the same sampling budget, DWE reduces hidden-state and output-weight gradient MSE by 63.5% and 57.9%, respectively, compared with importance sampling. In off-policy KD, it achieves up to a 1.95× output-head speedup and reduces training time by 10.4-15.7% relative to full-vocabulary KD. In on-policy distillation (OPD), it achieves up to a 2.20× output-head speedup. DWE maintains competitive downstream performance in both settings. Our code is available at https://github.com/dwe-lab/DWE.
Figures & tables
Figure 1: Overview of DWE . The positive and negative parts of the logit gradient are normalized into two sampling distributions (a). Both distributions are reordered using the fixed geometric order τ (b), then sampled at shared, stratified quantiles to obtain K coordinate pairs (c). Averaging the corresponding paired estimates gives a sparse gradient estimate that preserves the full gradient in expectation. This estimate enables backpropagation through only the selected output rows, at most 2K per token (d). The illustration uses K=2 .
Figure 2: Output-head time across model scales. (a) We compare mean total output-head time for Full and DWE at 8K token positions across the three model configurations. Stacked segments show forward and backward time; DWE forward includes estimator preparation. (b) Each cell reports DWE’s total output-head speedup over Full for the corresponding model configuration and number of token positions.
4B-Instruct → 0.6B
8B → 1.7B
32B → 4B
Method
GPU h
Speedup
Tokens/s
GPU h
Speedup
Tokens/s
GPU h
Speedup
Tokens/s
Full
1.09
1.00 ×
20,460
1.54
1.00 ×
14,429
2.75
1.00 ×
8,077
DWE
0.92
1.18 ×
24,131
1.30
1.19 ×
17,109
2.47
1.12 ×
9,011
Table 1: KD training efficiency. We train each student on 80M tokens using its corresponding teacher. Speedup is relative to Full.
Method
HellaSwag
PIQA
ARC-E
ARC-C
GSM8K
LAMBADA
MMLU
Avg.
Qwen3-4B-Instruct-2507 → Qwen3-0.6B
Full KD
49.4
68.3
66.8
36.0
11.0
46.0
45.6
46.2
IS
49.5
68.3
66.8
35.8
10.9
46.2
45.4
46.1
DWE
49.5
68.1
66.8
35.9
10.5
46.3
45.4
46.1
Qwen3-8B → Qwen3-1.7B
Full KD
62.8
73.6
75.0
45.1
45.0
55.6
58.0
59.3
Table 2: Downstream performance across model sizes. Zero-shot benchmark scores (%). Best scores among Full KD, IS, and DWE are bolded within each model group.
ID
Configuration
Hidden
Head
A0
Importance sampling
0.3042
0.1679
A1
Independent positive/negative pairs
0.2019
0.1293
A2
Geometry-aware IID pairs
0.1941
0.1283
A3
Geometry-aware stratified pairs (DWE)
0.1110
0.0707
Table 3: Component ablation. Cumulative additions at K=8 . Hidden and Head report relative MSE for gradients with respect to h and W .
Figure 3: Gradient estimation error and output-head time. Top: relative MSE with 95% Monte Carlo confidence intervals. Bottom: DWE runtime on 1K positions, with Full as reference. Both methods use 2K draws per token.
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
Optimization
Implementation and methods
Training tokens
80M
Hardware
1× H100 80GB
Data sampling seed
2026
Sequence length
4,096
Training seeds
42, 43, 44
Microbatch size
2
Projection precision
BF16
Gradient accumulation
4
Probability/residual precision
FP32
Optimizer
8-bit Adam
Token chunk size
256
Appendix
Table 4: KD training configuration. Shared settings across student sizes.
Optimization and generation
Implementation and methods
Updates
100
Hardware
1× H100 80GB
Training seeds
42, 43, 44
Projection precision
BF16
Global batch size
256
Probability/residual precision
FP32
Microbatch size
2
Token chunk size
256
Gradient accumulation
128
Gradient checkpointing
Enabled
Peak learning rate
5×10−6
Dropout
Disabled
Appendix
Table 5: OPD training configuration. Shared settings and method-specific sampling parameters.
Benchmark
Questions
Repeats
Metric
HellaSwag ( Zellers et al., 2019 )
10,042
1
Length-normalized accuracy
PIQA ( Bisk et al., 2020 )
1,838
1
Accuracy
ARC-Easy ( Clark et al., 2018 )
2,376
1
Accuracy
ARC-Challenge ( Clark et al., 2018 )
1,172
1
Length-normalized accuracy
GSM8K ( Cobbe et al., 2021 )
1,319
1
Exact match
LAMBADA ( Paperno et al., 2016 )
5,153
1
Accuracy
Appendix
Table 6: KD evaluation benchmarks. Question counts refer to the complete evaluated sets.
Domain
Benchmark
Questions
Repeats
Metric
Mathematics
MATH500 ( Hendrycks et al., 2021b ; Lightman et al., 2024 )
500
10
Accuracy
AIME25 ( MAA, 2025 )
30
16
Accuracy
AMC23 ( MAA, 2023 )
40
16
Accuracy
HMMT25 ( Dekoninck et al., 2026 )
30
16
Accuracy
OlympiadBench ( He et al., 2024 )
674
3
Accuracy
RG-Math ( Stojanovski et al., 2025 )
100
3
Native task score
Appendix
Table 7: OPD evaluation benchmarks. Question counts refer to the evaluated sets.
Method
Forward
Backward
Optimizer
Other
Total
Full
0.648
1.522
0.069
0.018
2.258
DWE
0.738
1.079
0.067
0.017
1.901
Appendix
Table 8: KD update runtime. We report the mean runtime of each stage of a complete training update in seconds. The forward pass includes loss computation and estimator preparation. Optimizer time includes gradient clipping and parameter updates, and other overhead includes data loading.
4B-Instruct → 0.6B
8B → 1.7B
32B → 4B
Method
Forward KL
Perplexity
Forward KL
Perplexity
Forward KL
Perplexity
Full
0.5207
17.238
0.3661
12.929
0.3947
10.505
IS
0.5223
17.254
0.3668
12.935
0.3957
10.518
DWE
0.5213
17.242
0.3663
12.928
0.3950
10.508
Appendix
Table 9: Held-out evaluation. Final seed 42 checkpoints.
Figure 4: Output-head time. Runtimes are normalized to Full. Labels above the bars give total speedups, and times below give Full’s absolute runtime.
End-to-end training
Method
Seed 42
Seed 43
Seed 44
Mean
Full
694.77
683.65
687.21
688.54
DWE
680.03
675.35
678.72
678.03
Reduction (%)
2.12
1.21
1.24
1.53
Appendix
Table 10: OPD training runtime. We report mean seconds per update across seeds (top) and by stage (bottom). Stage timings average three updates after two warmups.
Table 11: Reasoning performance across 13 benchmarks. Scores (%) are means with standard deviations over repeated evaluations. Superscripts give evaluation counts. Best scores among Full, IS, and DWE are bolded. Average is the unweighted mean across all 13 benchmarks.
Figure 5: Training dynamics. Full and DWE across three training seeds. Columns correspond to seeds 42, 43, and 44. The top row shows response-token throughput; the bottom row shows full-vocabulary reverse KL. Curves summarize consecutive blocks of five updates. Each method is evaluated on its own responses.
Token positions
Peak memory (MiB)
Change
Full
DWE
1,024
1942.4
1854.2
− 4.5%
4,096
1981.4
1878.8
− 5.2%
8,192
2033.5
1911.5
− 6.0%
Appendix
Table 12: Output-head peak memory. Values report incremental peak allocated memory, excluding preallocated model weights and inputs.
Knowledge distillation transfers knowledge by encouraging a student to match a teacher's predicted class probabilities. These probabilities express not only confidence in the correct class, but also relations among incorrect alternatives. Yet closer imitation does not necessarily yield a better student. A student may already distinguish the correct class more sharply than its teacher, so further imitation can require giving back discrimination it has acquired. Our main result is an exact separation between full imitation and conditional learning. When the correct class's score advantage over each alternative must be preserved, full teacher-to-student KL minimization is blocked exactly when the student assigns no more probability than the teacher to every incorrect class. Crucially, the teacher's relative probabilities among incorrect classes remain fully learnable. We characterize the exact price of this transfer: a minimum increase in correct-class log-odds that compensates for the largest conditional-probability mismatch. Label fitting and conditional matching can therefore be completed even as full teacher KL diverges. This separation motivates task-preserving knowledge distillation (TPKD), which keeps the label gradient intact and minimally corrects the conditional gradient so that its output update preserves the label step's gains against every incorrect alternative. The corrected conditional direction retains more than half of the original first-order conditional descent at the same step size, with a tight bound. For a fixed positive conditional target and sufficiently small constant output steps, label and conditional errors vanish together. Experiments trace this learning from exact head updates to ordinary network training. TPKD reaches 88.05% accuracy on CIFAR-100 and 93.81% on CLINC150, improving over standard distillation by 0.47 and 0.35 percentage points across three seeds.
Knowledge Distillation (KD) is a central paradigm for transferring knowledge from a large teacher network to a typically smaller student model, often by leveraging soft probabilistic outputs. While KD has shown strong empirical success in numerous applications, its theoretical underpinnings remain only partially understood. In this work, we adopt a Bayesian perspective on KD to rigorously analyze the convergence behavior of students trained with Stochastic Gradient Descent (SGD). We study two regimes: (i) when the teacher provides the exact Bayes Class Probabilities (BCPs); and (ii) supervision with noisy approximations of the BCPs. Our analysis shows that learning from BCPs yields variance reduction and removes neighborhood terms in the convergence bounds compared to one-hot supervision. We further characterize how the level of noise affects generalization and accuracy. Motivated by these insights, we advocate the use of Bayesian deep learning models, which typically provide improved estimates of the BCPs, as teachers in KD. Consistent with our analysis, we experimentally demonstrate that students distilled from Bayesian teachers not only achieve higher accuracies (up to +4.27%), but also exhibit more stable convergence (up to 30% less noise), compared to students distilled from deterministic teachers.
Itai Morad, Nir Shlezinger, Yonina C. Eldar
School of ECE, Ben-Gurion University, Be’er Sheva, Israel · Faculty of Math and CS, Weizmann Institute of Science, Rehovot, Israel
Knowledge distillation transfers representational knowledge from a large teacher network to a compact student. Existing relational and contrastive distillation methods treat all samples uniformly, spending equal gradient on well-matched and poorly-matched regions of the representation space alike. We propose Representational Difference Distillation (RDD), which diagnoses where teacher and student representations structurally disagree and concentrates the distillation signal on those regions. RDD uses two asymmetric affinity matrices that capture opposing directions of misalignment: one identifies samples the student incorrectly considers similar, the other identifies teacher relationships the student has yet to learn. These affinities determine which sample pairs the distillation loss aligns and how strongly it corrects each misaligned sample. On CIFAR-100 with resnet32x4 to resnet8x4, RDD reaches 75.58% test accuracy in our runs, on par with CRD (75.45%) and above KD and RKD. We additionally explore curriculum-based and sampling-based variants, finding that weighting the loss is more effective than filtering the data.
Abdulkarim Mugisha, Divin Irakiza
Department of Computing + Mathematical Sciences, California Institute of Technology, Pasadena, US.