BeNice! Closing Looping's Inference-Memory Gap via KV-Sharing
Organizations: University of California, San Diego · Together AI
Abstract
Looped architectures scale quality while keeping parameter count fixed by repeatedly passing activations through the same block of layers. During inference, each recurrence generates independent KV-caches, causing memory to grow linearly. To address this challenge, prior work has proposed KV-sharing (i.e., sharing KV-caches across depth), finding that, in some cases, the KV-cache of the final recurrence can be shared with the earlier recurrences without quality loss, a property we denote as KV-shareability. However, the mechanisms underlying KV-shareability remain poorly understood, with even identically trained looped architectures not consistently exhibiting it. In this paper, we study how KV-shareability can be enabled in looped models. We propose a two-stage method: in the first stage, we use stochastic depth during pretraining, which induces contractive residual dynamics that drive representations toward a common limit across recurrences. In the second stage, we propose BeNice!, a post-training method that broadcasts the final recurrence's KV-cache into the first recurrence, training it to produce compatible residuals while preserving the original model's quality. As a result, BeNice! enables KV-shareability while matching standard finetuning's unshared validation perplexity. Using BeNice!, we show that KV-sharing is complementary to alternative KV-compression methods, composing with memory-efficient sequence mixers (e.g., multi-latent attention, Kimi delta attention) and low-precision KV-cache quantization (e.g., fp8, mxfp8, nvfp4). Finally, in simulated low-memory, long-context inference, KV-sharing improves cache hit rates by up to 31.4%, increases throughput by up to 23.6%, and reduces p90 time-to-first-token by up to 83.6%.
Figures & tables
| Model | Lambada BPB ( ) | Core ( ) | Core-Extended ( ) | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Unshared | Shared | Unshared | Shared | Unshared | Shared | |||||
| Fixed-Point | Parcae 140M | 0.962 | 0.962 | 0.000 | 14.07 | 14.17 | 0.10 | 10.13 | 10.09 | -0.04 |
| Parcae 370M | 0.762 | 0.764 | 0.002 | 20.47 | 19.85 | -0.62 | 13.23 | 13.24 | 0.01 | |
| Parcae 770M | 0.645 | 1.460 | 0.814 | 25.05 | 21.10 | -3.94 | 15.69 | 13.95 | -1.74 | |
| Parcae 1.3B | 0.601 | 2.281 | 1.680 | 28.76 | 21.37 | -7.40 | 16.73 | 13.48 | -3.25 | |
| Huginn 3.5B | 0.429 | 0.429 | 0.000 | 40.97 | 40.53 | -0.44 | 29.06 | 28.61 | -0.44 | |
| Model | Core ( ) | Core-Extended ( ) | |||||
|---|---|---|---|---|---|---|---|
| Unshared | Shared | Unshared | Shared | ||||
| 140M | Parcae | 15.50 | 14.97 | -0.53 | 10.43 | 10.10 | -0.33 |
| + BeNice! | 15.47 | 15.61 | +0.14 | 10.28 | 10.19 | -0.09 | |
| 370M | Parcae | 20.74 | 15.16 | -5.58 | 12.99 | 9.68 | -3.31 |
| + BeNice! | 23.90 | 23.51 | -0.39 | 14.39 | 14.24 | -0.15 | |
| 770M | Parcae | 30.45 | 26.92 | -3.52 | 19.22 | 16.67 | -2.55 |
| Model | Val. PPL ( ) | Core ( ) | Core-Extended ( ) | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Unshared | Shared | Unshared | Shared | Unshared | Shared | |||||
| 770M | Standard FT | 11.86 | 21.61 | +9.75 | 24.74 | 23.42 | -1.32 | 15.34 | 14.54 | -0.80 |
| BeNice! | 11.85 | 11.86 | +0.01 | 25.15 | 25.19 | +0.04 | 15.35 | 15.29 | -0.06 | |
| 1.3B | Standard FT | 10.79 | 18.52 | +7.73 | 29.01 | 27.49 | -1.51 | 17.23 | 16.66 | -0.58 |
| BeNice! | 10.79 | 10.78 | -0.01 | 28.63 | 28.67 | +0.04 | 17.32 | 17.41 | +0.09 | |
Appendix figures & tables18 assets
Supplementary material from the paper’s appendix.
Appendix
| Notation | Description | |
|---|---|---|
| Hidden dimension of the model | ||
| Discrete temporal state axis of on | ||
| Hyperparameter used to select the strength of the auxiliary loss in BeNice! | ||
| Initial prelude block of a recurrent architecture | ||
| Middle recurrent block of a recurrent architecture | ||
| Final coda block of a recurrent architecture |
| Category | Task | Type | Shots | KV Protocol | CORE |
|---|---|---|---|---|---|
| Understanding | HellaSwag (0-shot) [ 74 ] | MC | 0 | QA | ✓ |
| HellaSwag (10-shot) [ 74 ] | MC | 10 | QA | ✓ | |
| LAMBADA [ 47 ] | LM | 0 | QA/PPL | ✓ | |
| Winograd WSC [ 6 ] | S | 0 | QA | ✓ | |
| WinoGrande [ 55 ] | S | 0 | QA | ✓ | |
| BIG-Bench Language ID [ 60 ] | MC | 10 | QA | ✓ |
| Training | Val. PPL ( ) | CORE ( ) | |||||
|---|---|---|---|---|---|---|---|
| Unshared | Shared | Unshared | Shared | ||||
| 140m | Stochastic | 25.68 | 25.67 | -0.02 | 6.41 | 6.48 | +0.08 |
| Static | 24.48 | 25.79 | +1.31 | 9.17 | 8.55 | -0.62 | |
| 370m | Stochastic | 17.34 | 17.36 | +0.02 | 14.49 | 14.36 | -0.13 |
| Static | 17.30 | 20.00 | +2.70 | 15.00 | 14.22 | -0.78 | |
| 770m | Stochastic | 14.03 | 14.04 | +0.01 | 18.91 | 18.78 | -0.13 |
| Model | |||
|---|---|---|---|
| 140M | 0.4588 | 56.3 | 0.82 |
| 370M | 2.2766 | 135.2 | 1.69 |
| 770M | 186.35 | 153.4 | 134.8 |
| 1.3B | 342.65 | 301.6 | 177.5 |
| Model | Baseline: Mean Relative Difference | BeNice! : Mean Relative Difference |
|---|---|---|
| 140M | 0.0526 | 0.0059 |
| 370M | 0.1304 | 0.0059 |
| 770M | 0.0957 | 0.0070 |
| 1.3B | 0.1253 | 0.0049 |
| Model | Val. PPL ( ) | Core ( ) | Core-Extended ( ) | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Unshared | Shared | Unshared | Shared | Unshared | Shared | |||||
| 770M | Parcae | 11.87 | 34.20 | +22.33 | 25.05 | 21.10 | -3.94 | 15.69 | 13.95 | -1.74 |
| + Standard FT | 11.86 | 21.61 | +9.75 | 24.74 | 23.42 | -1.32 | 15.34 | 14.54 | -0.80 | |
| + BeNice! | 11.85 | 11.86 | +0.01 | 25.15 | 25.19 | +0.04 | 15.35 | 15.29 | -0.06 | |
| + BeNice! † | 11.89 | 11.89 | +0.00 | 24.69 | 24.71 | +0.02 | 15.32 | 15.19 | -0.13 | |
| 1.3B | Parcae | 10.78 | 1.6e4 | +1.6e4 | 28.78 | 21.33 | -7.45 | 16.73 | 13.48 | -3.25 |
| Model | Val. PPL ( ) | ||||
|---|---|---|---|---|---|
| Unshared | Layer , Recurrence | Naive Patching | Shared | ||
| MHA | 140M | 15.51 | 15.50 | 15.52 | 16.99 |
| 370M | 11.57 | 11.56 | 11.56 | 3723 | |
| 770M | 9.78 | 9.80 | 10.49 | 36.66 | |
| 1.3B | 8.58 | 8.92 | 12.77 | 9.42 | |
| MLA | 140M | 15.56 | 15.54 | 15.55 | 15.55 |
| Hyperparameter | Model | 2 4 | 2 8 | 4 8 | Mean | BPB ( ) |
|---|---|---|---|---|---|---|
| Learning Rate | 140M | 0.950 | 0.967 | 0.900 | 0.939 | 41.805 |
| Learning Rate | 370M | 0.943 | 1.000 | 0.943 | 0.962 | 26.483 |
| Learning Rate | 770M | 0.829 | 0.829 | 1.000 | 0.886 | 18.373 |
| Muon Momentum | 140M | 0.900 | 0.700 | 0.900 | 0.833 | 37.269 |
| Muon Momentum | 370M | 1.000 | 1.000 | 1.000 | 1.000 | 25.083 |
| Warmup Fraction | 140M | 0.600 | 0.900 | 0.700 | 0.733 | 22.614 |
| Small (140M) | Medium (370M) | Large (770M) | XLarge (1.3B) | ||
| Architecture | Layers in | 2 | 4 | 6 | 8 |
| Layers in | 2 | 4 | 6 | 8 | |
| Layers in | 2 | 4 | 6 | 8 | |
| 768 | 1,024 | 1,280 | 1,536 | ||
| 3,072 | 4,096 | 5,120 | 6,144 | ||
| MHA | Attention | Causal Self-Attention [ 68 ] w/ QK-Norm [ 26 ] | |||
| Optimizer | Parameters |
|---|---|
| AdamW [ 36 ] | Token embeddings ( wte ) |
| LM head ( lm_head ) | |
| Normalization layers ( RMSNorm ) | |
| Value embedding gates ( ve_gate ) | |
| All 1D parameters | |
| Injection parameters ( , , ) |
| Small (140M) | Medium (370M) | Large (770M) | XLarge (1.3B) | |
| AdamW and Muon Learning Rate | ||||
| Warmup Ratio | 0.05 | |||
| Constant Decay Ratio | 0.2 | |||
| Gradient Clipping | 1.0 | |||
| Muon Momentum | 0.95 | |||
| Muon Weight Decay | 0.3 | |||
KV-Cache Reuse
Key-value (KV) cache reuse lets language models reuse previously computed attention states to cut repeated prefill work and serving latency.
See all 73 papers