Structured Memory for Edge Language Models: Persistent Context and Corpus Retrieval via O(1) SSM State Injection
On the map: Retrieval-augmented generation → Generation and context integration
also in 1 more
Abstract (arXiv)
Retrieval-augmented generation (RAG) imposes a prefill cost proportional to retrieved context length, and -- with Transformer backbones -- a KV-cache that grows with each generated token. State-Space Models (SSMs) avoid the second cost by construction; we eliminate the first, collapsing prefill from O(Lcontext) to O(1) per query. We introduce PRECOG (Pre-Computed Context Injection), a retrieval mechanism that exploits a property unique to SSMs: the fixed-size, position-agnostic recurrent hidden state is a complete summary of everything the model has read. PRECOG pre-encodes document corpora offline as SSM hidden states and injects the best-matching state directly at query time, bypassing in-context re-ingestion entirely. The same state-injection mechanism enables SMC (Structured Memory Consolidation): a hierarchical persistent memory with cognitive-domain clustering, an adjustable fidelity-vs-storage dial, and O(1) session initialization, which consolidates short-term episodic states into long-term semantic memory and fuses both with retrieved corpus states at query time. We demonstrate the system on TENNs-LLM, a 1.2B-parameter gated-SSM language model with a 192 KB hidden state. PRECOG matches in-context RAG answer quality, reducing prefill latency from ~27 s to <6 ms on edge hardware -- a ~4500× speedup that crosses the threshold from unusable to interactive. The mechanism is architecturally impossible for Transformer KV-caches, which are position-entangled and grow linearly with context length.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Placed in Generation and context integration, one of 15 directions in Retrieval-augmented generation. Builds on 30 of its 35 references that are in the map. First posted on arXiv 3 Aug 2026.
Builds on
30 of 35 references.
Closest ancestors · 4
Same direction, newest first
- 2024xRAG: Extreme Context Compression for Retrieval-augmented Generation with One Token22 May
- 2023REPLUG: Retrieval-Augmented Black-Box Language Models30 Jan
- 2022Atlas: Few-shot Learning with Retrieval Augmented Language Models5 Aug
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks22 May
Other references · 26
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,084
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,767
- 2023Mamba: Linear-Time Sequence Modeling with Selective State Spacescited by 4,616
- 2016SQuAD: 100,000+ Questions for Machine Comprehension of Textcited by 4,115
- 2021Prefix-Tuning: Optimizing Continuous Prompts for Generationcited by 3,878
- 2021The Power of Scale for Parameter-Efficient Prompt Tuningcited by 3,769
- 2018HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answeringcited by 3,686
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
- 2021Efficiently Modeling Long Sequences with Structured State Spacescited by 2,424
- 2020The Pile: An 800GB Dataset of Diverse Text for Language Modelingcited by 2,346
- 2024Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Dualitycited by 1,283
- 2021Improving language models by retrieving from trillions of tokenscited by 1,278
14 more
- 2020Leveraging Passage Retrieval with Generative Models for Open Domain Question Answeringcited by 1,203
- 2023RWKV: Reinventing RNNs for the Transformer Eracited by 814
- 2022Simplified State Space Layers for Sequence Modelingcited by 776
- 2023Retentive Network: A Successor to Transformer for Large Language Modelscited by 594
- 2023Textbooks Are All You Need II: phi-1.5 technical reportcited by 559
- 2023Learning to Compress Prompts with Gist Tokenscited by 379
- 2023Adapting Language Models to Compress Contextscited by 350
- 2023LLMLingua: Compressing Prompts for Accelerated Inference of Large Language Modelscited by 279
- 2023In-context Vectors: Making In Context Learning More Effective and Controllable Through Latent Space Steeringcited by 240
- 2024MobileLLM: Optimizing Sub-billion Parameter Language Models for On-Device Use Casescited by 216
- 2024Human-inspired Episodic Memory for Infinite Context LLMscited by 62
- 2026Memory Caching: RNNs with Growing Memorycited by 12
- 2025PICASO: Permutation-Invariant Context Composition with State Space Modelscited by 4
- 2024State Soup: In-Context Skill Learning, Retrieval and Mixingcited by 3
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2025Understanding the Skill Gap in Recurrent Language Models: The Role of the Gather-and-Aggregate Mechanism
- 2026MARCH: Scaling Recurrent Memory with Content-Routed State Anchors
- 2024MemLong: Memory-Augmented Retrieval for Long Text Modeling
- 2024Expansion Span: Combining Fading Memory and Retrieval in Hybrid State Space Models
- 2025Memory in Large Language Models: Mechanisms, Evaluation and Evolution
- 2026Memory Decoder at Scale: A Pretrained, Parametric Long-Term Memory
- 2026To Memorize or to Retrieve: Scaling the Interaction Between Pretraining and Retrieval
- 2025Every Token Counts: Generalizing 16M Ultra-Long Context in Large Language Models