When AI models engage in long-horizon reasoning, they consume massive amounts of memory. They use a structure known as the KV-cache (a buffer storing Key and Value tensors for past tokens). To save space, engineers use quantization (mapping high-precision numbers to fewer bits). However, as models generate tokens one by one, quantization errors pile up. This causes the model to lose its train of thought during complex tasks.
Recent research from Huawei introduces KVarN. This method is designed to stop this error accumulation. It combines a mathematical rotation with a specialized scaling technique. KVarN aims to keep compressed memory stable during very long generation sequences.
The Problem
Current KV-cache quantization focuses on the "prefill" stage. This is the initial moment a model processes a large prompt in parallel. State-of-the-art methods like KIVI work well in these static settings. However, they struggle during autoregressive decoding (the sequential generation of tokens).
The authors identify a fundamental flaw. Standard methods fail to preserve per-token scales (the relative magnitude of the vectors). Errors in the Key (K) matrix are driven by incorrect token magnitudes rather than directional distortion. These errors do not stay constant. Instead, they compound. As shown in, errors from one timestep flow into the next.
This creates a feedback loop of inaccuracy. This is lethal for reasoning tasks. A single error early in a chain of thought invalidates the whole result. The paper shows that magnitude errors drive the largest quantization outliers [Figure 1a].
How It Works
KVarN addresses both the "shape" and the "scale" of the data. The architecture relies on two core transformations applied before compression:
- Incoherence Processing via Hadamard Rotation: The method applies a Hadamard transform in the channel dimension. This is a mathematical rotation that redistributes information more uniformly. It effectively smooths out extreme outliers in the channel space. This can be applied online with $O(N \log N)$ complexity. It can also be absorbed into existing model weights .
- Dual-Scaling Variance Normalization: This is the critical addition. Rotation handles channel outliers but ignores token-wise scaling issues. KVarN uses a "dual-scaling" approach. It normalizes variance across both the token and channel axes. The process uses an iterative algorithm to balance the rows and columns of the K and V matrices. This ensures variance is approximately uniform before quantization .
By combining these, KVarN minimizes the "magnitude" component of the error [Figure 1b]. The quantized values represent the original signal with higher fidelity. This prevents exponential error growth during long-horizon decoding.
Numbers
The authors report that KVarN establishes a new state-of-the-art for 2-bit precision. On the AIME24 reasoning benchmark using Qwen3-4B, KVarN achieved 60.0% accuracy. This outperformed the KIVI baseline of 55.5% [Table 1]. Similar gains were observed on MATH500 and HumanEval.
The implementation overhead is remarkably low. The authors measured the cost of variance-normalization on a GPU. For a Qwen3-4B model, normalization took only 1.9 ms. Standard token generation took 1050 ms. This represents a measured overhead of just 0.18% .
KVarN uses two scales instead of the single scale used by KIVI. However, fusing the second scale into the dequantization kernel (the math used to restore high precision) keeps latency increases below 1.4% .
What's Missing
There are gaps a production engineer should consider. First, the paper does not explore how KVarN interacts with Multi-Head Latent Attention (MLA). MLA is a compressed attention mechanism used in some newer models. It is unclear how this mechanism reacts to variance normalization.
Second, the evaluation is limited to specific model families like Qwen, Llama, and Phi. The interaction between quantization and specific architectural quirks remains unverified.
Finally, end-to-end deployment testing is difficult. Current mainstream serving frameworks do not yet natively support 2-bit KV-caches. Therefore, actual throughput improvements in production environments remain unproven.
Should You Prototype This
Yes, if you are optimizing for long-context reasoning or "Chain of Thought" scaling. The core insight is vital. Preserving token magnitude is more important than minimizing raw Mean Squared Error (MSE) for decoding stability.
The implementation cost appears manageable. The authors provided a vLLM implementation at https://github.com/huawei-csl/KVarN. The computational overhead is negligible at 0.18%. The accuracy wins on reasoning benchmarks make this a high-leverage optimization for long-sequence generation.
Figures from the paper
How this was made
Model: nvidia/Gemma-4-26B-A4B-NVFP4
Persona: habr_engineer
Refinement: 0
Pipeline: forge-1.0
Evaluator: nvidia/Gemma-4-26B-A4B-NVFP4
Score: 97% (passed)
Claims verified: 18 / 18
Model: nvidia/Gemma-4-26B-A4B-NVFP4
NVIDIA GB10 · 128 GB unified · NVFP4 · 100% local · $0 cloud
Tokens: 96,036
Wall-time: 329.8s
Tokens/s: 291.2