New LRSA method accelerates long-context AI inference
Researchers propose LongCat Recall Sparse Attention (LRSA) to solve retrieval bottlenecks in long-sequence models, significantly speeding up inference.
Source: Grafy Research LabResearchers have introduced a new mechanism called LongCat Recall Sparse Attention (LRSA) to address the efficiency bottlenecks encountered when large language models (LLMs) process extremely long sequences. By optimizing how historical data is indexed and retrieved, the method aims to make long-context inference significantly faster without sacrificing the model's ability to access relevant information.
Why is long-context retrieval a bottleneck?
As LLMs process longer inputs—such as entire books, massive code repositories, or extensive chat histories—the computational cost typically grows quadratically. To mitigate this, many models use retrieval-based sparse attention, such as DeepSeek Sparse Attention (DSA). This approach identifies a small subset of relevant key-value (KV) entries to focus on, rather than attending to every single position in the history.
However, according to the researchers Hao Zhang, Bin Xiao, and Kefeng Zhang, the act of selecting these relevant entries can itself become a major bottleneck. In existing sparse attention models, the system may still need to search through the entire visible history to find the best candidates. For very long sequences, this exhaustive search process limits the speed gains that sparse attention was intended to provide.
How does LRSA organize data for faster access?
To solve the search problem, LRSA introduces a hierarchical organization of historical keys. Instead of treating the sequence as one continuous block, the method partitions the sequence into "time buckets" that can be indexed independently. This means that as new information arrives, the system can create new indices without having to regroup or re-index the entire previous history.
Within these buckets, the researchers employ a two-tier system:
- Capacity-Balanced Directional Groups: Keys are organized into groups with fixed sizes.
- Retrieval Pages: Multiple complete groups are packed into a single page.
Each group maintains its own "center," which serves as a fine-grained representative of the data within that group. This structure allows the model to perform a coarse-to-fine retrieval process. The system first scores the group centers to select the most relevant pages, and then refines the selection by scoring the individual members within those selected pages. This process is combined with other fixed candidates, such as the sink prefix and sliding-window entries, to select the final logical positions for attention.
What are the performance benefits of LRSA?
According to the research paper, the architectural changes in LRSA lead to substantial improvements in speed during inference. When tested with a 1024K-token context, the researchers found that LRSA accelerates the key selection process by compared to DeepSeek Sparse Attention.
When measuring the combined impact of both the selection process and the subsequent attention mechanism, LRSA demonstrated a speedup over full attention. These gains are achieved not just through better indexing, but through hardware-level optimizations, such as fusing construction stages into kernels to reduce memory traffic and sharing storage for overlapping candidates during chunked prefill.
How is the index maintained during inference?
The researchers integrated LRSA into SGLang to manage how the index evolves during live model execution. One key feature is asynchronous index construction: the system can build indices for new buckets in the background, overlapping this task with the actual computation of the current layer.
Furthermore, the system supports the reuse of indices. If a new request shares a prefix with a previous one, the system can reuse the compatible bucket indices and member pages from the existing key-value pool. This prevents redundant computation and storage, making the system more efficient for multi-turn conversations or repetitive queries.
How can researchers apply these concepts?
While LRSA is a specialized architectural optimization for model inference engines, the underlying challenge—efficiently navigating and retrieving information from massive datasets—is central to modern AI research.
For researchers working with extensive technical documents or long-form academic papers, understanding how models manage long-context retrieval is vital. You can explore how current models handle complex, multi-page documents by using Reader to perform research over PDFs and papers. This allows you to see in practice how AI manages context and retrieval when answering questions across large volumes of text.
Frequently asked questions
What problem does LRSA solve in long-context inference?
LRSA solves the retrieval bottleneck found in sparse attention mechanisms. While sparse attention reduces the amount of computation needed for attention, the process of searching the entire history to find which keys to attend to becomes too slow as sequences grow. LRSA makes this selection process much faster through structured indexing.
How does the hierarchical structure of LRSA work?
LRSA organizes data into a hierarchy consisting of time buckets, directional groups, and retrieval pages. It uses time buckets to allow incremental indexing without regrouping old data, uses groups to provide representative centers for data, and packs these groups into pages to allow for efficient, coarse-to-fine retrieval of the most relevant information.
How much faster is LRSA compared to full attention?
In tests involving a 1024K-token context, LRSA provides a speedup for the combined selection and attention process when compared to full attention. Additionally, it is faster at the specific task of key selection when compared to DeepSeek Sparse Attention.


