Long chain-of-thought (CoT) reasoning models such as DeepSeek-R1 keep lengthening their inference chains under test-time scaling, yet standard self-attention incurs quadratic cost in context length, making long-CoT deployment costly in production. We therefore introduce LISA (Linear-Indexed Sparse Attention), a plug-and-play replacement for self-attention that requires no full pretraining. LISA combines a linear-attention branch for long-range memory with a Lightning Indexer that dynamically selects the most relevant tokens for a sparse self-attention branch. The two branches are fused through a learned gate, so the model retains broad context while focusing computation on informative tokens. We train LISA in two stages. In Stage 1, a linear-attention branch is integrated with sliding-window attention and distilled from a frozen teacher's full-attention distribution. In Stage 2, the Lightning Indexer replaces the static window and is trained with a per-head KL-divergence objective to mimic teacher attention patterns. The resulting model reduces eager-mode self-attention computation from quadratic in sequence length to linear in the number of generated tokens and the selected context budget. Experiments on DeepSeek-distilled Qwen models show that LISA cuts measured eager-mode mean sample latency by 23.9% at 16K context without degrading long-context reasoning quality. Across nine mathematical and code reasoning benchmarks, the gated LISA-1.5B model improves the equal-weight benchmark average by 4.2 percentage points relative to the full-attention baseline.
Figures & tables
Figure 1: Overview of the LISA architecture.
Method
GSM8K
MATH-500
AMC23
AIME24
AIME25
AVG.
Acc↑
Tok↓
ReL↓
Acc↑
Tok↓
ReL↓
Acc↑
Tok↓
ReL↓
Acc↑
Tok↓
ReL↓
Acc↑
Tok↓
ReL↓
Acc↑
ReL↓
Qwen2.5-1.5B Series
Full-attention baseline
80.1
2086
76.2
78.8
3958
139.4
62.5
6392
242.9
20.0
13765
536.8
16.7
12684
504.7
51.6
300.0
+ H2O
76.1
2116
71.7
75.4
3835
128.5
55.0
6230
209.7
13.3
13921
462.2
10.0
12802
428.6
46.0
260.1
+ SepLLM
77.3
2230
75.8
76.0
3890
130.3
57.5
6573
220.2
13.3
13690
452.6
13.3
12690
423.9
47.5
260.6
LightThinker
78.8
2109
69.6
77.6
4060
134.8
60.5
6312
214.6
16.7
13827
461.6
13.3
12934
434.6
49.4
263.0
Table 1: Results of our model and baselines on mathematical reasoning benchmarks. The Full-attention baseline row is the unmodified original model. All cells report a single representative run; run-to-run variance on the small-sample benchmarks is reported separately in Table 2 .
AMC23
AIME24
AIME25
Acc↑
± std
Acc↑
± std
Acc↑
± std
Full-attention baseline
62.5
2.24
19.6
1.65
16.1
1.83
LISA
70.0
2.74
25.8
1.96
25.9
2.29
Table 2: Mean accuracy ( % ) over 16 independent evaluation runs on the small-sample benchmarks, Qwen2.5-1.5B. These benchmarks contain only about 30 problems each, so we report the standard deviation alongside the mean; the corresponding single-run values in Table 1 fall within one standard deviation of these means.
Method
GPQA-D↑
HumanEval↑
LiveCodeBench↑
BigCodeBench↑
Full-attention baseline
23.23
76.22
35.0
22.7
LISA
26.26
79.27
37.4
24.7
Table 3: Generalization results of Qwen2.5-1.5B on non-mathematical tasks (accuracy, %).
Variant
Description
GSM8K
MATH-500
AMC23
AIME24
AIME25
Avg
Acc↑
Acc↑
Acc↑
Acc↑
Acc↑
Full LISA (ours)
Complete method (Stage 1 + Stage 2)
80.2
82.0
70.0
26.7
26.7
57.1
Stage 1 only
Sliding-window sparse without indexer-guided training
79.2
80.6
65.0
23.3
23.3
54.3
Linear only
Remove sparse branch
68.3
67.8
55.0
13.4
10.0
42.9
Sparse only
Remove linear branch
66.6
60.8
42.5
6.7
6.7
36.7
No gating
Remove learned gating
78.3
80.2
65.0
23.3
20.0
53.4
Table 4: Component-level ablation on Qwen2.5-1.5B (accuracy, %). All variants use the same training configuration.
Figure 2: Cosine similarity between the linear and sparse attention outputs across all layers.
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
Context
Qwen2.5-1.5B
Qwen2.5-7B
Full-Attn
LISA
Reduction
Full-Attn
LISA
Reduction
4K
3.33 G
3.20 G
3.8%
14.69 G
14.74 G
− 0.3%
8K
4.03 G
3.47 G
13.9%
16.34 G
15.37 G
5.9%
12K
4.73 G
3.74 G
21.0%
17.98 G
16.00 G
11.0%
16K
5.44 G
4.01 G
26.3%
19.63 G
16.63 G
15.3%
Appendix
Table 5: Secondary decoding-FLOPs estimate per generated token (GFLOPs; SA + Indexer with cached keys + LA + SwiGLU MLP). LISA uses 5 full-attention + 23 LISA blocks. Primary efficiency claim: measured ReL.
Figure 3: Visualization of the top-256 tokens selected by the Indexer across layers.
Attention is the dominant source of latency during long-context LLM inference, an increasingly popular workload with reasoning models and RAG. We propose Kascade, a training-free sparse attention method that leverages known observations such as 1) post-softmax attention is intrinsically sparse, and 2) the identity of high-weight keys is stable across nearby layers. Kascade computes exact Top-k indices in a small set of anchor layers, then reuses those indices in intermediate reuse layers. The anchor layers are selected algorithmically, via a dynamic-programming objective that maximizes cross-layer similarity over a development set, allowing easy deployment across models. The method incorporates efficient implementation constraints (e.g. tile-level operations), across both prefill and decode attention. The Top-k selection and reuse in Kascade is head-aware and we show in our experiments that this is critical for high accuracy. Kascade achieves up to 4.1x speedup in decode attention and 2.2x speedup in prefill attention over FlashAttention-3 baseline on H100 GPUs while closely matching dense attention accuracy on long-context benchmarks such as LongBench and AIME-24.
Long-context inference in large language models is bottlenecked by the quadratic cost of full attention. Existing efficient alternatives often rely either on native sparse training or on heuristic token eviction, creating an undesirable trade-off among efficiency, training cost, and accuracy. In this work, we show that full-attention LLMs are already intrinsically sparse and can be transformed into highly sparse models with only minimal adaptation. Our approach is built on three observations: (1) only a small subset of attention heads truly requires full long-context processing; (2) long-range retrieval is governed primarily by a low-dimensional subspace, allowing relevant tokens to be retrieved efficiently with a 16-dimensional indexer; and (3) the useful token budget is strongly query-dependent, making dynamic top-p selection more suitable than fixed top-k sparsification. Based on these insights, we propose RTPurbo, which retains the full KV cache only for retrieval heads and introduces a lightweight token indexer for sparse attention. By exploiting the model's intrinsic sparsity, RTPurbo achieves sparsification with only a few hundred training steps. Experiments on long-context benchmarks and reasoning tasks show that RTPurbo preserves near-lossless accuracy while delivering substantial efficiency gains, including up to a 9.36× prefill speedup at 1M context and about a 2.01× decode speedup. These results suggest that strong sparse inference can be obtained from standard full-attention training without expensive native sparse pretraining.
Full self-attention in large language models scales as O(N^2), limiting long-context analysis to 65k tokens and requiring costly GPU clusters. The Reduced Interaction Sampling (RIS) inference engine addresses this as a model-agnostic architecture. Without modifying weights, RIS introduces sparse stochastic attention geometries that operate under extreme pruning (up to 99% under 1% density) while preserving factual retrieval. While foundational graph-theoretic RIS formulations establish an asymptotic O(N log N) bound, this work evaluates a practical fixed-density regime on unaccelerated commodity CPU systems. We validate RIS on Qwen2-1.5B-Instruct across two regimes. At 32,768 tokens (where native dense attention serves as the upper bound), RIS-Stochastic at 1% density and 70 ensemble seeds achieves 75.00% accuracy, outperforming the native dense baseline (71.88%), while 5% density at 10 seeds matches it (71.88%), demonstrating that multi-seed sparsity filters sequence-level noise. Crucially, a controlled ablation evaluating a single static mask at matched budget (N=1, d=0.50) yields only 53.12% accuracy, proving that multi-seed topological diversity, rather than raw edge density, drives contextual recovery. Under tight budgets, RIS-Structural reaches 65.62% accuracy at 1% density with 10 seeds (recovering 50.0% of the gap over the 59.38% zero-context floor) and 68.75% (75.0% recovery) with 30 seeds. At 65,536 tokens, where dense attention triggers out-of-memory faults, RIS yields retrieval gains of up to 14.06 percentage points over the zero-context floor (51.56%), confirmed as marginally significant under McNemar's paired test (p = 0.078 < 0.10). All evaluations run on commodity CPU servers (16-128 GB RAM), demonstrating that long-context LLM inference is feasible on standard academic hardware without GPU acceleration.
Anderson R. Santos
Faculty of Computing, Federal University of Uberlândia (UFU), Brazil.