Block-GTQ: RoPE-Aware KV-Cache Quantization
- Block-GTQ is a RoPE-aware key-cache quantization method that allocates bits based on the energy of two-dimensional frequency blocks.
- It exploits a block-wise rate-allocation strategy using an analytically motivated error proxy and a rigorously optimal greedy integer allocator.
- Empirical results demonstrate significant KV-cache compression and near-fp16 performance on long-context retrieval and reasoning tasks.
Block-GTQ is a RoPE-aware bit-allocation method for key-cache quantization in long-context transformer inference. It is designed for the setting in which KV-cache memory footprint and memory bandwidth dominate decoding latency and feasibility, and it departs from flat-vector key quantization by exploiting the fact that, under Rotary Positional Embeddings (RoPE), a key’s contribution to a future attention logit decomposes into a position-dependent sum over two-dimensional frequency blocks. In this formulation, key-cache compression becomes a block-wise rate-allocation problem: RoPE blocks with larger query-key energy are assigned more bits, while lower-impact blocks are assigned fewer bits. The method is built on TurboQuant-MSE (TQ-MSE), uses label-free calibration, and couples an analytically motivated error proxy with a greedy integer allocator that is proved optimal for the stated objective (Liang et al., 23 Jun 2026).
1. Problem setting and RoPE block structure
Block-GTQ is motivated by autoregressive decoding, where every new token streams cached keys and values for all previous tokens. In that regime, quantizing the KV cache reduces both memory footprint and HBM traffic, but the perturbation mechanisms for keys and values differ: values affect the post-softmax mixture, whereas keys perturb the pre-softmax logits seen by future queries. The method therefore focuses its non-uniform allocation on keys, while values are quantized uniformly with TQ-MSE in the reported deployment configurations (Liang et al., 23 Jun 2026).
The central structural observation is that RoPE changes the natural unit of key quantization. Let the head dimension be and define . A query and key head are partitioned into two-dimensional RoPE blocks indexed by , each associated with frequency . For query position , key position , and relative offset , the RoPE-transformed query-key dot product decomposes as
This decomposition is block-diagonal in the RoPE basis: each logit is a sum of independent two-dimensional block contributions modulated by and 0 (Liang et al., 23 Jun 2026).
The same block structure governs quantization error. If 1 is the decoded key and 2 is the error in block 3, then the induced logit perturbation satisfies
4
because each 5 is a 6 rotation. There are no cross-block terms in this bound, and RoPE preserves each block’s 7 norm. This is the basis for treating key quantization as a block-wise allocation problem rather than a coordinate-wise or flat-vector problem (Liang et al., 23 Jun 2026).
2. Sensitivity scores and the rate-allocation objective
The ideal block sensitivity in Block-GTQ is the expected squared query-key energy
8
The paper states that this quantity upper-bounds the expected squared logit error when combined with the block’s squared reconstruction error, but it also notes that direct estimation of 9 requires paired 0–1 products and is noisy on short calibration. The method therefore uses a label-free AM–GM surrogate
2
In grouped-query attention (GQA), for layer 3, KV head 4, RoPE block 5, query-head group 6, and calibration length 7, the instantiated score is
8
The score is RoPE-invariant and depends only on marginal second moments of pre-RoPE queries and keys (Liang et al., 23 Jun 2026).
The local quantizer reused by Block-GTQ is TQ-MSE. For a nonzero vector 9, TQ-MSE normalizes by its radius, applies a shared orthogonal rotation, scalar-quantizes each rotated coordinate at 0 bits, and rescales by the original radius. Its mean-squared reconstruction error obeys
1
with positive constant 2. Under the paper’s block-error accounting, this leads to the weighted proxy
3
to be minimized over integer block bit-widths 4 subject to a head-level budget (Liang et al., 23 Jun 2026).
The resulting optimization problem is
5
where 6 is typically 7 for average bit budget 8. The concrete interpretation is that RoPE blocks with larger sensitivity scores should receive more bits because their contribution to future logits is larger (Liang et al., 23 Jun 2026).
3. Greedy allocation and calibration pipeline
Block-GTQ assigns bits by marginal gain. Increasing block 9 from 0 to 1 reduces the objective by
2
These gains are positive and decay geometrically with each additional bit on the same block. The paper proves that a simple greedy rule is exactly optimal for the stated integer program: repeatedly allocate the next bit to the block with the largest current marginal gain, subject only to the per-block upper bound. The proof is by exchange argument over “prefix-constrained” geometric gain sequences (Liang et al., 23 Jun 2026).
The implementation pipeline is layer-wise and head-wise. First, pre-RoPE queries and keys are collected on a short unlabeled calibration prefix, with the paper giving 3 WikiText-2 tokens as an example. Second, each head is split into 4 RoPE blocks and the scores 5 are computed. Third, the allocator chooses 6, 7, and total budget 8, initializes all blocks at 9, and greedily distributes the remaining budget. The algorithmic description uses a max-heap keyed by 0, which the paper notes gives the same ordering as the analytic marginal gain up to a constant. The resulting complexity is
1
which is negligible for typical head sizes such as 2, where 3 (Liang et al., 23 Jun 2026).
A worked example in the paper considers one head with 4, hence 5, block energies 6, average budget 7, and bounds 8, 9. Starting from 0, the greedy updates allocate the four extra bits in the order 1, 2, 3, 4, yielding the final allocation 5. This illustrates the stated geometric trade-off: the highest-energy block receives repeated upgrades until its marginal gain falls below that of a lower-energy block still at low precision (Liang et al., 23 Jun 2026).
4. Quantizer materialization and packed-cache serving
After bit allocation, Block-GTQ groups blocks with the same assigned bit-width into “same-rate” segments. Post-RoPE key coordinates in each segment are concatenated and encoded with one TQ-MSE encoder at that segment’s rate. Values are not part of the RoPE logit decomposition and are therefore encoded with uniform TQ-MSE at the selected V budget. The reported experiments separate K-only diagnostics, where values remain in fp16 to isolate key effects, from deployment settings such as K3V3, K3V2, and K2V2, where both keys and values are quantized (Liang et al., 23 Jun 2026).
The serving path stores mixed-rate key segments and a uniform-rate packed value stream directly in HBM. The paper specifies nibble containers for segments at 6 bits, byte containers for higher-bit groups, per-segment codebooks, and per-token norms. The fused attention kernel then streams tiles of packed K/V, unpacks the segments, dequantizes through a small fp16 codebook that fits in L1, rescales by per-segment key norms and per-token value norms, computes 7 and 8 as fp16-input, fp32-accumulate tensor-core GEMMs with a fully fp32 online softmax, and never materializes a full fp16 KV cache in HBM; dequantized tiles are consumed immediately from registers or shared memory (Liang et al., 23 Jun 2026).
This systems design turns the mixed-rate allocation into concrete bandwidth and memory savings. At K3V3, the paper reports about 9 bytes per token per KV head for codes plus norms, compared with 0 bytes for an fp16 K/V pair, corresponding to approximately 1 KV-cache compression in practice. The text attributes the gap from the ideal 2 code-only rate to nibble or byte alignment and to per-segment norms and metadata. Calibration is entirely offline and amortized; after warmup, each layer-head allocation is fixed, no fp16 recent-key buffer is required, and a small Q-side rotation from TQ-MSE can be folded into 3 weights offline (Liang et al., 23 Jun 2026).
5. Empirical behavior and benchmark results
The paper evaluates Block-GTQ on a ten-model diagnostic panel and on long-context retrieval, understanding, and reasoning tasks. Under K-only quantization at 4 and 5 b/dim, Block-GTQ cuts mean per-layer RoPE-logit MAE by 6–7 relative to uniform TQ-MSE and wins all 8 layer comparisons at each budget. Without an fp16 recent-key buffer, it also achieves the lowest mean softmax KL against fp16 and the highest top-10 attended-token overlap at every evaluated budget. The largest gains are reported at higher key budgets, where the allocator can route extra bits to the highest-energy RoPE blocks (Liang et al., 23 Jun 2026).
On long-context retrieval and understanding, the reported gains are similarly large. For Llama-3.1-8B-Instruct on the six-task NIAH benchmark, Block-GTQ at K2V2 raises the average from 9 with uniform TQ-MSE to 0, and at K3V3 or K3V2 it remains close to the fp16 ceiling of 1. On LongBench-EN with the same model, the average rises from 2 under uniform TQ-MSE to 3 at K2V2, while Block-GTQ remains closest to fp16 at all listed budgets, with 4 at K3V3/K3V2/K2V2 versus 5 for fp16. For Qwen2.5-7B-Instruct on NIAH, the paper reports that uniform TQ-MSE collapses to 6 at all tested budgets, whereas Block-GTQ attains 7 at K3V3/K3V2/K2V2 against 8 for fp16 (Liang et al., 23 Jun 2026).
The long-reasoning results highlight the same pattern. On AIME 2024/2025 with DeepSeek-R1-Distill-Qwen-7B, and without an fp16 recent-key buffer, Block-GTQ at K3V2 scores 9, close to fp16’s 0, while uniform TQ-MSE collapses to 1. For DeepSeek-R1-Distill-Llama-8B, the corresponding numbers are 2 for Block-GTQ and 3 for fp16. The paper notes that PM-KVQ can lead on this backbone through joint K+V layer-wise allocation, which marks a boundary of the present K-focused design (Liang et al., 23 Jun 2026).
The systems benchmarks report both efficiency and feasibility gains. On a single H800 GPU with Qwen2.5-3B-Instruct at K3V3, the packed-cache path runs 4 faster than fp16 FlashAttention-2 at 5K context and reduces peak memory from 6 GB to 7 GB. At 8K and 9K context, fp16 is reported as OOM, while Block-GTQ remains feasible with peak memory 00 GB and 01 GB. Uniform TQ-MSE is about 02 faster at 03K and reaches about 04 KV compression, but the paper states that its perplexity collapses, whereas Block-GTQ preserves fp16-comparable quality and is therefore the deployable operating point (Liang et al., 23 Jun 2026).
6. Limitations, comparisons, and scope of the term
Block-GTQ allocates bits only on keys; values use uniform TQ-MSE. The paper explicitly lists this as a limitation, together with the assumption that per-block MSE decays as 05 and the requirement that short calibration capture the typical RoPE energy profile. Distribution shift can perturb the ranking of block sensitivities, especially at very low key budgets. The calibration analysis reports that with 06 tokens, allocation is stable at K3V3, with block Hamming distances across seeds of approximately 07–08 and objective regret at most 09–10, whereas K2V2 is more sensitive and the same ranking noise costs about 11 more in the rate objective. The paper therefore treats a V-side allocator, joint K+V optimization, dynamic per-request allocation, denser packing, and multi-GPU or batched serving for packed caches as future directions (Liang et al., 23 Jun 2026).
The method is compared primarily against uniform TQ-MSE and KIVI. Against uniform TQ-MSE, the reported conclusion is consistent across RoPE-logit MAE, attention KL, top-10 attended-token overlap, and downstream long-context tasks. Against KIVI-ScaleOnly, the paper states that per-channel quantization can be competitive when RoPE occupies only half of the key dimensions, as in partial-rotary or MLA settings, because Block-GTQ then has fewer RoPE blocks to differentiate. On fully RoPE’d GQA backbones, the paper reports that Block-GTQ usually wins. A plausible implication is that the method’s advantage is largest precisely when the inference stack exposes a strong RoPE block hierarchy (Liang et al., 23 Jun 2026).
The name should not be conflated with unrelated block-based constructions in other areas. The supplied literature also uses block-oriented formulations for quantitative group testing under noiseless, Gaussian, and Z-channel models (Li et al., 16 Jan 2026), for block floating point and scaled block floating point numerical formats (Soloveychik et al., 2022), for LDPC-based and spatially coupled quantitative group testing designs (Mashauri et al., 2024), and for block components of generalized quaternion group codes (Willenborg, 2 Jan 2025). Those topics are distinct from the method introduced as “Block-GTQ” in the KV-cache quantization setting.