Skip to content


SAM:面向长时程推理智能体的状态自适应记忆 ​

Abstract ​

Long-horizon agentic reasoning requires large language models to act over long interaction histories containing thoughts, tool calls, observations, and partial conclusions. The challenge is not merely that these histories grow long, but that information needed for the current decision may be scattered across distant steps and only become relevant later. Existing approaches address this difficulty by truncating the interaction history, compressing it into shorter surrogates, or retrieving selected parts of it for reuse, but they do not explicitly model how access to past interaction should adapt to the agent's evolving state. We instead cast long-horizon reasoning as a problem of state-adaptive memory.

长时程智能体推理要求大语言模型基于包含思考、工具调用、观测和阶段性结论的长交互历史采取行动。 挑战不仅在于这些历史不断变长,还在于当前决策所需的信息可能分散在相隔很远的步骤中,并且直到后来才变得相关。 现有方法通过截断交互历史、将其压缩为更短的替代表示,或检索其中的部分内容以供复用来应对这一困难,但它们并未显式建模:对过去交互的访问应如何适应智能体不断变化的状态。 我们则将长时程推理视为一个状态自适应记忆问题。

To this end, we propose State-Adaptive Memory (SAM), a standalone framework that consolidates ongoing interaction into compact memory cues while preserving raw trajectory pages for intent-driven recall. These cues are not treated as replacements for history; rather, they serve as lightweight handles that allow the agent to reconstruct temporally distant information according to its current needs, without retraining the underlying backbone. We further optimize the memory module through expert-guided supervision and reinforcement learning, aligning it with trajectory-level utility. Across BrowseComp, BrowseComp-ZH, WideSearch, and HLE, SAM consistently outperforms strong baselines over diverse agent backbones. Our results suggest that explicit memory modeling provides a simple and effective foundation for long-horizon agentic reasoning.

为此,我们提出状态自适应记忆(State-Adaptive Memory,SAM),这是一个独立框架,将持续发生的交互整合为紧凑的记忆线索,同时保留原始轨迹页,以支持意图驱动的回忆。 这些线索并非历史的替代品,而是轻量级索引,使智能体能够根据当前需要重建时间上相距较远的信息,无须重新训练底层骨干模型。 我们进一步通过专家指导的监督学习和强化学习优化记忆模块,使其与轨迹层面的效用对齐。 在 BrowseComp、BrowseComp-ZH、WideSearch 和 HLE 上,SAM 在多种智能体骨干模型下持续优于强基线。 我们的结果表明,显式记忆建模为长时程智能体推理提供了简单而有效的基础。

1. Introduction ​

Large language models (LLMs) are increasingly used as agents that reason and interact with external environments over extended horizons. Unlike single-pass generation, these tasks require the model to continually gather evidence, track progress, and choose subsequent actions based on a growing interaction history. As this history accumulates, it quickly becomes long and heterogeneous, interleaving thoughts, tool calls, observations, and partial conclusions. The resulting challenge is not only to continue reasoning, but also to recover what has already been established, what remains unresolved, and what information is needed next. For example, information encountered early in a trajectory may appear peripheral at first, yet later become critical for choosing the next action, ruling out an incorrect branch, or interpreting newly acquired evidence. Long-horizon agentic reasoning therefore poses a central problem of how to organize past trajectories so that it remains accessible to the current decision.

大语言模型(LLM)越来越多地被用作智能体,在较长时间跨度内推理并与外部环境交互。 与单次生成不同,这些任务要求模型根据不断增长的交互历史,持续收集证据、跟踪进展并选择后续行动。 随着历史不断累积,它很快就会变得冗长且异构,交织着思考、工具调用、观测和阶段性结论。 由此带来的挑战不仅是继续推理,还包括重新找出已经确立了什么、哪些问题仍未解决,以及接下来需要什么信息。 例如,轨迹早期遇到的信息起初可能显得无关紧要,但后来却可能成为选择下一步行动、排除错误分支或解读新获取证据的关键。 因此,长时程智能体推理提出了一个核心问题:如何组织过去的轨迹,使其仍能为当前决策所用。

Many existing approaches address this problem, at least in part, through context management. Common strategies include discarding interaction history, folding earlier steps into compact summaries, or retrieving selected past content for reuse. These methods can be effective when the information needed for the next step remains recent or can be adequately preserved in compressed form. However, long-horizon trajectories are often less forgiving: useful information may be distributed across distant steps, and its importance may only become apparent as the task unfolds. In such cases, the difficulty lies not only in limiting context length, but also in making past information available in a form that matches the agent's current needs.

许多现有方法至少在一定程度上通过上下文管理来处理这一问题。 常见策略包括丢弃交互历史、将早期步骤折叠为紧凑摘要,或检索选定的过去内容以供复用。 当下一步所需的信息仍在近期上下文中,或能够以压缩形式充分保留时,这些方法可以奏效。 然而,长时程轨迹往往提出更苛刻的要求:有用信息可能分散在相隔很远的步骤中,其重要性也可能直到任务推进后才显现。 在这种情况下,困难不仅在于限制上下文长度,还在于以符合智能体当前需要的形式提供过去的信息。

We argue that this challenge is better understood as one of state-adaptive memory. At any moment, an agent needs a coherent view of what has been established, what has been resolved, and what should be pursued next. Yet these elements are rarely presented explicitly in the raw trajectory; instead, they are scattered across a growing stream of loosely organized interaction history. A more natural view is that not all past information should remain equally active: as interaction unfolds, rich local context must gradually give way to a more compact form that still preserves what may later need to be recalled, echoing the classic distinction between active and more persistent memory states. From this perspective, the goal is not to keep the entire past in view, but to make the right parts of past information recoverable when the agent's current state demands them.

我们认为,将这一挑战理解为状态自适应记忆问题更为合适。 在任意时刻,智能体都需要连贯地了解 已经确立了什么、已经解决了什么,以及接下来应推进什么。 然而,这些要素很少明确呈现在原始轨迹中;相反,它们分散在不断增长、组织松散的交互历史流里。 一种更自然的观点是,并非所有过去的信息都应保持同等活跃:随着交互展开,丰富的局部上下文必须逐渐转为更紧凑的形式,同时仍保留日后可能需要回忆的内容,这呼应了活跃记忆状态与更持久记忆状态之间的经典区分。 从这一角度看,目标并不是始终将全部过去置于眼前,而是在智能体当前状态提出需要时,使过去信息中恰当的部分能够被恢复。

To this end, we propose State-Adaptive Memory (SAM), a standalone framework that equips an agentic LLM with an external memory model for trajectory consolidation and intent-driven recall. Rather than asking the agent to carry an ever-growing history forward, SAM converts ongoing interaction into two coupled forms: compact memory cues that remain visible in context as lightweight summaries and entry points for deeper recall, and raw trajectory pages preserved outside the live context window. Crucially, the cues are not treated as replacements for history; they act as persistent handles to the underlying pages. When the agent needs to revisit the past, it selects potentially relevant cues according to its current intent, and the memory model reconstructs the needed information from the corresponding pages. SAM therefore turns long-horizon history from a passive burden into a navigable memory space, enabling the agent to access temporally distant information on demand.

为此,我们提出 状态自适应记忆(SAM),这是一个独立框架,为智能体 LLM 配备外部记忆模型,用于轨迹整合和意图驱动的回忆。 SAM 不要求智能体不断携带日益增长的历史,而是将持续发生的交互转换为两种耦合形式:紧凑的记忆线索留在上下文中,充当轻量摘要和深层回忆入口;原始轨迹页则保存在实时上下文窗口之外。 关键在于,线索并不是历史的替代品,而是指向底层页面的持久索引。 当智能体需要回顾过去时,它会依据当前意图选择可能相关的线索,由记忆模型从对应页面中重建所需信息。 因此,SAM 将长时程历史从被动负担转化为可导航的记忆空间,使智能体能够按需访问时间上相距较远的信息。

This design also changes what it means to optimize memory. In SAM, memory is a representation whose value is realized only through future use: it must compress ongoing interaction, preserve information whose importance may surface only later, and remain recoverable under a changing decision state. We therefore optimize memory as an independent capability rather than absorbing it into a particular agent backbone: leading LLMs first validate the SAM framework, then this capability is transferred into a compact memory model via expert-guided supervision from rejection sampling, and finally refined with end-to-end RL (OAT-GRPO) in the full agent-environment loop. The result is a reusable memory module aligned with delayed, trajectory-level decision utility rather than local summary quality alone.

这一设计也改变了记忆优化的含义。 在 SAM 中,记忆是一种只有通过未来使用才能实现价值的表示:它必须压缩持续发生的交互,保留重要性可能直到后来才显现的信息,并在决策状态变化时仍可恢复。 因此,我们将记忆作为一种独立能力进行优化,而非将其吸收到某个特定智能体骨干模型之中:首先由领先的 LLM 验证 SAM 框架,再通过基于拒绝采样的专家指导监督,将这一能力迁移到紧凑的记忆模型中,最后在完整的智能体—环境循环中通过端到端 RL(OAT-GRPO)进一步改进。 最终得到的是一个可复用的记忆模块,它对齐的是延迟体现的、轨迹层面的决策效用,而不仅仅是局部摘要质量。

We evaluate SAM on four long-horizon agent benchmarks: BrowseComp, BrowseComp-ZH, WideSearch, and HLE. Across these settings, SAM consistently outperforms strong baselines over diverse agent backbones, indicating that explicit memory modeling can substantially improve long-horizon reasoning. Our contributions are threefold: (1) we formulate long-horizon context management as a state-adaptive memory problem, emphasizing demand-driven access to temporally distant information rather than recency-based compression alone; (2) we introduce a cue-page memory architecture that decouples lightweight write-time consolidation from intent-conditioned read-time reconstruction over preserved raw trajectory pages; and (3) we develop an optimization recipe for standalone memory models, combining expert-guided supervision with OAT-GRPO, a memory-action-level RL objective that assigns credit through memory-call trees and oracle-anchored recoverability rewards.

我们在四个长时程智能体基准上评估 SAM:BrowseComp、BrowseComp-ZH、WideSearch 和 HLE。 在这些设置下,SAM 在多种智能体骨干模型上持续优于强基线,表明显式记忆建模能够显著改善长时程推理。 我们的贡献有三点:(1)将长时程上下文管理表述为状态自适应记忆问题,强调按需访问时间上相距较远的信息,而不只是基于新近程度进行压缩;(2)提出线索—页面记忆架构,将写入时的轻量整合与读取时基于意图、利用保留的原始轨迹页进行的重建解耦;(3)提出独立记忆模型的优化方案,将专家指导监督与 OAT-GRPO 结合,后者是一种记忆动作层面的 RL 目标,通过记忆调用树和以预言机为锚的可恢复性奖励进行信用分配。

2. Method ​

2.1. Preliminary ​

In long-horizon agentic reasoning, the information relevant to the next decision is often only a small and implicit subset of the full interaction history. Consider a long-horizon agent interacting with an environment to solve a task instance x. At reasoning step t, the agent maintains an active context Ct and produces an action at, which may be an internal reasoning step or an external tool call. The environment then returns an observation ot. Over time, this yields an interleaved trajectory:

在长时程智能体推理中,与下一次决策相关的信息往往只是完整交互历史中一个很小且隐含的子集。 考虑一个与环境交互、以求解任务实例 x 的长时程智能体。 在推理步骤 t,智能体维护活跃上下文 Ct,并产生动作 at,它可以是内部推理步骤,也可以是外部工具调用。 随后,环境返回观测 ot。 随着时间推移,这会形成一条交错轨迹:

(1)τt=[(a1,o1),(a2,o2),…,(at,ot)].

In practice, each pair (at,ot) may contain heterogeneous content, including thoughts, tool arguments, tool responses, and partial conclusions. As t grows, directly carrying the entire trajectory in Ct becomes increasingly ineffective: the issue is not only that the context grows long, but that the information relevant to the next step becomes harder to identify within it.

在实践中,每一对 (at,ot) 都可能包含异构内容,包括思考、工具参数、工具响应和阶段性结论。 随着 t 增大,直接在 Ct 中携带整条轨迹会越来越低效:问题不仅是上下文变长,还在于其中与下一步相关的信息变得更难识别。

What the agent actually requires at step t is not the full trajectory itself, but a concise representation of its current task-solving status. We refer to this latent object as the agent's decision state. Rather than equating state with the raw prefix τt, we define:

智能体在步骤 t 真正需要的并非完整轨迹本身,而是对当前任务求解状况的简洁表示。 我们将这一潜在对象称为智能体的 决策状态。 我们不将状态等同于原始前缀 τt,而是定义:

(2)st=ϕ(τt,x),

where st captures three aspects that matter for the next decision: what has been established, what has been resolved, and what remains to be done. This definition is deliberately general. It does not assume that the needed information lies in the most recent steps, nor that it can be recovered from a fixed-size local window. The difficulty is precisely that st is not explicitly available: it must be inferred from information scattered across temporally distant interactions.

其中,st 刻画与下一次决策相关的三个方面:已经确立了什么、已经解决了什么,以及还有什么需要完成。 这一定义有意保持一般性。 它既不假定所需信息位于最近的步骤中,也不假定这些信息能够从固定大小的局部窗口中恢复。 困难恰恰在于,st 并非显式可得:它必须从分散在时间上相距较远的交互中的信息推断得到。

This perspective suggests a different goal for context management. Instead of approximating τt with a shorter recent-history surrogate, we seek to construct a state-adaptive support context C~t that exposes the information most useful for the current decision while remaining compact enough for continued reasoning. Formally, we want C~t to be sufficient for choosing the next action:

这一视角为上下文管理提出了不同的目标。 我们不以更短的近期历史替代表示来近似 τt,而是希望构建一个 状态自适应的支持上下文 C~t,呈现对当前决策最有用的信息,同时保持足够紧凑,以便继续推理。 形式化地说,我们希望 C~t 足以支持下一步动作的选择:

(3)at+1∼π(⋅∣x,C~t),C~t≈I(st),

where I(st) denotes the information most useful for the current decision state. We use st and I(st) only as conceptual notation: the point is not to explicitly estimate a latent state, but to distinguish the support needed for the next decision from the full trajectory prefix. Framed this way, the problem is no longer just how to shorten context, but how to recover the right support context for the agent's evolving state. This formulation has two advantages. First, it naturally accommodates non-Markov long-horizon tasks, where information from any earlier stage may become relevant again. Second, it separates memory access from the internals of the agent policy π, allowing memory to be modeled as an external and reusable capability.

其中,I(st) 表示对当前决策状态最有用的信息。 我们仅将 st 和 I(st) 用作概念性记号:重点并非显式估计潜在状态,而是区分下一次决策所需的支持与完整轨迹前缀。 这样一来,问题便不再只是如何缩短上下文,而是如何为智能体不断变化的状态恢复恰当的支持上下文。 这一表述有两个优点。 第一,它自然适用于非马尔可夫的长时程任务,这类任务中任意早期阶段的信息都可能再次变得相关。 第二,它将 记忆访问 与智能体策略 π 的内部机制分离,使记忆能够被建模为一种外部且可复用的能力。

2.2. State-Adaptive Memory (SAM) ​

Following the formulation above, we instantiate C~t with an external memory system, State-Adaptive Memory (SAM). The key idea is to change the role of history in long-horizon reasoning. Rather than treating past interaction as a prefix that must be carried forward, SAM reorganizes it into a memory space that the agent can navigate according to its current state. To this end, SAM maintains two coupled views of the interaction history: compact memory cues that remain available as persistent pointers to past progress, and raw trajectory pages that preserve the detailed interaction record for later reconstruction. This design keeps the online context lightweight while preserving access to information that may become relevant again much later. As shown in Figure 1, SAM consists of a page-based write path that consolidates recent interaction into memory cues and a read path that reconstructs decision-relevant information from raw pages under the agent's current recall intent.

遵循上述表述,我们使用外部记忆系统 状态自适应记忆(SAM) 来实现 C~t。 核心思想是改变历史在长时程推理中的作用。 SAM 不将过去的交互视为必须不断向前携带的前缀,而是将其重组为智能体能够根据当前状态进行导航的记忆空间。 为此,SAM 维护交互历史的两个耦合视图:紧凑的记忆线索作为指向过去进展的持久指针始终可用,原始轨迹页则保留详细交互记录,供日后重建。 这一设计使在线上下文保持轻量,同时保留对那些可能在很久以后再次变得相关的信息的访问能力。 如 图1 所示,SAM 包括一条基于页面的写入路径,将近期交互整合为记忆线索;以及一条读取路径,在智能体当前回忆意图的条件下,从原始页面重建与决策相关的信息。

SAM 概览。左上:基于页面的整合以紧凑的记忆线索替换原始交互历史,同时在外部保存对应的原始页面。右上:给定回忆意图,智能体选择候选线索,SAM 从关联页面中重建与决策相关的信息。下方:记忆模块先利用专家轨迹训练,再通过强化学习进一步优化。
图1:SAM 概览。左上:基于页面的整合以紧凑的记忆线索替换原始交互历史,同时在外部保存对应的原始页面。右上:给定回忆意图,智能体选择候选线索,SAM 从关联页面中重建与决策相关的信息。下方:记忆模块先利用专家轨迹训练,再通过强化学习进一步优化。

Page-based episodic consolidation. The first step is to determine how the interaction history is consolidated. To preserve the local coherence of reasoning, action, and feedback while keeping the mechanism simple, SAM partitions the trajectory into contiguous pages according to an information budget. Once the recent live context reaches a predefined capacity, SAM groups it into a page

基于页面的情景整合。 第一步是确定如何整合交互历史。 为在保持机制简单的同时,保留推理、动作与反馈之间的局部连贯性,SAM 按照信息预算将轨迹划分为连续的 页面。 一旦近期实时上下文达到预设容量,SAM 就将其归并为一个页面:

(4)pk=[(ai,oi),…,(aj,oj)],

where k indexes the page and the chunk size is bounded by a token budget. This design preserves local temporal coherence among reasoning, action, and feedback, while avoiding the brittleness and extra computation of explicit semantic segmentation.

其中,k 是页面索引,分块大小受 token 预算约束。 这一设计保留了推理、动作与反馈之间的局部时间连贯性,同时避免了显式语义分割的脆弱性和额外计算。

For each page pk, the memory model then produces a compact memory cue mk=Msum(pk) which captures the continuation-relevant contribution of that page, such as what was established, what was ruled out, what remains unresolved, and what may matter again later. After consolidation, the raw page pk is removed from the active context, while its cue mk is retained in a memory bank $\mathcal{M}_t $:

对于每个页面 pk,记忆模型随后生成紧凑的 记忆线索 mk=Msum(pk),刻画该页面对后续推进的贡献,例如已经确立了什么、排除了什么、哪些问题仍未解决,以及哪些内容日后可能再次重要。 整合后,原始页面 pk 从活跃上下文中移除,而其线索 mk 保留在记忆库 $\mathcal{M}_t $ 中:

(5)Mt={m1,m2,…,mKt},

and the corresponding raw pages are stored in an external page store $\mathcal{P}_t $:

对应的原始页面则存储在外部页面存储 $\mathcal{P}_t $ 中:

(6)Pt={p1,p2,…,pKt}.

The important point is that consolidation in SAM is not irreversible compression. The cue is not meant to replace the page or to function as a self-sufficient substitute for history; it serves as a lightweight handle to that page. In other words, SAM does not flatten past interaction into a single surrogate history, but converts it into a set of navigable memory entries whose underlying trajectory content remains recoverable.

关键在于,SAM 中的整合并非不可逆的压缩。 线索既不旨在替代页面,也不是能够独立充当历史替代品的自足表示;它只是指向该页面的轻量级索引。 换言之,SAM 不会将过去的交互压平为单一的替代历史,而是将其转化为一组可导航的记忆条目,其底层轨迹内容仍可恢复。

Agent-guided cue selection. At step t, the agent observes the task x, the current live context, and the memory cues in Mt. If additional past information is needed, the agent issues a recall request with an intent qt describing what it is trying to recover, and selects a small subset of candidate cues:

智能体引导的线索选择。 在步骤 t,智能体观察任务 x、当前实时上下文,以及 Mt 中的记忆线索。 如果还需要过去的信息,智能体就会发出回忆请求,以意图 qt 描述它试图恢复的内容,并选择一个较小的候选线索子集:

(7)Rt={mk1,…,mkr}⊆Mt.

Importantly, this selection is not determined by a hand-crafted retrieval score. The role of the cues is not to replace the agent's judgment about relevance, but to expose a coarse yet persistent map of past interaction. They make it possible for the agent to decide, from its current state, which earlier pages are worth revisiting.

重要的是,这一选择并不由手工设计的检索分数决定。 线索的作用不是替代智能体对相关性的判断,而是提供一幅粗粒度但持久的过去交互地图。 它们使智能体能够从当前状态出发,判断哪些早期页面值得重新查看。

Intent-driven episodic recall. The selected cues identify their underlying pages {pk1,…,pkr}. Conditioned on the recall intent qt, the memory model revisits these pages sequentially and extracts the information most relevant to the current need:

意图驱动的情景回忆。 选中的线索指向其底层页面 {pk1,…,pkr}。 以回忆意图 qt 为条件,记忆模型依次重新访问这些页面,并提取与当前需要最相关的信息:

(8)ρt=Mrec(qt,pk1,…,pkr).

The recalled content ρt is then injected into the agent's active context for subsequent reasoning. Because recall is conditioned on the current intent, SAM does not replay raw history verbatim. Instead, it reconstructs a focused support context tailored to the present decision. This is the key distinction from using summaries as replacements for history, or from directly retrieving pre-compressed snippets: in SAM, the cue only identifies candidate parts of the agent's own trajectory, while the returned content is reconstructed from the underlying raw pages under the current intent. The resulting active context can be written as:

随后,回忆内容 ρt 被注入智能体的活跃上下文,用于后续推理。 由于回忆以当前意图为条件,SAM 不会逐字重放原始历史。 相反,它会重建一个聚焦于当前决策的支持上下文。 这正是它与用摘要替代历史或直接检索预先压缩片段的关键区别:在 SAM 中,线索仅标识智能体自身轨迹中的候选部分,而返回的内容则是在当前意图下从底层原始页面重建得到的。 由此产生的活跃上下文可写为:

(9)C~t=[x;Ctlive;Mt;ρt],

where Ctlive denotes the uncompressed recent context. Here, Ctlive provides short-term continuity, Mt provides lightweight long-term guidance, and ρt restores the detailed past information needed for the current decision. Recall in SAM is therefore not a replay of stored history, but a state-conditioned reconstruction of decision support from stored trajectory pages.

其中,Ctlive 表示未经压缩的近期上下文。 这里,Ctlive 提供短期连续性,Mt 提供轻量级长期引导,ρt 则恢复当前决策所需的过去详细信息。 因此,SAM 中的回忆并不是重放已存储的历史,而是以状态为条件,从存储的轨迹页中重建决策支持。

SAM is state-adaptive primarily in how memory is accessed. Consolidation is intentionally simple and page-based, providing a stable way to turn long trajectories into persistent memory entries. The adaptive component appears at read time: which cues are selected, which pages are revisited, and what information is reconstructed all depend on the agent's current intent. What matters, therefore, is not merely what happened most recently, but which parts of the interaction history are useful for the agent's present state.

SAM 的状态自适应性主要体现在记忆的访问方式上。 整合过程有意采用简单的页面机制,为将长轨迹转化为持久记忆条目提供稳定方式。 自适应部分出现在读取时:选择哪些线索、重新访问哪些页面,以及重建什么信息,都取决于智能体的当前意图。 因此,重要的不仅仅是最近发生了什么,而是交互历史中的哪些部分对智能体当前状态有用。

2.3. Optimization Process of SAM ​

Optimizing SAM is not simply a matter of training a better summarizer. The memory model must learn a representation whose value is deferred: a cue is useful only if it preserves information that may become important later, and a recall result is useful only if it improves a downstream decision. We therefore optimize SAM as a standalone memory capability, keeping the agent backbone frozen, and follow the same logic as the framework itself: first transfer the desired memory behavior from strong models, then align it with trajectory-level utility in closed-loop interaction.

优化 SAM 并不只是训练一个更好的摘要器。 记忆模型必须学习一种价值延后体现的表示:线索只有保留了日后可能变得重要的信息才有用,回忆结果只有改善了下游决策才有用。 因此,我们将 SAM 作为独立的记忆能力进行优化,冻结智能体骨干模型,并遵循与框架本身相同的逻辑:先从强模型迁移所需的记忆行为,再在闭环交互中使其与轨迹层面的效用对齐。

Expert-guided supervised fine-tuning. We instantiate the memory model with Qwen3.5-9B and bootstrap it from expert traces: leading LLMs (Claude-4.5-Opus and GPT-5.4) act as expert memory models on in-domain queries, and we retain only trajectories that yield correct final answers, providing paired targets for both consolidation (mk⋆ for each page pk) and intent-driven recall (ρt⋆ for each (qt,pk1,…,pkr)). The memory model is then initialized by supervised fine-tuning:

专家指导的监督微调。 我们以 Qwen3.5-9B 实现记忆模型,并利用专家轨迹进行启动:领先的 LLM(Claude-4.5-Opus 和 GPT-5.4)在域内查询上充当专家记忆模型,我们仅保留最终答案正确的轨迹,为整合(每个页面 pk 对应的 mk⋆)和意图驱动的回忆(每个 (qt,pk1,…,pkr) 对应的 ρt⋆)同时提供配对目标。 随后通过监督微调初始化记忆模型:

(10)LSFT=∑k−log⁡PM(mk⋆∣pk)+∑t−log⁡PM(ρt⋆∣qt,pk1,…,pkr).

OAT-GRPO. Supervised transfer alone is insufficient because memory quality is only partially observable at write time, and vanilla GRPO does not match this structure: it forms its baseline over independent trajectories and assigns a single sparse outcome bit to the whole rollout, rather than to the individual memory actions whose quality we want to optimize. We therefore introduce OAT-GRPO (Oracle-Anchored Tree GRPO), which extends GRPO along two design axes: (i) the rollout is structured as a memory-call tree that exposes a sibling group at every memory action and propagates outcome credit back to each individual memory output; and (ii) at every action node we additionally inject an oracle-anchored reward computed against a committee of frontier models, which densifies the sparse outcome signal and covers regions of the recall space that the on-policy memory model would rarely visit on its own.

OAT-GRPO。 仅靠监督迁移还不够,因为写入时只能部分观测记忆质量,而原始 GRPO 与这一结构并不匹配:它基于彼此独立的轨迹构建基线,并将单一、稀疏的二元结果信号赋给整条 rollout,而非赋给我们希望优化质量的各个记忆动作。 因此,我们提出 OAT-GRPO(Oracle-Anchored Tree GRPO,以预言机为锚的树式 GRPO),沿两个设计维度扩展 GRPO:(i)将 rollout 组织为一棵 记忆调用树,在每个记忆动作处形成兄弟节点组,并将结果信用反向传播到每个独立的记忆输出;(ii)在每个动作节点额外注入相对于前沿模型委员会计算的 预言机锚定 奖励,使稀疏的结果信号更加稠密,并覆盖当前策略记忆模型自身很少访问的回忆空间区域。

Tree-structured outcome reward. Unlike standard agentic RL, where the main reasoning policy is itself the trained model and rollouts can be replayed cheaply with a fixed environment, here the model under training sits behind a tool: the agent calls the memory model multiple times within a single trajectory, and every update changes how every later memory call would have been answered. Naively re-running whole trajectories per gradient step is therefore both wasteful and credit-blind, since the binary task outcome arrives only at the end. The memory-call tree is the natural fix: each time the agent issues a recall, the memory model is branched into b samples sharing the same parent context but producing different recalled summaries; each branch is then continued by the frozen reasoner, and the tree expands recursively at every subsequent memory call until a leaf is scored by a binary outcome rout∈{0,1} against the gold answer. Branching at exactly the points where the trained model acts both amortizes rollout cost across siblings and makes credit assignment local: for a memory action node a, its outcome value is the Monte-Carlo mean over all descendant leaves:

树结构的结果奖励。 在标准智能体 RL 中,主推理策略本身就是待训练模型,且在固定环境下能够以较低成本重放 rollout;与之不同,这里的待训练模型位于 工具背后:智能体在单条轨迹内多次调用记忆模型,而每次更新都会改变后续每次记忆调用原本会得到的回答。 因此,若每个梯度步都简单地重新运行整条轨迹,不仅浪费计算,也无法区分各动作的贡献,因为二元任务结果直到最后才出现。 记忆调用树是自然的解决方式:每当智能体发起回忆,就从记忆模型分出 b 个样本,它们共享相同的父上下文,但产生不同的回忆摘要;随后由冻结的推理模型继续推进每个分支,并在此后的每次记忆调用处递归扩展这棵树,直到叶节点通过与标准答案比较,得到二元结果评分 rout∈{0,1}。 恰好在待训练模型采取动作的位置分支,既能在兄弟节点之间分摊 rollout 成本,也能使信用分配局部化:对于记忆动作节点 a,其结果价值是所有后代叶节点结果的蒙特卡洛均值:

(11)Rout(a)=1|L(a)|∑ℓ∈L(a)rout(ℓ),

where L(a) is the leaf set in the subtree rooted at a. Sibling actions sharing a parent context c form a local baseline that isolates the contribution of this memory output relative to other memories produced from the same state—the GRPO group structure, instantiated at the memory-action level rather than the trajectory level.

其中,L(a) 是以 a 为根的子树中的叶节点集合。 共享父上下文 c 的兄弟动作形成局部基线,从而分离出 这一次 记忆输出相对于同一状态下产生的其他记忆的贡献——这就是 GRPO 的组结构,只是将其落实在记忆动作层面,而非轨迹层面。

Oracle-anchored recoverability reward. Outcome credit alone is sparse, high-variance, and coverage-limited, since the on-policy memory model only explores a thin slice of plausible recalls. The deeper difficulty is that no single “golden” recall exists for (qt,{pk1,…,pkr}): acceptable outputs form a target space A⋆(qt,⋅) of summaries that are concise yet faithful to the evidence the downstream reasoner will need. Since A⋆ is unobserved, we approximate it by the union A^ of references from a committee of three frontier models (GPT-5.4, GLM-4.7, DeepSeek-V4-Flash) queried with the same intent and pages: each alone covers only a slice, but their union is broad enough to act as an oracle proxy while remaining tight enough to penalize off-target outputs. The objective is then to push the memory model's per-context output distribution toward A^—covering the committee-spanned target space rather than collapsing onto any single reference. Concretely, GPT-5.4 acts as a separate assessor scoring each candidate a on 0–10 (rescaled to [0,1]) for relevance, coverage, and consistency against A^, yielding Rrec(a). Committee and judge calls are shared across siblings of the same parent context, so Rrec(a) measures only how well a branch covers the shared target without re-injecting committee variance into the credit signal.

预言机锚定的可恢复性奖励。 仅有结果信用仍然稀疏、方差较高且覆盖有限,因为当前策略记忆模型只探索了合理回忆空间中的狭小部分。 更深层的困难在于,对于 (qt,{pk1,…,pkr}),并不存在唯一的“黄金”回忆:可接受的输出构成一个摘要目标空间 A⋆(qt,⋅),其中的摘要既简洁,又忠实于下游推理模型将要需要的证据。 由于 A⋆ 不可观测,我们用三个前沿模型(GPT-5.4、GLM-4.7、DeepSeek-V4-Flash)组成的委员会针对相同意图和页面给出的参考答案并集 A^ 来近似它:每个模型单独只能覆盖其中一部分,但它们的并集足够广,可以作为预言机的代理,同时又足够聚焦,能够惩罚偏离目标的输出。 于是,目标变为推动记忆模型在各上下文下的输出分布趋近 A^——覆盖委员会所张成的目标空间,而不是坍缩到某一条参考答案。 具体而言,GPT-5.4 作为独立评估器,参照 A^,从相关性、覆盖度和一致性三个方面为每个候选 a 给出 0–10 分(缩放到 [0,1]),得到 Rrec(a)。 同一父上下文的兄弟节点共享委员会和评判模型的调用,因此 Rrec(a) 仅衡量一个分支覆盖共享目标的程度,不会将委员会的方差再次引入信用信号。

OAT-GRPO objective. The two rewards are combined into a per-action signal

OAT-GRPO 目标。 将两种奖励组合为逐动作信号:

R(a)=αRout(a)+(1−α)(Rrec(a)−brec),

where brec re-centers the committee score. Within each parent context c, the b sibling actions {ai} form the OAT-GRPO group with advantage

其中,brec 用于将委员会分数重新居中。 在每个父上下文 c 内,b 个兄弟动作 {ai} 构成 OAT-GRPO 组,其优势为:

A^i=R(ai)−mean{R(aj)}std{R(aj)},

and the memory model Mθ is updated with the clipped surrogate

记忆模型 Mθ 则通过以下截断代理目标进行更新:

(12)JOAT-GRPO(θ)=E[1b∑i=1bmin(ri(θ)A^i,clip(ri(θ),1−ε,1+ε)A^i)],

where ri(θ)=Mθ(ai∣c)Mθold(ai∣c) and ε is the clipping range. Compared with vanilla GRPO, OAT-GRPO keeps the surrogate but replaces what the group is over (siblings at a shared decision context) and how each member is scored (tree-attributed outcome plus oracle-anchored recoverability). Full training details are deferred to the appendix.

其中,ri(θ)=Mθ(ai∣c)Mθold(ai∣c),ε 是截断范围。 与原始 GRPO 相比,OAT-GRPO 保留了代理目标,但改变了组由 什么 构成(共享决策上下文下的兄弟节点),以及 如何 为每个成员评分(树结构归因的结果,加上预言机锚定的可恢复性)。 完整训练细节见附录。

3. Experiments ​

3.1. Datasets ​

Training data. Our training corpus is built entirely from public agent-trajectory releases: OpenSeeker, 11.7K QA pairs each annotated with a full multi-turn agent trajectory, and OpenResearcher, a complementary deep-research dataset with multi-message tool-augmented traces. Since the two sources are heterogeneous in length and answer reliability, we apply a filtering pass that drops trivially short trajectories and trajectories whose final answer disagrees with the verified gold. The curated subset is used uniformly across training stages.

训练数据。 我们的训练语料完全来自公开的智能体轨迹数据:OpenSeeker,包含 11.7K 个问答对,每个问答对都标注了完整的多轮智能体轨迹;以及 OpenResearcher,这是一个互补的深度研究数据集,提供包含多条消息、由工具增强的轨迹。 由于两个来源在长度和答案可靠性上存在差异,我们进行了一轮过滤,删除过于简短的轨迹,以及最终答案与经核验标准答案不一致的轨迹。 整理后的子集统一用于各个训练阶段。

Evaluation benchmarks. We evaluate on four long-horizon agent benchmarks that stress complementary aspects of memory-intensive reasoning: BrowseComp (long-range web browsing), BrowseComp-ZH (cross-lingual multi-hop search), WideSearch (broad exploration over large search spaces), and HLE (knowledge-intensive scientific reasoning). For evaluation efficiency under limited compute, and following prior work, we randomly sample 200 questions per benchmark on BrowseComp and HLE; BrowseComp-ZH and WideSearch are evaluated on their full sets. Per-benchmark coverage and motivation are detailed in Appendix C.

评估基准。 我们在四个长时程智能体基准上进行评估,分别侧重记忆密集型推理的不同方面:BrowseComp(长程网页浏览)、BrowseComp-ZH(跨语言多跳搜索)、WideSearch(在大规模搜索空间中广泛探索)和 HLE(知识密集型科学推理)。 为在有限算力下提高评估效率,并遵循已有工作,我们在 BrowseComp 和 HLE 上各随机采样 200 道题;BrowseComp-ZH 和 WideSearch 则使用各自的完整测试集。 各基准的覆盖范围及选择动机详见 附录 C。

3.2. Experimental Setup ​

Models. SAM separates an agent backbone, which drives the reasoning loop, from a memory model, which handles context management. We use two agent backbones spanning complementary regimes: the proprietary GLM-4.7 and the open-source Qwen3.5-35B-A3B. The memory model, instantiated from Qwen3.5-9B and shared across both backbones, is the only component updated during the SFT and RL stages of Section 2.3, and is responsible for both page-level consolidation and intent-driven recall.

模型。 SAM 将驱动推理循环的智能体骨干模型与负责上下文管理的记忆模型分离。 我们使用两个代表互补类型的智能体骨干模型:专有模型 GLM-4.7 和开源模型 Qwen3.5-35B-A3B。 记忆模型以 Qwen3.5-9B 初始化,由两个骨干模型共享,是 第 2.3 节 中 SFT 和 RL 阶段唯一被更新的组件,同时负责页面级整合和意图驱动的回忆。

Tools. The agent operates over a uniform tool interface with five tools: search, visit, scholar, python, and memory, the latter being the SAM recall interface. The first three open-web benchmarks use {search, visit, memory}; HLE additionally enables {scholar, python} for its scientific subset. The toolset remains constant across all context-management baselines on a given benchmark.

工具。 智能体通过统一的工具接口运行,包含五种工具:search、visit、scholar、python 和 memory,最后一种即 SAM 的回忆接口。 前三个开放网页基准使用 {search、visit、memory};HLE 为其科学子集额外启用 {scholar、python}。 在同一基准上,所有上下文管理基线的工具集保持一致。

Baselines. We compare against three groups of methods. (i) Foundation models (OpenAI-o3, GPT-5.4, Claude-4.5-Opus, Kimi-K2.5) are reported as reference numbers from their original releases. (ii) Open-source agent systems (WebThinker, WebSailor, ReSum, IterResearcher, AgentFold) represent the current open-source frontier; per-system memory and workspace designs are summarized in Appendix D. (iii) Context-management baselines share the agent backbone with SAM and form the most controlled comparison: w/o CM retains the entire trajectory in context; discard-tool drops earlier tool responses once they exit a fixed window; recent-k keeps only the last k interaction steps; and summary replaces the dropped prefix with a rolling summary generated by the agent backbone itself.

基线。 我们与三组方法进行比较。 (i)基础模型(OpenAI-o3、GPT-5.4、Claude-4.5-Opus、Kimi-K2.5)使用各自原始发布中的数值作为参考。 (ii)开源智能体系统(WebThinker、WebSailor、ReSum、IterResearcher、AgentFold)代表当前开源前沿;各系统的记忆与工作空间设计汇总于 附录 D。 (iii)上下文管理基线 与 SAM 共享智能体骨干模型,构成控制变量最严格的比较:w/o CM 将整条轨迹保留在上下文中;discard-tool 丢弃移出固定窗口的早期工具响应;recent-k 仅保留最后 k 个交互步骤;summary 则以智能体骨干模型自身生成的滚动摘要替换被丢弃的前缀。

Inference protocol. Every context-management method, including SAM, runs under an identical inference protocol: a 128K context window with the management routine triggered at 64K, fixed decoding hyperparameters across methods, and a per-query round cap. To reduce sampling variance we report avg@3. Full inference, training, and reward configurations are deferred to Appendix B.

推理协议。 包括 SAM 在内的每种上下文管理方法都使用相同的推理协议:上下文窗口为 128K,在 64K 时触发管理流程,各方法采用固定且一致的解码超参数,并设置每个查询的轮数上限。 为降低采样方差,我们报告 avg@3。 完整的推理、训练和奖励配置见 附录 B。

3.3. Main Results ​

表1:长时程智能体基准上的结果。报告各基准的总体分数及四个基准的平均值(CM 表示上下文管理)。带 † 的结果来自原论文。
CategoryModelCMB. C.B. C.-ZHHLEWideSea.Avg.
Foundation modelsOpenAI-o3†w/o49.758.124.952.646.3
GPT-5.4w/o54.9–35.2––
Claude-4.5-Opusw/o37.062.443.4––
Kimi-K2.5-1Tw/o60.6–50.272.7–
GLM-4.7w/o43.552.537.265.449.4
Qwen3.5-35B-A3Bw/o36.042.234.065.644.5
Agent systemsWebThinker-32B†/2.87.315.8––
WebSailor-32B†/10.525.59.6––
ReSum-30B†/18.333.3–––
IterResearcher-30B-A3B†/37.345.228.8––
AgentFold-30B-A3B†/36.247.3–62.1–
Models with CMGLM-4.7discard-tool49.062.536.566.353.6
recent-k51.561.237.267.154.3
summary53.559.037.568.354.6
SAM (Ours)56.564.238.269.257.0
Qwen3.5-35B-A3Bdiscard-tool40.543.536.064.746.2
recent-k38.245.034.265.345.7
summary39.543.035.266.846.1
SAM (Ours)42.246.537.269.148.8

Table 1 reports the main results, and we summarize the takeaways in two points.

表1 报告了主要结果,我们将结论概括为两点。

SAM is the strongest context-management method on every backbone. Across the four-benchmark average, SAM beats the best heuristic on each backbone by a clear margin and outperforms the no-management baseline by an even larger one. The lead is largest where the demand on memory is greatest, on BrowseComp and BrowseComp-ZH, indicating that SAM's gains come precisely where heuristic strategies are weakest.

SAM 在每个骨干模型上都是最强的上下文管理方法。 按四个基准的平均成绩计算,SAM 在每个骨干模型上都明显超过最佳启发式方法,并以更大幅度超过不进行上下文管理的基线。 在对记忆要求最高的 BrowseComp 和 BrowseComp-ZH 上,领先幅度最大,表明 SAM 的收益恰好来自启发式策略最薄弱的场景。

The same SAM module generalizes across benchmarks and backbones. A single Qwen3.5-9B memory model, trained once, drives the best score in every backbone–benchmark cell we evaluate, spanning long-range English browsing (BrowseComp), cross-lingual search (BrowseComp-ZH), broad exploration (WideSearch), and knowledge-intensive scientific reasoning (HLE), and on top of two heterogeneous backbones (proprietary GLM and open-source Qwen3.5). The heuristic baselines, in contrast, flip relative ranking across benchmarks (e.g. summary leads BrowseComp on GLM but loses to discard-tool on BrowseComp-ZH), confirming that SAM's improvement is a property of the memory mechanism itself rather than of any benchmark- or backbone-specific coupling.

同一个 SAM 模块能够跨基准、跨骨干模型泛化。 单个只训练一次的 Qwen3.5-9B 记忆模型,在我们评估的每个骨干模型—基准组合中都取得了最佳成绩,涵盖长程英文浏览(BrowseComp)、跨语言搜索(BrowseComp-ZH)、广泛探索(WideSearch)和知识密集型科学推理(HLE),并适用于两个异构骨干模型(专有 GLM 与开源 Qwen3.5)。 相比之下,启发式基线在不同基准上的相对排名会发生反转(例如,在 GLM 上,summary 在 BrowseComp 中领先,却在 BrowseComp-ZH 中落后于 discard-tool),这证实 SAM 的改进源于记忆机制本身,而不是与某个特定基准或骨干模型的耦合。

4. Discussions ​

4.1. Ablation on Training Stages and Backbone Size ​

We isolate the contribution of each optimization stage and probe whether the SAM recipe transfers to a larger memory backbone, using GLM-4.7 as the (frozen) agent backbone and inheriting the inference protocol of Section 3.2. Starting from full SAM, we ablate the SFT and OAT-GRPO stages individually, and additionally fine-tune a 27B memory backbone with LoRA (SAM-27B) under otherwise identical settings. As shown in Figure 2 (left), removing either stage causes a consistent drop on every benchmark, confirming that the two stages are complementary rather than redundant: SFT provides a competent prior over consolidation/recall behavior, while OAT-GRPO further sharpens decisions via tree-structured outcome and recoverability rewards. The 27B LoRA variant matches the 9B full-finetune SAM within 0.3 avg., indicating that the gains stem from the SAM mechanism itself and persist when the memory backbone is scaled up.

我们以 GLM-4.7 为冻结的智能体骨干模型,并沿用 第 3.2 节 的推理协议,分离各优化阶段的贡献,同时探究 SAM 方案能否迁移到更大的记忆骨干模型。 从完整 SAM 出发,我们分别消融 SFT 和 OAT-GRPO 阶段,并在其他设置完全相同的条件下,额外使用 LoRA 微调一个 27B 记忆骨干模型(SAM-27B)。 如 图2(左)所示,移除任一阶段都会使每个基准的表现一致下降,证实两个阶段是互补而非冗余的:SFT 为整合与回忆行为提供了良好的先验,而 OAT-GRPO 则利用树结构的结果奖励和可恢复性奖励进一步改善决策。 27B LoRA 变体与 9B 全参数微调 SAM 的平均成绩相差不超过 0.3,表明收益源于 SAM 机制本身,并在记忆骨干模型扩大后依然存在。

VariantBCBC-ZHHLEWSAvg.
w/o CM43.552.537.265.449.4
SAM56.564.238.269.257.0
Training stage
w/o SFT55.263.237.367.955.9
w/o OAT-GRPO54.562.737.467.755.6
Backbone size
SAM-27B56.663.937.868.356.7
回忆机制消融:比较 SAM、summary-only、recency、raw-content 与无记忆基线
图2:左:以 GLM-4.7 为智能体骨干模型,对训练阶段和记忆骨干模型规模进行消融(BC:BrowseComp,BC-ZH:BrowseComp-ZH,WS:WideSearch)。右:在 BrowseComp 上使用 Qwen3.5-35B-A3B 对回忆机制进行消融,固定整合后的页面存储,仅改变页面的检索方式。

4.2. Is Episodic Recall Necessary? ​

We test three variants that share SAM's write side but degrade the read side: summary-only (rolling summary, no per-page recall), recency (most-recent pages regardless of intent), and raw-content (raw page contents in place of intent-conditioned snippets). Figure 2 (right) shows all three trail full SAM, with recency barely above the no-memory baseline. Returning raw pages does not close the gap, ruling out lossy consolidation as the sole cause; neither a global digest nor a recency window substitutes for query-conditioned access. Intent-driven recall, rather than consolidation per se, is the principal source of SAM's gains.

我们测试了三个与 SAM 共享写入机制、但弱化读取机制的变体:summary-only(滚动摘要,不进行逐页回忆)、recency(无论意图如何都取最近的页面)和 raw-content(用原始页面内容替代以意图为条件的片段)。 图2(右)显示,三者均落后于完整 SAM,其中 recency 仅略高于无记忆基线。 返回原始页面也无法弥合差距,排除了“有损整合是唯一原因”这一解释;无论全局摘要还是近期窗口,都无法替代以查询为条件的访问。 意图驱动的回忆,而非整合本身,才是 SAM 收益的主要来源。

4.3. Long-Horizon Behavior Analysis ​

We next examine when and why SAM helps, by zooming in on three orthogonal axes that all stress its long-horizon advantage. Figure 3 reports, on Qwen3.5-35B-A3B, (a) the state of the agent the moment context management is triggered, (b) accuracy as a function of the number of interaction rounds taken to solve a query, and (c) the sensitivity of SAM to the memory page size used during consolidation.

接下来,我们聚焦三个相互独立、都能体现其长时程优势的维度,考察 SAM 何时 有效以及 为何 有效。 图3 基于 Qwen3.5-35B-A3B 报告:(a)上下文管理触发瞬间的智能体状态;(b)准确率随求解查询所需交互轮数的变化;(c)SAM 对整合时所用记忆页大小的敏感性。

不同上下文管理策略的触发时状态

(a)不同上下文管理策略的触发时状态。

准确率与交互轮数的关系

(b)准确率与交互轮数的关系。

准确率与页面大小的关系

(c)准确率与页面大小的关系。

图3:SAM 在 Qwen3.5-35B-A3B 上的长时程行为。(a)不同上下文管理策略触发时的工具调用次数、置信度和准确率。(b)按交互轮数区间(21–40、41–80、>80)统计的 BrowseComp 准确率。(c)BrowseComp 和 BrowseComp-ZH 上的准确率随整合时所用记忆页大小的变化。

SAM keeps the agent productive when memory fires. Panel (a) compares the five strategies along three quantities measured at the trigger moment. Among the heuristic baselines, summary is the strongest on tool-call count, confidence, and trigger-time accuracy, while discard-tool and recent-k trail it on every metric. SAM extends the trend further and tops every metric. The accuracy lift exceeds the confidence lift, so the extra activity is not merely louder but also more correct. This contradicts the worry that retrieval-style memory floods the context, intent-driven recall instead lets the agent reach a more decisive state when the threshold is hit.

SAM 使智能体在记忆触发时仍能有效推进任务。 子图(a)根据触发时刻测得的三个量比较五种策略。 在启发式基线中,summary 在工具调用次数、置信度和触发时准确率上表现最强,而 discard-tool 和 recent-k 在所有指标上均落后于它。 SAM 进一步延续这一趋势,在每项指标上都取得最高值。 准确率的提升大于置信度的提升,因此增加的活动并非只是声势更大,而是确实更加正确。 这一结果与“检索式记忆会让上下文过载”的担忧相反:意图驱动的回忆反而使智能体在达到阈值时进入更能作出明确决策的状态。

SAM widens its lead as rounds grow. Panel (b) restricts to the three long-horizon round buckets (21–40, 41–80, >80) on BrowseComp, where context management actually engages. SAM is uniformly above every baseline in every bucket; the SAM-over-summary gap remains visible even past 80 rounds, where summary-only memory begins to lose useful state. The longer the trajectory, the more episodic recall pays off relative to a single rolling summary.

随着轮数增加,SAM 的领先优势扩大。 子图(b)聚焦 BrowseComp 上三个长时程轮数区间(21–40、41–80、>80),这些区间中上下文管理确实会介入。 SAM 在每个区间都高于所有基线;即使超过 80 轮,当仅依赖摘要的记忆开始丢失有用状态时,SAM 相对于 summary 的优势仍然可见。 轨迹越长,情景回忆相对于单一滚动摘要的收益就越明显。

SAM is robust across page sizes. Panel (c) varies the consolidation granularity from 32K to 128K. SAM beats the no-memory baseline at all small-to-medium sizes on both benchmarks; the only failure case is the largest 128K setting on BrowseComp, where each page is large enough to dilute the per-page intent signal. The optimum sits at 32K–64K, small enough to stay semantically focused, large enough to avoid eager consolidation. Together, the three views indicate that SAM's advantage comes from when it intervenes, what it preserves, and how it recalls, not from a narrowly tuned page-size choice.

SAM 对不同页面大小具有稳健性。 子图(c)将整合粒度从 32K 调整到 128K。 在两个基准的所有中小页面设置下,SAM 都超过无记忆基线;唯一的失败情形是 BrowseComp 上最大的 128K 设置,此时每页足够大,以至于稀释了页面内的意图信号。 最优点位于 32K–64K:足够小,能够保持语义聚焦;又足够大,能够避免过早整合。 综合这三个视角可见,SAM 的优势来自它 何时 介入、保留什么 以及 如何回忆,而不是对某个页面大小进行狭窄范围的调优。

5. Related Work ​

Memory and context management for long-horizon agents. Existing work on keeping the active context manageable largely follows three lines. Action-space approaches let the agent invoke context-editing operations during reasoning, turning context maintenance into a learned skill of the policy. Lossy-surrogate approaches replace history with summaries—via prompted or trained folding operators, inference-time pruning, RL-trained compact internal states, or per-round workspace reconstruction. Retrieval-over-history approaches keep history uncompressed and retrieve from it via dense memory, static intent indices, or learned latent compression. In contrast, SAM treats long-horizon reasoning as state-adaptive memory: a standalone module that consolidates interaction into compact cues while preserving raw trajectory pages, so the cues serve as query-time handles for intent-driven recall, optimized via expert-guided supervision and trajectory-utility-aligned RL, and applied across diverse backbones without retraining them.

长时程智能体的记忆与上下文管理。 现有关于保持活跃上下文可管理的工作主要沿三条路线展开。 动作空间 方法允许智能体在推理过程中调用上下文编辑操作,将上下文维护转化为策略学到的一项技能。 有损替代表示 方法以摘要替换历史,具体形式包括通过提示或训练得到的折叠算子、推理时剪枝、经 RL 训练的紧凑内部状态,以及逐轮工作空间重建。 历史检索 方法保持历史未经压缩,并通过稠密记忆、静态意图索引或学习到的潜在压缩从中检索。 相比之下,SAM 将长时程推理视为 状态自适应 记忆:这是一个独立模块,将交互整合为紧凑线索,同时保留原始轨迹页,使线索成为查询时用于意图驱动回忆的索引;该模块通过专家指导监督和与轨迹效用对齐的 RL 进行优化,并可应用于多种骨干模型,无须重新训练这些骨干模型。

6. Conclusion ​

We presented State-Adaptive Memory (SAM), a standalone memory framework for long-horizon agentic reasoning. SAM is motivated by a simple observation: as trajectories grow, the main challenge is not merely fitting more history into context, but enabling the agent to access the right past information for its current decision state. To address this, SAM consolidates ongoing interaction into compact memory cues while preserving raw trajectory pages for intent-driven recall. This design allows an agent to recover information from arbitrary stages of its trajectory without retraining the underlying backbone. Experiments across multiple long-horizon benchmarks show that explicit memory modeling provides a simple, general, and effective foundation for improving agentic reasoning. We hope SAM can serve as a useful step toward modular memory systems for increasingly capable agents.

我们提出了状态自适应记忆(SAM),这是一个用于长时程智能体推理的独立记忆框架。 SAM 源于一个简单观察:随着轨迹增长,主要挑战不只是将更多历史塞进上下文,而是使智能体能够根据当前决策状态访问恰当的过去信息。 为此,SAM 将持续发生的交互整合为紧凑的记忆线索,同时保留原始轨迹页,以支持意图驱动的回忆。 这一设计使智能体能够恢复轨迹中任意阶段的信息,而无须重新训练底层骨干模型。 多个长时程基准上的实验表明,显式记忆建模为改善智能体推理提供了简单、通用且有效的基础。 我们希望,SAM 能成为迈向模块化记忆系统的有益一步,为能力不断增强的智能体提供支持。