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

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

TL;DR

ResidualQuant is a novel quantization method designed specifically for "looped Transformers" that achieves near-lossless accuracy even at aggressive 2-bit precision. By exploiting the high similarity of Key-Value (KV) states across recurrent loops, it reduces KV cache memory by over 80% and boosts inference throughput by up to 4.15× on modern GPUs.

What Problem Does This Paper Address?

Looped Transformers (like Ouro or Huginn) are a rising class of models that achieve high parameter efficiency by repeatedly applying the same shared Transformer blocks. While this keeps the model weight footprint small, it creates a massive bottleneck during inference: the KV cache.

Because each loop produces its own set of keys and values, the memory required for the KV cache scales linearly with the number of loops. This quickly exhausts GPU memory, limiting the maximum batch size and slowing down generation. Existing quantization methods, which try to compress these values to 4 bits or fewer, typically suffer from severe accuracy degradation when pushed to the extreme 2-bit regime needed to solve this bottleneck.

Methods

The authors introduce ResidualQuant, which moves away from quantizing each loop's KV states independently. Instead, it uses a "predict-and-compress" approach:

  1. Last-loop Anchor: The method designates the final loop's KV state as a high-precision "anchor" (stored in INT4).
  2. Residual Representation: All other loops are represented as residuals—the difference between their actual state and the anchor. Because states across loops are highly similar, these residuals are much smaller and have fewer outliers than the raw values.
  3. Least-Squares (LS) Scaling: Rather than simple subtraction, the method calculates an optimal scaling factor for each residual to minimize reconstruction error.
  4. Orthogonal Rotations (OptR-H): To further tame any remaining outliers, the residuals are rotated using learned orthogonal matrices before being quantized to INT2.
  5. Loop-wise Mixed Precision: By giving the critical "anchor" loop slightly more bits (INT4) and the residuals fewer (INT2), the system balances accuracy and compression.
Visualizing how inter-loop residuals are much smaller and more uniform than raw KV states, making them easier to quantize.

Datasets

The researchers evaluated ResidualQuant across several challenging benchmarks to ensure broad applicability:

  • Mathematical Reasoning: GSM8K and MATH500.
  • Code Generation: HumanEval and MBPP.
  • Models: The method was tested on the Ouro-1.4B (4 loops) and Huginn-3.5B (32 loops) architectures.

Key Insights and Ideas

  • The "Aha" Moment: The core insight is that in looped Transformers, the KV states don't change drastically from one iteration to the next. This redundancy is a "free lunch" for compression that standard quantization methods ignore.
  • Residuals are "Quantization-Friendly": Raw KV states often have "outlier" channels with massive values that ruin low-bit quantization. Residuals naturally suppress these outliers, allowing 2-bit precision to work effectively for the first time.
  • Anchor Choice Matters: The authors found that using the final loop as the anchor (Last-loop policy) is superior to using the first loop or the previous loop. It provides a more stable reference that reduces average error across all steps.

Key Results

ResidualQuant demonstrates a significant leap in the accuracy-memory tradeoff:

  • Near-Lossless Accuracy: On Ouro-1.4B, ResidualQuant achieved 76.0% accuracy on MATH500, actually slightly exceeding the BF16 baseline of 75.0%, while naive INT2 quantization collapsed to just 27.8%.
  • Massive Memory Savings: It reduced theoretical KV storage by 80.7% compared to the BF16 standard.
  • Real-World Speedups: On an NVIDIA RTX 5090, the reduced memory traffic improved decode throughput by 2.73× for fixed batches. Because the footprint is smaller, it also enabled 4× larger batch sizes, leading to a 4.15× improvement in peak throughput.
Figure 1: ResidualQuant progressively recovers BF16-level accuracy while reducing KV storage and improving decode throughput. Results on Ouro-1.4B with group size 𝑔= 32 in every quantized loop. Left: Starting from 1O direct INT2 quantization, we successively introduce 2O Last-loop residual quantization, 3O least-square scaling, 4O rotation, and 5O 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× the peak decode throughput and 4× the largest feasible batch size compared to the BF16 counterpart.

Limitations and Future Work

  • Anchor Latency: Because the "Last-loop" anchor isn't available until the final loop finishes, the system must temporarily store the current token's KV states in high precision (BF16) during the prefill/decode step before they can be compressed.
  • Architecture Specificity: The current implementation is tailored for looped Transformers. While the authors showed the principle also works for activation quantization in standard models, the massive KV cache gains are specific to recurrent architectures.
  • Kernel Optimization: Achieving the reported speedups requires custom CUDA kernels that can reconstruct the KV states "on-the-fly" during the attention mechanism to avoid the overhead of writing dequantized values back to main memory.

Summary updated

BibTeX
@misc{kim2026residualquant,
  author = {Heejun Kim and Junyoung Lee and SangLyul Cho and Dongsu Han and Insu Han and Sehoon Kim},
  title = {{ResidualQuant: KV Cache Quantization for Looped Transformers with 2-Bit Residuals}},
  year = {2026},
  eprint = {2610.10381},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.10381},
}
Figure