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

Hao Zhang, Bin Xiao, Kefeng ZhangarXiv 2026

Imagine you’re trying to find a specific quote in a library of a million books. If you have to read every single page just to decide which ones are relevant, you’ll never get any actual work done. This is the "retrieval bottleneck" currently plaguing Large Language Models (LLMs) as they push toward massive context windows.

TL;DR

LongCat Recall Sparse Attention (LRSA) solves the "finding a needle in a haystack" problem for LLMs by organizing memory into a smart, paged index. By grouping similar data points together and using "representatives" to quickly filter out irrelevant chunks, it speeds up key selection by nearly 5x and overall attention by over 35x in 1-million-token contexts—all without sacrificing the model's accuracy.

What Problem Does This Paper Address?

The "magic" of modern LLMs comes from Attention, a mechanism that lets the model look back at previous tokens to understand the current one. The problem? Standard attention is "dense"—it looks at everything. As the conversation gets longer, the cost of looking at everything grows quadratically.

Researchers previously came up with Sparse Attention (like DeepSeek’s DSA), which only looks at a small, relevant subset of the past. But there's a catch: to find that "relevant subset," the model still has to score every single historical token. When you have a million tokens, even this "lightweight" scoring becomes a massive bottleneck. You end up spending more time searching for what to pay attention to than actually doing the math.

Methods

The authors introduce LRSA, a hierarchical system that treats LLM memory more like a well-organized filing cabinet than a giant pile of paper.

  1. Temporal Bucketing: Instead of re-indexing everything every time a new word is generated, LRSA breaks the sequence into "buckets" (e.g., 1024 tokens). Each bucket is indexed once and then left alone.
  2. Capacity-Balanced Grouping: Within each bucket, tokens are grouped by "directional similarity" (think of this as semantic "vibe"). Crucially, these groups are fixed-size. This is a "co-design" choice: by making groups a predictable size, they can be packed perfectly into memory "pages" that the GPU can read very efficiently.
  3. Coarse-to-Fine Retrieval:
    • Coarse: The model first scores a single "center" (a representative) for each group. If a group's center looks promising, the whole page is flagged.
  4. Fine: The model then zooms in on only the flagged pages, scoring individual tokens to find the absolute best ones for the final attention calculation.
Figure 1: Overview of LRSA. (a) Each completed bucket is independently partitioned into capacity-balanced directional groups, which are packed into member pages. With the default capacities, the expanded page contains eight groups of eight keys, with one center per group. (b) Queries score group centers and select the Top-Kpage pages using the maximum group score within each page. Retrieved members are combined with sink, sliding-window, and visible unindexed candidates, deduplicated, and scored to select the final Top-K positions for attention. The position map supports deduplication and recovery of original logical positions. Reordered page and slot addresses are depicted as one-dimensional indices for simplicity.

Datasets

The researchers evaluated LRSA across ten diverse downstream tasks to ensure that "speeding things up" didn't "break the brain" of the model. These included:

  • Question Answering: NarrativeQA, HotpotQA, TriviaQA, 2WikiMQA, MuSiQue.
  • Classification & Summarization: TREC, QMSum, Qasper.
  • Chinese Language Tasks: DuReader, LSHT.

They tested these using state-of-the-art models like Qwen3-4B and Hunyuan-7B.

Key Insights and Ideas

  • The "Max" Trick: When deciding which pages to retrieve, LRSA uses the maximum score of any group in that page, rather than an average. This ensures that a single, highly relevant "needle" isn't drowned out by a "haystack" of mediocre neighbors.
  • Hardware-Aware Design: Most clustering algorithms create groups of random sizes. LRSA forces groups to be the same size. While this sounds restrictive, it’s what allows the GPU to achieve such high speeds—it loves predictable, aligned data.
  • Asynchronous Construction: LRSA is integrated into the SGLang runtime. It builds the index for the next layer while the GPU is still busy calculating the current layer. It’s essentially "free" work that happens in the background.

Key Results

The numbers are impressive, especially as the context gets longer:

  • Retrieval Speedup: At a 1024K (1 million) token context, LRSA is 4.70× faster at selecting keys than the previous gold standard (DSA).
  • End-to-End Speedup: Compared to standard "full" attention, LRSA provides a staggering 35.60× speedup for the combined selection and attention process.
  • Accuracy Preservation: Despite the aggressive filtering, the performance drop on downstream tasks was negligible—roughly 0.08 points on a 100-point scale. It’s essentially as smart as the slow version, just much faster.

Limitations and Future Work

While LRSA is a massive leap, the authors note a few areas for growth:

  • Hierarchy Depth: Currently, LRSA uses a two-stage hierarchy (Centers -> Pages). For contexts reaching tens of millions of tokens, a deeper, multi-level hierarchy might be needed to keep the "coarse" search from becoming the new bottleneck.
  • Kernel Fusion: While they've optimized many GPU kernels, they believe even tighter integration (fusing the scoring and selection steps across multiple levels) could squeeze out even more performance.

In short, LRSA proves that if you want to handle a million things at once, the secret isn't just working harder—it's getting organized.

Summary updated

Abstract

Retrieval-based sparse attention, exemplified by DeepSeek Sparse Attention (DSA), reduces attention computation by selecting a small subset of key-value entries. However, selecting these entries can still require searching the entire visible history. For long sequences, retrieval becomes a major bottleneck, limiting the efficiency gains from sparse attention. To address this problem, we propose LongCat Recall Sparse Attention (LRSA), which combines fine-grained representatives with paged retrieval in an incrementally maintained index. LRSA partitions the sequence into time buckets that can be indexed independently as new keys arrive, without regrouping existing history. Within each bucket, it organizes indexing keys into capacity-balanced directional groups and packs a fixed number of complete groups into each page, retaining a separate center for every group. These centers provide fine-grained representatives for page selection, after which refinement scores members of the selected pages together with sink, sliding-window, and visible unindexed candidates to select the final Top-$K$ logical positions. To execute this retrieval process efficiently, we store members in reordered pages, fuse construction stages according to group size, and share storage for overlapping fixed candidates across queries during chunked prefill. These choices support regular member access while reducing kernel launches during construction and repeated candidate transfers. Moreover, we integrate LRSA into SGLang to maintain the index during inference, overlapping asynchronous index construction for new buckets with subsequent computation and reusing compatible bucket indices and member pages after a prefix match in the original key-value pool. With a 1024K-token context, LRSA accelerates key selection by 4.70$\times$ over DSA and combined selection and attention by 35.60$\times$ over full attention.
BibTeX
@misc{zhang2026longcat,
  author = {Hao Zhang and Bin Xiao and Kefeng Zhang},
  title = {{LongCat Recall Sparse Attention: Co-Designing Key Organization and Retrieval for Long-Context Inference}},
  year = {2026},
  eprint = {2611.27233},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.27233},
}
Figure