arXiv(opens in a new tab)cs.LGOct 2026Cited by 5 papers on PaperVantage

Manuscript Offprint

arXiv:2610.10381

ResidualQuant: KV Cache Quantization for Looped Transformers with 2-Bit Residuals

Heejun Kim, Junyoung Lee, SangLyul Cho, Dongsu Han, Insu Han, Sehoon Kim

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Heejun Kim 1^{1} Junyoung Lee 2^{2} SangLyul Cho 3^{3} Dongsu Han 1^{1} Insu Han 1^{1} Sehoon Kim 1,†^{1,\dagger}

1^{1}KAIST, 2^{2}Yonsei University, 3^{3}Seoul National University

Abstract: Looped Transformers improve parameter efficiency by repeatedly applying shared Transformer blocks over multiple recurrent loops, increasing computational depth without increasing the parameter count. However, KV cache memory still scales with the number of loops, becoming a key memory bottleneck that limits batch size and inference throughput. KV cache quantization can alleviate this bottleneck, but existing methods often suffer substantial accuracy degradation at aggressive low-precision regimes. We observe that looped Transformers offer a unique opportunity: KV states across loops are highly similar. Based on this observation, we propose RESIDUALQUANT, which uses the final-loop KV states as a reference and represents the remaining loops with low-precision residuals. Our method further combines least-square scaling and rotations applied to the residuals, as well as loop-wise mixed precision, to enable accurate quantization down to INT2 while retaining efficient reconstruction. Across multiple looped Transformer models and mathematical reasoning and code generation benchmarks, RESIDUALQUANT consistently improves the accuracy–memory tradeoff over state-of-the-art rotation-based KV quantization. In particular, our method retains accuracy close to BF16 under mixed-precision settings while reducing theoretical KV storage by 80.7%, achieving up to 13.0% higher accuracy than the rotation-based baseline at the same memory budget. On an RTX 5090, the reduced KV memory traffic improves fixed-batch decode throughput by up to 2.73×, while the smaller memory footprint enables up to 2× larger batches, improving peak throughput by up to 4.15×.

Project page: https://seal-kaist.github.io/projects/ResidualQuant

Figure

Figure 1: RESIDUALQUANT progressively recovers BF16-level accuracy while reducing KV storage and improving decode throughput. Results on Ouro-1.4B with group size g=32g = 32 in every quantized loop. Left: Starting from ① direct INT2 quantization, we successively introduce ② Last-loop residual quantization, ③ least-square scaling, ④ rotation, and ⑤ mixed precision to achieve RESIDUALQUANT. Accuracy increases from 27.8% to 76.0%, matching the BF16 baseline of 75.0%, while KV cache storage is reduced by 80.7%. Right: At 8k context on an RTX 5090, RESIDUALQUANT achieves 3.27×3.27\times the peak decode throughput and 4×4\times the largest feasible batch size compared to the BF16 counterpart.

1. Introduction

Recursive or looped Transformers refine latent representations by repeatedly applying shared modules, increasing computational depth without increasing the parameter count (Dehghani et al., 2019; Saunshi et al., 2025; Suleymanzade et al., 2026; Wang et al., 2026b). Models such as Huginn (Geiping et al., 2025) and Ouro (Zhu et al., 2025) exploit this structure through adjustable recurrence or adaptive depth allocation, requiring less weight storage than models with distinct parameters at the same computational depth. However, each loop produces distinct keys and values, making KV cache memory grow with recurrent depth, in addition to context length and batch size, despite weight sharing. This limits the extent to which weight savings translate

† Corresponding author: Sehoon Kim.

into larger batches and higher throughput, making KV cache memory reduction an important challenge for realizing the full efficiency benefits of looped Transformers.

To reduce this storage overhead, prior work has explored sharing or reusing KV states across recurrences. MoR (Bae et al., 2025b) reuses KV states from the first recursion, PLT (Wu et al., 2025) combines first-loop global KV with local attention in subsequent loops, and MELT (Vendrell et al., 2026) updates shared KV states through learned gates. While these approaches reduce storage, sharing KV states across loops can discard loop-specific information and degrade accuracy when representations differ across loops.

KV quantization offers an alternative approach that preserves distinct KV states for each loop while reducing their storage precision. Because KV memory grows with recurrent depth, aggressive low-precision quantization is particularly desirable for looped Transformers. However, existing KV quantization methods (Hooper et al., 2024; Liu et al., 2024), including state-of-the-art rotation-based approaches (Ashkboos et al., 2024; Yun et al., 2026; Zhou et al., 2026), often suffer substantial accuracy degradation in sub-4-bit regimes. Looped Transformers, however, present a unique opportunity: KV states from different loops are closely related because they are generated by repeatedly applying the same shared modules. This creates strong similarity between KV states across loops as shown in Figure 2, which can be exploited to improve low-bit quantization.

Motivated by this inter-loop similarity, we propose RESIDUALQUANT, a loop-aware KV cache quantization method that represents each loop's KV states as residuals from those of a reference anchor loop. The resulting residuals (e.g., Figure 2, right) are more robust to low-bit quantization, enabling aggressive KV cache compression using INT2 precision while preserving loop-specific information. Our main contributions can be summarized as follows:

• We introduce RESIDUALQUANT, which reconstructs loop-specific KV states using the final-loop KV states as an anchor and stores their differences as low-precision residuals (Section 3.2). We further apply least-squares residual scaling, learned rotations (Section 3.3), and loop-wise INT4/INT2 mixed precision (Section 3.4), which together enable an effective balance between low-bit quantization accuracy and runtime efficiency.

• We show that RESIDUALQUANT substantially improves the accuracy–memory tradeoff over state-of-the-art rotation-based KV quantization across Ouro-1.4B and Huginn-3.5B on reasoning and code generation benchmarks. In particular, our INT2/4 configuration reduces theoretical KV storage by 80.7% relative to BF16 while retaining accuracy close to BF16, whereas baseline methods degrade sharply at the same KV cache budget (Section 5.1).

• We demonstrate that these KV memory savings translate directly into higher inference throughput. At 16k context on an RTX 5090, RESIDUALQUANT improves fixed-batch decode throughput by 2.73×2.73\times through reduced KV cache memory traffic. Its smaller KV memory footprint further increases the largest feasible tested batch size by 2×2\times, yielding a 4.15×4.15\times improvement in peak decode throughput over BF16 (Section 5.3).

• We further show that the same residual reconstruction principle extends to activation quantization, consistently improving accuracy over existing quantization methods, including state-of-the-art weight–activation quantization methods such as LoopQ (Fang et al., 2026) and FlatQuant (Sun et al., 2025) (Section 5.4).

References (79)

  • QuaRot: Outlier-Free 4-Bit Inference in Rotated LLMs
  • Program Synthesis with Large Language Models
  • Relaxed Recursive Transformers: Effective Parameter Sharing with Layer-wise LoRA
  • Mixture-of-Recursions: Learning Dynamic Recursive Depths for Adaptive Token-Level Computation
  • Deep Equilibrium Models
  • PonderNet: Learning to Ponder
  • LSQ+: Improving Low-Bit Quantization Through Learnable Offsets and Better Initialization
  • QuIP: 2-Bit Quantization of Large Language Models With Guarantees
  • Evaluating Large Language Models Trained on Code
  • LoopSpec: Pipelined Self-Speculative Decoding for Looped Transformers (opens arXiv in a new tab)
  • Training Verifiers to Solve Math Word Problems
  • Universal Transformers
  • Looped Transformers for Length Generalization
  • LoopQ: Quantization for Recursive Transformers (opens arXiv in a new tab)
  • Scaling up Test-Time Compute with Latent Reasoning: A Recurrent Depth Approach
  • Alex Graves. Adaptive Computation Time for Recurrent Neural Networks. arXiv:1603.08983, 2016. (opens arXiv in a new tab)
  • KVQuant: Towards 10 Million Context Length LLM Inference with KV Cache Quantization
  • Alexia Jolicoeur-Martineau. Less is More: Recursive Reasoning with Tiny Networks. arXiv:2510.04871, 2025. (opens arXiv in a new tab)
  • Efficient Memory Management for Large Language Model Serving with PagedAttention
  • ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
  • Let's Verify Step by Step
  • Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generation
  • SpinQuant: LLM Quantization with Learned Rotations
  • KIVI: A Tuning-Free Asymmetric 2bit Quantization for KV Cache
  • Reasoning with Latent Thoughts: On the Power of Looped Transformers
  • RotateKV: Accurate and Robust 2-Bit KV Cache Quantization for LLMs via Outlier-Aware Adaptive Rotations
  • Thinking with Looped Flows
  • FlatQuant: Flatness Matters for LLM Quantization
  • Memory-Efficient Looped Transformer: Decoupling Compute from Memory in Looped Language Models (opens arXiv in a new tab)
  • Hierarchical Reasoning Model (opens arXiv in a new tab)
  • SMELT: Scaling Laws for Compute-Matched MoE Looped Transformers
  • RecurTrace: Adaptive Latent Reasoning with Loop-Time Memory
  • Parallel Loop Transformer for Efficient Test-Time Computation Scaling (opens arXiv in a new tab)
  • FlashLoop: Fast and Memory-Efficient Looped Transformers via Lazy Updates (opens arXiv in a new tab)
  • Output-Aware Rotation for INT2 KV-Cache Quantization (opens arXiv in a new tab)
  • OSCAR: Offline Spectral Covariance-Aware Rotation for 2-bit KV Cache Quantization (opens arXiv in a new tab)
  • Scaling Latent Reasoning via Looped Language Models (opens arXiv in a new tab)
  • Experiments are conducted on NVIDIA RTX 5090 and NVIDIA RTX PRO 6000 Blackwell GPUs, with the latter equipped with 96 GB of memory
  • Ouro-1.4B uses plain-text prompts, while Huginn-3.5B uses its tokenizer's chat template
  • For mathematical reasoning, GSM8K is scored by exact match on extracted final answers, and MATH500 is scored using Math-Verify
  • For a group of $L$ loops with equal KV sizes
  • The term $16/g_{r}$ accounts for the two FP8 metadata values—a scale and an offset—stored for each quantization group
  • Its amortized storage cost is
  • The four configurations in Table 2 are uniform INT2 with $g = 32$, uniform INT2 with $g = 16$, mixed INT2/4 with $g = 32$, and mixed INT2/4 with $g = 16$
  • The data come from physical layer 3 and KV head 2 of Ouro-1.4B, with both indices starting at 1
  • Residual quantization with LS scaling and shared OptR-H rotations reconstructs states in the rotated space $Z_r = U X_r$, yielding $\widehat{X}_r = U^\top \widehat{Z}_r$ in the original space
  • The reconstructed anchor and residuals are
  • The fixed key means $\mu_{a}$ and $\mu_{r}$ correspond to the rotated anchor and residuals
  • This order describes reconstruction dependencies
  • the shared anchor and that loop's residual
  • Each group uses one final INT4 anchor
  • ><tr><td>Schedule</td><td>$g$</td><td>$b_{\mathrm{eff}}$</td><td>w/o OptR-H</td><td>w/ OptR-H</td></tr><tr><td>BF16</td><td>$-$</td><td>$16$</td><td>$42.84$</td><td></td></tr><tr><td rowspan=
  • Separate $96\times 96$ rotations for K and V are learned for each group, layer, and head and shared within the group
  • Increasing the group length from four to sixteen loops reduces effective bitwidth from 3.5 to 3.3 at $g=16$ and from 3.1 to 2.8 at $g=32$
  • MATH500 accuracy (%) on Ouro-1.4B with uniform INT2, uniform INT4, and mixed INT2/4
  • This section describes how the rotation matrices are calibrated offline and how the resulting fixed matrices are applied during inference
  • The row-vector rotation corresponding to the main text's column-vector rotation $U$ is $T = U^\top$, applied to $X$ as $XT$
  • Eigenvectors align important directions, while Hadamard mixing and permutation redistribute them across groups
  • Let $\widehat{S} = \text{softmax}(Q\widehat{K}^\top/\sqrt{D})$ and let $W_O$ denote the output projection for the head
  • The K rotation is selected first, and V rotation learning then fixes $\widehat{S}$ computed from reconstructed K. Output projection error is evaluated per head using $W_O W_O^\top$
  • Each step uses the last 64 queries from two calibration examples
  • Ouro-1.4B uses $128 \times 128$ rotations, while Huginn-3.5B uses $96 \times 96$ rotations matching its head dimension
  • Returning to column-vector notation, let $Z_r = U X_r$
  • The cache stores integer codes, group-wise FP8 scales and offsets, and BF16 LS coefficients for residuals
  • Rotated KV for past tokens is reconstructed as $\widehat{Z}_4=A$ and $\widehat{Z}_r=\alpha_rA+\mathcal{D}_2(c_r)+\mu_r$
  • Weight and activation codes use INT4, while KV caches remain in BF16
  • The first loop directly quantizes the full activation
  • We apply residual quantization with LS scaling to QKV, attention output, MLP gate/up, and down projections
  • Its LS residual variant initializes from the corresponding direct artifact and undergoes a further 15 epochs of calibration through the residual computation path, using the same calibration tokens and batch size
  • GSM8K uses flexible-extract exact match, with three-shot plain-text prompts for Ouro-1.4B and eight-shot prompts using the authors' chat template and system instruction for Huginn-3.5B
  • Huginn-3.5B MATH500 uses the four-shot minerva_math500 task with plain-text prompts, no chat template or system instruction, a 2,048-token generation limit, and Minerva exact match
  • Model-specific prompts and scoring settings are shared between direct and LS residual variants
  • At 8k context, peak throughput increases from 113.1 to 367.4 tokens/s ( $3.25\times$), while the largest tested feasible power-of-two batch increases from 4 to 16
  • While its quantization method is motivated by a similar observation of inter-loop redundancy, RESIDUALQUANT improves both quantization accuracy and runtime efficiency, enabling residual KV states to be reduced from INT4 to INT2
  • MATH500 accuracy on Ouro-1.4B and average KV bitwidth during prefill and decode
  • ><tr><td rowspan=
  • RESIDUALQUANT is orthogonal to FlashLoop's sparse KV update and attention mechanisms
  • All methods use the same model revision, zero-shot plain prompts, greedy decoding, seed 0, and a 2,048-token generation limit, with answers scored using Math-Verify
  • With $g = 16$, RESIDUALQUANT reaches 74.4% accuracy compared with 72.8% for FlashLoop, while reducing average bitwidth from 2.64 to 2.18 for prefill and from 4.50 to 3.47 for decode