Manuscript Offprint

arXiv:2610.09827

Dual-QK: Sharp Queries and Flat Keys for Prunable 2-bit KV Caches

Sunjoo Whang, Jungjun Oh, Minsung Kim, Dongho Seo, Jisu Shin, Gregory Kielian, Hoi-Jun Yoo, Sangjin Kim

ABSTRACT

Long inputs and extended generation increase the storage and access costs of the key-value (KV) cache. Low-bit quantization reduces storage and memory traffic, while query-channel pruning can further reduce key-cache reads. Rotation-based quantization redistributes the energy of key outliers across channels. To maintain computational invariance, the same orthogonal transform must be applied to queries, preserving query-key dot products. However, this rotation can disperse query energy, weakening the separation between a few large components to retain and many small ones to prune. We introduce Dual-QK, which uses paired non-orthogonal query and key transforms to address this conflict. Using calibrated query and key statistics, Dual-QK combines partial key whitening with a query-aligned basis to balance key scales for INT2 quantization and concentrate query energy for dynamic channel pruning. Channel-0 protection and bucket-relative RoPE support low-bit accuracy over long contexts. Experiments on four models across five generative benchmarks and long-context retrieval tasks show improved accuracy over OSCAR on most tasks at 40% query-channel sparsity. At a 128K context, Dual-QK provides 6.8×6.8\times KV-cache compression and an estimated 8.3×8.3\times reduction in KV read volume relative to unpruned BF16. Under the evaluated configurations, our SGLang implementation achieves up to 3.75×3.75\times the decoding throughput of unpruned BF16.

1 INTRODUCTION

Large language models are expanding from understanding long documents and code repositories to multistep reasoning and tool use. Long inputs require substantial context before generation begins, while reasoning traces and accumulated tool outputs extend the history during generation. Autoregressive decoding stores this history in the key-value (KV) cache, and dense attention revisits accumulated keys and values for every token. As the context grows, storing and repeatedly accessing this cache places increasing demands on memory capacity and bandwidth. Efficient long-context inference therefore requires reducing both cache storage and access costs during decoding.

KV quantization reduces both storage and memory traffic by lowering the number of bits per element (Liu et al., 2024; Hooper et al., 2024; Zhou et al., 2026). Dynamic sparse attention can further reduce reads by selecting tokens or channels for each query while retaining the cached history (Tang et al., 2024; Ribar et al., 2024). Each query-key (QK) dot product is a sum of channel contributions, so omitting channels with small contributions reduces the key components needed to compute attention scores. Combining query-channel sparsity with low-precision keys allows fewer channels to be read at fewer bits, preserving the storage benefits of quantization while further reducing key accesses. Realizing both benefits requires a representation that supports accurate key quantization and effective channel selection.

However, key quantization and query-channel pruning favor different channel distributions, as illustrated in Figure 1 (a) and (b). For key quantization, outliers widen the shared quantization range and reduce the resolution available to other values, favoring a flatter distribution. Query-channel pruning instead benefits from a sharp distribution that separates a few important channels from many small ones. Rotation-based quantization redistributes the energy of key outliers across channels (Ashkboos et al., 2024; Liu et al., 2025; Zhou et al., 2026). To maintain computational

†^{\dagger}Corresponding author.

Figure

Figure

Figure 1: Conceptual comparison at the same bit width and retained-channel budget. (a) Q-PCA concentrates query energy, whereas (b) Hadamard rotation mitigates key outliers. (c) Dual-QK targets both properties using reciprocal Q/K transforms. Hatched channels are omitted from the dot product.

invariance, the same orthogonal transform is applied to queries, preserving query-key dot products before quantization. However, this shared transform can also disperse query energy, weakening the concentration exploited by pruning. Conversely, query principal component analysis (Q-PCA) uses the eigenvectors of query second moments as a shared rotation basis for queries and keys. This concentrates query energy in a few channels but does not explicitly control key outliers that affect quantization error. These contrasting requirements motivate a joint design of query and key representations.

We propose Dual-QK, which uses paired non-orthogonal query and key transforms to address this conflict. Pairing an invertible query transform with its inverse transpose on keys preserves query-key dot products before quantization and pruning. This extends the shared orthogonal rotations used in prior work, allowing the query and key distributions to be shaped differently. Dual-QK uses this freedom to balance key scales while concentrating query energy in a few channels. These transforms support 2-bit key quantization and dynamic channel selection based on current query magnitudes.

Specifically, Dual-QK combines partial key whitening with a query-aligned basis derived from calibrated query and key statistics to balance key scales and concentrate query energy. Large query magnitudes make attention scores sensitive to quantization error in the leading key channel (channel-0). We therefore retain this channel in BF16 and exclude it from range estimation to narrow the quantization range of the remaining INT2 channels. Bucket-relative RoPE represents each stored key relative to its bucket anchor, keeping stored-key positional offsets within the calibration window. The corresponding query adjustment preserves attention scores before quantization and pruning.

Our contributions are as follows:

• We analyze the conflicting distributional requirements of key quantization and query-channel pruning and introduce Dual-QK, a paired transformation that constructs flat keys and sharp queries while preserving attention scores before compression.

• We exploit these distributions to combine dynamic query-channel selection with INT2 key quantization, using leading-channel protection and bucket-relative RoPE to maintain accuracy across context positions.

• We evaluate Dual-QK on four models for generative accuracy, long-context retrieval, and decoding throughput. At 40% query-channel sparsity, Dual-QK improves accuracy over OSCAR on most tasks. At a 128K context, it provides 6.8×6.8\times KV-cache compression and an estimated 8.3×8.3\times reduction in KV read volume relative to unpruned BF16.

References (65)