CompKV: Compensation-Aware KV Selection for Long-Context LLM Inference

Zhen Huang, Ruizhe Yao, Danyi Liu, Xinrui Chen, Shuwei Li +6 more
9/22/2026
cs.LGcs.AI

No confident code implementation found for this paper.

Abstract

Despite their strong performance, large language models (LLMs) are bottlenecked by KV cache memory traffic during long-context inference. Sparse attention is widely used to accelerate LLM inference by computing exact attention over a selected subset of tokens. To recover the contribution of tokens excluded from exact attention, recent methods apply coarse-grained compensation to the omitted attention tail. However, existing methods typically select tokens based on attention mass and only then compensate for the unselected tokens. This decoupled design overlooks their interaction: selection should prioritize tokens that would leave the largest compensation error if omitted. To address this limitation, we introduce CompKV, the first compensation-aware sparse attention framework that divides tokens into blocks and explicitly optimizes selection for the downstream compensation mechanism. Our theoretical analysis shows that the residual left by block-level mean compensation is governed by both block attention mass and within-block logit variation. We approximate this residual using compact block-level statistics, yielding a deployable selection criterion. We further develop an efficient asynchronous implementation. Experiments on RULER and LongBench-Pro show that CompKV performs best among the evaluated sparse baselines while delivering up to a $6.85\times$ self-attention speedup over full attention.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{huang2026compkv,
  title  = {CompKV: Compensation-Aware KV Selection for Long-Context LLM Inference},
  author = {Zhen Huang and Ruizhe Yao and Danyi Liu and Xinrui Chen and Shuwei Li and Siru Zhong and Zijian Cao and Yushan Lai and Mingming Guo and Weijie Zheng and Haohuan Fu},
  year   = {2026},
  eprint = {2609.26300},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2609.26300v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2609.26300.svg)](https://codeofpaper.com/paper/2609.26300)

Discussion