DisaggKD: Efficient Knowledge Distillation through Teacher-Student Disaggregation and a Fused Loss
Organizations: The University of Tokyo, RIKEN AIP · SB Intuitions Corp.
Abstract
Knowledge distillation (KD) frameworks place teacher and student on the same GPUs, so per-GPU memory limits the teachers that fit. DisaggKD separates them across nodes: teacher replicas stream hidden states to the student, a KD loss over row windows and vocabulary shards equals the full-vocabulary loss in exact arithmetic without forming the full-vocabulary logits, and a prefetch ring paces producer and trainer. Closed-form memory and traffic models locate the memory limits of each layout. On the Qwen3.5-35B-A3B to 9B pair, the disaggregated layout matches the LM loss of the colocated run with the same loss and is faster than that run; our fused loss also lets a colocated run train on as few nodes at faster speed, while the split is memory efficient when the student spans several nodes. On the larger pairs, colocated runs with a fused loss still run OOM where the split trains, because teacher weights and student states fill the budget.
Figures & tables
| Colocated (4 nodes, tp2/pp4/cp4/dp1) | Disaggregated (3 nodes: 2 trainer + 1 producer) | |
| Memory per GPU (GiB) | 11.5 + 15.8 + 36.0 + 0.25 + 12.3 predicted 75.8 (fit), measured 76.1 | trainer : predicted 55.8 (fit), measured 57.1 producer : predicted 41.8 (fit), measured 39.4 |
| ModelOpt | ModelOpt fused-W | KDFlow | NeMo-RL | DisaggKD (ours) | |
| Teacher and student on | same GPUs | same GPUs | same GPUs | same GPUs | separate nodes |
| Idle teacher weights | kept | kept | kept (optional offload) | offloaded | lm_head only |
| Teacher forward | in the student’s step | in the student’s step | phases | 1 phase per step | concurrent, ahead |
| Teacher output | logits, columns | logits, columns | hidden states | logits, columns | hidden states |
| KL taken over | all columns | all columns | all columns | top 8192 columns | all columns |
| Largest logits tensor | tokens , chunks optional | step tokens |
| Nodes | DisaggKD (ours) | ModelOpt | ModelOpt fused-W |
|---|---|---|---|
| Qwen3.5: 35B/3B to 9B | |||
| 2 | 284 | 147 | |
| 3 | 74 | OOM | 72 |
| 4 | 70 | 91 to 177 | 101 ‡ |
| Qwen3-235B: 235B/22B to 30B/3B | |||
| 3 | 393 | OOM | OOM |
| s/it, seed | Peak | MMLU, seed | |||
| Loss (nodes) | 42 | 43 | 42 | 43 | |
| Colocated (ModelOpt) | |||||
| KD-only (4) | 90.5 | 97.7 | 63.4 | 67.97 | 69.22 |
| Bal-L+K (4) | 176.8 | 172.1 | 67.2 | 67.51 | 69.78 |
| SQ-L+K (4) | 96.3 | – | 59.9 | – | – |
| SQ-L+K fused (4) | 100.6 † | – | 40.7 | – | – |
Appendix figures & tables29 assets
Supplementary material from the paper’s appendix.
Appendix
| Module | Term |
|---|---|
| Student weights, gradients, optimizer | ({\color[rgb]{0,0.45,0}2}{+}{\color[rgb]{0,0.45,0}4})\,P_{\mathrm{loc}}\,\mathrm{bytes}+{\color[rgb]{0,0.45,0}12}(D_{s}/(\mathrm{tp}\,\mathrm{pp}\,\mathrm{dp}\,\mathrm{cp})+E_{s}/(\mathrm{pp}\,\mathrm{ep}\,\mathrm{edp}))\,\mathrm{bytes} , experts on , their optimizer state on ranks |
| Student activations, colocated | {\color[rgb]{0,0.45,0}1}\tfrac{\ell_{s}}{\mathrm{pp}}\tfrac{L}{\mathrm{cp}\,\mathrm{tp}}d_{s}\,b\,\mathrm{bytes} stored layer inputs of the 1 microbatch in flight at the loss stage (full recomputation) |
| Student attention scores | when attention is not fused (zero for the students of this paper) |
| Student MoE dispatch | {\color[rgb]{0.75,0,0}2}\tfrac{L}{\mathrm{cp}}k_{\mathrm{e}}d_{s}\,b/\mathrm{tp}\,\mathrm{bytes} |
| Colocated teacher shard | {\color[rgb]{0,0.45,0}2}(D_{t}/(\mathrm{pp}\,\mathrm{tp})+E_{t}/(\mathrm{pp}\,\mathrm{ep}))\,\mathrm{bytes} (bf16) |
| Colocated logits buffers | ({\color[rgb]{0.75,0,0}7}{+}1{+}{\color[rgb]{0.75,0,0}1.5})\,(L/\mathrm{cp})(V/\mathrm{tp})\,{\color[rgb]{0,0.45,0}4}\,\mathrm{bytes} (7 buffers, 1 for the loss-averaging all-reduce, and 1.5 for the backward pass; 1 more with the LM loss) |
| Model | In the fit | Outside the fit |
|---|---|---|
| Trainer device peak | 8 runs: RMS 1.2, largest 2.5 | 13 runs: RMS 1.7, largest 4.0 |
| Producer device peak | 8 runs: RMS 5.0, largest 8.4 | leave one MoE family out (6 runs): RMS 8.6, largest 12.3 |
| Colocated verdict | 6 configurations: 5 correct | 18 configurations: 17 correct |
| Colocated peak | 4 peaks, 4 OOM points: RMS 0.5, largest 1.2 | 9 peaks: RMS 1.5, largest 3.0; 2 OOM points, largest 15.8 |
| Inter-node traffic (Qwen3.5) | within 2% (3 and 4 nodes) | |
| NVLink traffic (Qwen3.5) | 4.4% (colocated), 15% (trainer), 3% (producer) |
| Run (T+P nodes) | Replica | Shard | Pred. | Meas. | Err. | Resid. | Err., family left out |
|---|---|---|---|---|---|---|---|
| Qwen3.5 (2+1) | TP2, fp8 | 18.1 | 41.8 | 39.4 | 21.3 | ||
| Qwen3.5 (3+1) | TP2 EP2, fp8 | 10.4 | 34.1 | 32.0 | 21.6 | ||
| Qwen3-235B (2+1) | TP8, bf16 | 54.7 | 78.4 | 72.4 | 17.7 | ||
| Qwen3-235B (4+4) | TP8, bf16 | 54.7 | 78.4 | 73.3 | 18.6 | ||
| Nemotron (2+2) | TP8 EP2, fp8 | 38.6 | 62.3 | 69.6 | 31.0 | ||
| Nemotron (4+4) | TP8 EP2, fp8 | 38.6 | 62.3 | 70.7 | 32.1 |
| Trainer | Grid | Pred. | Meas. | Err. | Use | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Qwen3.5 (2+1) | 2/2/2/2 | 64 | 18.8 | 1.1 | 12.0 | 8.6 | 0.0 | 55.8 | 57.1 | 1.3 | fit |
| Qwen3.5 (3+1) | 2/2/2/3 | 42 | 16.7 | 1.1 | 7.9 | 8.6 | 0.0 | 49.6 | 50.3 | 0.7 | fit |
| Qwen3.5 (2+1), tp4 | 4/2/2/1 | 128 | 12.5 | 0.7 | 12.0 | 4.3 | 0.0 | 44.9 | 45.1 | 0.2 | fit |
| Qwen3-32B (1+1), seq 4096 | 2/2/1/2 | 64 | 12.3 | 1.2 | 1.9 | 10.1 | 0.0 | 40.8 | 40.3 | +0.5 | fit |
| Llama (8+8) | 8/2/2/2 | 64 | 37.0 | 2.0 | 6.0 | 3.2 | 0.0 | 63.5 | 61.0 | +2.5 | fit |
| Nemotron (2+2) | 2/2/1/4/4 | 32 | 47.4 | 2.8 | 7.9 | 4.5 | 2.5 | 80.4 | 79.6 | +0.8 | fit |
| Configuration | Pred. | Measured | Use |
|---|---|---|---|
| Coloc., 3 nodes, cp1 | 86.8 | OOM, 72.9+15.2 | held out |
| Coloc., 4 nodes, cp1 | 86.4 | OOM, 72.4+15.2 | fit |
| Coloc., 4 nodes, cp2 | 78.3 | OOM, 71.4+7.6 | fit |
| Coloc., 4 nodes, cp4 | 75.8 | 76.1 | fit |
| Coloc., 4 nodes, cp4, Bal-L+K | 79.6 | 79.1 | fit |
| Coloc., 4 nodes, cp8 | 77.3 | 77.0 | held out |
| Remainder after subtracting | Mean | SD | LOO | LOFO |
|---|---|---|---|---|
| , | 29.91 | 4.7 | 5.1 | 5.7 |
| and | 23.09 | 4.1 | 4.4 | 4.5 |
| and | 16.41 | 2.3 | 2.4 | 2.4 |
| and | 15.32 | 1.3 | 1.4 | 1.4 |
| Trainer | Device | Torch | Reserved | Non-PyTorch | Unallocated | End of iter. | Stage 1 | Ramp | |
| Qwen3.5 (2+1) | 57.1 | 39.2 | 43.1 | 13.9 | 3.8 | 31.8 | +0.3 | 11.6 | 12.0 |
| Qwen3.5 (3+1) | 50.3 | 33.0 | 36.6 | 13.4 | 3.6 | 25.6 | 7.9 | ||
| Qwen3.5 (2+1), tp4 | 45.1 | 29.0 | 31.1 | 14.0 | 2.1 | 25.1 | 11.7 | 12.0 | |
| Qwen3-32B (1+1) | 40.3 | 25.1 | 28.8 | 11.5 | 3.7 | 15.6 | +0.2 | 1.7 | 1.9 |
| Llama (8+8) | 61.0 | 50.3 | 52.7 | 7.8 | 2.4 | 43.8 | +0.2 | 6.0 | |
| Nemotron (2+2) | 79.6 | 67.5 | 69.8 | 9.7 | 3.6 | 59.3 | +2.2 | 7.9 |
| Probe | Trainer grid | s/it | Torch | Device | NCCL | Comms | Measured; model |
|---|---|---|---|---|---|---|---|
| Qwen3.5 (2+1), garbage kept | tp2/pp2/cp2/dp2 | 74.3 | 39.2 | 57.1 | end of iter. 31.8 | ||
| Qwen3.5 (2+1), collected | tp2/pp2/cp2/dp2 | 116.9 | 27.7 | 44.8 | end of iter. 20.0; 11.8 | ||
| Qwen3.5 (2+1), tp4, reference | tp4/pp2/cp2/dp1 | 97.0 | 29.0 | 45.1 | 59.6 (3.73) | 17 | |
| NVLS multicast off | tp4/pp2/cp2/dp1 | 98.2 | 29.0 | 44.8 | 59.6 (3.72) | 17 | |
| eager kernel loading | tp4/pp2/cp2/dp1 | 100.2 | 29.0 | 46.8 | 59.6 (3.72) | 17 | |
| Qwen3-32B (1+1), tp2 | tp2/pp2/cp1/dp2 | 25.1 | 38.2 (4.78) | 19 |
| Qwen3.5 (GB; student; teacher) | ||||
|---|---|---|---|---|
| Dimension | Teacher (forward) | Student (training) | colocated | disaggregated |
| Tensor | 412.3; 85.9 | 824.6; 343.6 | ||
| Pipeline, per boundary and direction | , both directions colocated | , both directions | 4.29; 2.15 | 4.29; 0 |
| Context, attention | 51.5; 8.1 | 34.4; 0 | ||
| Context, linear attention | 232.8; 97.0 | 310.5; 0 | ||
| Data and context | none | 5.0; 0 | 10.1; 0 | |
| Sent | Received | Sent: | |||
| Node | calc. | meas. | calc. | meas. | pipe.+ring |
| 3 nodes (dp2) | |||||
| Stage 0 | 34.4 | 34.8 | 34.4 | 34.8 | 34.4+0 |
| Last stage | 34.4 | 34.9 | 68.7 | 69.6 | 34.4+0 |
| Producer | 34.4 | 34.8 | 0 | 0.1 | |
| 4 nodes (dp3) | |||||
| Pair (T+P nodes) | Consumed | Meas. | Duty | Limit | CR | |||
|---|---|---|---|---|---|---|---|---|
| Qwen3.5 (1+1), 15 it. | 4 | 3.7 | 28.1 | 37 | 283.7 | 0.13 | trainer | |
| Qwen3.5 (2+1) | 4 | 13.8 | 28.1 | 37 | 74.3 | 0.50 | trainer | |
| Qwen3.5 (3+1) | 2 | 29.5 | 32.8 | 63 | 69.9 | 0.90 | trainer | |
| Qwen3.5 (3+1), rerun | 2 | 31.4 | 32.8 | 63 | 65.0 | 0.97 | trainer | |
| Qwen3.5 (3+1), seed 43 | 2 | 20.1 | 32.8 | 63 | 99.4 | 0.63 | trainer | all |
| Qwen3.5 (3+1), seed 43, 30 it. | 2 | 33.2 | 32.8 | 63 | 61.9 | 1.0 | producer |
| Input: teacher replica, corpus order, look-ahead iterations, start slot | |
|---|---|
| 1 | load the teacher shard (routed experts in fp8 for the Qwen3.5 and Nemotron teachers, bf16 otherwise); write the lm_head shards once |
| 2 | for do |
| 3 | if my replica then continue |
| 4 | forward of microbatch (final hidden states) |
| 5 | wait until |
| 6 | slice rows per last-stage rank; send header and payload to the receiver group |
| Input: student hidden states , prefetch ring, shards , labels , window size | |
|---|---|
| 1 | pop the next slot from the ring; post receives for up to 4 following slots of the same iteration |
| 2 | for do |
| 3 | for |
| 4 | kernel: for each row, one pass over the entries in tiles gives ( ) and |
| 5 | MAX all-reduce of ; rescale; SUM all-reduce of over the tp ranks; the label logit of comes from a separate vocabulary-parallel pass |
| 6 | over the rows of window ; free |
| Experts | s/it | Torch | KD loss, it. 1, 2, 3 | Grad norm, it. 1, 2, 3 |
|---|---|---|---|---|
| bf16 | 100.3 | 61.7 | 0.215, 0.207, 0.207 | 0.70, 0.70, 1.04 |
| fp8 | 119.1 | 55.9 | 0.215, 0.207, 0.795 | 0.70, 0.70, 14.5 |
| Run (T+P nodes) | Trainer grid | Producer replicas | Iter. | s/it | tok/s | KD loss | Peak | CR |
|---|---|---|---|---|---|---|---|---|
| Qwen3.5 (1+1) | tp2/pp2/cp2/dp1 | 4 TP2 | 15 | 283.7 | 14.8 | 2.228 2.488 | 57.5; 39.4 | |
| Qwen3.5 (2+1) | tp2/pp2/cp2/dp2 | 4 TP2 | 200 | 74.3 | 56.4 | 2.228 2.227 | 39.2; 39.4 | |
| Qwen3.5 (3+1) | tp2/pp2/cp2/dp3 | 2 TP2 EP2 | 200 | 69.9 | 59.1 | 2.226 2.225 | 33.0; 32.0 | |
| Qwen3-235B (2+1) | tp2/pp2/ep4 | 1 TP8 (bf16) | 200 | 392.9 | 10.7 | 2.020 1.962 | 64.3; 72.9 | all |
| Qwen3-235B (4+4) | tp2/pp2/ep4, dp8 | 4 TP8 (bf16) | 200 | 108.5 | 38.7 | 2.020 1.962 | 50.7; 73.3 | all |
| Qwen3-235B (4+4), KD-only | tp2/pp2/ep4, dp8 | 4 TP8 | 60 | 105.0 | 40.0 | 2.066 2.029 | 51.0; 72.9 | all |
| Device | Torch | OOM point | ||||||
| Pair | Configuration | Pred. | Meas. | Pred. | Meas. | Pred. | Meas. | Outcome |
| Qwen3.5 | 3 nodes, tp2/dp3, best grid tp2/pp2/cp2, global batch 126 | 133.1 | 120.8 | not run | ||||
| 3 nodes, tp2/pp4/cp1/dp3 | 185.9 | 173.6 | 86.8 | 88.0 | OOM at the 4th buffer (student divide) | |||
| 4 nodes, cp1 | 184.6 | 172.3 | 86.4 | 87.6 | OOM at the 4th buffer | |||
| 4 nodes, cp2 | 112.1 | 99.8 | 78.3 | 79.0 | OOM at the 7th buffer | |||
| 4 nodes, cp4/dp1 | 75.8 | 76.1 | 63.6 | 63.4 | trains 200 iterations | |||
| Stack | Pair | Nodes | Steps | Tokens ( ) | s/step | Tok/s/GPU | Peak | Setting |
| ModelOpt, KD-only | Qwen3.5 | 4 | 200 | 4194 | 90.5 | 1450 | 63.4 | tp2/pp4/cp4/dp1 |
| ModelOpt, Bal-L+K | Qwen3.5 | 4 | 200 | 4194 | 176.8 | 741 | 67.2 | tp2/pp4/cp4/dp1 |
| ModelOpt, SQ-L+K | Qwen3.5 | 4 | 200 | 4194 | 96.3 | 1361 | 59.9 | tp2/pp4/cp4/dp1 |
| ModelOpt, SQ-L+K fused | Qwen3.5 | 4 | 15 | 4194 | 100.6 | 1303 | 40.7 | tp2/pp4/cp4/dp1 |
| ModelOpt, SQ-L+K fused-W | Qwen3.5 | 3 | 15 | 4129 | 72.0 | 2389 | 64.1 | tp2/pp4/cp1/dp3 |
| ModelOpt, SQ-L+K fused-W | Qwen3.5 | 2 | 15 | 4194 | 146.8 | 1786 | 50.3 | tp2/pp4/cp2/dp1 |
| (a) LM loss gap to the colocated run | ||||||
|---|---|---|---|---|---|---|
| Bal-L+K | SQ-L+K | |||||
| Disagg., 4 nodes | Disagg., rescaled | Disagg., 4 nodes | ||||
| gap | signed | gap | signed | gap | signed | |
| 1 | 0.020 | 0.001 | 0.021 | 0.005 | 0.017 | 0.005 |
| 5 | 0.014 | 0.001 | 0.014 | 0.005 | 0.010 | 0.005 |
| 9 | 0.012 | 0.001 | 0.012 | 0.006 | 0.009 | 0.005 |
| Iteration | 20 | 50 | 100 | 200 |
| Colocated Bal-L+K | 0.88 | 0.87 | 0.89 | 0.91 |
| SQ-L+K (disagg. and coloc.) | 0.98 | 0.94 | 0.88 | 0.75 |
| Disaggregated, rescaled | 0.49 | 0.49 | 0.49 | 0.49 |
| Colocated KD-only | 1 | 1 | 1 | 1 |
| Loss | Alloc. | Req. | In use | Failed in |
|---|---|---|---|---|
| KD-only, ModelOpt | 72.9 | 15.2 | 75.5 | the loss |
| SQ-L+K fused | 57.7 | 15.2 | 66.2 | model forward |
| SQ-L+K fused-W | 64.1 | 78.9 | trains |
| Run | Nodes | s/it | GPU-s | Peak |
|---|---|---|---|---|
| Colocated, cp4/dp1 | 4 | 96.3 | 3082 | 59.9 |
| Colocated fused, cp4/dp1 | 4 | 100.6 † | 3219 | 40.7 |
| Colocated fused-W, cp1/dp3 | 3 | 72.0 † | 1728 | 64.1 |
| Colocated fused-W, cp2/dp1 | 2 | 146.8 † | 2349 | 50.3 |
| Disaggregated, cp2/dp1 | 1+1 | 283.7 † | 4539 | 57.5 |
| Disaggregated, cp2/dp3 | 3+1 | 69.9 | 2237 | 33.0 |
| (a) Profile of the colocated runs | (b) Streamed trainer on other grids | ||||||||
| KD-only | Bal-L+K | Trainer grid | Nodes | s/it | GPU-s | Relative | CR | ||
| Loss stage, GPU-kernel share (%) | 85.9 | 77.6 | tp2/pp2/cp2/dp4 | 4+2 | 39.3 | 1886 | 1.00 | ||
| Loss stage, NCCL collectives (s) | 2.3 | 18.3 | tp2/pp4/cp2/dp2 | 4+2 | 50.8 | 2438 | 1.29 | ||
| Loss stage, copy operators (s) | 7.1 | 23.4 | tp2/pp2/cp4/dp2 | 4+2 | 50.0 | 2400 | 1.27 | ||
| Loss stage, stream syncs (s) | 13.2 | 30.4 | tp2/pp4/cp4/dp1 | 4+2 | 70.9 | 3403 | 1.80 | ||
| Stage 1, GPU-kernel share (%) | 98.0 | 98.5 | tp2/pp2/cp2/dp3 | 3+1 | 65.0 | 2080 | |||
| Runs | Documents read | Shared |
|---|---|---|
| Colocated | 99.99% of the corpus (9999:1:0), shuffled | 0 of 128 |
| Disaggregated | the whole corpus, same shuffle seed |
| Seed 42 | Seed 43 | Change | ||
| Disagg. (ours), 4 nodes | 68.52 | 70.09 | ||
| Disagg. (ours), 3 nodes | 70.14 | – | – | – |
| Coloc., Bal-L+K | 67.51 | 69.78 | ||
| Coloc., KD-only | 67.97 | 69.22 | ||
| Between layouts, seed 42 | ||||
| 4 nodes coloc. Bal-L+K | – | – | 0.001 | |
| CR | s/it | Effect | KD loss |
|---|---|---|---|
| 13.5 | – | 2.42 | |
| mb | 68.1 | 2.42 | |
| iter | 14.9 | 2.41 | |
| mb+iter | 69.3 | 2.42 | |
| producer | 13.5 | 2.40 | |
| all | 68.8 | 2.41 |
| Run (30B student) | tp/pp/cp/ep | edp | Dispatcher | LM, it. 2 | Grad norm, it. 1 | Layer 0 | Outcome |
|---|---|---|---|---|---|---|---|
| Torch forward | 2.16 | reference | |||||
| Disaggregated, 235B | 2/2/1/8 | 2 | flex | 2.11 | 2.2 | stable, 20 it. | |
| Disaggregated, 235B | 2/2/1/4 | 2 | flex | 2.11 | 1.7 | stable, 200 it. | |
| Colocated, 4B | 2/2/1/4 | 4 | all-to-all | 2.18 | 29 | 77.4 | finite, 2 it. |
| Colocated, 4B | 1/2/1/8 | 2 | all-to-all | 2.18 | 29 | finite, 2 it. | |
| Colocated, 4B | 2/2/1/8 | 2 | all-to-all | 2.18 | 29 | finite, 2 it. |
| Layout | Teacher | Grid | edp | Dispatcher | Outcome |
|---|---|---|---|---|---|
| Disagg. | Ultra | 2/2/1/4 | 4 | flex | finite, 200 it. |
| Coloc. | Ultra | 2/4/8/16 | 1 | all-to-all | NaN, gradient norm |
| Coloc. | Ultra | 4/4/4/16 | 1 | all-to-all | NaN, forward loss |
| Coloc. | Ultra | 4/4/4/16 | 1 | all-gather | NaN, gradient norm |
| Coloc. | Nano | 4/4/4/16 | 1 | all-gather | NaN, gradient norm |
| Coloc. | Nano | 4/4/1/16 | 1 | all-gather | NaN, gradient norm |
| (a) Llama | (b) Qwen3-32B to 4B | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Layout (nodes) | Iter. | s/it | GPU-s | Peak | CR | MMLU | Seq. batch | Microbatches | s/it | Tokens/s/GPU | CR |
| Colocated (8) | 5 | 484 | 31.0k | 36.7 | – | 64 | 13.5 | 2426 | |||
| Colocated (16), training | 200 | 301 | 38.5k | 27.5 | – | 76.98 | 64 | 69.6 | 471 | all | |
| pace check | 20 | 305 | 39.0k | 27.4 | – | 32 | 11.9 | 2755 | |||
| Disagg. (ours, 4+2) | 5 | 818 | 39.3k | 68.6 | all | 16 | 13.5 | 2427 | |||
| Disagg. (ours, 8+8), training | 400 | 186 | 23.8k | 50.3 | 76.41 | ||||||
Language Model Distillation
Language model distillation transfers a larger model’s capabilities to smaller or specialized models using outputs, probabilities, or internal representations.
See all 522 papers