Meituan's LRSA speeds up sparse-attention key selection 4.7× over DSA at 1M context

LongCat Recall Sparse Attention: Co-Designing Key Organization and Retrieval for Long-Context Inference

Hao Zhang, Bin Xiao, Kefeng Zhang

cs.CL

2026-11-20

LRSA swaps DSA's exhaustive key scoring for an incrementally built paged index: 4.70× faster selection at 1M context, up to 1.98× end-to-end over DSA, quality within 0.08 points.

What problem this solves

Retrieval-based sparse attention like DeepSeek Sparse Attention (DSA) picks a Top-K subset of key-value entries per query with a lightweight learned indexer, then runs main attention only on that subset, cutting O(L²) to O(LK). The catch is the picking itself: the indexer scores every visible key, so selection stays O(L²) no matter how small the attention budget is. At 1024K tokens, DSA's selection-plus-attention speedup over full attention stalls at 12.70× because retrieval now dominates.

Follow-up work has attacked this cost through coarse prefiltering (HISA's block pooling), cross-layer reuse (IndexCache), and execution fusion (LiteTopK). LRSA works a different axis: how historical keys are organized, so that group representatives stay accurate while member access stays regular.

Method

The index has three levels.

Each constraint has a job. Capacity-balanced groups pack whole into fixed-capacity pages, so page count times page capacity bounds the refinement workload. Eight small centers per page, rather than one page-wide mean, keep a relevant subgroup from being diluted by its page-mates; max aggregation does the same at page ranking. The ablations agree: one center per page costs 3.93 points of historical AMR at 1024K, and mean aggregation costs up to 4.19.

Execution adds three optimizations. Members are stored in reordered pages for contiguous reads. Recursive grouping moves integer indices instead of full vectors, with fusion granularity chosen by group size, cutting 42 kernel launches per bucket to 19. During chunked prefill, neighboring queries share overlapping sink and tail ranges, so fixed candidates are copied once per chunk, saving 10.06× of copying at chunk size 1024. In SGLang, bucket indices are built asynchronously after the current layer's attention and hidden behind later layers; prefix hits in the KV pool can reuse whole bucket indices or share member pages.

Results

ComparisonMetricResult
DSAselection speedup @1024K4.70× (1.72× at 64K)
Full attentionselection + attention @1024K35.60× (DSA: 12.70×)
DSAend-to-end @1024K1.865×–1.984× depending on budget
DSA10-task average45.04 vs 45.11 (Qwen3-4B); 41.85 vs 41.93 (Hunyuan-7B)
Temporal groupinghistorical AMRdirectional wins by 4.58–6.12 points

Quality holds: ten-task averages differ by at most 0.08 on a hundred-point scale. At matched page budgets, directional grouping beats temporal grouping by 4.58–6.12 points of historical AMR; at 1024K it reaches 98.078% in 3.1131 ms with twice the reference page budget, while temporal grouping needs four times the budget for 97.383% in 4.8908 ms. Async maintenance is effectively hidden: the execution-time difference versus model-only runs sits between -0.378 and 0.199 ms, with median publication waits of 2.6–3.5 microseconds.

Why it matters

This is systems work carried end to end: index structure, kernel fusion, shared candidate storage, SGLang integration, prefix reuse, and retention policies, all measured. The takeaway for long-context serving is concrete. At 64K and below, the end-to-end gain over DSA is modest, about 1.13×; it grows with context and reaches roughly 2× at 1024K. Multi-turn and shared-prefix workloads get extra mileage from index reuse.

The position should be clear: this accelerates DSA's retrieval stage, it is not a new attention mechanism, and the payoff assumes a retrieve-then-attend architecture is already in place.

Limitations

The authors say so themselves: adding depth to the two-stage hierarchy is not automatically faster, since each level brings its own scoring and Top-K overhead while the number of coarse representatives shrinks; cross-level fused kernels are left as future work.

The reading raises more. Quality comparisons cover only Qwen3-4B and Hunyuan-7B, while DSA was validated on far larger models, so behavior at tens of billions of parameters has no data. All efficiency numbers come from NVIDIA H20 GPUs. The index costs extra GPU memory; the paper trades this with two retention policies but never states absolute index memory, so deployments must budget it themselves. And in Table 1 both sparse methods sit slightly below dense attention (45.19 and 41.96 averages), a gap the paper leaves undiscussed.

Terms

Source

What people are saying

Related papers

All paper explainers