OpenRadar

Project · Python · Added June 8, 2026

kvarn

KVarN is a vLLM KV-cache quantization backend from Huawei that delivers 3-5x more context capacity with FP16-level accuracy — one flag, no calibration.

366 stars 18 forks View on GitHub

KVarN

Overview

KVarN is a variance-normalized KV-cache quantization backend for vLLM, developed by Huawei’s Central Software Lab. It arrived on GitHub on May 29, 2026, and picked up 366 stars in its first ten days — a pace that reflects how desperate the LLM inference community is for something that actually works in production. The project has an accompanying research paper on arXiv (2606.03458), which gives it more academic credibility than most “we quantized something” repos.

The team behind KVarN includes Lorenz K. Müller, Philippe Bich, Chiara Boretti, and others from Huawei CSL — the same group that publishes regularly on efficient inference. This isn’t a weekend hack. The paper describes a four-stage pipeline (Hadamard rotation, variance normalization, asymmetric quantization) that targets the specific failure mode of existing KV-cache quantization: accuracy collapse on reasoning tasks.

The core problem KVarN solves is straightforward but significant. Running LLM agents with long contexts eats GPU memory fast. The KV-cache — the key-value pairs stored for each token in each attention layer — is the main memory bottleneck. Existing quantization methods like TurboQuant can compress the cache, but vLLM’s own benchmarks show they drop throughput by 40-52% while only offering 2.3-3.7x capacity gains. That trade-off is why most production deployments still run FP16. KVarN claims to break that trade-off: 3-5x capacity, FP16-level accuracy, and throughput that actually beats FP16 on burst workloads.

Why it matters

If you’re building AI agents that need to maintain long conversation histories, process large documents, or run multiple concurrent sessions, KV-cache memory is your bottleneck. Every serious inference framework — vLLM, TensorRT-LLM, SGLRT — has been wrestling with this problem. The standard approach has been “quantize aggressively and hope the accuracy loss is tolerable.” KVarN takes a different angle: instead of accepting accuracy loss, it preprocesses the cache to make quantization less lossy in the first place.

The timing matters too. vLLM v0.22.0 shipped with TurboQuant as its built-in KV-cache quantization option, but the community quickly discovered its throughput penalty made it impractical for high-traffic deployments. KVarN positions itself as the alternative that doesn’t force you to choose between memory efficiency and serving speed. For teams running LLM inference at scale — especially those deploying agentic workloads where context windows keep growing — this is the kind of infrastructure improvement that compounds.

What’s particularly interesting is the MLA (Multi-head Latent Attention) support. DeepSeek, GLM, and other modern architectures use MLA to compress the KV-cache natively. KVarN is the first vLLM-compatible sub-8-bit quantization method that works on these compressed latents, which means it’s future-proofed for the architectures that are gaining traction.

Key Features

Variance-Normalized Quantization Pipeline. KVarN’s four-stage pipeline is the core innovation. It applies a Hadamard rotation to spread channel outliers, then uses iterative Sinkhorn-like variance normalization to equalize variance across the tile, and finally applies asymmetric round-to-nearest quantization. The insight is that quantization error accumulates differently in reasoning tasks than in simple generation — KVarN’s normalization specifically targets that accumulation pattern.

Calibration-Free Operation. Most quantization methods require calibration data — you need to run representative inputs through the model to determine optimal quantization parameters. KVarN skips this entirely. The variance normalization adapts on-the-fly to each tile, so there’s no offline calibration step. You add one flag to your vLLM command and it works. This matters for teams that serve diverse workloads where “representative data” is a fiction.

FP16-Level Accuracy on Reasoning Tasks. On Qwen3-32B with AIME25 (a math reasoning benchmark), KVarN matches FP16 accuracy exactly. This isn’t “close enough” — it’s parity. The arXiv paper shows this holds across multiple model families and task types, including the long-context reasoning scenarios where other quantization methods degrade most visibly.

Throughput Above FP16. This is the surprising result. On burst workloads (16K context, TP=2), KVarN actually beats FP16 throughput by about 1.3x. The mechanism is straightforward: with 3-5x more KV-cache capacity, the scheduler can batch more requests together, and the quantization overhead is more than offset by the batching gains. For serving teams, this means KVarN isn’t just a memory optimization — it’s a throughput optimization.

MLA Model Support. KVarN is the first sub-8-bit KV-cache quantization that works with Multi-head Latent Attention architectures. On GLM-4.7-Flash (TP=2), it delivers 2.77x KV capacity at accuracy parity with bf16. This is important because MLA models are becoming standard — DeepSeek, GLM, and others all use variants of it — and existing quantization methods don’t handle the compressed latent representation.

Native vLLM Integration. KVarN is a vLLM fork (v0.22.0-based), not a standalone library. It uses Triton kernels that JIT-compile at runtime, so there’s no separate build step for different GPU architectures. The kv_cache_dtype="kvarn_k4v2_g128" flag is the only change to your existing vLLM code. Serving works identically — vllm serve with the same flag.

4-bit Keys, 2-bit Values Preset. The shipped configuration (kvarn_k4v2_g128) allocates more bits to keys than values — 4-bit keys, 2-bit values with 128-token tiles. This asymmetric allocation is based on the empirical finding that key quantization errors propagate more aggressively in autoregressive generation. The tile size of 128 matches vLLM’s block size, keeping the integration clean.

Use Cases

Pros and Cons

Pros:

Cons:

Getting Started

# Clone KVarN (vLLM v0.22.0 fork)
git clone https://github.com/huawei-csl/KVarN.git
cd KVarN

# Install using precompiled vLLM wheel; KVarN kernels are Triton, JIT-compiled
VLLM_USE_PRECOMPILED=1 pip install -e .

Use it in Python:

from vllm import LLM, SamplingParams

llm = LLM(
    model="Qwen/Qwen3-32B",
    dtype="float16",
    kv_cache_dtype="kvarn_k4v2_g128",  # enable KVarN
    block_size=128,
)
print(llm.generate(
    "Explain KV-cache quantization in one sentence.",
    SamplingParams(max_tokens=64)
)[0].outputs[0].text)

Or serve directly:

vllm serve Qwen/Qwen3-32B \
    --dtype float16 \
    --kv-cache-dtype kvarn_k4v2_g128 \
    --block-size 128

For tight single-GPU setups, add VLLM_MEMORY_PROFILER_ESTIMATE_CUDAGRAPHS=0 to recover full capacity.

Alternatives

TurboQuant (vLLM built-in) — vLLM’s native KV-cache quantization available since v0.22.0. TurboQuant is simpler to enable (just a dtype flag) and doesn’t require a fork, but vLLM’s own benchmarks show 40-52% throughput loss for 2.3-3.7x capacity. Choose TurboQuant if you want the official vLLM path and can tolerate the throughput penalty. Choose KVarN if throughput and accuracy are non-negotiable.

KIVI — An earlier KV-cache quantization method that focuses on per-channel quantization with outlier handling. KIVI doesn’t require a fork and works as a standalone library, but it targets 2-bit quantization without the variance normalization step that KVarN uses. Results are model-dependent, and KIVI doesn’t support MLA architectures. Choose KIVI for simpler integration on dense attention models where moderate accuracy loss is acceptable.

SGLang with RadixAttention — SGLang takes a different approach entirely: instead of quantizing the cache, it uses radix tree-based prefix sharing to reuse KV-cache entries across requests with common prefixes. This is complementary to quantization (you could use both), but it only helps when requests share prefixes. Choose SGLang’s approach for prompt-heavy workloads with high prefix overlap; choose KVarN for general-purpose capacity expansion.

Verdict

KVarN is the most promising KV-cache quantization work I’ve seen for vLLM. The research is solid — the arXiv paper has rigorous benchmarks across multiple model families, and the results (FP16 accuracy with above-FP16 throughput) are genuinely surprising. The calibration-free design and single-flag integration make it practical to evaluate, which matters more than most researchers realize. The main risk is that it’s a vLLM fork, which creates maintenance burden, and 366 stars means the community is still small. But if you’re running vLLM in production and hitting KV-cache memory walls — especially with agent workloads that need long contexts — KVarN is worth benchmarking today. The fact that it comes from Huawei’s research lab with a proper paper behind it gives it more staying power than typical GitHub quantization projects.

Related

Shared tags