Infini Memory: Maintainable Topic Documents for Long-Term LLM Agent Memory
MemoryAgent无问芯穹清华大学上海交通大学Infini Memory:面向长期 LLM 智能体记忆的可维护主题文档
Abstract
Long-term LLM agents need persistent memory that can track changing facts and provide relevant evidence across sessions. Existing memory systems often store observations as isolated records, summaries, or indexed fragments, which makes evidence aggregation, fact revision, and memory maintenance difficult. We propose Infini Memory, a maintainable text-based persistent memory architecture that treats agent memory as topic-structured documents. Each topic document serves as a semantic unit for collecting related evidence, preserving metadata, and revising facts over time. New observations are first staged in a buffer and periodically consolidated into coherent textual contexts. At inference time, an agentic retrieval procedure lets the LLM read memory through iterative tool calls rather than a single retrieval step. On MemoryAgentBench, Infini Memory achieves 64.7% overall score. Ablations show that topic-structured maintenance and iterative evidence inspection improve complementary aspects of long-term memory use.
长期 LLM 智能体需要一种能够跟踪变化事实并跨会话提供相关证据的持久记忆。 现有记忆系统常把观察存储为孤立记录、摘要或索引片段,这使证据聚合、事实修订和记忆维护变得困难。 我们提出 Infini Memory,这是一种可维护的文本式持久记忆架构,它把智能体记忆视为按主题组织的文档。 每个主题文档都作为语义单元,用于收集相关证据、保留元数据并随时间修订事实。 新的观察首先暂存在缓冲区中,随后定期整合为连贯的文本上下文。 在推理时,智能体式检索过程让 LLM 通过迭代工具调用读取记忆,而非只执行一次检索。 在 MemoryAgentBench 上,Infini Memory 取得了 64.7% 的总体分数。 消融实验表明,按主题组织的维护与迭代式证据检查分别改善了长期记忆使用的互补方面。
1. Introduction
LLM agents increasingly operate over long horizon across many sessions, but an LLM's context window only bounds how much input the model can attend to in a single forward pass. Increasing its length exposes more history to the model, but does not by itself specify which information should be retained, how stale information should be revised, or how related evidence should be organized for future use.
LLM 智能体越来越多地跨多个会话执行长程任务,但 LLM 的上下文窗口只限定了模型在单次前向传播中能够关注多少输入。 扩大上下文窗口会向模型暴露更多历史,却不能自行规定应保留哪些信息、如何修订过时信息,或如何组织相关证据以供未来使用。
To address this gap, recent agent systems introduce memory mechanisms that retain information beyond the immediate prompt, including prior interactions, tool observations, task facts, and user preferences. Memory has been studied as a component of language-agent architectures and long-term conversational agents, with a parallel line of work introducing benchmarks for multi-turn memory capabilities. In this paper, we use persistent memory to refer to an external, editable memory state that survives across interaction sessions and can be written, updated, and queried by an agent during inference.
为弥补这一缺口,近期智能体系统引入了记忆机制,用于保留当前提示之外的信息,包括先前交互、工具观察、任务事实和用户偏好。 已有工作把记忆作为语言智能体架构和长期对话智能体的组成部分进行研究,同时还有一条研究路线提出了评估多轮记忆能力的基准。 在本文中,我们用持久记忆指代一种可跨交互会话存续的外部可编辑记忆状态,智能体可以在推理期间写入、更新和查询它。
These memory systems typically maintain information outside the model and retrieve relevant content back into the prompt at inference time. Existing designs include text memories with summary-based dialogue memories, vector retrieval, hierarchical memory managers, and knowledge-graph memory layers. These systems demonstrate the usefulness of external memory, but they also exhibit four recurring failure modes (Figure 1). When memory is represented mainly as independent retrievable items, evidence about the same user, task, or event can be distributed across many small records (memory fragmentation). When newer observations contradict older ones, append-style storage can leave both versions available for retrieval (memory conflict). When long histories are compressed into summaries, temporal order and source cues may be weakened (compression loss). Standard retrieval methods based on vector similarity, keyword matching, or fixed top-k procedures may return isolated fragments rather than enough evidence for temporally grounded reasoning (insufficient retrieval). We use fragments to refer to such retrieved pieces: evidence that may be relevant to a query but lacks the local context needed to resolve it.
这些记忆系统通常在模型之外维护信息,并在推理时把相关内容检索回提示中。 现有设计包括采用摘要式对话记忆的文本记忆、向量检索、层级记忆管理器和知识图谱记忆层。 这些系统证明了外部记忆的用途,但也呈现出图1所示的四种反复出现的失效模式。 当记忆主要表示为彼此独立的可检索条目时,同一用户、任务或事件的证据可能分散在许多小记录中(记忆碎片化)。 当较新的观察与较旧观察矛盾时,追加式存储可能让两个版本都保持可检索状态(记忆冲突)。 当长历史被压缩成摘要时,时间顺序和来源线索可能被削弱(压缩损失)。 基于向量相似度、关键词匹配或固定 top-k 流程的标准检索方法,可能只返回孤立片段,而不是足以支持时间依据推理的证据(检索不足)。 我们用片段指代这类检索结果:它们可能与查询相关,却缺少解决问题所需的局部上下文。

These observations motivate treating persistent memory as a lifecycle maintenance problem. A memory module for long-term agents should support three coupled operations. First, it should write durable information from interactions into the memory state. Second, it should maintain that state by grouping related evidence so that facts about the same user, task, or event are no longer scattered, reconciling new observations against contradicted older ones, and preserving temporal and source cues even as content is condensed. Third, it should read memory by retrieving evidence with sufficient local context rather than isolated fragments.
这些观察促使我们把持久记忆视为一个生命周期维护问题。 面向长期智能体的记忆模块应支持三项相互耦合的操作。 首先,它应把交互中的持久信息写入记忆状态。 其次,它应通过聚合相关证据来维护该状态,使同一用户、任务或事件的事实不再分散;根据相互矛盾的旧观察协调新观察;并且即使内容被压缩,也要保留时间和来源线索。 第三,它应通过检索具有充分局部上下文的证据来读取记忆,而不是只取回孤立片段。
We propose Infini Memory, a maintainable persistent memory architecture that represents external memory as topic-structured documents. Each topic document groups related evidence under a shared subject and carries entry-level metadata that retains temporal and source cues as content is rewritten. The system separates frequent writes from less frequent structural consolidation: new memory candidates are first appended to a buffer document, then periodically rewritten, split, updated, and merged into topic documents. At query time, the agent retrieves from this document library and expands local context around matching evidence. Retrieval over this library can use lexical indexing over plain-text documents rather than a vector or graph database backend.
我们提出 Infini Memory,这是一种可维护的持久记忆架构,把外部记忆表示为按主题组织的文档。 每个主题文档都在一个共同主题下聚合相关证据,并携带条目级元数据,从而在内容重写时保留时间和来源线索。 该系统把高频写入与较低频的结构整合分开:新的记忆候选项先追加到缓冲文档中,之后再定期重写、拆分、更新并合并到主题文档中。 在查询时,智能体从该文档库中检索,并围绕匹配证据扩展局部上下文。 对该文档库的检索可以采用纯文本文档上的词法索引,而不依赖向量数据库或图数据库后端。
The main contributions of this work are as follows:
- We introduce a document-based persistent memory architecture for long-term LLM agents. It organizes memory as topic documents and maintains them through buffered writing and periodic consolidation, avoiding a mandatory dependency on vector or graph databases.
- We present an agentic retrieval strategy in which the LLM controls a multi-step search process over structured memory tools. The strategy supports iterative evidence inspection, local context expansion, and answer-oriented evidence assembly.
- We evaluate Infini Memory on MemoryAgentBench, where its agentic retrieval variant achieves 64.7% overall, and use controlled variants to analyze maintenance and retrieval choices.
本工作的主要贡献如下:
- 我们提出一种面向长期 LLM 智能体的文档式持久记忆架构。它把记忆组织为主题文档,并通过缓冲写入和周期性整合对其进行维护,从而避免强制依赖向量数据库或图数据库。
- 我们提出一种智能体式检索策略,其中 LLM 控制针对结构化记忆工具的多步搜索过程。该策略支持迭代式证据检查、局部上下文扩展和面向答案的证据组装。
- 我们在 MemoryAgentBench 上评估 Infini Memory,其智能体式检索变体取得 64.7% 的总体分数,并通过受控变体分析维护与检索方案。
2. Related Work
2.1 Persistent Memory Representation and Maintenance
Recent work on LLM agents has increasingly treated memory as an external state that must be written, updated, and retrieved across interactions. Early persistent-memory systems mainly extend the effective context available to an LLM. MemGPT introduces virtual context management, in which an agent moves information between limited in-context memory and external storage through explicit control operations. MemoryBank stores long-term user memories and updates them over time with mechanisms inspired by the Ebbinghaus forgetting curve. Mem0 further develops this line by dynamically extracting, consolidating, and retrieving salient information from conversations, with a graph-based variant for relational structure. These systems show that persistent memory is useful for long-term interaction, but they often store memory as compact entries, summaries, or indexed fragments, which can make later revision and evidence reconstruction difficult when information is distributed across many interactions.
近期关于 LLM 智能体的工作越来越多地把记忆视为一种外部状态,需要在多次交互中写入、更新和检索。 早期的持久记忆系统主要扩展 LLM 可用的有效上下文。 MemGPT 引入虚拟上下文管理,智能体通过显式控制操作,在有限的上下文内记忆与外部存储之间移动信息。 MemoryBank 存储长期用户记忆,并通过受艾宾浩斯遗忘曲线启发的机制随时间更新这些记忆。 Mem0 进一步发展了这一路线,通过动态提取、整合和检索对话中的显著信息,并提供用于表示关系结构的图式变体。 这些系统表明持久记忆有助于长期交互,但它们通常把记忆存为紧凑条目、摘要或索引片段;当信息分散在许多次交互中时,这会给后续修订和证据重建带来困难。
A second line of work focuses on structured memory organization. Graph-based and associative approaches, such as HippoRAG-v2, use non-parametric memory structures to support factual, associative, and sense-making retrieval. REMem represents episodic memory with a hybrid graph over time-aware gists and facts, targeting recollection and reasoning over event histories. A-MEM proposes an agentic memory system inspired by the Zettelkasten method, where each memory is stored as an atomic note with structured attributes and dynamically generated links to related memories. These methods improve memory organization beyond flat retrieval, but they often rely on atomic notes, embeddings, or graph structures as the main substrate.
第二类工作关注结构化记忆组织。 HippoRAG-v2 等基于图和联想的方法使用非参数记忆结构,以支持事实检索、联想检索和意义建构检索。 REMem 使用由时间感知要点和事实组成的混合图表示情景记忆,旨在支持对事件历史的回忆与推理。 A-MEM 提出一种受卡片盒笔记法启发的智能体记忆系统,其中每条记忆都存为带有结构化属性的原子笔记,并动态生成指向相关记忆的链接。 这些方法改进了扁平检索之上的记忆组织,但通常依赖原子笔记、嵌入或图结构作为主要载体。
LightMem is also relevant because it separates memory processing into stages: sensory filtering, topic-aware short-term consolidation, and offline long-term update. Infini Memory shares the motivation of reducing online maintenance overhead, but differs in emphasizing plain-text topic documents and explicit consolidation operations. This makes its design more aligned with systems where interpretability, editable state, and infrastructure simplicity are important.
LightMem 也与本研究相关,因为它把记忆处理划分为多个阶段:感知过滤、主题感知的短期整合以及离线长期更新。 Infini Memory 同样致力于降低在线维护开销,但不同之处在于它强调纯文本主题文档和显式整合操作。 因此,它的设计更适合重视可解释性、状态可编辑性和基础设施简洁性的系统。
2.2 Retrieval and Evaluation for Long-Term Memory Agents
Retrieval is a key difficulty for long-term memory because relevant evidence may be scattered across many interactions. Standard retrieval pipelines usually rely on vector similarity, keyword matching, or a fixed top-k procedure. These methods are efficient, but they may return isolated fragments rather than enough evidence for temporally grounded reasoning or contradiction resolution. Recent systems therefore move toward more active retrieval procedures. REMem, for example, uses an agentic retriever with curated tools to iteratively retrieve and reason over episodic memory graphs. A-MEM introduces agency mainly in memory construction and organization, dynamically creating notes, attributes, and links when new memories arrive. Infini Memory extends this direction to the read path over structured text memory: the LLM can iteratively choose memory tools, inspect intermediate results, expand local context, and assemble evidence before answering.
检索是长期记忆的一项关键难题,因为相关证据可能分散在许多次交互中。 标准检索流程通常依赖向量相似度、关键词匹配或固定的 top-k 过程。 这些方法效率很高,但它们可能返回孤立片段,而不是支持时间依据推理或矛盾消解所需的充分证据。 因此,近期系统开始转向更加主动的检索过程。 例如,REMem 使用配备专门工具的智能体式检索器,在情景记忆图上迭代检索和推理。 A-MEM 主要在记忆构建和组织中引入智能体能力,在新记忆到来时动态创建笔记、属性和链接。 Infini Memory 把这一方向扩展到结构化文本记忆的读取路径:LLM 可以迭代选择记忆工具、检查中间结果、扩展局部上下文,并在回答前组装证据。
Benchmarks for long-term memory have also shifted from static long-context understanding toward interactive memory evaluation. LoCoMo evaluates very long-term conversational memory over multi-session dialogues with question answering, event summarization, and multimodal dialogue generation tasks. LongMemEval focuses on long-term interactive memory for chat assistants and evaluates information extraction, multi-session reasoning, temporal reasoning, knowledge updates, and abstention. These benchmarks are useful for testing long-context recall and temporally grounded dialogue understanding, but they do not fully isolate the operational abilities required by memory agents that incrementally store, revise, and retrieve information.
长期记忆基准也从静态长上下文理解转向了交互式记忆评估。 LoCoMo 在多会话对话上通过问答、事件摘要和多模态对话生成任务评估超长期对话记忆。 LongMemEval 聚焦对话助手的长期交互记忆,并评估信息提取、多会话推理、时间推理、知识更新和拒答能力。 这些基准有助于测试长上下文回忆和基于时间依据的对话理解,但没有完全分离出增量存储、修订和检索信息的记忆智能体所需的操作能力。
MemoryAgentBench is more directly aligned with the goals of this work. It evaluates memory agents through incremental multi-turn interactions and identifies four core competencies: accurate retrieval, test-time learning, long-range understanding, and selective forgetting. These competencies match the main design questions addressed by Infini Memory: whether the system can retrieve relevant evidence, acquire new information during deployment, integrate long-range context, and revise outdated memory. We therefore use MemoryAgentBench as the main evaluation setting, while interpreting results as benchmark-level evidence rather than as a complete characterization of all long-term memory use cases.
MemoryAgentBench 与本工作的目标更加直接一致。 它通过增量式多轮交互评估记忆智能体,并确定了四项核心能力:准确检索、测试时学习、长程理解和选择性遗忘。 这些能力对应 Infini Memory 所处理的主要设计问题:系统能否检索相关证据、在部署期间获取新信息、整合长程上下文并修订过时记忆。 因此,我们使用 MemoryAgentBench 作为主要评估环境,同时把结果解释为基准层面的证据,而不是对所有长期记忆使用场景的完整刻画。
3. Memory Design
3.1 Infini Memory Design Overview
Infini Memory represents persistent memory as a library of topic documents, where a topic denotes a maintenance scope that groups entries handled together by later operations (routing, splitting, merging). This scope is defined by how the memory will be used in future interactions. For example, entries about a stable user preference or an ongoing project may form a topic because they provide context for the same class of future questions and updates. This design avoids two less desirable extremes. (1) If memory is stored as isolated records, related evidence may be separated and later retrieval may return fragments without enough context; (2) if all memory is stored in a single chronological log, later operations may need to scan or rewrite unrelated history. We discuss the alternatives we rejected (pure vector store, pure knowledge graph, no buffer) in the appendix. Topic documents provide a bounded unit that can preserve related entries and their metadata under local headings, while keeping each document focused enough for rewriting, splitting, and merging.
Infini Memory 把持久记忆表示为一个主题文档库,其中主题表示一种维护范围,把后续操作(路由、拆分和合并)共同处理的条目聚合起来。 这一范围由记忆在未来交互中的使用方式定义。 例如,关于稳定用户偏好或持续进行中的项目的条目可以构成一个主题,因为它们为同一类未来问题和更新提供上下文。 这种设计避免了两个不够理想的极端。 (1)如果把记忆存为孤立记录,相关证据可能彼此分离,后续检索可能返回缺少充分上下文的片段;(2)如果把所有记忆都存入单一时间日志,后续操作可能需要扫描或重写不相关的历史。 我们在附录中讨论了被否决的替代方案(纯向量存储、纯知识图谱和无缓冲设计)。 主题文档提供了一个有界单元,既可以在局部标题下保留相关条目及其元数据,又能让每个文档足够聚焦,以便进行重写、拆分和合并。
Based on topic documents, Infini Memory organizes its memory pipeline around representation, writing, consolidation, and retrieval. Each topic document stores a summary, a hierarchical body, and entry-level metadata to organize related evidence within a bounded document scope (Section 3.2). New memories first enter a short-term buffer named CURRENT, so frequent writes do not repeatedly rewrite the topic library; consolidation is triggered after enough related evidence accumulates (Section 3.3). At inference time, the LLM iteratively searches, inspects, and expands context from the maintained topic library to recover evidence beyond a single retrieval result (Section 3.4). The structured text backend keeps the default system self-contained and leaves room for optional retrieval or maintenance extensions (Section 3.5).
基于主题文档,Infini Memory 围绕表示、写入、整合和检索组织其记忆流程。 每个主题文档都存储摘要、层级正文和条目级元数据,以便在有界文档范围内组织相关证据(第 3.2 节)。 新记忆首先进入名为 CURRENT 的短期缓冲区,使频繁写入不会反复重写主题库;当积累足够多的相关证据后触发整合(第 3.3 节)。 在推理时,LLM 从维护后的主题库中迭代搜索、检查并扩展上下文,以恢复单次检索结果之外的证据(第 3.4 节)。 结构化文本后端让默认系统保持自包含,同时为可选的检索或维护扩展留出空间(第 3.5 节)。

3.2 Topic Document Representation
Infini Memory stores persistent memory as topic documents (Figure 2), where each document groups related facts, preferences, and event cues under a shared topic. A document contains a metadata header, {id, summary, token_count, created_time, update_log, aux}, and a hierarchical body. The body uses topic and subtopic headings to organize unordered-list memory entries, each prefixed with a parsable signature <seq=..., time=..., source=...>. This representation preserves local context while keeping temporal order, provenance, and later revision operations explicit.
Infini Memory 把持久记忆存为主题文档(图2),每个文档都在一个共同主题下聚合相关事实、偏好和事件线索。 文档包含元数据头部 {id, summary, token_count, created_time, update_log, aux} 和层级正文。 正文使用主题和子主题标题组织无序列表形式的记忆条目,每个条目前都有可解析的签名 <seq=..., time=..., source=...>。 这种表示既保留了局部上下文,也明确保留了时间顺序、来源和后续修订操作。
Entry-level metadata. Each memory entry carries at least a sequence number seq, which increases monotonically with each write call. When temporal information is available from the interaction content, a time field is recorded. When information is extracted from the model response, a source=AI tag can be attached. The metadata signature can be extended with domain-specific fields such as entity type, namespace, machine identifier, IP address, or sensitivity level.
条目级元数据。 每个记忆条目至少携带一个序列号 seq,它会随每次写入调用单调递增。 当交互内容中提供了时间信息时,系统会记录 time 字段。 当信息从模型响应中提取时,可以附加 source=AI 标签。 元数据签名可以通过实体类型、命名空间、机器标识符、IP 地址或敏感级别等领域特定字段进行扩展。
This storage format has three practical benefits. First, the document summary and body can be refreshed together when a topic document is maintained, keeping retrieval metadata aligned with the underlying evidence. Second, temporal and source cues move with each entry when content is modified, e.g., rewritten, split, or merged. Third, each memory entry carries metadata that makes later revision explicit. When new evidence updates earlier content, seq and time provide ordering cues for superseding outdated entries or applying explicit deletion rules.
这种存储格式具有三项实际优势。 首先,在维护主题文档时,可以同时刷新文档摘要和正文,使检索元数据与底层证据保持一致。 其次,当内容被重写、拆分或合并等方式修改时,时间和来源线索会随每个条目一起移动。 第三,每个记忆条目都携带元数据,使后续修订变得明确。 当新证据更新先前内容时,seq 和 time 会提供顺序线索,用于取代过时条目或应用显式删除规则。
3.3 Buffered Writing and Consolidation
The writing and consolidation pipeline (Figure 3; full procedure in the algorithm in the appendix) is designed around the mismatch between the frequency of memory extraction and the scope of memory maintenance. Memory extraction may happen after every interaction, but consolidation should not. Updating the topic library after each extracted entry would require repeated topic routing, contradiction checking, and document rewriting. Such eager maintenance may also introduce unstable edits before enough related evidence is available. Infini Memory therefore introduces CURRENT as a buffer for recent entries.
写入与整合流程(图3;完整过程见附录中的算法)围绕记忆提取频率与记忆维护范围之间的不匹配进行设计。 记忆提取可能在每次交互后发生,但整合不应如此频繁。 在提取每个条目后都更新主题库,将需要反复进行主题路由、矛盾检查和文档重写。 这种急切维护还可能在获得足够多相关证据之前引入不稳定的编辑。 因此,Infini Memory 引入 CURRENT 作为近期条目的缓冲区。
The CURRENT buffer collects extracted memories in append form. Appending to this buffer does not require scanning or rewriting existing topic documents. More importantly, the buffer preserves the short-range coherence of recent interactions. Several adjacent turns often describe the same task, correct the same fact, or refine the same preference. Keeping them together before consolidation allows the system to resolve local redundancy and contradictions before they enter the topic library.
CURRENT 缓冲区以追加形式收集提取出的记忆。 向该缓冲区追加内容不需要扫描或重写现有主题文档。 更重要的是,缓冲区保留了近期交互的短程连贯性。 相邻的几轮交互通常描述同一任务、纠正同一事实或细化同一偏好。 在整合前把它们保存在一起,使系统能够在这些内容进入主题库之前解决局部冗余和矛盾。
The buffer is flushed when it reaches a token threshold or remains active for a predefined time window:
当缓冲区达到 token 阈值或持续活跃达到预定义时间窗口时,系统会刷新缓冲区:
where
其中,
When the buffer is flushed, the system rewrites CURRENT into REWRITE_CURRENT. This intermediate draft is not a persistent memory store. It is a normalized view of the recent buffer, created to make library update easier. The rewrite step groups locally related entries, removes redundant statements, preserves useful metadata, and marks possible updates to earlier facts. For example, several adjacent entries may be merged into one statement with a sequence range, while a correction may be marked as superseding an earlier entry. The full prompt invariants enforced at this stage are listed in the appendix.
刷新缓冲区时,系统会把 CURRENT 重写为 REWRITE_CURRENT。 这一中间草稿不是持久记忆存储。 它是近期缓冲区的规范化视图,旨在简化主题库更新。 重写步骤会聚合局部相关条目、删除冗余陈述、保留有用元数据,并标记对先前事实的潜在更新。 例如,若干相邻条目可以合并为带有序列范围的一条陈述,而纠正内容可以标记为取代先前条目。 这一阶段强制执行的完整提示约束列于附录中。
The normalized draft is then routed into the topic library. For each block in REWRITE_CURRENT, the planner decides whether it should update an existing topic document or create a new one. If the block extends an existing topic, it is inserted into the relevant document region. If it changes an earlier fact, the planner records the update relation and rewrites the affected local context. If it does not fit any existing maintenance scope, a new topic document is created. This step combines topic assignment and revision, because the correct target document is the one in which the block can be maintained together with related evidence. This procedure is given in the algorithm in the appendix.
随后,规范化草稿被路由到主题库中。 对于 REWRITE_CURRENT 中的每个内容块,规划器会决定它应更新现有主题文档还是创建新文档。 如果内容块扩展了现有主题,就把它插入相关文档区域。 如果它改变了先前事实,规划器会记录更新关系并重写受影响的局部上下文。 如果它不适合任何现有维护范围,则创建新的主题文档。 该步骤把主题分配与修订结合起来,因为正确的目标文档应当能够让该内容块与相关证据一起得到维护。 这一过程见附录中的算法。
After the update is applied, CURRENT is cleared for the next writing interval. Recent buffer content remains available to the retrieval module before consolidation, so newly written information can still be used in answers. This avoids a gap between extraction and retrievability.
应用更新后,系统会清空 CURRENT,以供下一个写入间隔使用。 整合前,近期缓冲内容仍可供检索模块使用,因此新写入的信息仍能用于回答。 这避免了提取与可检索之间的空档。
The topic library is periodically updated through split and merge operations. Overgrown documents are split to reduce overly broad local context, while fragmented documents are merged when they describe the same maintenance scope. After each structural update, summaries and metadata are refreshed to support future routing and retrieval.
主题库通过拆分和合并操作定期更新。 系统会拆分过度增长的文档,以缩小过于宽泛的局部上下文;当碎片化文档描述同一维护范围时,则将它们合并。 每次结构更新后,系统都会刷新摘要和元数据,以支持未来的路由和检索。

3.4 Agentic Retrieval over Topic Documents
The retrieval module is responsible for turning the topic library into evidence for answer generation. Infini Memory supports two retrieval variants: a hybrid reader (Infini Memory-H) that combines LLM-based summary selection with BM25 partition retrieval (Figure 4), and an agentic reader (Infini Memory-A) in which the LLM controls a multi-step search process over memory tools (Figure 5). In the agentic variant, the model selects which tool to call, inspects intermediate results, expands local context when needed, and decides when the collected evidence is sufficient. It is a tool-guided retrieval workflow built on top of topic documents.
检索模块负责把主题库转化为答案生成所需的证据。 Infini Memory 支持两种检索变体:一种是结合基于 LLM 的摘要选择与 BM25 分区检索的混合读取器 Infini Memory-H(图4);另一种是由 LLM 控制针对记忆工具的多步搜索过程的智能体式读取器 Infini Memory-A(图5)。 在智能体式变体中,模型选择要调用的工具、检查中间结果、在需要时扩展局部上下文,并判断收集到的证据何时已经充分。 这是构建在主题文档之上的工具引导检索流程。
Long-term memory questions often require more than isolated snippets. They may depend on related events, updated facts, or surrounding context. A single-shot retrieval can miss these connections. With topic documents, a matched entry can be expanded into its local block, where temporal and source metadata help the system identify the relevant evidence.
长期记忆问题通常需要的不只是孤立片段。 它们可能依赖相关事件、更新后的事实或周围上下文。 单次检索可能遗漏这些联系。 借助主题文档,可以把匹配条目扩展到其局部内容块,其中的时间和来源元数据会帮助系统识别相关证据。
At the start of retrieval, the system exposes a document catalog and a set of memory tools. The catalog contains document identifiers and summaries. For small libraries, the catalog can be provided directly. For larger libraries, the agent can inspect the catalog through paging or search. The default tools include global lexical search, document-local pattern search, catalog inspection, and line-range reading. These tools correspond to different retrieval behaviors: broad search finds candidate regions, local search verifies precise matches, and line-range reading recovers the context around evidence.
检索开始时,系统会公开一个文档目录和一组记忆工具。 目录包含文档标识符和摘要。 对于小型文档库,可以直接提供目录。 对于较大的文档库,智能体可以通过分页或搜索检查目录。 默认工具包括全局词法搜索、文档内模式搜索、目录检查和行范围读取。 这些工具对应不同的检索行为:广泛搜索用于发现候选区域,局部搜索用于验证精确匹配,行范围读取则用于恢复证据周围的上下文。
During retrieval, the agent alternates between tool calls and evidence inspection. Early steps usually identify candidate documents or headings. Later steps read local regions and check whether the evidence supports the query. The loop stops when the agent returns a stop decision, reaches a maximum number of iterations, reaches an evidence budget, or fails to obtain new useful evidence. These limits are important because agentic retrieval increases test-time computation compared with single-shot retrieval. The full retrieval loop, including the BM25 fallback path, is given in the algorithm in the appendix; the prompt that drives the per-step search behavior also appears in the appendix.
在检索期间,智能体在工具调用与证据检查之间交替进行。 早期步骤通常识别候选文档或标题。 后续步骤读取局部区域,并检查证据是否支持查询。 当智能体给出停止决策、达到最大迭代次数、用尽证据预算或无法获得新的有用证据时,循环停止。 这些限制非常重要,因为与单次检索相比,智能体式检索增加了测试时计算量。 包括 BM25 回退路径在内的完整检索循环见附录中的算法;驱动逐步搜索行为的提示也列于附录中。
The final evidence set may contain document-level selections, heading-level blocks, or expanded line ranges. Snippet-level results are expanded to the nearest coherent heading block when possible. The final context also includes recent entries from CURRENT, so unconsolidated memories remain accessible. If the agent returns no evidence or too little evidence, the system runs a conservative lexical fallback over the topic library. This fallback is used as a recall guard and does not replace the agentic retrieval policy.
最终证据集可能包含文档级选择、标题级内容块或扩展后的行范围。 在可能的情况下,片段级结果会扩展到最近的连贯标题内容块。 最终上下文还包含 CURRENT 中的近期条目,因此尚未整合的记忆仍然可用。 如果智能体没有返回证据或返回的证据太少,系统会在主题库上执行保守的词法回退检索。 这一回退机制用作召回保障,并不会取代智能体式检索策略。


3.5 Deployment and Extensibility
Infini Memory uses structured text as the default memory carrier. This choice keeps the default backend simple because the system can operate with ordinary document storage, lexical indexing, and deterministic file inspection tools. It does not require configuring a vector database, graph database, or external memory service before the system can run.
Infini Memory 使用结构化文本作为默认记忆载体。 这一选择让默认后端保持简洁,因为系统可以使用普通文档存储、词法索引和确定性文件检查工具运行。 系统运行前不需要配置向量数据库、图数据库或外部记忆服务。
This design should be interpreted as backend-light rather than computation-free. Agentic retrieval may use more tool calls or LLM tokens than a single retrieval step. Periodic consolidation also introduces maintenance cost. The intended benefit is that the default memory state remains readable, editable, and portable, while more specialized retrieval backends can be added when needed.
这种设计应理解为轻后端,而不是无计算开销。 与单次检索步骤相比,智能体式检索可能使用更多工具调用或 LLM token。 周期性整合也会引入维护成本。 其预期优势在于,默认记忆状态保持可读、可编辑和可移植,同时可以在需要时添加更专门的检索后端。
The same abstraction can support domain-specific extensions. The metadata area of each memory entry can store namespaces, entity schemas, access rules, or retention policies. Additional tools can expose vector search, graph traversal, database lookup, or permission checks. These extensions can be integrated as retrieval tools or maintenance rules while preserving topic documents as the shared memory state.
同一抽象还可以支持领域特定扩展。 每个记忆条目的元数据区域可以存储命名空间、实体模式、访问规则或保留策略。 附加工具可以提供向量搜索、图遍历、数据库查询或权限检查。 这些扩展可以作为检索工具或维护规则集成,同时仍把主题文档保留为共享记忆状态。
| Method | AR | TTL | LRU | SF | Overall Score | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| SH-QA | MH-QA | LME | Event | Avg. | MCC | Rec. | Avg. | Summ. | DetQA | Avg. | FC-SH | FC-MH | Avg. | ||
| Baselines | |||||||||||||||
| RAPTOR | 32.0 | 39.0 | 38.2 | 48.2 | 39.4 | 56.8 | 14.0 | 35.4 | 25.3 | 45.6 | 35.5 | 16.0 | 2.0 | 9.0 | 29.8 |
| MemoRAG | 35.0 | 36.0 | 25.0 | 54.4 | 37.6 | 75.0 | 15.7 | 45.4 | 15.3 | 53.5 | 34.4 | 25.0 | 8.0 | 16.5 | 33.5 |
| HippoRAG-v2 | 78.0 | 70.0 | 54.7 | 72.2 | 68.7 | 65.2 | 12.3 | 38.8 | 32.1 | 54.3 | 43.2 | 58.0 | 5.0 | 31.5 | 45.5 |
| Mem0 | 28.0 | 36.0 | 42.0 | 35.5 | 35.4 | 35.2 | 11.2 | 23.2 | 12.4 | 42.3 | 27.4 | 25.0 | 3.0 | 14.0 | 25.0 |
| MemGPT | 49.0 | 30.0 | 42.7 | 45.6 | 41.8 | 65.6 | 14.3 | 40.0 | 10.9 | 40.2 | 25.6 | 32.0 | 3.0 | 17.5 | 31.2 |
| LightMem | 57.0 | 34.0 | 69.2 | 39.2 | 49.9 | 58.0 | 12.7 | 35.4 | 27.5 | 41.0 | 34.2 | 29.0 | 6.0 | 17.5 | 34.2 |
| REMem | 62.0 | 42.0 | 62.3 | 41.2 | 51.9 | 80.0 | 13.2 | 46.6 | 23.4 | 47.6 | 35.5 | 32.0 | 9.0 | 20.5 | 38.6 |
| Infini Memory variants | |||||||||||||||
| Infini Memory-H | 77.0 | 76.0 | 76.0 | 83.0 | 78.0 | 81.0 | 15.8 | 48.4 | 57.2 | 78.4 | 67.8 | 80.0 | 22.0 | 51.0 | 61.3 |
| Infini Memory-A | 83.0 | 79.0 | 79.3 | 83.6 | 81.2 | 84.0 | 18.0 | 51.0 | 59.9 | 77.2 | 68.6 | 81.0 | 35.0 | 58.0 | 64.7 |
注:AR = 准确检索;TTL = 测试时学习;LRU = 长程理解;SF = 选择性遗忘。子数据集(除特别说明外均为准确率):SH-QA / MH-QA = 单跳 / 多跳文档问答;LME = LongMemEval(S*),重建的多会话对话变体;Event = EventQA,长叙事上的时间事件推理;MCC = 多类别分类;Rec. = 电影推荐(Recall@5);Summ. = 小说摘要(Fluency × F1);DetQA = 侦探推理问答;FC-SH / FC-MH = FactConsolidation 单跳 / 多跳选择性遗忘。粗体表示每列最佳值。
4. Experiments
4.1 Experimental Setup
Benchmark and Models. We evaluate our method on MemoryAgentBench, a benchmark for external memory mechanisms across four capabilities: Accurate Retrieval (AR) for factual recall from long histories, Test-Time Learning (TTL) for in-context rule acquisition, Long-Range Understanding (LRU) for extended narrative comprehension, and Selective Forgetting (SF) for updating outdated information.
基准与模型。 我们在 MemoryAgentBench 上评估所提出的方法,该基准针对外部记忆机制评估四项能力:从长历史中回忆事实的准确检索(AR)、在上下文中学习规则的测试时学习(TTL)、理解长篇叙事的长程理解(LRU),以及更新过时信息的选择性遗忘(SF)。
We use gpt-5-mini as the base model. System outputs are evaluated with an LLM-as-Judge protocol using gpt-5, where the judge assigns a binary correctness judgment based on the question, reference answer, and model output.
我们使用 gpt-5-mini 作为基础模型。 系统输出通过使用 gpt-5 的 LLM-as-Judge 协议进行评估,评判模型根据问题、参考答案和模型输出给出二元正确性判断。
Baselines. We compare Infini Memory against seven memory baselines. We use the official integrations supplied with MemoryAgentBench for RAPTOR, MemoRAG, HippoRAG-v2, Mem0, MemGPT, LightMem, and REMem. All baselines follow the same 4096-token chunking strategy as the benchmark's standard configuration. Each baseline retains its own retrieval and indexing logic under its official integration.
基线。 我们把 Infini Memory 与七种记忆基线进行比较。 对于 RAPTOR、MemoRAG、HippoRAG-v2、Mem0、MemGPT、LightMem 和 REMem,我们使用 MemoryAgentBench 提供的官方集成。 所有基线都遵循与该基准标准配置相同的 4096-token 分块策略。 每种基线都在其官方集成中保留自身的检索和索引逻辑。
Memory and retrieval configuration. For memory maintenance, Infini Memory triggers a CURRENT buffer rewrite upon reaching either 5000 tokens or a time threshold; it splits topic documents exceeding 5000 tokens and merges documents under 1000 tokens based on summary similarity. During retrieval, the LLM receives the query alongside an id + summary catalog. The agent can invoke memory tools for up to seven rounds—covering corpus search, regex matching, catalog browsing, and line reading. If agentic retrieval yields insufficient evidence, a BM25-based retriever supplements non-duplicate candidates.
记忆与检索配置。 在记忆维护方面,Infini Memory 会在达到 5000 token 或时间阈值时触发 CURRENT 缓冲区重写;它拆分超过 5000 token 的主题文档,并根据摘要相似度合并低于 1000 token 的文档。 检索期间,LLM 会同时接收查询和 id + summary 目录。 智能体最多可以调用七轮记忆工具,涵盖语料库搜索、正则表达式匹配、目录浏览和行读取。 如果智能体式检索产生的证据不足,基于 BM25 的检索器会补充不重复的候选项。
4.2 Main Benchmark Results
As shown in Table 1, Infini Memory-A achieves the highest overall score of 64.7%, improving over the strongest baseline by 19.2% points and leading on all four MemoryAgentBench capabilities, with gains of +12.5% on AR, +4.4% on TTL, +25.4% on LRU, and +26.5% on SF. Compared with the hybrid variant Infini Memory-H (61.3%), agentic retrieval adds 3.4% points on average; the largest gain falls on Selective Forgetting (+7.0%), where explicit temporal and source cues help the reader track revised facts.
如表1所示,Infini Memory-A 取得最高的 64.7% 总体分数,比最强基线高 19.2 个百分点,并在 MemoryAgentBench 的四项能力上均居首,在 AR、TTL、LRU 和 SF 上分别提高 +12.5%、+4.4%、+25.4% 和 +26.5%。 与混合变体 Infini Memory-H(61.3%)相比,智能体式检索平均增加 3.4 个百分点;最大增益出现在选择性遗忘(+7.0%)上,其中显式时间和来源线索有助于读取器追踪修订后的事实。
The pattern within Long-Range Understanding is more nuanced: the agentic reader leads on summary-oriented questions while the hybrid reader leads on detailed QA, reflecting a trade-off between targeted inspection and broader partition-level coverage.
长程理解内部的表现模式更为细致:智能体式读取器在面向摘要的问题上领先,而混合读取器在细节问答上领先,这反映了定向检查与更广泛分区级覆盖之间的权衡。
Discussion: multi-hop selective forgetting (FC-MH). The 81.0%/35.0% gap between FC-SH and FC-MH reveals a structural limit of write-time consolidation. Single-hop forgetting is settled at write time: the rewrite stage applies recency overrides within a topic document, so the latest version supersedes earlier ones before retrieval. Multi-hop forgetting cannot be settled this way, because a reasoning chain often spans several topic documents updated at different times. No single rewrite pass enforces cross-document consistency, and missing any hop causes cascade failure. This difficulty is intrinsic to the task: the MemoryAgentBench authors report that even o4-mini drops from 80.0% to 14.0% on FC-MH as context grows from 6K to 32K tokens.
讨论:多跳选择性遗忘(FC-MH)。 FC-SH 与 FC-MH 之间 81.0%/35.0% 的差距揭示了写入时整合的结构性限制。 单跳遗忘可以在写入时解决:重写阶段在主题文档内应用新近性覆盖,因此最新版本会在检索前取代早期版本。 多跳遗忘无法通过这种方式解决,因为推理链通常跨越多个在不同时间更新的主题文档。 单次重写无法强制保持跨文档一致性,而遗漏任何一跳都会导致级联失败。 这一困难是任务本身固有的:MemoryAgentBench 的研究者报告,即使是 o4-mini,当上下文从 6K 增长到 32K token 时,其 FC-MH 得分也会从 80.0% 降至 14.0%。
4.3 Ablation Experiments
| Variant | Maint. | Retrieval | Acc. | Δ |
|---|---|---|---|---|
| Infini Memory-A (full) | ✓ | Agentic | 79.3 | — |
| Retrieval ablation (maintenance fixed) | ||||
| Infini Memory-H (hybrid) | ✓ | Summary+BM25 | 76.0 | −3.3 |
| Summary-only | ✓ | Summary | 41.7 | −37.6 |
| Maintenance ablation (retrieval fixed at hybrid) | ||||
| w/o Split & Merge | Summary+BM25 | 69.3 | −10.0 | |
| Threshold | #Docs | Acc. | Δ |
|---|---|---|---|
| ≥ 1000 | 762 | 74.0 | −2.0 |
| ≥ 3000 | 319 | 74.3 | −1.7 |
| ≥ 5000† | 322 | 76.0 | — |
| ≥ 7000 | 280 | 70.7 | −5.3 |
| ≥ 9000 | 255 | 69.7 | −6.3 |
4.3.1 Structural Maintenance Ablation
We hold the read path fixed at the hybrid reader (Infini Memory-H, Section 3.4) and disable structural maintenance: no plan-driven split/update and no small-document merging, while retaining append-only writes and the CURRENT rewrite. Accuracy on LongMemEval (S
我们把读取路径固定为混合读取器(Infini Memory-H,第 3.4 节),并禁用结构维护:不执行规划驱动的拆分 / 更新和小文档合并,同时保留仅追加写入和 CURRENT 重写。 LongMemEval(S


Figure 6 breaks this gap down by question type. The shortfall concentrates on knowledge-update and multi-session questions, both of which depend on evidence drawn from distant turns and reconciled at read time. Without split and merge, related facts remain in whichever document they were first appended to, and superseded entries continue to coexist with their replacements, so the reader can no longer assemble a coherent and up-to-date answer across the relevant turns. Question types that resolve within a single session degrade much less, since the CURRENT rewrite alone already removes local duplicates and contradictions when the supporting evidence is nearby.
图6按问题类型进一步分解了这一差距。 性能不足主要集中在知识更新和多会话问题上,这两类问题都依赖从相距较远的轮次中获取并在读取时协调的证据。 如果没有拆分和合并,相关事实会停留在最初追加到的文档中,而已被取代的条目继续与替代内容共存,因此读取器无法再跨相关轮次组装连贯且最新的答案。 可以在单次会话内解决的问题类型退化要小得多,因为当支持证据彼此接近时,仅 CURRENT 重写就已经能够删除局部重复和矛盾。
4.3.2 Retrieval Strategy Ablation
We compare three read paths over the same maintained memory. Single-shot summary selection reaches only 41.7%: document summaries alone miss fine-grained facts such as exact values, timestamps, and entity mentions. Adding BM25 partition retrieval (Infini Memory-H) lifts accuracy to 76.0%, recovering most of the gap. The agentic reader (Infini Memory-A) reaches 79.3% (Figure 7) by issuing follow-up searches, inspecting local context, and combining complementary evidence spans before answering.
我们在同一份维护后的记忆上比较三种读取路径。 单次摘要选择仅达到 41.7%:仅依赖文档摘要会遗漏精确数值、时间戳和实体提及等细粒度事实。 加入 BM25 分区检索(Infini Memory-H)后,准确率提高到 76.0%,弥补了大部分差距。 智能体式读取器(Infini Memory-A)通过发起后续搜索、检查局部上下文并在回答前组合互补证据片段,取得 79.3% 的准确率(图7)。

4.3.3 Split-Threshold Sensitivity
We sweep the document split threshold, defined as the minimum token count above which a topic document becomes a split candidate, on LongMemEval (S
我们在 LongMemEval(S
Table 3 shows that the accuracy curve is asymmetric. Lowering the threshold to ≥ 3000 or ≥ 1000 costs only 1.7 and 2.0 points, even though the library expands to 762 documents at the most aggressive setting. The partitions stay topically clustered at this granularity, so over-fragmentation is recoverable: the hybrid reader still reaches most of the relevant evidence through summary plus BM25 matching. Raising the threshold to ≥ 7000 or ≥ 9000, by contrast, costs 5.3 and 6.3 points while the document count moves only modestly from 322 to 280 and then 255. The sharp accuracy drop between ≥ 5000 and ≥ 7000 therefore reflects the cost of letting documents grow past a single coherent topic rather than a count-based artefact: a small number of oversized documents accumulate content from multiple chunks and begin to mix unrelated subtopics, which degrades both topic routing during consolidation and partition-level retrieval at read time.
表3表明准确率曲线是不对称的。 把阈值降到 ≥ 3000 或 ≥ 1000 仅损失 1.7 和 2.0 个百分点,尽管在最激进的设置下文档库扩展到 762 个文档。 在这一粒度下,各分区仍按主题聚集,因此过度碎片化可以补救:混合读取器仍能通过摘要与 BM25 匹配找到大部分相关证据。 相比之下,把阈值提高到 ≥ 7000 或 ≥ 9000 会损失 5.3 和 6.3 个百分点,而文档数量仅从 322 小幅降至 280,再降至 255。 因此,≥ 5000 与 ≥ 7000 之间准确率的急剧下降,反映的不是基于数量的假象,而是文档增长到超出单个连贯主题所带来的代价:少量过大文档积累了来自多个块的内容,并开始混合不相关子主题,从而同时削弱整合期间的主题路由和读取时的分区级检索。
The default ≥ 5000 setting sits just above the 4096-token chunking budget (Section 4.1). With this margin, only documents that have absorbed content from more than one chunk become split candidates, so splitting acts as a safety valve for that minority rather than reshaping the bulk of the library. Figure 8 shows the resulting token-count distributions: at ≥ 1000, nearly all documents collapse below 1000 tokens; at ≥ 9000, a long tail extends beyond 7000 tokens; at ≥ 5000, the bulk stays below 4000 tokens with only a thin tail approaching the threshold.
默认的 ≥ 5000 设置略高于 4096-token 分块预算(第 4.1 节)。 借助这一余量,只有吸收了多个块内容的文档才会成为拆分候选项,因此拆分只充当少数此类文档的安全阀,而不会重塑文档库主体。 图8展示了由此得到的 token 数分布:在 ≥ 1000 时,几乎所有文档都缩到 1000 token 以下;在 ≥ 9000 时,长尾延伸到 7000 token 以上;在 ≥ 5000 时,主体保持在 4000 token 以下,只有一条细尾接近阈值。

Overall, the ablations attribute the gains to two complementary sources. Holding the hybrid reader fixed, removing structural maintenance costs 6.7 points (76.0 → 69.3), while holding the maintained memory fixed, upgrading from Infini Memory-H to Infini Memory-A adds 3.3 points (76.0 → 79.3). Structural maintenance therefore contributes more than the retrieval upgrade in this setting, and neither component is sufficient on its own.
总体而言,消融实验把增益归因于两个互补来源。 固定混合读取器时,移除结构维护会损失 6.7 个百分点(76.0 → 69.3);固定维护后的记忆时,从 Infini Memory-H 升级到 Infini Memory-A 会增加 3.3 个百分点(76.0 → 79.3)。 因此,在这一设置下,结构维护的贡献大于检索升级,而且任何一个组件单独使用都不充分。
5. Conclusion
We presented Infini Memory, a persistent memory architecture that represents agent memory as topic-structured text documents and maintains them through buffered writing, periodic consolidation, and structural maintenance. At inference, the LLM iteratively queries memory through tool calls, keeping the memory state inspectable and editable across long-term interaction. On MemoryAgentBench, its agentic retrieval variant achieves 64.7% overall and 81.2% on Accurate Retrieval under our evaluation protocol, with notable gains on Factual Recall, Test-Time Learning, and Selective Forgetting; the hybrid summary-plus-BM25 reader remains useful for long-range detailed QA. These results suggest that persistent agent memory quality depends on both how memory is maintained and how evidence is retrieved.
我们提出 Infini Memory,这是一种把智能体记忆表示为按主题组织的文本文档,并通过缓冲写入、周期性整合和结构维护对其进行管理的持久记忆架构。 在推理时,LLM 通过工具调用迭代查询记忆,使记忆状态在长期交互中保持可检查和可编辑。 在我们的评估协议下,其智能体式检索变体在 MemoryAgentBench 上取得 64.7% 的总体分数和 81.2% 的准确检索分数,在事实回忆、测试时学习和选择性遗忘上获得显著增益;混合式摘要加 BM25 读取器仍然适用于长程细节问答。 这些结果表明,持久智能体记忆的质量同时取决于记忆的维护方式和证据的检索方式。