Skip to content
AI.info

Research

PN-Mix: Pair-Norm Guided Mixed-Precision Key Cache Quantization for Efficient Long-Output LLM Inference

Overview Research area: Machine learning systems — specifically KV-cache quantization for memory- and bandwidth-efficient LLM inference (long-output decoding). Technical level: Advanced. The paper rel

PN-Mix: Pair-Norm Guided Mixed-Precision Key Cache Quantization for Efficient Long-Output LLM Inference
arXiv
2610.19605
Published
2026-10-14
Authors
Gil Jae Song, Sungjoo Yoo

AI summary

Overview

Research area: Machine learning systems — specifically KV-cache quantization for memory- and bandwidth-efficient LLM inference (long-output decoding).

Technical level: Advanced. The paper relies on attention-logit perturbation analysis at the RoPE channel-pair level plus an online quantization implementation; the core intuition is explainable, but the derivation and system details assume familiarity with transformer attention and GQA.

Scope (one sentence): PN-Mix is a mixed-precision key-cache quantization scheme that uses a query–key pair-norm importance score, computed once during prefill at the RoPE channel-pair granularity, to allocate higher precision to salient key channel pairs throughout decoding.

What This Paper Is About

Long-output LLM inference (code generation, long chain-of-thought reasoning) is bottlenecked by the KV cache, which grows linearly with sequence length and batch size and limits both batch size and maximum generation length. Quantizing the cache to low bit-widths (e.g., 2-bit) saves memory but badly degrades accuracy, so the paper asks: which parts of the key cache deserve the limited bit budget, and how can that be decided cheaply? PN-Mix answers by ranking RoPE channel pairs using the product of query and key pair norms, which the authors show is what actually governs how much a quantization error perturbs the attention logits.

Key Contributions

  1. A query-aware saliency criterion. The authors derive, from attention-logit perturbation analysis, a saliency score for RoPE channel pairs based on query–key pair-norm products — the term that multiplies (and therefore scales the impact of) the quantization-induced perturbation in each pair, rather than key statistics alone.
  2. The PN-Mix method. A mixed-precision key-cache quantization scheme for RoPE-based decoder-only LLMs that assigns more bits to the top-r% salient channel pairs, computed from the prefill tokens and stored as a binary mask of size B × L × Hᵏᵛ × (d/2) bits per batch.
  3. Prefill-once, reuse-throughout-decoding selection. The paper shows that salient pairs identified at prefill remain predictive of saliency during decoding, which removes both offline calibration (unlike ChanMix) and repeated per-group saliency recomputation and index management (unlike Kitty).
  4. Empirical validation across standard reasoning, code-generation, and AIME benchmarks on Llama and Qwen models from 8B to 32B parameters, showing comparable or better average accuracy at 2.26 average key bits than prior mixed-precision methods using 2.32–2.39 bits.

Main Findings

  • Keys are more quantization-sensitive than values. Under a 2.25-bit budget on AIME with DeepSeek-R1-Distill-Llama-8B and Qwen3-8B (up to 32K generated tokens), value-only quantization degraded less than key-only quantization even without sink-token protection; with the first 32 tokens kept in FP16, value-only quantization approached the FP16 baseline while key-only quantization still showed non-negligible degradation.
  • The Q̃K̃ pair norm is the best saliency criterion tested. In an H3(50%)L1 simulation (3 bits to the top 50%, 1 bit to the rest) at the same ~2.25-bit budget, the Q̃K̃ pair norm achieved the lowest attention-distribution KL divergence among the channel-range, channel-magnitude, K̃ pair-norm, and Q̃K̃ pair-norm criteria on both evaluated models. Beating the K̃ pair norm specifically shows that adding query-side information helps beyond just respecting RoPE pairing.
  • A separable approximation preserves the ranking. The product of independently averaged query and key pair norms matches the causal-joint score with Spearman ρ of 0.996 ± 0.000 and top-10%/top-50% overlaps of 96.2 ± 0.3 / 97.9 ± 0.1 on R1-Llama-8B with LiveCodeBench v5, and 0.990 ± 0.003 with 95.3 ± 0.6 / 96.2 ± 0.5 on R1-Qwen-7B with AIME25.
  • Importance is highly concentrated. Approximately 97–99% of total importance is concentrated in the top 50% of channel pairs (median across layers, KV heads, and prompts), which is why spending extra bits on a minority of pairs is effective.
  • Prefill-based selection is close to the full-sequence oracle. In the same simulation, prefill-based Q̃K̃ pair-norm selection reached attention-KL divergence close to a full-sequence oracle, and the paper reports the highest average Jaccard overlap with decoding-time salient pairs among the compared criteria (with overlap not systematically decaying as decoding progresses, per Appendix L).
  • Standard benchmarks tighten the gap to FP16. On GSM8K, MATH-Algebra, HumanEval, and GPQA-Diamond, uniform 2-bit KIVI (2.25 bits) lost 5.0–9.7 average points versus FP16 across the four models, while PN-Mix (1) at 2.26 bits stayed within one point of FP16 in average. Averages: Llama-3.1-8B-Instruct 53.08 versus 54.04 FP16, Kitty 51.86, ChanMix 47.77, KIVI 45.35; Qwen3-8B 77.21 versus 77.85 FP16, ChanMix 74.88, Kitty 74.43, KIVI 68.16; Qwen2.5-14B-Instruct 72.11 versus 71.52 FP16, Kitty 72.01, ChanMix 69.66; Qwen3-32B 78.06 versus 78.58 FP16, ChanMix 77.01, Kitty 75.84.
  • AIME results hold under value quantization too. PN-Mix recorded the highest mean accuracy among non-FP16 methods in five of six model–benchmark settings (exception: R1-Qwen-7B on AIME25), including when values were quantized to 2 bits. For example, Qwen3-8B AIME24 with 2-bit values: PN-Mix (2) 74.33, PN-Mix (1) 74.67, Kitty 71.33, ChanMix 60.66, KIVI 56.33.
  • Graceful degradation at lower bit-widths. In the authors' Pareto sweep, PN-Mix degrades gracefully down to 1.5 bits, whereas the compared baselines show sharper performance drops below 2.25 bits.
  • Every design component matters. On Qwen3-8B with PN-Mix (2) and FP16 values, the full configuration scored 76.00 on AIME24 and 84.87 on HumanEval; removing the 1-bit midpoint correction gave 72.00 / 84.02, removing sink-token protection gave 69.67 / 80.36, and swapping the importance criterion for K̃ range, K̃ magnitude, or K̃ pair norm gave 70.67 / 83.78, 73.00 / 84.39, and 74.67 / 84.63, respectively. An online (rather than prefill-once) variant scored 72.33 / 82.31.
  • Motivating memory pressure. Qwen3-8B in FP16 runs out of memory on a single A100-40GB GPU when generation length exceeds 4K at batch size 32, or when batch size exceeds 20 at 8K generation length.
  • Not reported in the provided text: wall-clock throughput, latency, or memory savings measurements from the efficiency experiments (the excerpt lists the A100-SXM4-40GB hardware but the results section is truncated), and the tail of the ablation section.

Methodology in Plain English

The authors start from the observation that the KV cache is the memory bottleneck in long generations, and that the key cache is the more fragile half when squeezed to low bits. Instead of asking "which key channels have large values?", they ask "where does a quantization error actually hurt the attention output?"

Because RoPE rotates adjacent channel pairs together, a key's contribution to an attention score decomposes into, for each channel pair, the query pair's length times the key pair's length times the cosine of the angle between them. When a key pair is quantized, both its length and its angle shift slightly. The authors write out the resulting logit error and find it is a sum of per-pair perturbation terms, each multiplied by the product of the query pair norm and key pair norm. So pairs with a large product are the ones where quantization noise gets amplified into logit error — and that product is computable before quantization, from the unquantized tensors.

Averaging that product over every causal query–key position pair would be expensive, so they approximate it by averaging query norms over query positions and key norms over key positions separately, then multiplying — and they verify this separable version ranks channel pairs almost identically to the exact version. Under grouped-query attention, each KV head serves multiple query heads, so the query-side scores are averaged over those heads.

The payoff is a cheap decision procedure: at prefill, compute the score once per layer, KV head, and channel pair; take the top r%; store a single bitmask; and use it for the entire decode. During decoding, PN-Mix keeps the first 32 tokens (attention sinks) and a 128-token residual buffer in FP16, quantizes keys with per-channel asymmetric groups (3 bits for selected pairs, 1 bit otherwise), applies a midpoint correction for 1-bit groups, and quantizes values at low precision with per-token groups since values proved less sensitive. Two operating points are evaluated: r = 50% with group size 128 (2.26 bits) and r = 40% with group size 64 (2.29 bits).

Why This Matters

Impact on research. The paper argues that mixed-precision KV quantization should be guided by the attention computation rather than by cache statistics in isolation — a shift from key-only, per-channel saliency to query-aware, RoPE-pair-level saliency. It also shows that a prefill-time decision is sufficient, which sidesteps a tension in prior work between input adaptivity (Kitty's repeated per-group selection, with its index storage and loading overhead) and zero-overhead offline profiling (ChanMix, which is not input-adaptive). That is a useful template for other cache-compression decisions that currently require per-step bookkeeping.

Real-world applications:

  • Serving long chain-of-thought reasoning models on fixed GPU memory, where generation runs to tens of thousands of tokens.
  • Code generation and code-completion assistants that emit long files or multi-function responses.
  • Long-output agentic or multi-step tool-use workloads where batch size is currently capped by cache size rather than by compute.
  • Cost reduction in inference fleets: fitting more concurrent requests or longer outputs per GPU without moving to lower-precision weights or additional hardware.

Industry relevance. The method requires no offline calibration set and no retraining, and it targets standard RoPE-based decoder-only models (Llama, Qwen) at 8B–32B — the deployment sweet spot for many production endpoints. The prefill-only selection also avoids a per-step overhead that would otherwise erode the memory savings, and the paper's motivating example (Qwen3-8B FP16 exhausting a 40GB A100 at modest batch/length combinations) is a concrete capacity-planning problem for serving teams.

Future Directions

  • Combine with value-cache quantization more aggressively. The paper already reports 2-bit-value results; a natural next step is a jointly optimized key/value bit allocation rather than treating values with a fixed low-precision scheme.
  • Adapt the selection ratio r per layer or per head. The paper uses a single global r (50% or 40%) for all layers and KV heads, yet the concentration statistic (97–99% of importance in the top half) is reported per layer and head, suggesting a non-uniform schedule could help.
  • Extend to non-RoPE or partially-RoPE architectures and to token eviction or low-rank compression, where the same "attention-aware rather than cache-statistic-aware" importance principle could apply.
  • Report the systems side fully. The provided text does not include measured latency/throughput or actual memory-footprint numbers for PN-Mix versus baselines; quantifying the real decoding-speed benefit of avoiding per-group index management is the open empirical question. The paper also leaves the theoretical characterization of why prefill saliency transfers to decoding (beyond the empirical Jaccard analysis) as an open question.

Target Audience

Researchers and engineers working on LLM inference efficiency — KV-cache compression, quantization, and serving systems — who already understand attention, GQA, and RoPE. It is also valuable for practitioners choosing a KV-quantization scheme for RoPE-based models in the 7B–32B range who need input-adaptive precision without offline calibration, and for students studying how to derive a practical heuristic from a perturbation analysis. Readers wanting a beginner-level or fully systems-benchmarked treatment will find the math demanding and, in this excerpt, the efficiency numbers absent.

Authors’ abstract

Long-output inference in large language models suffers from severe KV cache memory and bandwidth bottlenecks. While KV cache quantization alleviates this issue, low-bit quantization (e.g., 2-bit) severely degrades model accuracy. Recent mixed-precision key-cache quantization methods mitigate this degradation by allocating higher precision to important key channels, but estimate channel saliency using only key statistics. Through attention logit perturbation analysis at the RoPE channel-pair level, we show that quantization errors in channel pairs with large query--key pair-norm products contribute significantly to logit variation. Based on this insight, we propose PN-Mix, a mixed-precision key-cache quantization method for RoPE-based decoder-only LLMs, which allocates higher precision to salient channel pairs identified once during the prefill stage and reused throughout decoding. Across standard reasoning, code-generation, and AIME benchmarks, PN-Mix with 2.26-bit average precision achieves comparable or better average accuracy than prior mixed-precision methods using 2.32--2.39 bits. Furthermore, in our Pareto sweep, PN-Mix degrades gracefully down to 1.5 bits, whereas the compared baselines exhibit sharper performance drops below 2.25 bits.

Read the original paper