evermind-ai/msa

Memory Sparse Attention - A scalable, end-to-end trainable latent-memory framework for 100M-token contexts.

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 1 hour ago
Added to GitGenius on September 19th, 2026
Created on October 29th, 2025
Open Issues & Pull Requests: 5 (+0)
GitHub issues: Enabled
Number of forks: 229
Total Stargazers: 3,516 (+0)
Total Subscribers: 66 (+0)

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 3
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 172 days
Stale 30+ days: 3
Stale 90+ days: 3

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

No label distribution available yet.

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

MSA is a sparse attention framework that enables language models to handle extremely long contexts up to 100 million tokens through a scalable, end-to-end trainable latent-memory approach.

The framework addresses the fundamental constraint that full attention mechanisms limit most large language models to effective context lengths between 128K and 1M tokens. MSA solves this by combining scalable sparse attention with document-wise rotary position embeddings to achieve near-linear complexity during both training and inference. The approach compresses key-value caches through chunk-mean pooling of document latent states, then uses a router projector to select relevant documents via cosine similarity before concatenating their compressed representations with local key-value pairs for decoding. A Memory Parallel inference engine distributes this computation across GPUs using tiered storage, keeping routing keys on GPU while storing content on CPU with on-demand transfers. For multi-hop reasoning tasks, a Memory Interleave mechanism alternates between generative retrieval, context expansion, and generation across scattered memory segments.

Developers should consider MSA if they need to process documents at scales far beyond current long-context model limits while maintaining end-to-end differentiability and avoiding complex external retrieval pipelines. The framework suits applications requiring both memory capacity and reasoning over extremely long sequences, such as long-context question-answering and needle-in-haystack retrieval tasks. The project demonstrates less than nine percent degradation across the range from 16K to 100M tokens and outperforms both retrieval-augmented generation systems and leading long-context models on standard benchmarks, suggesting it provides a practical path to decouple memory capacity from reasoning ability.

The codebase includes reference implementations and evaluation scripts tied to the research paper, with supporting materials available through academic repositories. Development appears focused on the core sparse attention mechanism and inference optimization rather than broad feature expansion.