Long-context LLM inference is bottlenecked by the memory demands of the key-value (KV) cache, whose size scales linearly with context length. Dynamic sparse attention reduces this bottleneck by fetching and attending only to a critical subset of tokens. The dominant primitive in dynamic sparse attention research and deployment is fixed-budget top-k selection, which is favored because its deterministic block count aligns with the static memory allocation that systems like vLLM rely on. Top-k uses a fixed budget regardless of how attention mass is distributed across heads, layers, and decode steps, leading to either wasted bandwidth on heads with peaky attention or dropped context on heads with diffuse attention. Top-p (nucleus) selection adapts naturally to this variation but has seen limited adoption in production serving systems due to two system-level challenges: variable block counts that break deterministic block allocation and computationally expensive selection kernels that exceed the cost of attention itself. We present DisSparse, a serving system that integrates top-p sparse attention into vLLM end-to-end. DisSparse decouples block selection from the scheduler's critical path, hides selection latency behind layer computation via a two-stream pipeline, and introduces a single-pass histogram-based top-p kernel. We further observe intra-block sparsity, the inflation of selection budgets caused by mixing high- and low-importance tokens within fixed-size KV cache blocks, and address it with a token relocation kernel guided by accumulated prefill attention scores. Across long- and medium-context benchmarks on multiple models, DisSparse achieves 1.17x to 1.80x speedup in sparsity analysis (block selection) over state-of-the-art top-p methods with negligible accuracy loss and supports up to 8x larger maximum batch sizes than dense vLLM under the same memory budget.
Figures & tables
Figure 1: Llama-3.1-8B-Instruct [ 47 ] on NarrativeQA from LongBench [ 12 ] : critical token counts per layer per decode step vary substantially, showing why fixed- k budgets are mismatched. Results on other models are in Appendix A .
Figure 2: Llama-3.1-8B-Instruct [ 47 ] , Layer 0 on LongBenchV2 [ 11 ] . Block-level top- p selects ∼2× more tokens than a token-level oracle to reach p=0.95 , motivating the relocation kernel.
Figure 3
Figure 5: Percentage of selected critical blocks per KV head for layer 4 in Llama-3.1-8b-Instruct on LongBenchV2 samples. Results on other models are in Appendix A .
Figure 6: Pipelined Execution
Figure 7: vLLM System Overview. DisSparse adds the new INT4 cache to the KV cache manager and synchronization unit between the workers (model executor) and the KV cache manager (scheduler).
Blocks
Mass
Threshold
FP16
INT4
Extra
Recall
FP16
INT4
p=0.8
66.9
72.3
+5.3
0.9754
0.8346
0.8612
p=0.85
89.1
94.9
+5.8
0.9743
0.8737
0.8906
p=0.9
123.3
129.2
+5.8
0.9723
0.9140
0.9227
p=0.95
187.4
193.5
+6.0
0.9731
0.9559
0.9590
Table 1: Selection difference between DisSparse applied on INT4 vs. exact top- p selection on FP16 with PyTorch [ 67 ] on LongBenchV2 samples. Mass: average cumulative probability of selected blocks.
LongChat-7B
LLaMA-3.1-8B
Method
Budget
Avg.
Budget
Avg.
Full Attention
32k
36.10
32k
52.01
Quest+Twi
137
37.33 +3.4%
489
52.00 -0.0%
DS+Twi
126
37.98 +5.2%
446
51.73 -0.5%
Quest+DisSparse
141
37.66 +4.3%
520
52.10 +0.2%
DisSparse
170
37.79 +4.7%
610
52.20 +0.4%
Table 2: Average scores on 12 tasks from LongBench. Budget is the average number of selected tokens per layer/head. Detailed per-dataset results are in Table 5 (Appendix B ). DS results are from [ 7 , 51 ] .
Figure 8: Perplexity on PG-19 vs. top- p threshold for LLaMA-3.1-8B.
GSM8K(flexible/strict) ↑
COQA(em/f1) ↑
PG-19 PPL ↓
LLaMA-2-7B-Chat
Full (dense)
0.227/0.225
0.606/0.761
10.85
Quest-128
0.052/0.051
0.571/0.744
27.47
Twilight
0.225/0.225
0.599/0.759
11.09
DisSparse
0.223/0.221
0.597/0.758
11.07
Token Budget
105/117
112/125
415/452
Table 3: Results for GSM8K, COQA, PG-19 (length 4K for LLaMA-2, 16K for LLaMA-3.1). Token Budget: Twilight/DisSparse.
Figure 9: Sparsity analyzer latency for Quest+Twilight vs Quest+DisSparse. DisSparse replaces Twilight’s softmax + binary-search post-pass with more efficient GEMV for score calculation and top- p kernel in Algorithm 6 .
Model
Benchmark
Block Size
Mean Reduction
Acc. Δ
Llama-3.1-8B
LongBench
16
11.4%
−0.17
LongBench
32
13.2%
−0.44
LongBenchV2
16
9.4%
+0.79
LongBenchV2
32
12.4%
0.00
Qwen2.5-7B
LongBench
16
7.9%
−0.17
LongBench
32
7.6%
−0.80
Table 4: Reduction: percentage decrease in average critical block counts ( p =0.95) with DisSparse. Acc. Δ shows the change in average benchmark score from No Reloc. to Reloc. (negative: relocation lost accuracy).
Figure 10: Performance of DisSparse vs. vLLM [ 5 ] with Llama 3.1-8B-Instruct [ 47 ] and Phi-3-mini-128k-instruct [ 49 ] models on LongBenchV2 samples [ 11 ] (up to 32k sequence length). Each system is evaluated on 3 metrics: throughput, TPOT, and end-to-end latency vs. batch size.
Appendix figures & tables12 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 11: Critical token counts ( p=0.95 ) across decode steps for Qwen2.5-7B-Instruct.
Figure 12: Critical token counts ( p=0.95 ) across decode steps for Qwen3-32B.
Figure 13: Critical token counts ( p=0.95 ) across decode steps for Gemma-2-27B-it.
Single-Doc. QA
Multi-Doc. QA
Summarization
Few
Syn.
Code
Method
Budget
Qasper
MF-en
HotpotQA
2WikiMQA
Musique
GovRep.
QMSum
M-News
TriviaQA
PR-en
LCC
Repo.
Avg.
LongChat-7B-v1.5-32k
Full Attn.
32k
29.07
41.45
31.33
21.37
12.94
30.88
23.01
25.99
84.02
29.13
49.41
54.63
36.10
Quest
256
25.64
32.31
23.50
19.93
7.36
22.53
21.20
24.95
68.03
32.10
45.66
44.27
30.62
1024
31.19
41.69
30.83
21.98
9.98
29.79
22.94
26.29
84.99
32.96
48.31
52.99
36.16
4096
29.36
42.04
33.33
21.55
13.07
31.38
23.10
26.35
85.15
30.09
49.86
54.53
36.65
Appendix
Table 5: Per-dataset accuracy on LongBench (A100). Bold indicates the best result within each model section (per dataset). Green and red percentages denote change relative to Full Attention. Top- p configurations use p = 0.95 for LlaMA-3.1-8B-Instruct and p = 0.85 for LongChat-7B-v1.5-32k .
Single-Doc. QA
Multi-Doc. QA
Summarization
Few
Syn.
Code
Method
Budget
Qasper
MF-en
HotpotQA
2WikiMQA
Musique
GovRep.
QMSum
M-News
TriviaQA
PR-en
LCC
Repo.
Avg.
LongChat-7B-v1.5-32k
Full Attn.
32k
27.23
41.45
30.45
23.53
13.02
31.42
22.69
26.52
83.96
31.50
54.65
58.04
37.04
Quest
256
23.31
33.44
20.15
21.68
7.39
22.88
21.39
25.79
69.62
34.50
50.17
48.56
31.57 -14.8%
1024
28.91
40.89
30.62
22.27
11.41
31.18
22.22
26.46
84.72
34.50
52.21
57.42
36.90 -0.4%
4096
28.68
42.18
30.31
23.08
11.19
31.56
22.26
26.69
83.97
29.00
54.70
58.47
36.84 -0.5%
Appendix
Table 6: Per-dataset accuracy on LongBench (RTX 6000 Ada). Bold indicates the best result within each model section (per dataset). All top- p configurations use p = 0.95. Green and red percentages denote change relative to Full Attention.
Single-Doc. QA
Multi-Doc. QA
Summarization
Few
Syn.
Code
Method
Budget
Qasper
MF-en
HotpotQA
2WikiMQA
Musique
GovRep.
QMSum
M-News
TriviaQA
PR-en
LCC
Repo.
Avg.
Qwen3-32B
Full Attn.
32k
44.03
48.42
56.85
48.51
37.67
32.85
23.76
25.35
88.82
99.50
68.94
66.10
53.40
Quest
256
27.56
34.51
25.50
24.34
11.50
24.70
22.18
24.13
65.84
77.00
53.80
43.25
36.19 -32.2%
1024
36.90
41.94
43.73
35.74
23.62
32.18
23.68
25.59
78.42
85.00
61.87
60.25
45.74 -14.3%
4096
42.24
47.05
54.81
45.90
33.86
32.56
24.20
25.19
87.86
87.00
68.58
65.72
51.25 -4.0%
Appendix
Table 7: Per-dataset accuracy of Qwen3-32B on LongBench (RTX 6000 Ada). Bold indicates the best result per dataset. Green and red percentages denote change relative to Full Attention. The thinking mode is disabled for the experiment with enable_thinking=False . All top- p configurations use p = 0.95.
Block Size: 16
Block Size: 32
Block Count
Reduction
Accuracy
Block Count
Reduction
Accuracy
Category / Dataset
No Reloc.
Reloc.
No Reloc.
Reloc.
No Reloc.
Reloc.
No Reloc.
Reloc.
LongBench (by Dataset)
narrativeqa
251.2
207.7
17.3%
28.05
27.93
146.4
116.6
20.4%
29.73
29.21
qasper
57.9
55.3
4.5%
46.55
46.22
33.0
31.3
5.0%
46.84
45.82
multifieldqa_en
68.0
63.1
7.2%
52.53
53.10
39.2
36.0
8.4%
52.01
51.71
Appendix
Table 8: Comparison of KV Block Usage and Accuracy with and without Relocation for LongBench and LongBenchV2 (Llama-3.1-8B 128K). Results shown for both block sizes, 16 and 32. ’No Reloc.’: the KV tokens keep the chronological order in the same way they were generated during prefill. ’Reloc’: the KV tokens are relocated after the prefill phase. ’Reduction’: Percentage decrease in the critical block count from ’No Reloc’ to ’Reloc’.
Configuration
16K
32K
Full Attn.
94.86
89.09
Quest+Twilight
94.88
88.66
Twilight
94.71
88.98
Quest+DisSparse
95.08
88.32
DisSparse
94.71
89.14
Appendix
Table 9: Average accuracy on 11 RULER subtasks with Llama-3.1-8B-Instruct (50 samples per subtask). All configurations share the same prompts, tokenization, and scoring. DisSparse uses token-level top- p
Block Size: 16
Block Size: 32
Block Count
Reduction
Accuracy
Block Count
Reduction
Accuracy
Category / Dataset
No Reloc.
Reloc.
No Reloc.
Reloc.
No Reloc.
Reloc.
No Reloc.
Reloc.
LongBench (by Dataset)
narrativeqa
225.4
201.2
10.8%
19.83
16.52
125.9
113.3
10.0%
16.04
13.92
qasper
60.5
58.1
4.0%
38.88
39.46
34.4
32.9
4.4%
39.37
39.20
multifieldqa_en
71.4
67.2
5.9%
48.38
49.62
40.6
37.7
7.1%
48.79
48.98
Appendix
Table 10: Comparison of KV Block Usage and Accuracy with and without Relocation for LongBench and LongBenchV2 (Qwen2.5-7B-Instruct, 32K). LongBench results are shown for block sizes 16 and 32. LongBenchV2 was evaluated at block size 16 only; n is the number of samples per length bucket. ’No Reloc.’: the KV tokens keep the chronological order in the same way they were generated during prefill. ’Reloc’: the KV tokens are relocated after the prefill phase. ’Reduction’: Percentage decrease in the critical block count from ’No Reloc’ to ’Reloc’.
Block Count
Reduction
Accuracy
Dataset
No Reloc.
Reloc.
No Reloc.
Reloc.
narrativeqa
245.6
203.6
17.1%
19.90
18.48
qasper
68.4
63.9
6.5%
29.67
30.06
multifieldqa_en
85.5
76.6
10.4%
44.07
43.92
hotpotqa
151.5
128.0
15.6%
32.78
33.10
2wikimqa
94.1
83.3
11.5%
24.49
24.25
Appendix
Table 11: Comparison of KV Block Usage and Accuracy with and without Relocation for LongBench (LongChat-7B-v1.5-32K, 32K). Block size 16. ’No Reloc.’: the KV tokens keep the chronological order in the same way they were generated during prefill. ’Reloc’: the KV tokens are relocated after the prefill phase. ’Reduction’: Percentage decrease in the critical block count from ’No Reloc’ to ’Reloc’.
Dataset
AdaKV-512
AdaKV-1024
Quest+DisSparse (520)
DisSparse (610)
Qasper
31.06
36.35
46.60
45.60
MF-en
50.27
51.63
52.50
52.90
HotpotQA
53.90
54.97
54.80
55.10
2WikiMQA
43.48
43.95
46.50
44.70
Musique
28.16
28.73
24.80
28.00
GovRep.
22.02
24.28
34.50
33.90
Appendix
Table 12: Comparison with Ada-KV on 12 LongBench datasets (LLaMA-3.1-8B-Instruct). Numbers in the headers are token budgets.
Prompt length
Dense
DisSparse
Ratio
8K
14
26
1.86 ×
16K
8
14
1.75 ×
Appendix
Table 13: Maximum concurrent requests in colocated serving.
LLM inference acceleration develops algorithms and systems that reduce language-model latency, memory use, and serving cost while preserving output quality.