News

Memory Sparse Attention Scales LLM Memory to 100 Million Tokens, Addressing Long-Term Context Challenges

Memory Sparse Attention Scales LLM Memory to 100 Million Tokens, Addressing Long-Term Context Challenges

Long-term memory remains a significant challenge for large language models (LLMs). The industry is currently capped at effective context windows of approximately 1 million tokens, which impedes the development of complex applications such as massive multi-agent systems and the processing of very large text corpora.

Memory Sparse Attention (MSA), a novel technique developed by researchers at Evermind, Shanda Group, and Peking University, addresses the limitations of existing long-memory solutions. This architecture enables models to extend their context window up to an unprecedented 100 million tokens while preserving their reasoning accuracy.

The core innovation of MSA is its differentiable, end-to-end routing mechanism. The model learns to compress extensive document collections into precomputed attention values and then selectively retrieve only the most relevant document chunks directly into the model’s active working memory during text generation. MSA represents one of several emerging optimization techniques designed to empower developers to build AI applications capable of handling massive documents and acquiring long-term memory skills for dynamic environments.

The Challenge of Long Memory

LLMs consistently struggle with long-term, fine-grained memory retention. Standard full-attention mechanisms become computationally constrained as data grows due to their substantial memory requirements. To process language, these models must compute how every token relates to every other token in a sequence. As the sequence length increases, the computational demand for tracking these relationships grows quadratically.

The effective context window for most modern LLMs is typically capped between 128,000 and 1 million tokens. To provide perspective, cognitive science estimates human lifelong memory holds the equivalent of 200 to 300 million tokens. This hard limit poses significant challenges for complex applications that demand long, persistent contexts.

For instance, when attempting to comprehend extensive novel series (e.g., A Song of Ice and Fire or the Harry Potter series), standard models inevitably drop early plot points and subtle character details. Similarly, when developing digital twins to replicate human behavior or maintaining consistent personas in role-playing scenarios, the AI will eventually forget its identity and break character as the conversation history exceeds the available context window.

Furthermore, managing the long-term history of multi-agent systems becomes unmanageable because the models cannot reliably retrieve granular past decisions or interactions to inform current reasoning. The fundamental challenge for AI developers is to scale LLM memory without compromising computational efficiency, architectural compatibility, or reasoning precision.

Requirements for an Effective Memory System

In their published paper, the researchers outline five core characteristics for an effective long-term memory system:

1- The system must offer architectural compatibility, integrating easily with mainstream LLM architectures.

↗ Read original source