Task-KV: Task-aware KV Cache Optimization via Semantic Differentiation of Attention Heads
On the map: Efficient LLM inference and serving → KV cache optimization
Abstract (arXiv)
KV cache is a widely used acceleration technique for large language models (LLMs) inference. However, its memory requirement grows rapidly with input length. Previous studies have reduced the size of KV cache by either removing the same number of unimportant tokens for all attention heads or by allocating differentiated KV cache budgets for pre-identified attention heads. However, due to the importance of attention heads varies across different tasks, the pre-identified attention heads fail to adapt effectively to various downstream tasks. To address this issue, we propose Task-KV, a method that leverages the semantic differentiation of attention heads to allocate differentiated KV cache budgets across various tasks. We demonstrate that attention heads far from the semantic center (called heterogeneous heads) make an significant contribution to task outputs and semantic understanding. In contrast, other attention heads play the role of aggregating important information and focusing reasoning. Task-KV allocates full KV cache budget to heterogeneous heads to preserve comprehensive semantic information, while reserving a small number of recent tokens and attention sinks for non-heterogeneous heads. Furthermore, we innovatively introduce middle activations to preserve key contextual information aggregated from non-heterogeneous heads. To dynamically perceive semantic differences among attention heads, we design a semantic separator to distinguish heterogeneous heads from non-heterogeneous ones based on their distances from the semantic center. Experimental results on multiple benchmarks and different model architectures demonstrate that Task-KV significantly outperforms existing baseline methods.
Key facts. Cited by 4 papers in the map (data through 7 Oct 2026). Placed in KV cache optimization, one of 12 directions in Efficient LLM inference and serving. Builds on 26 of its 40 references that are in the map. First posted on arXiv 25 Jan 2025.
Builds on
26 of 40 references.
Closest ancestors · 7
Same direction, newest first
- 2024DuoAttention: Efficient Long-Context LLM Inference with Retrieval and Streaming Heads14 Oct
- 2024RazorAttention: Efficient KV Cache Compression Through Retrieval Heads22 Jul
- 2024PyramidKV: Dynamic KV Cache Compression based on Pyramidal Information Funneling4 Jun
- 2024MiniCache: KV Cache Compression in Depth Dimension for Large Language Models23 May
- 2024PyramidInfer: Pyramid KV Cache Compression for High-throughput LLM Inference21 May
- 2024SnapKV: LLM Knows What You are Looking for Before Generation22 Apr
- 2023Model Tells You What to Discard: Adaptive KV Cache Compression for LLMs3 Oct
Other references · 19
- 2017Attention Is All You Needcited by 59,932
- 2018HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answeringcited by 3,686
- 2023Mistral 7Bcited by 3,065
- 2017TriviaQA: A Large Scale Distantly Supervised Challenge Dataset for Reading Comprehensioncited by 2,895
- 2023Retrieval-Augmented Generation for Large Language Models: A Surveycited by 2,185
- 2023Efficient Streaming Language Models with Attention Sinkscited by 2,115
- 2023LongBench: A Bilingual, Multitask Benchmark for Long Context Understandingcited by 1,378
- 2023GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpointscited by 1,311
- 2020Constructing A Multi-hop QA Dataset for Comprehensive Evaluation of Reasoning Stepscited by 1,259
- 2019Multi-News: a Large-Scale Multi-Document Summarization Dataset and Abstractive Hierarchical Modelcited by 431
- 2021QMSum: A New Benchmark for Query-based Multi-domain Meeting Summarizationcited by 363
- 2023RepoBench: Benchmarking Repository-Level Code Auto-Completion Systemscited by 346
7 more
- 2021Efficient Attentions for Long Document Summarizationcited by 342
- 2023Tool Learning with Foundation Modelscited by 302
- 2024Retrieval Head Mechanistically Explains Long-Context Factualitycited by 219
- 2023LooGLE: Can Long-Context Language Models Understand Long Contexts?cited by 200
- 2020The Lipschitz Constant of Self-Attentioncited by 171
- 2021Contributions of Transformer Attention Heads in Multi- and Cross-lingual Taskscited by 16
- 2024LongHeads: Multi-Head Attention is Secretly a Long Context Processorcited by 16
Built on by
Citing papers per year: 2025: 4.
4 papers.
- 2025SentenceKV: Efficient LLM Inference via Sentence-Level Semantic KV Cachingcited by 9
- 2025Unveiling Simplicities of Attention: Adaptive Long-Context Head Identificationcited by 5
- 2025NOSA: Native and Offloadable Sparse Attentioncited by 4
- 2025HA-RAG: Hotness-Aware RAG Acceleration via Mixed Precision and Data Placementcited by 0
- 2025HA-RAG: Hotness-Aware RAG Acceleration via Mixed Precision and Data Placement23 Oct 2025
- 2025NOSA: Native and Offloadable Sparse Attention15 Oct 2025
- 2025SentenceKV: Efficient LLM Inference via Sentence-Level Semantic KV Caching1 Apr 2025
- 2025Unveiling Simplicities of Attention: Adaptive Long-Context Head Identification11 Feb 2025
Similar, not cited
Close in wording, no citation either way
- 2024Beyond KV Caching: Shared Attention for Efficient LLMs
- 2025CAKE: Cascading and Adaptive KV Cache Eviction with Layer Preferences
- 2026SGD-KV: Summarization Guided KV Cache Compression
- 2025LLMs Know What to Drop: Self-Attention Guided KV Cache Eviction for Efficient Long-Context Inference
- 2026CateKV: On Sequential Consistency for Long-Context LLM Inference Acceleration
- 2026LKV: End-to-End Learning of Head-wise Budgets and Token Selection for LLM KV Cache Eviction
- 2024A Survey on Large Language Model Acceleration based on KV Cache Management
- 2025KVCompose: Efficient Structured KV Cache Compression with Composite Tokens