How Far Must You Test a KV Cache? Sharp Continuation Bounds for Attention

Key-value (KV) cache compression, eviction, merging, and quantization methods replace an exact prefix history h in a causal attention head with an alternative cache state g before identical append-only continuation steps. Auditing g against h on immediate next-token queries (horizon L = 1) can miss future divergence completely, and for any fixed horizon H and tolerance eta > 0, witness histories can satisfy D_H <= eta while still exhibiting a substantial discrepancy D_inf >= 1/15 on longer continuations. We resolve a sharp behavioral certification question: for a single causal attention head with positive bounded weights 0 < alpha <= w(x, y) <= beta, weight ratio kappa = beta/alpha, and values in an arbitrary real normed space E, how far must two histories h, g of length at most n be tested on common continuations to control their worst-case final-output discrepancy D_inf over all finite nonempty continuations? We establish four main results. First (Exact Depth-Two Threshold), one-token agreement D_1 = 0 is insufficient, whereas two-token agreement is necessary and sufficient for exact behavioral equivalence: D_2 = 0 iff D_inf = 0. Second (Quantitative Continuation Certificate), for every test horizon L >= 2 and histories of lengths at most n, writing C = max{2, kappa(n + 1)/(L - 1)}, D_L <= D_inf <= (1 + 2C) D_L in [0, inf] over arbitrary alphabets and real normed spaces. Third (Logarithmic Dyadic Probe Suite), testing only singletons x and dyadic repetitions y^{2^j} x (2^j <= L - 1) yields D_inf <= (1 + 4C) D_dyad using at most M + M^2(1 + floor(log_2(L - 1))) distinct words over an alphabet of size M, replacing exhaustive suffix enumeration with O(M^2 log L) probes. Fourth (Sharp Three-Token Softmax Lower Bound), an explicit three-token scalar dot-product softmax head with weight ratio k >= 2 and arbitrary equal-length histories a^n, b^n proves that the best uniform amplification factor F*(kappa, n, L) satisfies S/30 <= F*(kappa, n, L) <= 5S for S = max{1, kappa n/(L - 1)}, establishing that the minimum sufficient horizon for constant worst-case amplification is L = Theta(kappa n). All 24 numbered definitions, lemmas, propositions, and theorems are formally verified in Lean 4 (251 checked declarations, zero sorry, standard axioms only).

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-11-30
DOI
https://doi.org/10.5281/zenodo.24669818
Primary Topic
Topic Modeling
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

How Far Must You Test a KV Cache? Sharp Continuation Bounds for Attention

Chengrui Li
Zenodo (CERN European Organization for Nuclear Research)
Topic Modeling
preprint

How Far Must You Test a KV Cache? Sharp Continuation Bounds for Attention

Chengrui Li
preprint en

Abstract

Key-value (KV) cache compression, eviction, merging, and quantization methods replace an exact prefix history h in a causal attention head with an alternative cache state g before identical append-only continuation steps. Auditing g against h on immediate next-token queries (horizon L = 1) can miss future divergence completely, and for any fixed horizon H and tolerance eta > 0, witness histories can satisfy D_H <= eta while still exhibiting a substantial discrepancy D_inf >= 1/15 on longer continuations. We resolve a sharp behavioral certification question: for a single causal attention head with positive bounded weights 0 < alpha <= w(x, y) <= beta, weight ratio kappa = beta/alpha, and values in an arbitrary real normed space E, how far must two histories h, g of length at most n be tested on common continuations to control their worst-case final-output discrepancy D_inf over all finite nonempty continuations? We establish four main results. First (Exact Depth-Two Threshold), one-token agreement D_1 = 0 is insufficient, whereas two-token agreement is necessary and sufficient for exact behavioral equivalence: D_2 = 0 iff D_inf = 0. Second (Quantitative Continuation Certificate), for every test horizon L >= 2 and histories of lengths at most n, writing C = max{2, kappa(n + 1)/(L - 1)}, D_L <= D_inf <= (1 + 2C) D_L in [0, inf] over arbitrary alphabets and real normed spaces. Third (Logarithmic Dyadic Probe Suite), testing only singletons x and dyadic repetitions y^{2^j} x (2^j <= L - 1) yields D_inf <= (1 + 4C) D_dyad using at most M + M^2(1 + floor(log_2(L - 1))) distinct words over an alphabet of size M, replacing exhaustive suffix enumeration with O(M^2 log L) probes. Fourth (Sharp Three-Token Softmax Lower Bound), an explicit three-token scalar dot-product softmax head with weight ratio k >= 2 and arbitrary equal-length histories a^n, b^n proves that the best uniform amplification factor F*(kappa, n, L) satisfies S/30 <= F*(kappa, n, L) <= 5S for S = max{1, kappa n/(L - 1)}, establishing that the minimum sufficient horizon for constant worst-case amplification is L = Theta(kappa n). All 24 numbered definitions, lemmas, propositions, and theorems are formally verified in Lean 4 (251 checked declarations, zero sorry, standard axioms only).

Zenodo (CERN European Organization for Nuclear Research)
Topic Modeling
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon