One Model, Two Paths: Balancing Single-Pass and Looped Performance in Language Models
Organizations: The Chinese University of Hong Kong, Shenzhen · Shanghai Jiao Tong University
Abstract
Repeating Transformer layers can improve language-model performance without adding parameters. A pretrained model can be adapted to support both single-pass and looped inference by reusing middle-layer weights for additional computation. Because both paths share weights, training to improve looped predictions can degrade single-pass quality. We study joint training strategies using weighted losses on both outputs, with guidance from the frozen original model. Joint supervision substantially reduces single-pass degradation compared to looped-only training, while preserving looped gains over ordinary continued training. Most of this benefit comes from adjusting the single-pass loss weight, with guidance from the frozen original model further improving the looped output. With validation-selected weights, our method preserves single-pass quality within a predefined tolerance of ordinary continued training while improving looped predictions.
Figures & tables
| Method | Updates | Single | Looped |
|---|---|---|---|
| Ordinary | 5120 | 3.638339 | – |
| Loop-only | 3413 | 3.809579 | 3.629291 |
| Joint CE 5% | 2925 | 3.674221 | 3.632287 |
| Joint CE | 2925 | 3.661175 | 3.633369 |
| Online KD | 2925 | 3.650679 | 3.634773 |
| Matched CE | 2925 | 3.651328 | 3.635767 |
| Recipe | All four | ||||
|---|---|---|---|---|---|
| Label-only CE, | 0/4 | ||||
| Online KD, | 0/4 | ||||
| Frozen-original KD, | 4/4 |
Appendix figures & tables41 assets
Supplementary material from the paper’s appendix.
Appendix
| Setting | Value | Setting | Value |
|---|---|---|---|
| Parameters | 133,830,912 | Physical blocks | 8 |
| Hidden / MLP size | 768 / 2,048 | Attention / KV heads | 12 / 12 |
| Vocabulary | 50,257 | Repeated block indices | 2–5 (zero-based) |
| Sequence / batch | 1,024 / 32 | Microbatch / accumulation | 4 / 8 |
| Arithmetic / weights | BF16 / FP32 | Gradient norm limit | 1 |
| Optimizer | Muon NS5 + AdamW | Muon / AdamW learning rates | 0.004 / 0.00006 |
| Dataset / split | Documents or items | Targets | Blocks | Role |
| FineWeb-Edu training | 1,935,463 | 2,000,000,435 tokens | – | Shared training pool |
| Supervision validation | 551 | 524,288 | 16 | Checkpoint selection |
| Supervision confirmation | 2,190 | 2,097,152 | 32 | Primary text evaluation |
| WikiText test | 62 articles | 282,624 | 18 | Secondary text evaluation |
| ARC-Easy test | 2,376 | – | – | Task evaluation |
| PIQA validation | 1,838 | – | – | Task evaluation |
| Comparison | Block mean | Text interval | Time mean | Text interval |
|---|---|---|---|---|
| Static KD CE, single | ||||
| Static KD CE, looped | ||||
| Staged KD CE, single | ||||
| Staged KD CE, looped | ||||
| CE ordinary suffix, single | ||||
| CE ordinary suffix, looped |
| Comparison | C mean SD | D mean SD | Order interval (95%) |
|---|---|---|---|
| Static KD CE, single | |||
| Static KD CE, looped | |||
| Staged KD CE, single | |||
| Staged KD CE, looped | |||
| CE ordinary suffix, single | |||
| CE ordinary suffix, looped |
| Comparison | Block mean | Text interval | Time mean | Text interval |
|---|---|---|---|---|
| Static KD CE, single | ||||
| Static KD CE, looped | ||||
| Staged KD CE, single | ||||
| Staged KD CE, looped | ||||
| CE ordinary suffix, single | ||||
| CE ordinary suffix, looped |
| Comparison | C mean SD | D mean SD | Order interval (95%) |
|---|---|---|---|
| Static KD CE, single | |||
| Static KD CE, looped | |||
| Staged KD CE, single | |||
| Staged KD CE, looped | |||
| CE ordinary suffix, single | |||
| CE ordinary suffix, looped |
| Method | Updates | Single | Looped |
|---|---|---|---|
| Ordinary | 4404–4484 | 3.639523 | – |
| Loop-only | 3417–3461 | 3.807901 | 3.628643 |
| Joint CE 5% | 2622–2658 | 3.673922 | 3.633616 |
| Joint CE | 2633–2655 | 3.661637 | 3.635265 |
| Online KD | 2169–2188 | 3.650933 | 3.637430 |
| Matched CE | 2502–2520 | 3.651958 | 3.637436 |
| Role | Budget | Order | Method | ||||
|---|---|---|---|---|---|---|---|
| Fixed | Block | C2 | Matched CE | ||||
| Fixed | Block | C2 | Loop CE | ||||
| Fixed | Block | C2 | Loop KD | ||||
| Fixed | Block | C2 | Loop matched CE | ||||
| Fixed | Block | D2 | Joint CE | ||||
| Fixed | Block | D2 | Matched CE |
| Method | ||||
|---|---|---|---|---|
| Ordinary | 6/0/0 | 6/0/0 | 0/6/0 | 0/6/0 |
| Loop-only | 0/6/0 | 0/6/0 | 6/0/0 | 6/0/0 |
| Joint CE 5% | 0/6/0 | 0/6/0 | 6/0/0 | 6/0/0 |
| Joint CE | 0/6/0 | 0/6/0 | 6/0/0 | 6/0/0 |
| Online KD | 5/0/1 | 0/6/0 | 6/0/0 | 6/0/0 |
| Matched CE | 5/0/1 | 0/6/0 | 4/0/2 | 6/0/0 |
| Text | Budget | Fixed | Diagnostic |
|---|---|---|---|
| Confirmation | Block | 0/60 | 0/60 |
| Confirmation | Time | 0/60 | 0/60 |
| WikiText | Block | 6/60 | 4/60 |
| WikiText | Time | 2/60 | 3/60 |
| ARC-Easy | PIQA | HellaSwag | ||||
|---|---|---|---|---|---|---|
| Method | Single | Looped | Single | Looped | Single | Looped |
| Ordinary | 42.88 / 42.97 | 39.97 / 40.41 | 58.41 / 58.66 | 56.96 / 57.68 | 27.18 / 27.24 | 27.13 / 26.89 |
| Loop-only | 41.76 / 41.74 | 43.16 / 43.09 | 57.90 / 58.57 | 57.98 / 58.51 | 27.28 / 27.35 | 27.16 / 27.18 |
| Joint CE 5% | 43.19 / 43.89 | 43.32 / 43.55 | 58.49 / 58.29 | 58.78 / 58.41 | 27.23 / 27.32 | 27.24 / 27.35 |
| Joint CE | 43.36 / 43.78 | 43.18 / 43.78 | 58.46 / 58.34 | 58.56 / 58.61 | 27.36 / 27.25 | 27.29 / 27.32 |
| Online KD | 43.11 / 43.85 | 43.06 / 43.54 | 58.35 / 58.20 | 58.36 / 58.08 | 27.30 / 27.24 | 27.25 / 27.26 |
| ARC-Easy | PIQA | HellaSwag | ||||
|---|---|---|---|---|---|---|
| Method | Single | Looped | Single | Looped | Single | Looped |
| Ordinary | 0.00 / 0.00 | 7.15 / 5.90 | 0.00 / 0.00 | 3.28 / 2.72 | 0.00 / 0.00 | 4.45 / 5.13 |
| Loop-only | 2.52 / 2.67 | -0.89 / -0.93 | 1.35 / 1.33 | 0.43 / 0.36 | 1.94 / 2.06 | 0.43 / 0.22 |
| Joint CE 5% | -1.06 / -1.99 | -1.25 / -1.76 | -0.12 / 0.38 | -0.38 / 0.26 | 0.24 / 0.03 | 0.09 / 0.02 |
| Joint CE | -1.24 / -2.16 | -1.11 / -1.84 | -0.04 / 0.26 | -0.18 / 0.06 | -0.11 / -0.05 | 0.05 / -0.16 |
| Online KD | -1.50 / -2.48 | -1.19 / -2.22 | 0.10 / 0.27 | 0.30 / 0.51 | -0.18 / -0.01 | 0.27 / 0.22 |
| Method | Single NLL | Looped NLL | Forward KL | Fix (%) | Break (%) |
|---|---|---|---|---|---|
| Ordinary | 3.6259 | 3.8698 | 0.2111 | 2.6402 | 4.6581 |
| Loop-only | 3.7974 | 3.6163 | 0.1809 | 4.2093 | 2.4029 |
| Joint CE 5% | 3.6603 | 3.6182 | 0.0489 | 2.0884 | 1.6266 |
| Joint CE | 3.6467 | 3.6189 | 0.0366 | 1.7648 | 1.4287 |
| Online KD | 3.6367 | 3.6207 | 0.0263 | 1.4517 | 1.2664 |
| Matched CE | 3.6379 | 3.6226 | 0.0264 | 1.4531 | 1.2704 |
| Method | Seconds/update | Allocated GiB | Reserved GiB |
|---|---|---|---|
| Ordinary | 0.50234 | 5.76 | 6.41 |
| Loop-only | 0.64863 | 6.52 | 7.19 |
| Joint CE 5% | 0.84690 | 8.51 | 8.81 |
| Joint CE | 0.84702 | 8.51 | 8.81 |
| Online KD | 1.02425 | 8.90 | 9.58 |
| Matched CE | 0.88865 | 8.51 | 8.81 |
| Supervision-study process category | Observed GPU-process hours |
|---|---|
| Training and engineering | 36.978048 |
| Validation NLL and diagnostics | 4.256758 |
| Confirmation and WikiText | 2.096609 |
| Task evaluation | 24.670267 |
| Task-interface checks | 0.004445 |
| Total observed | 68.006127 |
| Implementation | Matched / Joint CE | Conditional 95% |
|---|---|---|
| Common weighted-CE entry | 1.000229 | |
| Historical separate entries | 1.051945 |
| Single-pass output | Looped output | |||||
| Comparison | Mean | Text interval | Order interval | Mean | Text interval | Order interval |
| KD flat | ||||||
| KD permuted online | ||||||
| Frozen looped permuted | ||||||
| Frozen looped matched CE | ||||||
| Frozen single-pass matched CE | ||||||
| Single-pass output | Looped output | |||||
| Comparison | Mean | Text interval | Order interval | Mean | Text interval | Order interval |
| KD flat | ||||||
| KD permuted online | ||||||
| Frozen looped permuted | ||||||
| Frozen looped matched CE | ||||||
| Frozen single-pass matched CE | ||||||
| Single-pass output | Looped output | |||||
| Comparison | Mean | Text interval | Order interval | Mean | Text interval | Order interval |
| KD flat | ||||||
| KD permuted online | ||||||
| Frozen looped permuted | ||||||
| Frozen looped matched CE | ||||||
| Frozen single-pass matched CE | ||||||
| Method | ||||
|---|---|---|---|---|
| Online KD | ||||
| Matched CE | ||||
| Frozen looped | ||||
| Frozen single-pass |
| NLL increase | 0.0005 | 0.001 | 0.002 | 0.005 | 0.010 | 0.020 |
|---|---|---|---|---|---|---|
| PPL increase (%) | 0.0500 | 0.1001 | 0.2002 | 0.5013 | 1.0050 | 2.0201 |
| Study / reference | Budget | ||||||
|---|---|---|---|---|---|---|---|
| Supervision / fixed | Block | 0/60/0 | 0/60/0 | 0/60/0 | 0/60/0 | 0/57/3 | 17/34/9 |
| Supervision / fixed | Time | 0/60/0 | 0/60/0 | 0/60/0 | 0/60/0 | 1/55/4 | 18/35/7 |
| Target / fixed | Block | 0/102/0 | 0/102/0 | 0/102/0 | 0/102/0 | 0/91/11 | 35/58/9 |
| Target / fixed | Time | 0/102/0 | 0/102/0 | 0/102/0 | 0/102/0 | 0/89/13 | 28/56/18 |
| Target / selected | Block | 0/102/0 | 0/102/0 | 0/102/0 | 0/102/0 | 0/91/11 | 35/58/9 |
| Target / selected | Time | 0/102/0 | 0/102/0 | 0/102/0 | 0/102/0 | 0/89/13 | 28/56/18 |
| Budget | Output | Interval | ||||
|---|---|---|---|---|---|---|
| Equal updates | Single | Text family | U | U | S | S |
| Equal updates | Single | Order 95% | U | U | S | S |
| Block | Single | Text family | V | U | U | S |
| Block | Single | Order 95% | U | U | U | S |
| Time | Single | Text family | U | U | S | S |
| Time | Single | Order 95% | U | U | S | S |
| Single-pass output | Looped output | |||
|---|---|---|---|---|
| Teacher / method | NLL | Order 95% interval | NLL | Order 95% interval |
| Online KD | ||||
| Frozen initial looped output | ||||
| Frozen-original KD (ours) | ||||
| Tolerance | CE | Online KD | Frozen-original KD |
|---|---|---|---|
| 0.001 | None | None | 0.4 |
| 0.005 | 0.8 | 0.8 | 0.4 |
| 0.01 | 0.4 | 0.4 | 0.4 |
| 0.02 | 0.4 | 0.2 | 0.4 |
| Family | All four | |||||
|---|---|---|---|---|---|---|
| Label-only CE | 0.2 | 0/6 | ||||
| 0.4 | 2/6 | |||||
| 0.8 | 0/6 | |||||
| 1.6 | 0/6 | |||||
| Online KD | 0.2 | 0/6 | ||||
| 0.4 | 1/6 |
| CE weight | Output | Frozen CE | Text 99.9621% |
|---|---|---|---|
| 0.2 | Single | ||
| Loop | |||
| 0.4 | Single | ||
| Loop | |||
| 0.8 | Single | ||
| Loop |
| Recipe | Criterion | Mean | Text 99.5833% | Order 95% |
|---|---|---|---|---|
| Label-only CE | ||||
| Online KD | ||||
| Comparison | Output | Mean | Text 98.75% | Order 95% |
|---|---|---|---|---|
| Online KD selected CE | Single | |||
| Online KD selected CE | Looped | |||
| Frozen-original KD (ours) selected CE | Single | |||
| Frozen-original KD (ours) selected CE | Looped |
| Recipe | Order | All four | ||||
|---|---|---|---|---|---|---|
| Label-only CE | C2 | No | ||||
| C3 | No | |||||
| D2 | No | |||||
| D3 | No | |||||
| Online KD | C2 | No | ||||
| C3 | No |
| Configuration | Split | Documents | Targets | Scoring blocks |
|---|---|---|---|---|
| Main / deeper, GPT-2 tokenizer | Validation | 524 | 524,288 | 16 |
| Main / deeper, GPT-2 tokenizer | Confirmation | 2,175 | 2,097,152 | 32 |
| Main / deeper, GPT-2 tokenizer | WikiText | – | 282,624 | 1 |
| Native, Parcae tokenizer | Validation | 524 | 524,288 | 16 |
| Native, Parcae tokenizer | Confirmation | 2,175 | 2,125,824 | 32 |
| KL receiving path | Matched CE | Single difference | Looped difference |
|---|---|---|---|
| Single pass | |||
| Looped output | |||
| Both outputs |
| Configuration and recipe | Looped CE | CE reference | |||
|---|---|---|---|---|---|
| Main , selected | 4 | Selected CE | |||
| Main selected recipe, WikiText | 4 | – | – | ||
| Deeper , fixed coefficients | 4 | Fixed CE | |||
| Native R1 R4, fixed coefficients | 6 | Fixed CE |
| Receivers A B | Contrast | Output | Mean | Text 99.5833% | Order 95% |
|---|---|---|---|---|---|
| Single loop receiver | Direct | Single | |||
| Direct | Loop | ||||
| Interaction | Single | ||||
| Interaction | Loop | ||||
| Single both receivers | Direct | Single | |||
| Direct | Loop |
| Fixed-recipe configuration | Output | Frozen CE | Text 99.1667% | Order 95% |
|---|---|---|---|---|
| HF | Single | |||
| Loop | ||||
| Native Parcae | Single | |||
| Loop |
| Fixed recipe | Noise view | ||
|---|---|---|---|
| Label-only CE | 0 | ||
| 1 | |||
| 2 | |||
| Online KD | 0 | ||
| 1 | |||
| 2 |
| Recipe | Output | ARC-Easy | PIQA | HellaSwag |
|---|---|---|---|---|
| Ordinary | Single | 43.08 | 58.65 | 27.32 |
| Selected Label-only CE | Single | 44.41 | 58.71 | 27.48 |
| Selected Label-only CE | Looped | 43.70 | 58.60 | 27.42 |
| Selected Online KD | Single | 44.03 | 58.31 | 27.20 |
| Selected Online KD | Looped | 43.82 | 58.30 | 27.22 |
| Selected Frozen-original KD (ours) | Single | 44.14 | 58.72 | 27.06 |
| Task | Selected recipe | Output | (pp) | Item 95% (pp) | Order 95% (pp) |
|---|---|---|---|---|---|
| ARC-Easy | Label-only CE, | Single | |||
| Label-only CE, | Looped | ||||
| Online KD, | Single | ||||
| Online KD, | Looped | ||||
| Frozen-original KD, | Single | ||||
| Frozen-original KD, | Looped |
LLM Inference
Large language model inference studies how models generate outputs efficiently, reliably, and securely across hardware and workloads.
See all 280 papers