DisSparse: Pipelined Top- Sparse Attention for Long-Context LLM Serving
Organizations: Department of Computer Science and Engineering, University of California, Riverside
Abstract
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- selection, which is favored because its deterministic block count aligns with the static memory allocation that systems like vLLM rely on. Top- 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- (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- 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- 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- methods with negligible accuracy loss and supports up to 8x larger maximum batch sizes than dense vLLM under the same memory budget.
Figures & tables
| Blocks | Mass | |||||
| Threshold | FP16 | INT4 | Extra | Recall | FP16 | INT4 |
| 66.9 | 72.3 | +5.3 | 0.9754 | 0.8346 | 0.8612 | |
| 89.1 | 94.9 | +5.8 | 0.9743 | 0.8737 | 0.8906 | |
| 123.3 | 129.2 | +5.8 | 0.9723 | 0.9140 | 0.9227 | |
| 187.4 | 193.5 | +6.0 | 0.9731 | 0.9559 | 0.9590 | |
| 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% |
| 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 |
| Model | Benchmark | Block Size | Mean Reduction | Acc. |
| Llama-3.1-8B | LongBench | 16 | 11.4% | |
| LongBench | 32 | 13.2% | ||
| LongBenchV2 | 16 | 9.4% | ||
| LongBenchV2 | 32 | 12.4% | ||
| Qwen2.5-7B | LongBench | 16 | 7.9% | |
| LongBench | 32 | 7.6% |
Appendix figures & tables12 assets
Supplementary material from the paper’s appendix.
Appendix
| 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 | |
| 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% | |
| 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% | |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| Prompt length | Dense | DisSparse | Ratio |
| 8K | 14 | 26 | 1.86 |
| 16K | 8 | 14 | 1.75 |
LLM Inference Acceleration
LLM inference acceleration develops algorithms and systems that reduce language-model latency, memory use, and serving cost while preserving output quality.
See all 1,273 papers