arXiv:2610.06686cs.LGOct 2026

Manuscript Offprint

arXiv:2610.06686

OVAL: Output-Aware Local Page Bases for KV Cache Retrieval

Ashkan Shahbazi, Chayne Thrash, Soheil Kolouri

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

ABSTRACT

Long context inference with large language models becomes increasingly expensive as attention must operate over an ever growing KV cache. Page sparse attention reduces this cost by representing each KV page compactly and retrieving only a subset for each query. Existing retrieval methods are designed to estimate attention scores or page relevance, but their objectives do not directly account for how approximation errors affect the resulting value weighted attention output. We introduce OVAL, an output aware page encoding derived from the joint structure of keys and values while preserving the key information needed for accurate retrieval. OVAL is training free and requires no additional value dependent statistics at inference time. Once constructed, its stored representation has the same size and decode time scoring cost as a key only spectral representation. Across long reasoning, long context understanding, and long generation benchmarks, OVAL consistently improves over the key only spectral baseline and performs competitively with recent KV cache compression and retrieval methods. On long reasoning benchmarks, it achieves strong avg@k performance across model benchmark pairs, while matching or surpassing leading baselines on several long context understanding and generation settings with modest decoding overhead. Code is available at https://github.com/Ashkan13776/oval-kv.

1 Introduction

Large language models rely on self attention to retrieve information from increasingly long sequences, enabling applications from long document understanding and multi turn dialogue to code generation and extended reasoning [1–4]. This flexibility comes at substantial computational cost. For a sequence of length n, standard self attention compares every query with every key, giving quadratic complexity during full sequence processing [1, 5]. For contexts spanning tens or hundreds of thousands of tokens, attention therefore incurs substantial storage and bandwidth costs [3, 6].

Autoregressive inference avoids recomputing previous representations by maintaining a key value cache, or KV cache. At each layer, keys and values from previous tokens are stored and reused during generation. For a new query q, the model scores the cached keys, normalizes the logits into attention weights, and forms the output as a weighted combination of the corresponding values. Although this removes redundant computation, the KV cache grows linearly with sequence length, number of layers, batch size, and number of KV heads [7, 8]. Each decoding step must also read and score the cached history, making long context inference increasingly dominated by KV access costs [9–11].

In practice, this history is not managed as an unstructured collection of tokens. Modern inference systems group consecutive KV entries into fixed size blocks, or pages, which form the natural unit of cache management and sparse retrieval [12]. Page retrieval methods first identify a small subset of relevant pages and then perform exact attention over the tokens they contain. To do so efficiently, they maintain a compact summary for each page and use it to estimate relevance to the current query [9, 10]. The effectiveness of this pipeline therefore depends critically on what information the page summary preserves.

Existing methods answer this question primarily through the keys. They estimate page importance using extrema, low dimensional key representations, geometric statistics, or spectral summaries [9–11, 13–15]. This is natural because keys determine the attention logits. However, preserving logits is not the final objective of an attention layer. What is propagated to the rest of the network is the attention output. Let o(q)=∑iαi(q)vio(q) = \sum_i \alpha_i(q)v_i, where α(q)=softmax(Kq/d)\alpha(q) = \text{softmax}(Kq/\sqrt{d}). The effect of an error in the attention distribution therefore depends on the associated values. A large logit error may have little effect when attention is redistributed among tokens with similar values, while a small error along a weak key direction may substantially change the output if it shifts probability between very different values. Thus, a high variance key direction can be unimportant to the output, while a lower variance direction can be critical. Any criterion based only on key geometry cannot distinguish these cases. This motivates the central question: what information should a page preserve to maintain the attention output?

Our key observation is that not all attention score errors matter equally. An error matters only when it redistributes attention between tokens whose values are meaningfully different. Therefore, the importance of a key direction cannot be determined from the keys alone; it depends on how keys and values vary together within the page. Guided by this observation, we construct each page summary jointly from its keys and values, prioritizing the directions that matter most to the resulting attention output rather than simply preserving the dominant variation in key space. Output fidelity, however, is only one role of a page summary. Before a page can contribute to the output, it must first be retrieved, which requires an accurate estimate of its attention mass. We show that these two objectives have different local sensitivities: conditional attention output error is generically first order in discarded logit directions, while page log mass error is locally second order. This motivates a hybrid objective that combines output sensitivity with the conventional key covariance. The resulting basis is obtained through a small page local eigenproblem. At one endpoint, it reduces to ordinary page local key PCA; moving away from this endpoint introduces value information according to its effect on the attention output.

We call the resulting method OVAL. OVAL uses both keys and values when constructing each page basis, but stores no value statistics and requires no value dependent computation during retrieval. Values are accessed only when a completed page summary is constructed. At decode time, the summary has the same dimensionality and scoring complexity as a key only spectral page summary. Across long reasoning, long context understanding, long generation, and efficiency benchmarks [3, 4, 11, 16], the output aware component consistently improves over the key PCA endpoint on long reasoning tasks and yields strong performance against contemporary KV cache compression and retrieval methods.

References (40)