arXiv(opens in a new tab)cs.LGOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.03135

Page-EntroKV: Hardware-Aligned, Entropy-Weighted KV-Cache Eviction under Grouped-Query Attention

Inbasekaran S

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Long-context inference in autoregressive language models is limited by the key-value (KV) cache. The cache grows with context length, and every decoded token streams the full cache through memory. Most dynamic eviction methods score token importance per query head and choose tokens independently. This fits poorly with grouped-query attention (GQA), where several query heads share one physical KV buffer: if the heads choose different tokens, the serving engine must keep the union of their selections, inflating the cache by up to the group ratio r. A simple arithmetic average does not fix this—it dilutes the specialized retrieval heads that carry factual recall.

We introduce Page-EntroKV, a formal framework for KV-cache eviction that works at the level GQA serving actually uses. Heads in each physical group are pooled with weights derived from sink-isolated collision (Rényi-2) entropy—one inner product per head, computed once at prefill with no calibration—so sink heads cannot be mistaken for retrieval heads. The pooled scores are mapped onto PagedAttention page frames, and eviction runs at the hardware tuple (l,g,Pb)(l, g, P_b). We formalize the union overhead ratio and intra-group disagreement, prove an exact identity linking them for two-head groups, and give two-sided bounds for general ratios. We prove that group-level pooling preserves the eviction budget exactly, derive a finite-context needle-retention guarantee that arithmetic-mean pooling provably violates, characterize the temperature limits of the entropy-weighted family, and give exact per-layer cross-group page accounting.

On a pilot architecture (Qwen2.5-1.5B-Instruct, r=6, 28 layers), head-independent replay inflates the cache by up to 5.1×5.1\times at a 2% budget—with the theoretical certificate firing in the large majority of measured cells—while Page-EntroKV holds the union overhead at exactly 1,000 across 1,008 pooled measurements. Across a 1,008-observation head census, sink isolation inverts the sink-to-context weight ordering from a 2.10×2.10\times unearned sink advantage to a 0.66×0.66\times deficit. In pilot-scale needle retrieval, entropy-weighted pooling retains the needle where arithmetic-mean pooling collapses (100% vs. 0% under the pooled-selection criterion at a 20% budget); strict all-layer retention is reported as a limitation. Retained cardinality is exact for every page size, preliminary runs show representative QA and code tasks remain solvable at 20% retention, and the mechanism ablations are certified over all 56 of 56 layer-group pairs with zero skipped layers. Larger-model, long-context, and serving phases are pre-registered and in progress.

Keywords: Grouped-Query Attention, PagedAttention, KV-cache compression, Attention entropy, Inference serving, Formal analysis

1. Introduction

Long-context large language models (LLMs) are now deployed for multi-turn agentic workflows, repository-scale code synthesis, and multi-document legal discovery [29, 30, 4]. Context windows have grown to match, but long-context use remains fragile: reliability degrades with input position [31]. At context lengths of 32k to 128k +^{+} tokens, decoding hits a hardware boundary: every decoded token streams the entire key-value (KV) cache from GPU high-bandwidth memory (HBM) into on-chip SRAM, so the decode phase is strictly memory-bound and its cost grows linearly with context length [9, 7]. At practical batch sizes the KV cache alone can occupy most of the accelerator's memory, capping concurrency and decoding throughput.

Production architectures respond by sharing KV buffers across query heads. Grouped-query attention (GQA) [3]—adopted by Llama-3.1, Qwen-2.5, and Mistral [4, 5, 6]—partitions HQH_Q logical query heads into HKVH_{KV} physical KV groups, shrinking the cache by the ratio r=HQ/HKVr = H_Q / H_{KV}. In serving runtimes such as vLLM [7], these groups are materialized as block-partitioned tensors of shape [Nblocks,HKV,B,Dhead][N_{\text{blocks}}, H_{\text{KV}}, B, D_{\text{head}}]: the sharing is the memory layout itself, not an implementation detail.

This physical layout breaks a core assumption behind prevailing eviction heuristics. Policies such as H2O [10], SnapKV [11], and Scissorhands [12] compute token importance per query head and select top-k sets independently. Sibling heads in a GQA group share one physical buffer, so the engine must store the union of their selections—up to r×r \times the intended budget. We formalize this penalty as the union overhead ratio (UOR) and connect it exactly to measurable intra-group disagreement (Proposition 1). Arithmetic mean pooling fails from the other direction: it dilutes specialized retrieval heads [24], averaging a needle token attended to with mass 1−ϵ1 - \epsilon by one head down to (1−ϵ)/r(1 - \epsilon)/r, below eviction thresholds.

Page-EntroKV follows three design principles, each chosen against a specific alternative. Pooling at the physical-group level rather than the head level preserves GQA's memory sharing and keeps the budget exact; head-level selection cannot do both, because the engine stores whatever union the heads produce. Discrete attention entropy—one inner product per head—separates sharp retrieval heads from diffuse background heads, so weighting heads by inverse entropy amplifies exactly the signals that mean pooling destroys; evaluating that entropy on sink-isolated distributions keeps attention-sink heads from being mistaken for retrieval heads. Projecting importance onto discrete PagedAttention page frames before eviction, rather than selecting tokens first, makes the compression decision coincide with the hardware allocation tuple (l,g,Pb)(l, g, P_b) and eliminates internal fragmentation and cache-unrolling overhead. Figure 1 shows the resulting architecture.

The contributions of this paper are formal, algorithmic, implementational, and pilot-validated:

• Architectural formulation. We formalize the GQA structural constraint in dynamic KV-cache eviction through two metrics—the union overhead ratio and intra-group disagreement—linked by an exact identity for two-head groups and sandwiched two-sidedly at every ratio (Section 3).

• Algorithmic design. We design entropy-weighted group pooling around discrete sink-isolated Rényi-2 attention entropy, together with a page-frame mapping that evicts exactly at the (l,g,Pb)(l, g, P_b) tuple (Section 4).

• Theoretical guarantees. We prove strict budget preservation (UOR ≡\equiv 1), a finite-context needle-retention bound under head specialization with sink isolation, the temperature degeneracies of the pooling family, and page-level union accounting (Section 5).

• Reference implementation and pilot validation. We provide a complete PyTorch reference implementation, an instrumented harness, and a pilot validation on Qwen2.5-1.5B-Instruct confirming the structural core on real text—with every deviation, exclusion, and pending item disclosed (Section 6).

This is a formulation-and-theory paper with a pilot-scale empirical tier. The architectural guarantees hold by construction; the pilot of Section 6 validates the structural core on real text at small scale; the full pre-registered sweep—long context, larger models, and serving—is in progress and disclosed item by item in Section 6.5.

The remainder of this paper is organized as follows. Section 2 reviews related work. Section 3 formalizes the problem and its structural metrics. Section 4 presents the Page-EntroKV design. Section 5 develops the theoretical analysis. Section 6 reports the pilot validation and the remaining pre-registered protocol. Section 7 delimits scope and limitations, and Section 8 concludes. Section Appendix A summarizes notation, Section Appendix B tabulates the guarantee-to-evidence mapping, Section Appendix C collects the full step-by-step derivations, and Section Appendix D gives the reference implementation.

References (30)