Papers
Topics
Authors
Recent
Search
2000 character limit reached

RoPE-Aware Bit Allocation for KV-Cache Quantization

Published 23 Jun 2026 in cs.LG and cs.CL | (2606.24033v1)

Abstract: Existing low-bit KV-cache quantizers often treat each cached key as a flat vector. Under RoPE, however, a key's contribution to a future attention logit decomposes into a position-dependent sum over two-dimensional frequency blocks. This makes key-cache quantization a block-wise bit-allocation problem: high-energy RoPE blocks are more sensitive to quantization error and should receive more bits. We introduce Block-GTQ, a RoPE-aware bit allocator for key-cache quantization built on TurboQuant-MSE(TQ-MSE). For each layer and KV head, Block-GTQ computes a label-free energy score for each RoPE block and greedily allocates integer bit widths by marginal gain. Under matched K/V bit budgets, Block-GTQ better preserves RoPE query-key logits on a ten-model diagnostic panel, cutting per-layer MAE by 32-80% at 2 and 3 b/dim K-only quantization and winning all 367/367 layer comparisons against uniform TQ-MSE. These fidelity gains translate to stronger downstream long-context retrieval, understanding, and reasoning. At K2V2 on Llama-3.1-8B-Instruct, Block-GTQ raises the six-task NIAH average from 70.6 to 97.4, and the LongBench-EN average from 36.87 to 53.31. On AIME 2024/2025 with DeepSeek-R1-Distill-Qwen-7B, without an fp16 recent-key buffer, Block-GTQ at K3V2 scores 51.7/37.5, close to fp16's 54.2/37.9, whereas uniform TQ-MSE collapses to 0.0/0.0. We further implement a packed-cache serving path. On a single H800 GPU with Qwen2.5-3B-Instruct, packed K3V3 achieves 3.24x KV-cache compression with fp16-comparable quality, runs 1.34x faster than fp16 FlashAttention2 at 128K context, reduces peak memory from 56.31 GB to 19.85 GB, and remains feasible at 256K and 512K where fp16 OOMs. Code is available at https://github.com/JIA-Lab-research/blockgtq.

Summary

  • The paper introduces Block-GTQ, a method that allocates bits per RoPE block to minimize logit errors in KV-cache quantization.
  • It employs a greedy allocation using aggregated energy scores, achieving 32โ€“80% error reduction and improved downstream attention fidelity.
  • Block-GTQ enables efficient packed-cache deployments, significantly reducing memory usage and latency in long-context inference.

RoPE-Aware Bit Allocation for KV-Cache Quantization: A Detailed Analysis

Introduction and Motivation

The KV-cache is a crucial bottleneck in long-context autoregressive transformer inference, dominating sequence-dependent memory and bandwidth costs due to the necessity of storing one key and value vector for every past token across all layers and heads. Typical approaches to KV-cache quantization treat each cached key as a flat vector, irrespective of how these vectors interact with rotary position embedding (RoPE) during attention computations. However, under RoPE, the contribution of a cached key to a future attention logit decomposes into a sum over frequency-block terms, yielding a block-diagonal structure with sharply uneven energy profiles across blocks. Logit sensitivity to quantization error is thus block-dependent, motivating precision allocation strategies that deviate from uniform bit-width assignment.

Block-GTQ Methodology

Block-GTQ reframes key-cache quantization for RoPE models as a block-wise allocation problem, targeting logit-preservation rather than global vector reconstruction. For each layer and KV head, Block-GTQ computes a label-free energy score per RoPE block using the aggregated second moments of query/key activations. It then greedily assigns integer bit widths according to the marginal reduction in logit error bound per extra bit, leveraging TurboQuant-MSE's 4-bits per coordinate rate law (MSEโˆผ4โˆ’b\text{MSE} \sim 4^{-b}). This assignment is optimal via a straightforward greedy exchange argument, minimizing logit error under a fixed bit budget.

Blocks with the same assigned bit width are grouped, and each group is encoded with the original TQ-MSE quantizer. Values (V) are quantized uniformly, as they do not affect the pre-softmax attention logits, focusing block-wise precision only on keys (K).

Block-Wise Allocation: Theoretical Underpinnings

RoPE decomposes attention logits across two-dimensional frequency blocks, and quantization error in high-energy blocks disproportionately affects downstream model behavior. The block-wise structure ensures independence of error contributions; therefore, norm-based energy scores in pre-RoPE coordinates suffice for allocation, as RoPE preserves block norms. The allocation objective is to minimize the expected logit error, leading to more bits allocated to blocks with higher energy scores.

Empirical Validation

Block-GTQ is verified across a ten-model panel, with both 2 and 3 b/dim budgets for K-only quantization. It reduces per-layer RoPE-logit mean absolute error by 32-80% compared to uniform TQ-MSE, consistently winning all layer comparisons. These gains propagate to downstream attention distributions, demonstrated by lower mean softmax KL divergence and higher top-10 attended-token overlap across models and budgets.

Numerical Results

  • At K2V2 on Llama-3.1-8B-Instruct, Block-GTQ increases the six-task NIAH average from 70.6 to 97.4 and the eight-task LongBench-EN average from 36.87 to 53.31 relative to uniform TQ-MSE.
  • On DeepSeek-R1-Distill-Qwen-7B (AIME 2024/2025), Block-GTQ at K3V2 achieves 51.7/37.5 pass@1, very close to fp16 baseline values, while uniform TQ-MSE yields 0.0/0.0.
  • All 367/367 layer comparisons at each bit budget favor Block-GTQ over uniform TQ-MSE.
  • Robustness ablation shows Block-GTQโ€™s allocation remains stable against calibration prefix length and corpus, especially at higher per-block bit rates owing to the amortized rate law.

Packed-Cache Deployment

Block-GTQ enables a packed-cache serving path in which keys and values are stored in a compressed layout. The in-kernel decode retrieves only relevant packed codes and norms per query, avoiding the materialization of a resident fp16 KV cache. This system achieves significant memory bandwidth efficiency, especially at long context lengths where bandwidth dominates latency.

  • At 128K-token context on a single H800 GPU (Qwen2.5-3B-Instruct): packed cache achieves 3.24x KV-cache compression, peak memory drops from 56.31GB to 19.85GB, and decode latency is reduced by 1.34x relative to fp16 baseline. At 256K and 512K tokens, fp16 OOMs, but Block-GTQ remains feasible.
  • The quality of compressed inference is close to fp16 (perplexity remains within 3.6% at 64K context), while uniform TQ-MSEโ€™s output quality rapidly degrades.

Comparative Evaluation and Limitations

Block-GTQโ€™s block-wise allocation consistently outperforms uniform and channel-wise quantization schemes (TQ-MSE, KIVI-ScaleOnly), especially in regimes where retrieval and reasoning through long contexts are critical. Channel-wise allocation (KIVI) becomes competitive only in architectures with limited RoPE substructure (e.g., DS-V2-Lite).

One limitation is the lack of block-wise allocation for values (V): Block-GTQ assigns uniform bits to V, leading to occasional quality gaps in V-sensitive backbones. Joint K+V optimization and denser packing are promising directions to further reduce memory and improve generalization.

Implications and Future Directions

Practically, Block-GTQ unlocks the deployment of LLMs at extremely long context lengths within manageable memory footprints, without sacrificing accuracy on retrieval, reasoning, or generation tasks. The approachโ€™s RoPE-aware precision routing may become standard in transformer-based inference engines, especially for high-throughput long-context applications.

Theoretically, the work highlights the importance of tailored compression objectives in structure-dependent memory representations. Future research may extend block-wise allocation to values, multi-GPU and batched serving, and explore adaptive calibration schemes for further robustness.

Conclusion

Block-GTQ establishes block-wise RoPE-aware bit allocation as an effective quantization paradigm for transformer KV-caches, outperforming uniform and channel-wise methods on attention-interface fidelity, downstream tasks, and deployment efficiency. Its greedy allocation scheme guarantees optimal logit-preservation at fixed budgets and enables long-context inference at scale with minimal memory and bandwidth overhead. The methodologyโ€™s extensibility to joint K+V allocation and optimized serving pipelines presents a fruitful avenue for further advances in efficient large-model inference.


Reference: "RoPE-Aware Bit Allocation for KV-Cache Quantization" (2606.24033)

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.