LoopKV: Per-Cell KV Cache Compression for Looped Transformer Serving
For looped transformers, the right granularity for KV cache compression is the (loop, layer) cell, not the whole layer or the whole loop; the price is a one-time per-model profile and a KL proxy for damage.
On this page
You have one RTX PRO 6000 and must decide how many 16K-context Ouro-1.4B requests it can serve. The default answer is simple: compress the intermediate results the model rereads while generating each token to 4 bits, just as you would for a dense model. That default is wrong here. Ouro-1.4B runs the same block four times and keeps a separate copy of those intermediates for each run; one uniform bit width moves precision away from the layers that need it. LoopKV profiles every (loop, layer) cell once, then chooses 4-bit storage, 2-bit storage, or a pointer to the final loop's copy [1].
The cache, not the weights, is what fills the GPU
Start with the byte budget. Ouro-1.4B has four loops, 24 layers, 16 KV heads of dimension 128, and stores 768 KiB of key-value cache (KV cache, the intermediate results a model rereads for every generated token) per token in BF16 [1]. Its 2.5 GB of weights are read four times per decode step. A larger batch amortizes those weight reads, but the cache is charged per request: the KV pool sets how many requests fit in a batch. At BF16's peak-throughput batch for 8K contexts, KV accounts for 84% of the bytes each decode step reads. Uniform-bit quantization (quantization, replacing 16-bit floats with fewer-bit integer codes) and fixed per-loop rules both assume that every layer in a loop, or every loop for a layer, has the same sensitivity. The measurements say otherwise.
A looped transformer (one block of layers run several times per token instead of stacking more layers) therefore has a different byte ledger. LoopKV compresses only the cache. It keeps the architecture, the number of loops and the weights unchanged, and tries to put precision where it matters.
Three measurements: sensitivity lives in the (loop, layer) cell
The paper measures damage cell by cell on Ouro-1.4B. Damage is KL divergence (how much the compressed model's next-token distribution differs from the exact model's), in units of the cheapest whole-loop sharing; a 32-token sink and a 256-token window stay BF16, and each 32-token page is processed when it leaves the window.
First, sensitivity is cell-specific. Quantizing one of the 72 cells to INT2 (2-bit integer codes) at a time, the top 19 cells hold half of the total difference. Loop 1 and four middle layers (7, 8, 10, 11) cause most of the damage; those four middle layers are on average 4.9× as sensitive as the other layers and hold half the total damage, while the last layers add almost nothing. At INT4, three quarters of all cells cost less than 1% of KL share. Cell damages also add up approximately to the final KL, so one offline profile predicts a plan's damage before serving.
Second, some cells can share the final loop's KV at less damage than storing their own INT2 copy: 21 of 24 loop-3 layers and 6 loop-2 layers, but no loop-1 layer.
Third, loops compound read errors. Page skipping in all four loops costs 1.8× the sum of its one-loop damages in KL, over 50% more than the at most 1.17× of plain models such as Qwen2.5 and Qwen3. At equal bytes, LoopKV-style reads, which keep the pages and read low-attention values at 2 bits, cause 4.7× less damage. Loops 3 and 4 also attend to different tokens (Jaccard, the overlap ratio of two sets, is 0.83), so which values need full precision depends on the reading loop and must be decided at run time.
How LoopKV puts three choices into one decode step
LoopKV gives each (loop, layer) cell one of three storage options:
- 4-bit codes: store its own high-precision copy;
- 2-bit codes: store a low-precision copy;
- a pointer: reuse the final loop's KV directly.
A one-time offline profile measures each cell's damage under each option, then a knapsack planner minimizes bytes read per decode step under budgets for predicted damage and storage. A tight storage budget gives LoopKV-M; no storage budget gives LoopKV-R.
At decode time, every 4-bit value is stored as a high and a low 2-bit plane. Each loop reads the high plane first and fetches the low plane only for tokens its own attention marks as needing 4-bit precision. That is what lets two loops sharing a block read the same cache at different precisions without extra bytes. A single fused kernel in vLLM executes every cell type in one launch; with the whole-step CUDA graph (a recorded, replayable graph of the decode step), LoopKV-M cuts host launches per decode step from 504 to 17 [1].
35% and 1.7–2.2×: how to read the numbers
On one RTX PRO 6000 serving Ouro-1.4B with a 16K maximum length, the latency SLO (service-level objective: a first token within 10 s and a mean time per output token below 55.8 ms). LoopKV-M stores 35% less KV than KIVI-4 on the same fused kernel and CUDA graph, and sustains 1.7–2.2× KIVI-4's goodput (goodput, the highest request rate that still meets the SLO). Figure 5 reports 8.0× BF16's goodput and 2.0× KIVI-4's. Across Ouro-1.4B, Ouro-2.6B and Dory-4B at 16K context on three GPU types, LoopKV-M reaches 1.13–4.44× the decode throughput of vLLM's BF16 cache; no suite average falls more than 0.5 percentage points below BF16's, over up to six suites per model. On Ouro-1.4B, LoopKV-M and LoopKV-R keep the exact model's top token at 99.63% and 99.72% of positions.
| Plan | KV storage | Goodput under SLO | Accuracy |
|---|---|---|---|
| KIVI-4 (uniform 4-bit) | reference | 1.0× (same-kernel control) | no significant drop reported |
| LoopKV-M | 35% less than KIVI-4 | 1.7–2.2× KIVI-4; 8.0× BF16 | six-suite average not significantly below BF16 |
| LoopKV-R | no storage budget | below M in Figure 5 | not significantly below BF16 |
| BF16 | unquantized | Figure 5 reference | — |
Read the numbers carefully. The 35% is storage relative to KIVI-4, not BF16. The 1.7–2.2× is SLO goodput, not a single-kernel speedup. The benchmark claim is about suite averages, not every task. And the six-suite result is on Ouro-1.4B; the broader cross-model claim is 0.5 percentage points on up to six suites.
Where it stops: it saves KV reads, not every kind of work
Boundaries. LoopKV needs a per-model offline profile: sensitivity differs across Ouro-2.6B, Dory-4B and Huginn-3.5B, so a plan does not transfer. It compresses the bytes read from the KV cache per decode step; it does not reduce weight reads or change the number of loops, so gains shrink when contexts are short or weight reads dominate. Its damage budget is a KL proxy; KL share is a unit, not an acceptance threshold, and task scores still need separate testing. The implementation depends on a vLLM fused kernel and a whole-step CUDA graph, so another serving stack requires re-engineering.
It fits looped models with per-loop KV, long contexts, KV-dominated decode bytes, and a team willing to profile each model. For a dense model, short contexts, or a stack you cannot modify, uniform 4-bit remains the safer default.
