Skip to content
Preprint

MegaMem: A Retrieval Solution for Ultra-Large Context Windows

Aug 2026 · 0 citations · 51 references
Computer Science

TL;DR

These results show that MegaMem supports ultra-large persistent memory while preserving strong answer accuracy under a bounded generation context, and provides a practical path toward accurate retrieval over memories ranging from hundreds of millions to one billion tokens.

Abstract

Modern language models and agents increasingly require persistent memory for complete codebases, long interaction histories, and heterogeneous enterprise records. The key challenge is to keep hundreds of millions of tokens searchable while passing only bounded source evidence to the answer model. We introduce MegaMem, a source-resolved dual-view retrieval system that separates semantic access from generation evidence. Distilled records and detailed evidence are searched with original and transformed queries; every distilled hit resolves to an immutable source ID before reciprocal-rank fusion, deduplication, and cross-encoder reranking; and only the highest-ranked detailed evidence within a fixed budget supports generation. Post-answer attribution then identifies which loaded sources support the fixed answer. We evaluate MegaMem on EnterpriseRAG-Bench, which contains more than 500,000 heterogeneous enterprise documents and approximately 650M tokens. MegaMem improves Overall from 68.22 to 82.26 and reaches 86.50 Correctness. These results show that MegaMem supports ultra-large persistent memory while preserving strong answer accuracy under a bounded generation context. By separating searchable memory scale from answer-context size, MegaMem provides a practical path toward accurate retrieval over memories ranging from hundreds of millions to one billion tokens. Our code is available at https://github.com/ xfab-xinyuansong/MegaMem.git.

View source

Similar papers

Preprint Aug 2026

MEMONDEMAND: A Memory Management System for Large-Scale Enterprise Data

On EnterpriseRAG-Bench, MEMONDEMAND outperforms the strongest published LB#1 result at every evaluated scale from 10M tokens through the complete 618M- token collection, and results on FinanceBench, HotpotQA, and FRAMES further show strong performance across financial, multi-hop, and fact-retrieval settings.

Xin-Yuan Song, Bo-Wen Zhu, H. Haque et al. · 0 citations
#machine learning Preprint Sep 2026

REVA: Reusable Evidence View Aggregation for Context-Efficient RAG Serving

This work revisits RAG compression from a data-mining perspective by aggregating historical query--document--model interactions into reusable evidence views and proposes Reusable Evidence View Aggregation (REVA), a framework that mines the target generator's historical attention traces into a document-keyed, budget-agn...

T. Nguyen, Qi-Ran Hu, Ban-Ruo Liu et al. · 0 citations
Jul 2026

SALT: Salience-Aware Lexical Trie for Long-Context Compression

SALT, a model-agnostic extractive framework that organizes per-sentence keywords into a trie ordered by sentence frequency (SF), a lightweight, reusable proxy for document thematic structure, reduces the prefill computation and memory cost of long-context prompts while remaining composable with KV-cache methods that ta...

Oteo Mamo, Hyunji Yi, Joydhriti Choudhury et al. · 0 citations
Jul 2026

Retain or Consolidate? Budget-Dependent Operator Selection for Language Agent Memory

This work decomposes each operator's utility into a coverage effect on evidence omitted by retention and a signed replacement effect on raw evidence that already fits, which explains why the preferred action changes with relative budget pressure.

Qingcan Kang, Mingyang Liu, Shixiong Kai et al. · 1 citation
Open access Jul 2026

MEMTIER: Tiered Retrieval, Session-Level Injection, and Typed Consolidation for Long-Running LLM Agents

MEMTIER, a tiered memory architecture and consolidation framework for an open-source agent runtime and three questions: what to store, what to inject, and what to keep are studied and cast agent memory as a pattern recognition problem: recognizing which session patterns carry evidence and which knowledge types to retai...

Bronislav Sidik, L. Rokach · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.