Do Halting Heads Really Save Compute in Looped Language Models?
Organizations: Apple
Abstract
Looped language models run each token through the same layers several times, and each run is one iteration. To save compute, an extra layer, the halting head, gives after each iteration the probability that the token stops there, so that easy tokens can stop early. Pretraining models from scratch, up to 1.3B parameters, we find two problems. First, heads trained on a mix of all iterations predict that tokens need under half the iterations, yet under the standard stopping rule tokens run almost every iteration, because this training never scores the single iteration where a token stops. Scoring every iteration instead fixes this, but in our runs it works only with a strong penalty favoring early stops. Second, savings are commonly reported as an average number of iterations per token, but when sequences are generated in batches that run until their slowest token stops, a model without a head is almost as good at that cost. The reported average can therefore overstate the saving. We recommend reporting the iterations tokens actually run, with the stopping threshold and batch size, and give a test, run before training a head, that bounds its gain.
Figures & tables
| Iterations | BPB | ||||||
| decode | |||||||
| Scale | at | at | hidden | reused | |||
| Mixture, | |||||||
| 140M | 3.81 | 7.86 | – | – | – | – | |
| 370M | 3.74 | 7.76 | 8.0 | – | – | – | |
| 770M | 3.63 † | 7.67 | – | – | – | – | |
| Method | Training depth | What the coda reads | Loss term on depth |
|---|---|---|---|
| Dense | no sharing, layers | final layer | — |
| Sampled-depth | Poisson, mean | — | |
| ACT ( Graves, 2016 ) | fixed | mixture up to its halting iteration | ponder cost, weight |
| Mixture | fixed | mixture | KL to geometric , weight |
| Per-step | fixed | each , weighted by | KL to geometric , weight |
| Scale | Reads mixture | Reads state at cap | Readout gap |
|---|---|---|---|
| Mixture | |||
| 140M | 1.2058 .0006 | 1.4091 .040 | .040 |
| 370M | 1.0807 .0001 | 1.2559 .015 | .015 |
| 770M | 1.0090 .0012 | 1.1767 .006 | .007 |
| 1.3B | 0.9643 .0017 | 1.1535 .016 | .015 |
| Per-step | |||
| change at | ||||
|---|---|---|---|---|
| Scale | Loss | BPB | ||
| 140M | Mixture | 1.813 | ||
| Per-step | 1.711 | |||
| 370M | Mixture | 1.610 | ||
| Per-step | 1.430 | |||
| BPB | Exit rule | Shuffled |
|---|---|---|
| Per-step, 140M | 1.2202 |
Appendix figures & tables32 assets
Supplementary material from the paper’s appendix.
Appendix
| Symbol | Where | Meaning |
| Model and depth | ||
| 2.1 | layers in the prelude, the core and the coda; only the core repeats | |
| 2.1 | the cap : the most iterations a token can run, set at inference | |
| Tab. 7 | the cap a model was trained at; unless stated | |
| 2.1 | an iteration, ; one run of the core | |
| 2.1 | the state of token after the core has run times | |
| Scale | Params | Tokens | |||
|---|---|---|---|---|---|
| 140M | 144.3M | 768 | 3072 | 2/2/2 | 11.2B |
| 370M | 388.0M | 1024 | 4096 | 4/4/4 | 29.6B |
| 770M | 776.7M | 1280 | 5120 | 6/6/6 | 61.6B |
| 1.3B | 1.339B | 1536 | 6144 | 8/8/8 | 104B |
| Scale | Workload | Fitted | Largest error | ||||||
|---|---|---|---|---|---|---|---|---|---|
| 140M | prefill, | 2.76 | 2.21 | 1.84 | 1.57 | 1.38 | 1.22 | ||
| 370M | prefill, | 3.05 | 2.36 | 1.92 | 1.62 | 1.40 | 1.24 | ||
| 770M | prefill, | 3.17 | 2.42 | 1.96 | 1.64 | 1.42 | 1.24 | ||
| 1.3B | prefill, | 3.22 | 2.45 | 1.97 | 1.65 | 1.42 | 1.25 | ||
| 140M | decode, | 3.16 | 2.42 | 1.95 | 1.65 | 1.41 | 1.24 | ||
| 370M | decode, | 3.24 | 2.43 | 1.92 | 1.61 | 1.41 | 1.24 |
| Model | Workload | Measured | Fixed at | |||
| 370M, both models, nine repeats per cell | ||||||
| Mixture | prefill, | 0.3 | 5.44 | 8 | ||
| Mixture | prefill, | 0.6 | 2.17 | 5 | ||
| Mixture | decode, | 0.5 | 2.86 | 5 | ||
| Mixture | decode, | 0.5 | 2.90 | 5 | ||
| Per-step, | prefill, | 0.7 | 2.93 | 6 | ||
| Mixture | Baseline | Curve | Would have | ||
|---|---|---|---|---|---|
| Scale | Steps | BPB | at the cap | falls | to fall |
| 140M | 3.020 | 1.4493 | 1.2159 | 0.0256 | |
| 370M | 3.017 | 1.2759 | 1.0875 | 0.0202 | |
| 770M | 2.885 | 1.1881 | 1.0157 | 0.0224 | |
| 1.3B | 2.925 | 1.1353 | 0.9693 | 0.0217 |
| forced depth | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Model | Seed | ||||||||||
| Sampled-depth | 42 | 7.2937 | 7.4076 | 5.0295 | 3.8793 | 2.7472 | 1.7466 | 1.3038 | 1.2311 | 1.2098 | 1.2081 |
| Sampled-depth | 7 | 5.9709 | 5.8090 | 4.6748 | 3.9846 | 2.5963 | 1.6305 | 1.2904 | 1.2285 | 1.2105 | 1.2092 |
| Per-step, | 42 | 1.3337 | 1.2532 | 1.2290 | 1.2206 | 1.2163 | 1.2156 | 1.2154 | 1.2154 | 1.2154 | 1.2154 |
| Per-step, | 7 | 1.3386 | 1.2654 | 1.2430 | 1.2352 | 1.2313 | 1.2307 | 1.2305 | 1.2305 | 1.2305 | 1.2305 |
| forced depth | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Model | Seed | |||||||||
| Sampled-depth | 42 | 1.7147 | 1.4347 | 1.3293 | 1.2763 | 1.2477 | 1.2311 | 1.2155 | 1.2078 | 1.2068 |
| Sampled-depth | 7 | 1.6856 | 1.4331 | 1.3310 | 1.2782 | 1.2496 | 1.2332 | 1.2177 | 1.2098 | 1.2087 |
| Per-step, | 42 | 1.3324 | 1.2519 | 1.2274 | 1.2188 | 1.2156 | 1.2144 | 1.2137 | 1.2136 | 1.2136 |
| Per-step, | 7 | 1.3236 | 1.2490 | 1.2257 | 1.2176 | 1.2147 | 1.2136 | 1.2129 | 1.2127 | 1.2127 |
| Specialist | 42 | — | — | — | — | — | 1.2077 | — | — | — |
| Seed | Steps | BPB | Specialist | Model specialist | |
|---|---|---|---|---|---|
| 42 | 15.993 | 1.2132 | 1.2047 | ||
| 7 | 16.000 | 1.2124 | 1.2047 | ||
| 42 | 6.531 | 1.2128 | 1.2065 | ||
| 7 | 6.491 | 1.2119 | 1.2066 | ||
| 42 | 4.798 | 1.2139 | 1.2114 | ||
| 7 | 4.755 | 1.2130 | 1.2116 |
| CC | FW | ||||||
|---|---|---|---|---|---|---|---|
| Scale | Method | Core-Ext | BPB | Core-Ext | BPB | ||
| 140M | Dense | 2 | 0.0488 .0021 | 1.2576 .0010 | – | – | – |
| 140M | Sampled-depth | 3 | 0.0641 .0010 | 1.2193 .0026 | 3 | 0.0906 .0111 | 0.9054 .0012 |
| 140M | ACT | 3 | 0.0724 .0021 | 1.2027 .0007 | – | – | – |
| 140M | Mixture | 3 | 0.0676 .0037 | 1.2052 .0007 | 3 | 0.1014 .0051 | 0.8983 .0005 |
| 370M | Dense | 2 | 0.0765 .0027 | 1.1208 .0011 | – | – | – |
| Model | |||||
|---|---|---|---|---|---|
| Specialist | 1.2349 | 1.3124 | 1.3953 | 1.4353 | 1.4779 |
| Specialist | 1.6913 | 1.2236 | 1.3212 | 1.3854 | 1.3434 |
| Specialist | 1.8764 | 1.7231 | 1.2152 | 1.3088 | 1.3838 |
| Specialist | 1.8973 | 1.8333 | 1.6849 | 1.2104 | 1.5053 |
| Specialist | 1.8785 | 1.8578 | 1.8347 | 1.7676 | 1.2047 |
| Per-step, | 1.2456 | 1.2251 | 1.2185 | 1.2164 | 1.2154 |
| Released | Mean | Mean | Specialist | Per-step | |
|---|---|---|---|---|---|
| 1 | 1.3801 .0015 | 1.2808 .0006 | 1.2574 .0015 | 1.8779 .060 | 1.3166 .0044 |
| 2 | 1.2779 .0006 | 1.2388 .0005 | 1.2409 .0008 | 1.7251 .038 | 1.2457 .0019 |
| 3 | 1.2418 .0007 | 1.2264 .0007 | 1.2375 .0007 | 1.2236 .0007 | 1.2251 .0012 |
| 4 | 1.2269 .0006 | 1.2225 .0008 | 1.2367 .0006 | 1.3167 .0063 | 1.2185 .0010 |
| 8 | 1.2160 .0006 | 1.2208 .0008 | 1.2364 .0006 | 1.3985 .103 | 1.2155 .0008 |
| Scale | Steps | Mixture | Baseline | ||
|---|---|---|---|---|---|
| 140M | 0.0 | 8.000 | 1.2058 .0006 | 1.2159 | |
| 140M | 0.1 | 7.860 | 1.2067 .0011 | 1.2160 | |
| 140M | 0.2 | 6.993 | 1.2301 .0080 | 1.2169 | |
| 140M | 0.3 | 5.755 | 1.2855 .0148 | 1.2185 | |
| 140M | 0.5 | 3.020 | 1.4493 .0165 | 1.2415 | |
| 370M | 0.0 | 8.000 | 1.0808 | 1.0875 |
| Scale | Mixture | Exit state | Over own | ||
|---|---|---|---|---|---|
| 140M | 0.5 | 4.08 | |||
| 0.7 | 3.11 | ||||
| 0.95 | 1.88 | ||||
| 370M | 0.5 | 3.79 | |||
| 0.7 | 2.83 | ||||
| 0.95 | 1.63 |
| Model | Steps | BPB | Baseline | Depth equivalent / steps [floor interval] | ||
| 140M; rows three seeds, rows seed | ||||||
| 0.0 | 7.997 | 1.2143 | 1.2155 | – | ||
| 0.5 | 4.074 | 1.2159 | 1.2261 | [ , open] | ||
| 0.7 | 3.113 | 1.2196 | 1.2398 | [ , open] | ||
| 0.9 | 2.160 | 1.2317 | 1.2721 | [ , ] | ||
| 0.95 | 1.879 | 1.2399 | 1.2905 | [ , ] | ||
| Gate chose | Share | ||||
|---|---|---|---|---|---|
| 0.6665 | 0.6677 | 0.6613 | 0.6601 | ||
| 4.0175 | 2.3504 | 2.3113 | 2.3033 | ||
| 7.2121 | 4.9394 | 3.3773 | 3.3300 | ||
| 8.3433 | 7.4025 | 5.0786 | 3.9426 | ||
| Corpus BPB | 2.4907 | 1.7641 | 1.3296 | 1.2531 |
| Tokens/pass | Sampled-depth there | Per-step sampled-depth | Verdict | ||
| 370M, , , BPB — same scale, model and threshold as | |||||
| (decode, ) | 1.06 | 2.99 | 1.1082 | model ahead | |
| (prefill, ) | 2.19 | 6.17 | 1.0889 | inside floor | |
| (prefill, ) | 2.32 † | 6.54 | 1.0886 | inside floor | |
| 370M, , , BPB — carried from | |||||
| (decode, ) | 1.06 | 1.72 | 1.1605 | model ahead | |
| Steps | Model baseline at the model’s own steps | ||||||
|---|---|---|---|---|---|---|---|
| Scale | teacher-forced | keep-first | teacher-forced | keep-first | drop | 512-token prompt | |
| 140M | 0.7 | 3.113 | 3.112 | .014 | .0082 | ||
| 0.95 | 1.877 | 1.889 | .015 | .0087 | |||
| 370M | 0.7 | 2.827 | 2.833 | .004 | .0002 | ||
| 0.95 | 1.628 | 1.651 | .004 | .0006 | |||
| 770M | 0.7 | 2.752 | 2.767 | .002 | .0006 | ||
| Steps | Model baseline | |||||
|---|---|---|---|---|---|---|
| Scale | Prompt | real | emulated | real | emulated | drop |
| 140M | 512 | 3.006 | 3.006 | n/a | ||
| 1 | 2.979 | 3.005 | ||||
| 370M | 512 | 2.734 | 2.734 | n/a | ||
| 1 | 2.638 | 2.746 | ||||
| 770M | 512 | 2.651 | 2.650 | n/a | ||
| Pass | Model baseline at | |||||
| Scale | depth | pass depth | TF | |||
| 140M | 3.13 | 4.71 | 1.51 | .0013 | ||
| 370M | 2.84 | 4.40 | 1.55 | .0005 | ||
| 770M | 2.76 | 4.37 | 1.58 | .0002 | ||
| Model | Variant | Steps | Change vs teacher-forced | Condition |
|---|---|---|---|---|
| Ouro 2.6B | teacher-forced | 2.444 | — | |
| keep-first | 2.475 | |||
| drop | 2.943 | |||
| Ouro 1.4B | teacher-forced | 2.669 | — | |
| keep-first | 2.654 |
| emulated, full split | real, seq. | |||||
|---|---|---|---|---|---|---|
| Scale | TF | hidden | copy | reuse | reuse | |
| 140M | 0.7 | |||||
| 0.95 | ||||||
| 370M | 0.7 | |||||
| 0.95 | ||||||
| 770M | 0.7 | |||||
| Model | Readout | Steps | BPB | Baseline | |
| Sampled rule: realized steps by construction | |||||
| 140M mixture-loss | mixture | 3.830 | 1.4633 | 1.2291 | |
| 140M mixture-loss | exit state | 3.830 | 1.5262 | 1.2291 | |
| 370M mixture-loss | mixture | 3.762 | 1.2966 | 1.0990 | |
| 370M mixture-loss | exit state | 3.762 | 1.3439 | 1.0990 | |
| 140M per-step, | exit state | 4.335 | 1.2198 | 1.2244 | |
| Steps | BPB | Baseline | ||
|---|---|---|---|---|
| (reported) ‡ | 7.99 | 1.2027 | 1.2159 | |
| ‡ | 7.95–7.98 | 1.2032 | 1.2159 | |
| ‡ | 0.5 | 7.862 | 1.2049 | 1.2160 |
| ‡ | 0 | 7.352 | 1.2048 | 1.2163 |
| ‡ | 0.1 | 7.182 | 1.2049 | 1.2164 |
| ‡ | 0.2 | 6.977 | 1.2056 | 1.2166 |
| Loss | |||
|---|---|---|---|
| 140M, BPB at forced | |||
| Mixture | 1.8127 .017 | 1.8508 .044 | 1.8648 .044 |
| Per-step | 1.7111 .003 | 1.3166 .004 | 1.2608 .000 |
| 370M, BPB at forced | |||
| Mixture | 1.6104 .011 | 1.6083 .027 | 1.6415 .026 |
| Per-step | 1.4302 .011 | 1.1576 .001 | 1.1225 |
| Model | |||||||
|---|---|---|---|---|---|---|---|
| Sampled-depth baseline | 1.3818 | 1.2779 | 1.2415 | 1.2266 | 1.2201 | 1.2174 | 1.2155 |
| Per-step, | 1.7139 | 1.5612 | 1.5015 | 1.4544 | 1.4000 | 1.3327 | 1.2039 |
| Per-step, | 1.3169 | 1.2456 | 1.2250 | 1.2185 | 1.2164 | 1.2157 | 1.2154 |
| Per-step, | 1.2608 | 1.2344 | 1.2278 | 1.2261 | 1.2256 | 1.2255 | 1.2255 |
| , | |||||||
| , |
| Model | ||||
|---|---|---|---|---|
| Sampled-depth baseline | 1.2214 | 1.1079 | 1.0912 | 1.0875 |
| Per-step, | 1.4302 | 1.2505 | 1.1817 | 1.0924 |
| Per-step, | 1.1576 | 1.0935 | 1.0880 | 1.0874 |
| Per-step, | 1.1225 | 1.0955 | 1.0940 | 1.0939 |
| Mixture, | 1.6104 | 1.2765 | 1.1844 | 1.0807 |
| Mixture, | 1.6083 | 1.2764 | 1.1588 | 1.0813 |
| Model | |||||
|---|---|---|---|---|---|
| Sampled-depth | – | 0.9439 | – | 0.9122 | 0.9054 |
| Mixture | 1.7119 | 1.1462 | 1.0577 | 1.0155 | 0.8997 |
| Mixture | 1.3168 | 1.1487 | 1.0601 | 1.0072 | 0.8995 |
| Per-step | 1.3446 | 1.2675 | 1.2464 | 1.2241 | 0.8969 |
| Per-step | 0.9766 | 0.9263 | 0.9108 | 0.9057 | 0.9035 |
| Seed | Per-step | Specialist | |
|---|---|---|---|
| 42 | 1.2039 | 1.2047 | |
| 7 | 1.2056 | 1.2035 | |
| 123 | 1.2055 | 1.2065 | |
| Mean | 1.2050 .0010 | 1.2049 .0015 | .0017 |
| Quintile of loss at the cap | ||||||
| Scale | 1 | 2 | 3 | 4 | 5 | |
| 140M | step | 2.28 | 3.08 | 3.33 | 3.40 | 3.48 |
| improvement | 0.06 | 0.29 | 0.34 | 0.24 | 0.12 | |
| 370M | step | 2.06 | 2.69 | 3.06 | 3.11 | 3.21 |
| improvement | 0.01 | 0.15 | 0.28 | 0.20 | 0.09 | |
| 770M | step | 2.03 | 2.54 | 2.98 | 3.06 | 3.16 |
LLM Inference Acceleration
LLM inference acceleration develops algorithms and systems that reduce language-model latency, memory use, and serving cost while preserving output quality.
See all 1,080 papers