From Rigid to Dynamic: Entropy-Guided Adaptive Inference for Long-Context LLMs

Zhanchao Xu, Haoyang Li, Qingfa Xiao, Fei Teng, Chen Jason Zhang +2 more
6/8/2026
cs.AIcs.CL

Official code: SHA-4096/EntropyInfer (1 star, last commit 2026-06-08).

Abstract

Existing sparse attention and KV cache compression methods for long-context LLM inference typically apply fixed sparsity patterns or uniform budgets across all attention heads, overlooking the substantial variation in attention behavior among heads and contexts. We observe two distinct entropy patterns among attention heads: Rigid Heads, whose entropy stays near zero across input segments, and Dynamic Heads, whose entropy fluctuates significantly. Crucially, the distribution of these types is context-dependent and cannot be predetermined offline. We therefore propose EntropyInfer, a training-free framework that uses attention entropy to adaptively allocate compute at the granularity of individual heads and segments during prefilling. For decoding, we introduce a latent KV cache compression scheme that leverages generated output tokens, rather than prefill tokens alone, to identify and retain the most critical cache entries. Extensive experiments on Llama, Qwen and openPangu model series show that EntropyInfer consistently outperforms baselines including SnapKV, AdaKV, and CritiPrefill, achieving up to 2.39$\times$ end-to-end speedup beyond 100k tokens with minimal quality degradation compared to full attention. The code is released in https://github.com/SHA-4096/EntropyInfer.

View on arXivView PDF

Code Implementations(1)

Code implementation for From Rigid to Dynamic: Entropy-Guided Adaptive Inference for Long-Context LLMs

10Shell, PythonJun 5, 20264 months ago

Similar Papers

Cite this paper

@article{xu2026from,
  title  = {From Rigid to Dynamic: Entropy-Guided Adaptive Inference for Long-Context LLMs},
  author = {Zhanchao Xu and Haoyang Li and Qingfa Xiao and Fei Teng and Chen Jason Zhang and Lei Chen and Qing Li},
  year   = {2026},
  eprint = {2606.09508},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2606.09508v1}
}

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/2606.09508.svg)](https://codeofpaper.com/paper/2606.09508)

Discussion