Skip to content
AI.info

Research

DropKV: Decoupling Residual-Output Perturbation for Near-Optimal KV-Cache Eviction

Overview Research area: Efficient inference for large language models (LLM systems / long-context serving), specifically key-value (KV) cache eviction. Technical level: Advanced. The paper combines a

DropKV: Decoupling Residual-Output Perturbation for Near-Optimal KV-Cache Eviction
arXiv
2610.22130
Published
2026-10-15
Authors
Aozhong Zhang, Selcuk Gurses, Yanxia Deng, Naigang Wang, Chi-Chun Liu, Davis Wertheimer, Derrick Liu, Xin Li, Zi Yang, Felix X. -F. Ye, Penghang Yin

AI summary

Overview

Research area: Efficient inference for large language models (LLM systems / long-context serving), specifically key-value (KV) cache eviction.

Technical level: Advanced. The paper combines a combinatorial-optimization argument with a constant-factor approximation proof, empirical verification of theoretical assumptions on real prefill passes, and hand-written Triton kernels.

Scope (1 sentence): The paper proposes DropKV, a KV-cache eviction scoring rule derived from the exact attention-output perturbation, proves it is near-optimal under a verifiable "cone condition," and backs it with fused Triton kernels and evaluations on RULER and LongBench across three long-context models.

What This Paper Is About

Serving LLMs on long inputs is bottlenecked by the KV cache, which grows linearly with sequence length — the paper notes that caching 128K tokens in Phi-3-mini needs roughly 48 GB in FP16 for the cache alone versus about 7 GB for the model weights. Eviction methods keep only a small subset of tokens, but the "best" subset is defined by minimizing the change in attention output, and finding it exactly is an NP-hard combinatorial search. DropKV's goal is to replace that intractable search with a per-token score that is cheap to compute, provably close to the optimal eviction set, and fast enough to run inside a production prefill kernel.

Key Contributions

  1. Decoupled perturbation framework. Instead of jointly optimizing the eviction set, DropKV scores each token independently by the output perturbation caused by removing just that token, using the exact residual form p_j/(1-p_j) · ||a − v_j||₂. The score costs O(nd) in parallel rather than requiring enumeration over the (n choose k) possible subsets.

  2. Constant-factor near-optimality guarantee. The paper proves that, under a small-eviction-probability assumption and a "cone condition" on the residual directions a − v_j, the decoupled selection matches the optimal NP-hard solution up to the factor 1/[c(1−ε)(1−kε)]. The cone condition is empirically checked on Llama-3.1-8B-Instruct, MegaBeam-Mistral-7B-512K, and Qwen2.5-7B-Instruct-1M at 128K context.

  3. Fused Triton implementation. Three fused Triton kernels (a FlashAttention-2-style forward pass, a scoring kernel, and a split-K merge) compute eviction scores on the fly without materializing the attention matrix, cutting scoring-kernel scratch from about 9 GB to about 17 MB at n = 128K and delivering a 19.8× scoring-kernel speedup.

  4. State-of-the-art accuracy and latency at matched budgets. DropKV reports the highest average accuracy and lowest latency among query-aware and output-aware eviction baselines on RULER and LongBench at 5% and 10% budgets (30% is also evaluated), while remaining faster than the dynamic-cache baseline.

Main Findings

  • RULER at 128K, 5% budget: DropKV averages 82.00 on Llama-3.1-8B-Instruct, 83.77 on Qwen2.5-7B-1M, and 85.40 on Mistral-7B-512K, corresponding to gains of 2.35, 3.87, and 4.03 points over the best competing baseline. Full-KV references for the same table are 84.84, 87.01, and 89.02.

  • LongBench at 5% budget: DropKV reaches 45.51 on Llama-3.1-8B-Instruct, 42.66 on Qwen2.5-7B-1M, and 36.22 on Mistral-7B-512K, improvements of 0.87, 0.94, and 0.68 points over the strongest baseline. Full-KV scores there are 49.91, 46.47, and 40.15.

  • Graceful degradation at long context: The authors report that competing methods degrade more sharply as sequence length grows, while DropKV stays closest to Full-KV, most visibly at 128K.

  • Cone condition holds on most head/query triples: At n = 128K, the cone constant c* is positive on 91.2%, 91.1%, and 76.5% of (layer, head, query-position) triples for Llama, Mistral, and Qwen2.5, with median c* of +0.107, +0.094, and +0.074. Requiring both preconditions simultaneously leaves a finite factor on 89.1%, 87.5%, and 73.4% of triples.

  • Theoretical bound is loose in practice: The realized multiplicative factor has median 10.4, 11.8, and 11.3 across the three models, but a brute-force study on small candidate subsets shows the empirical ratio F(Ĵ)/F(J*) has median ≤ 1.16 and 95th percentile ≤ 1.43.

  • Early-layer weakness: Per-layer prevalence of the cone condition stays high from Layer 1 onward on Llama and Mistral, but Llama Layer 0 is about 16% and Qwen2.5 Layers 0–3 are below 10%.

  • Scoring memory and speed: At n = 128K, B = 1, w = 8, and 5% budget, the Triton kernel is 19.8× faster than the PyTorch reference while holding scratch at about 17 MB versus about 9 GB (roughly 540× reduction); total peak allocation falls from 10.6 GB to 1.6 GB on the heaviest of the three models. Speedup grows from 1.8× at n = 4K to 19.8× at n = 128K.

  • End-to-end prefill: Matched-batch prefill speedup is positive in eight of nine (n, model) cells for n in {4K, 32K, 128K}, ranging from +1.9% to +9.9%; the single exception is Qwen at n = 32K with −0.1%. Dynamic cache admits a strictly smaller batch at every n and model, so a matched-batch comparison against it is not defined.

  • Throughput versus dynamic cache: Decoding throughput at each method's maximum feasible batch is 1.75–8.22× higher than the dynamic cache at 5% budget, a gain the authors attribute to KV-bandwidth reduction shared by any eviction method at that budget.

  • Adaptive head budgets: Combining DropKV scoring with AdaKV's head budget allocation (AdaDropKV) beats CAKE, AdaKV, and AnDPro on RULER at 64K and on LongBench at 5%, 10%, and 30%. For Llama, AdaDropKV scores 90.08/90.54/91.30 on RULER (Full-KV 91.35) and 46.45/48.43/49.47 on LongBench (Full-KV 49.91).

  • Robustness beyond the cone condition: A relaxed assumption bounds outlier residual mass by μ ≥ 0 and yields an additive bound that recovers the main theorem when μ = 0.

Methodology in Plain English

The starting point is a formula for what happens to a single attention output when you delete tokens. Removing a token does not just subtract its value vector; the softmax renormalizes over the surviving tokens, so the shift is the deleted token's attention weight times the difference between the current output and that token's value, divided by one minus the deleted weight. The authors show this quantity can be computed from the full cache before any eviction decision is made.

Choosing the group of k tokens that minimizes the total shift is a combinatorial problem — the paper states it is NP-hard, and enumerating every possible subset is hopeless. DropKV's move is to throw away the interaction terms between evicted tokens and rank tokens by their individual single-token shift, then delete the k smallest. Because each token's score is independent, all n scores can be computed in parallel at linear cost.

For real use, the score is accumulated over an observation window of the last w queries and squared, which keeps the same ranking at w = 1 but makes the computation kernel-friendly. A max-pool over neighbouring scores and pinning the most recent w tokens as always-retained follow the observation-window convention of SnapKV.

The theory explains why the crude independence assumption works. If no candidate token carries much attention weight, the renormalization denominators stay near one. If the residual vectors a − v_j all point into a narrow cone around some direction u, the individual perturbations reinforce rather than cancel, so ranking by individual size also ranks the group correctly. The paper measures the cone constant on real 128K-token prefill passes for three models and finds it positive on the large majority of head/query triples.

The engineering half of the paper replaces the naive PyTorch implementation — which would materialize w×n attention weights and w×n×d value-distance intermediates — with three fused Triton kernels. The scoring kernel reuses the log-sum-exp from a FlashAttention-style forward pass, recomputes logits tile by tile, derives the attention weight on the fly, and expands the squared distance as ||a||² + ||v||² − 2⟨a,v⟩ so each value tile is read once per pass.

Evaluation covers three decoder-only long-context models, seven eviction baselines (SnapKV, PyramidKV, StreamingLLM, KeyDiff, CAKE, CriticalKV, AnDPro), RULER and the 16 English and code tasks of LongBench, at 5%, 10%, and 30% cache budgets, using the last 8 query tokens and pooling kernel size 11 on an NVIDIA A100-80GB within a unified lm-evaluation-harness pipeline.

Why This Matters

Impact on research. The paper reframes KV eviction as an approximation problem with a stated guarantee rather than a collection of attention-score heuristics. It also closes a gap that output-aware methods had left open: CriticalKV minimizes a loose upper bound and AnDPro uses a convex relaxation, whereas DropKV scores with the exact per-token perturbation and then bounds the gap to the joint optimum. The empirical cone-condition audit gives the theory a falsifiable footprint on real models, and the Triton path shows that a principled score can also be a fast one — a combination the paper argues has been missing.

Real-world applications:

  • Long-document assistants that must hold contracts, filings, or research papers in context without exhausting GPU memory.
  • Code assistants operating over entire repositories, where the input is long and the token budget for the cache is fixed.
  • Multi-turn conversational agents with lengthy transcripts, where the resident cache footprint directly caps the number of concurrent users.
  • Retrieval-augmented generation with many retrieved passages, where prefill cost and cache size, not model quality, set the serving economics.

Industry relevance. The memory arithmetic in the introduction — 48 GB of KV cache against 7 GB of weights for a small model at 128K tokens — is the constraint that limits batch size and therefore throughput per GPU. A 19.8× reduction in scoring-kernel scratch (from about 9 GB to about 17 MB) and a peak allocation drop from 10.6 GB to 1.6 GB removes a prefill bottleneck that would otherwise negate the savings from eviction, and the reported 1.75–8.22× decoding throughput advantage over dynamic cache maps directly onto serving cost.

Future Directions

  • Tighter guarantees and weaker assumptions. The worst-case factor is large (median 10.4–11.8) while the measured ratio is near 1 (median ≤ 1.16), so a sharper analysis — or one that exploits structure beyond the cone condition — is an open problem. The additive μ-relaxation is a first step.
  • Fixing the early-layer gap. Llama Layer 0 (about 16%) and Qwen2.5 Layers 0–3 (below 10%) show pronounced dips in cone prevalence, which suggests layer-specific scoring or eviction policies could recover additional accuracy.
  • Extending adaptive and decode-side eviction. AdaDropKV already merges DropKV scoring with AdaKV's head budget allocation; pushing the same scoring into decoding-time eviction, and into combinations with quantization or low-rank compression (which the paper frames as orthogonal), remains open.
  • Broader model and hardware coverage. The empirical verification and main results cover three 7B–8B-class models on A100-80GB; whether the cone condition and the kernel speedups transfer to larger models and other accelerators is not established in the provided content.

Target Audience

Researchers and engineers working on LLM inference systems, long-context serving, and KV-cache optimization. The paper is most useful to readers who want both a theoretical handle on why a simple eviction heuristic works and a concrete kernel-level recipe for making it fast; it assumes familiarity with attention mechanics, softmax renormalization, and GPU memory hierarchies. Practitioners focused purely on applying an off-the-shelf eviction policy can read the method and results sections, while the appendix-heavy theory and per-task breakdowns suit those building on the guarantee itself.

Authors’ abstract

Key-value (KV) cache management has become a critical bottleneck for scaling Large Language Models (LLMs) to long-context scenarios due to linear memory growth. While recent eviction methods have moved beyond simple attention-score heuristics to incorporate value representations, they typically face a fundamental trade-off: the underlying optimization for minimizing output perturbation is an NP-hard combinatorial problem, leading to mathematically suboptimal heuristics or implementations that are difficult to kernelize. In this work, we propose DropKV, a simple principled eviction framework based on Decoupled Residual-Output Perturbation. By decoupling the joint eviction decision into independent per-token scoring, DropKV circumvents combinatorial intractability and admits a provable constant-factor approximation guarantee under a cone condition that we empirically verify on three long-context LLMs. To ensure practical viability, we provide a high-performance implementation using fused Triton kernels that avoid materializing the full attention matrix, delivering a 19.8x scoring-kernel speedup that translates to up to a 9.9% matched-batch end-to-end prefill speedup. Extensive evaluations on the RULER and LongBench benchmarks demonstrate that DropKV consistently outperforms state-of-the-art baselines at equivalent cache budgets, achieving the lowest inference latency among eviction methods while also remaining faster than the dynamic cache baseline.

Read the original paper