Large language models (LLMs) face significant challenges in processing long contexts due to the linear growth of the key-value (KV) cache and quadratic complexity of self-attention. Existing approaches address these bottlenecks separately: Multi-head Latent Attention (MLA) reduces the KV cache by projecting tokens into a low-dimensional latent space, while sparse attention reduces computation. However, sparse methods cannot operate natively on MLA's compressed latent structure, missing opportunities for joint optimization. In this paper, we propose Latent-Condensed Attention (LCA), which directly condenses context within MLA's latent space, where the representation is disentangled into semantic latent vectors and positional keys. LCA separately aggregates semantic vectors via query-aware pooling and preserves positional keys via anchor selection. This approach jointly reduces both computational cost and KV cache without adding parameters. Beyond MLA, LCA's design is architecture-agnostic and readily extends to other attention mechanisms such as GQA. Theoretically, we prove a length-independent error bound. Experiments show LCA achieves up to 2.5× prefilling speedup and 90% KV cache reduction at 128K context while maintaining competitive performance.
Figures & tables
Figure 1: An overview of Latent-Condensed Attention (LCA). The history context is condensed into a compact set of representatives via group-wise condensation in the latent space: semantic information is aggregated through weighted pooling of CKV , while positional information is preserved via anchor selection from KR . The recent context is retained in full fidelity without condensation.
Methods
Computation
Memory
No Extra Params
Minference
<O(L2)
O(L)
✓
FlexPrefill
<O(L2)
O(L)
✓
KDA
<O(L2)
O(L)
Ours
O(Lm)
O(m)
✓
Table 1: Comparison of efficient attention methods.
Methods
S. QA
M. QA
Sum.
F. S.
Syn.
Code
Avg.↑
FTL (s) ↓
DeepSeek V2-Lite (MLA)
23.92
11.15
17.52
63.19
3.09
58.17
29.51
3.20
∙ MInference Jiang et al. (2024)
14.54
5.61
13.80
41.15
2.17
41.01
19.71
2.99 (1.1 × )
∙ FlexPrefill Lai et al. (2025)
14.35
5.94
14.10
48.00
2.22
41.72
21.05
2.51 (1.3 × )
∙ KDA Kimi et al. (2025b)
18.81
11.68
14.22
56.97
3.25
57.97
27.15
2.47 (1.3 × )
∙ LCA (Ours)
22.61
8.90
23.74
58.27
2.33
58.67
29.09
1.80 (1.8 × )
Table 2: Comparisons on LongBench-E Bai et al. (2023) . We report the latency of DeepSeek V2-Lite within contexts of 64K on H200 GPUs.
Methods
4K
8K
16K
32K
64K
128K
Avg.↑
FTL (s) ↓
DeepSeek V2-Lite ( MLA )
79.51
78.82
62.28
58.33
47.57
23.96
58.91
10.78
∙ MInference Jiang et al. (2024)
76.88
69.69
44.06
20.31
10.31
4.34
37.60
5.66 (1.9 × )
∙ FlexPrefill Lai et al. (2025)
72.81
70.00
56.25
19.06
9.38
7.19
39.11
5.38 (2.0 × )
∙ KDA Kimi et al. (2025b)
72.22
73.61
64.24
51.39
44.10
22.22
54.63
4.96 (2.2 × )
∙ LCA (Ours)
77.19
77.19
63.75
59.69
50.63
24.38
58.80
4.40 (2.5 × )
Table 3: Comparisons on RULER Hsieh et al. (2024) across 4-128K context. We report the latency of DeepSeek V2-Lite within contexts of 128K on H200 GPUs.
Figure 2: Efficiency comparison of different context lengths. (a) presents the first-token generation latency. (b) shows the per-token (interval) latency during decoding. (c) illustrates the GPU memory footprint of KV cache.
Table 6Table 7Figure 8
#Queries
S. QA
M. QA
Sum.
F. S.
Syn.
Code
Avg.
32
23.01
8.82
23.87
58.33
2.41
59.09
29.26
16 (default)
22.61
8.90
23.74
58.27
2.33
58.67
29.09
8
22.34
8.37
23.17
56.22
2.09
58.41
28.43
Table 8: Ablation on the number of queries used to compute importance scores. Default setting is 16.
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
Context Length
4K
32K
128K
∥ki∥2
20.00
22.13
21.39
δk
0.43
0.64
0.77
δk/∥ki∥2
2.15%
2.89%
3.60%
∥vi∥2
20.87
21.38
21.23
δv
0.68
0.73
0.77
δv/∥vi∥2
3.26%
3.41%
3.63%
Appendix
Table 9: Statistics across different context lengths.
Metric
Multi-Doc. QA
Summarization
Code
∥ki∥2
22.76
21.42
20.07
δk
0.67
0.98
0.89
δk/∥ki∥2
2.94%
4.58%
4.43%
∥vi∥2
19.09
24.78
29.78
δv
0.56
0.51
0.98
δv/∥vi∥2
2.93%
2.06%
3.29%
Appendix
Table 10: Statistics across different task types.
g
LongBench Avg.
RULER Avg. (4K–128K)
RULER@128K
32
28.32
58.18
23.96
16
29.09
58.80
24.38
8
29.38
59.42
24.63
Appendix
Table 11: Effect of group size g with fixed window size w=1024 .
w
LongBench Avg.
RULER Avg. (4K–128K)
RULER@128K
512
28.84
57.14
23.68
1024
29.09
58.80
24.38
2048
29.14
59.52
25.53
Appendix
Table 12: Effect of window size w with fixed group size g=16 .
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× 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.
Zhanchao Xu, Haoyang Li, Qingfa Xiao +4
Department of Computing, PolyU · DSA, HKUST(GZ) · CSE, HKUST
Large language models (LLMs) face severe memory bottlenecks in long-context inference due to the linearly growing size of key-value (KV) caches. Existing KV cache compression techniques typically rely on simple heuristics, overlooking the distinct functional roles of different attention heads. We present SGD-KV (Summarization-Guided KV Cache Compression), a head-aware framework that leverages a novel chunk-summarization diagnostic task to systematically identify and prioritize attention heads specialized in hierarchical information aggregation. Experiments on Qwen2.5-7B-1M and Qwen3-32B across diverse long-context benchmarks demonstrate that SGD-KV achieves state-of-the-art performance with contexts up to 1M tokens, while reducing KV cache memory usage by up to 75%. Our findings show that strategically allocating the KV cache budget based on the summarization score distribution of attention heads yields a superior efficiency-accuracy trade-off for long-context inference.
Large Language Models (LLMs) face significant computational challenges when processing long contexts due to the quadratic complexity of self-attention. While soft context compression methods, which map input text to smaller latent representations, have shown promise, their real-world adoption is limited. Existing techniques typically compress the context as a single unit, which leads to quadratic compression complexity and an inability to reuse computations across queries with overlapping contexts. In this work, we introduce CompLLM, a soft compression technique designed for practical deployment. Instead of processing the context holistically, CompLLM divides it into segments and compresses each one independently. This simple design choice yields three critical properties: efficiency, as the compression step scales linearly with the context length; scalability, enabling models trained on short sequences (e.g., 1k tokens) to generalize to contexts of 100k tokens; and reusability, allowing compressed segments to be cached and reused across different queries. Our experiments show that with a 2x compression rate, at high context lengths CompLLM speeds up Time To First Token (TTFT) by up to 4x and reduces the KV cache size by 50%. Furthermore, CompLLM achieves performance comparable to that obtained with the uncompressed context, and even surpasses it on very long sequences, demonstrating its effectiveness and practical utility.
Gabriele Berton, Jayakrishnan Unnikrishnan, Son Tran +1
Amazon · Center For Research in Computer Vision, University of Central Florida