EpiKV: Epiphany-Aware KV Cache Eviction
- EpiKV is a KV-cache eviction policy that uses hidden state changes to compute token importance without materializing attention matrices.
- It addresses the linear growth challenge in long reasoning traces by scoring tokens based on their representational shifts, enhancing efficiency.
- The method operates online and causally within standard FlashAttention stacks, offering scalable, training-free inference improvements.
Searching arXiv for the primary paper and named related work to ground citations. Search query: "1ti:\1 KV Cache Eviction Without the Attention Matrix\"" EpiKV is a KV-cache eviction policy for long-reasoning LLM inference that replaces attention-derived token importance with a directly observable signal from the model’s hidden states. Introduced in "Epiphany-Aware KV Cache Eviction Without the Attention Matrix" (&&&1ti:\1&&&), the method scores tokens by the extent to which they coincide with a shift in internal computation, rather than by how much subsequent tokens attend to them. The paper positions this design against two constraints that become acute in long chains of thought: the linear growth of KV cache with sequence length, and the incompatibility between attention-matrix materialization and fused inference paths such as FlashAttention. EpiKV therefore operates as a causal, online, attention-free policy that requires no training, classifier, or custom kernel, while remaining usable in standard FlashAttention inference stacks unchanged (&&&1ti:\1&&&).
1. Problem setting and motivation
The immediate problem addressed by EpiKV is KV-cache growth during reasoning-oriented decoding. In long reasoning traces, chains of thought may extend to tens of thousands of tokens, and the KV cache grows linearly with sequence length. Under such conditions, cache memory becomes the dominant bottleneck at decode time, so practical systems retain only a budget of PRESERVED_PLACEHOLDER_1ti:\1^ tokens and evict the remainder (&&&1ti:\1&&&).
The paper argues that existing reasoning-oriented eviction methods, including H2O, ThinKV, and RaaS, mostly rank tokens by attention-derived importance. It identifies two independent deficiencies in that approach. First, attention is treated as a noisy proxy for importance in reasoning traces: attention sinks and filler tokens may receive high attention despite limited semantic importance, whereas important milestone tokens may cease to attract high attention after they are generated even though they remain load-bearing for later reasoning. Second, attention-based scoring is architecturally expensive because it requires materializing the attention matrix, which breaks the memory efficiency of fused attention implementations and forces eager execution when output_attentions=True is enabled (&&&1ti:\1&&&).
The deployment implication is explicit. On an 81ti:\1GB A11ti:\1ti:\1, the paper reports that an eager forward pass with attention weights runs out of memory at 8192 tokens, whereas the same model in FlashAttention mode scales to 65,536 tokens. This is the basis for the claim that EpiKV can scale to a 16x longer feasible context than attention-based scoring in production-style inference settings (&&&1ti:\1&&&).
2. Epiphany score and representational signal
EpiKV replaces attention weights with what the paper terms the epiphany score: a per-token measure of change in the model’s residual stream or hidden state. For layer and decode position , with hidden state , the layerwise change is defined as
The intended interpretation is that tokens associated with large representational shifts are more likely to mark consequential reasoning steps: an intermediate conclusion, a transition from exploration to commitment, or another structurally important point in the computation (&&&1ti:\1&&&).
A central empirical finding is a two-band anatomy in a 32-layer reasoning model. In layers 7–13, high is positively correlated with token importance. In layers 18–25, high is negatively correlated with token importance. The method therefore does not treat all hidden-state change as uniformly informative. Instead, it combines a positive signal from mid-layers with a negative signal from upper-mid layers. A simple combined score is
where is a rolling mean over a trailing window of 1ti:\1^ tokens (&&&1ti:\1&&&).
This formulation is consequential because it is computed directly from the standard forward pass: hidden states are read through the normal output_hidden_states interface, differences across consecutive decode positions are computed online, and the attention matrix is never materialized. A common misconception is that cache eviction for reasoning necessarily depends on attention maps; the paper’s central counterexample is that representation change alone can serve as the ranking signal (&&&1ti:\1&&&).
3. Causal online eviction algorithm
The full EpiKV procedure is a causal, online token-ranking policy. First, for each generated token 1 and each layer 2, it computes the hidden-state delta 3. Second, it smooths this signal over a causal trailing window of size 4, producing 5. The paper states that this smoothing improves correlation substantially relative to the raw signal (&&&1ti:\1&&&).
Third, it selects the two empirically relevant layer bands: Band A, layers 7–13, with positive correlation to importance; and Band B, layers 18–25, with negative correlation. The primary score uses representative layers near the centers of these bands, especially layers 11ti:\1^ and 21. Fourth, it combines them as 6 (&&&1ti:\1&&&).
A further methodological result is that raw hidden-state change has a monotonic positional trend within a trace. In effect, the raw score can track position as much as content, which would confound token ranking. To remove this positional drift, the paper introduces a causal rolling z-score,
7
where 8 and 9 are the trailing-window mean and standard deviation, and 1ti:\1^ is a small stabilizer. The final EpiKV score is then
1
At each decode step, the policy preserves prompt or prefill tokens, preserves a trailing recency window, scores the remaining cached positions, keeps the top-2 tokens by score, and evicts the rest permanently. Because each token’s score is frozen when the token is generated, the method remains fully online and causal (&&&1ti:\1&&&).
4. Systems compatibility and inference-stack implications
A defining property of EpiKV is that it does not require output_attentions=True, attention-matrix materialization, custom attention kernels, training, or an auxiliary classifier. The only required signals are cached K/V tensors, which are already resident, and hidden states exposed by the standard inference interface. This makes the method compatible with standard fused inference stacks such as FlashAttention, vLLM, TGI, and SGLang without modifying the FlashAttention kernel itself (&&&1ti:\1&&&).
The paper describes an implementation through HuggingFace DynamicCache and records several engineering fixes needed for correctness. Keep masks had to be moved to the correct device in multi-GPU settings. After eviction, the cache had to be rebuilt so that _seen_tokens matched the retained cache length. Otherwise, causal masking would be off by one. These are presented as cache-management details rather than kernel modifications, reinforcing the paper’s claim that the method drops into existing FlashAttention-based serving stacks without architectural surgery (&&&1ti:\1&&&).
This suggests a more precise distinction between EpiKV and attention-based baselines than a purely algorithmic comparison would capture. The contrast is not only between two token-importance signals; it is between a policy that preserves fused-kernel execution and one that can force a reversion to eager attention, thereby reinstating the quadratic memory behavior that long-context deployment is trying to avoid (&&&1ti:\1&&&).
5. Empirical results and benchmark comparisons
The reported MATH-51ti:\1ti:\1^ result without eviction is 75%. EpiKV reaches 1ti:\1% at a 512-token cache, 27% at 11ti:\124, 49% at 21ti:\148, and 72% at 41ti:\196. At the 41ti:\196-token budget, ThinKV is reported at 71% and H2O at 67%, so EpiKV is at parity with, or slightly above, the strongest attention-based baseline at that budget (&&&1ti:\1&&&).
| Setting | Reported result | Comparison |
|---|---|---|
| MATH-51ti:\1ti:\1, no eviction | 75% | Reference |
| MATH-51ti:\1ti:\1, EpiKV, 41ti:\196 | 72% | ThinKV 71%, H2O 67% |
| MATH-51ti:\1ti:\1, EpiKV, 21ti:\148 | 49% | Budget-sensitive regime |
| MATH-51ti:\1ti:\1, EpiKV, 11ti:\124 | 27% | Small-budget degradation |
| MATH-51ti:\1ti:\1, EpiKV, 512 | 1ti:\1% | Small-budget degradation |
The H2O failure mode is described as especially severe on reasoning traces. On MATH-51ti:\1ti:\1, H2O reaches 67% at 41ti:\196, 49% at 21ti:\148, 5% at 11ti:\124, and 1% at 512. The paper further reports collapsed generation rather than merely incorrect answers: at 11ti:\124, H2O produces no generated answer on 93/11ti:\1ti:\1^ problems; at 21ti:\148, on 48/11ti:\1ti:\1; and at 41ti:\196, on 27/11ti:\1ti:\1. At 512, it often emits unstructured text with no extractable answer (&&&1ti:\1&&&).
AIME-21ti:\124 is presented as a harder and longer-trace benchmark. The no-eviction score is 43.3%. EpiKV reports 1ti:\1.1ti:\1 at 512, 11ti:\124, and 21ti:\148; 16.7% at 41ti:\196; and 33.3% at 8192. The paper also reports an attention-free variant, Lag-KV, at 21ti:\1.1ti:\1 for 41ti:\196 and 36.7% for 8192, compared with ThinKV at 6.7%, 21ti:\1.1ti:\1 and 31ti:\1.1ti:\1 for 21ti:\148, 41ti:\196, and 8192 respectively, and H2O at 21ti:\1.1ti:\1 and 33.3% for 41ti:\196 and 8192 (&&&1ti:\1&&&).
| Setting | Reported result | Comparison |
|---|---|---|
| AIME-21ti:\124, no eviction | 43.3% | Reference |
| AIME-21ti:\124, EpiKV, 8192 | 33.3% | H2O 33.3%, ThinKV 31ti:\1.1ti:\1 |
| AIME-21ti:\124, Lag-KV, 8192 | 36.7% | Best reported attention-free variant |
| AIME-21ti:\124, EpiKV, 41ti:\196 | 16.7% | ThinKV 21ti:\1.1ti:\1 H2O 21ti:\1.1ti:\1 |
The paper also reports runtime comparisons at 8192 on AIME-21ti:\124: Lag-KV takes 441ti:\1.5s per problem, ThinKV 721.1ti:\1s, and RaaS 1238.7s. This is the basis for the claim of up to 2.8x speed and about 1.6x relative to ThinKV. The text is careful not to claim universal dominance across all budgets; it instead emphasizes deployable budgets, where EpiKV or related attention-free variants are parity-or-better while preserving FlashAttention compatibility (&&&1ti:\1&&&).
6. Limitations, assumptions, and interpretation
The paper is explicit about its limits. Evaluation is shown on a single model family, DeepSeek-R1-Distill-LLaMA-8B, and cross-architecture transfer is not tested. The results are budget-sensitive, and no single FlashAttention-2-compatible method wins at every budget. AIME-21ti:\124 contains only 31ti:\1^ problems, so the paper treats its results as directional and notes that the confidence intervals for AIME span zero. Throughput measurements are single-GPU, single-example measurements, with some results described as projections or microbenchmarks rather than full batched deployment measurements (&&&1ti:\1&&&).
The selected layer bands are also not presented as universal constants. The paper states that important layers shift with task difficulty and that, on GSM8K, the anatomy moves toward earlier layers. Layers 11ti:\1^ and 21 are therefore regime-specific hyperparameters rather than architecture-independent invariants. The method also assumes access to hidden states through standard inference APIs, a causal decode setting in which token importance can be fixed online at generation time, and a policy in which prompt or prefill tokens and a recency window are always preserved (&&&1ti:\1&&&).
A plausible implication is that EpiKV should be understood less as a closed-form universal recipe than as a specific design pattern for attention-free cache eviction: rank tokens by locally normalized representational change, preserve structural tokens, and keep the policy causal and production-compatible. Within that framing, its main contribution is to redefine token importance in long reasoning traces as a property of internal state transition rather than explicit attention allocation (&&&1ti:\1&&&).