Anthropic发布Agent记忆组件研究:梦境计算与显著性判断
The Components of Agent Memory
Anthropic深度拆解Agent记忆机制,Opus 5展现闭环学习能力,对做长程Agent的同学极具参考价值。
Søren Kierkegaard wrote that life can only be understood backward, but it must be lived forward. We’ve encountered a similar bind when designing memory for AI agents.
索伦·克尔凯郭尔曾写道,生活只能向后理解,但必须向前度过。在设计 AI 智能体的记忆时,我们也遇到了类似的困境。
As humans, we encode memory constantly as we go about our lives. The hippocampus plays a central role in this, capturing experiences in the moment so that memories form quickly and are immediately available. But only some experiences are consolidated into long-term knowledge.
作为人类,我们在日常生活中不断编码记忆。海马体在其中起着核心作用,它捕捉当下的体验,使记忆迅速形成并立即可用。但只有部分体验会被巩固为长期知识。
Much of that consolidation appears to happen when our brains are offline. As we sleep, and during quiet rest, the hippocampus replays our recent experiences. This is thought to gradually distill those experiences and integrate them into the neocortex—the part of our brains that stores most of what we think of as knowledge.
大部分巩固过程似乎发生在大脑离线时。当我们睡觉以及处于安静休息状态时,海马体会重播我们最近的经历。人们认为,这一过程会逐渐提炼这些经历,并将它们整合到新皮层中——新皮层是大脑中存储我们大多数所谓知识的区域。
Agent memory can use a similar division of labor. Agents capture much of their work in logs or transcripts. Researchers at Letta and UC Berkeley proposed sleep-time compute as a way for models to use idle time between interactions to reorganize their existing context. The same idea can help agents organize their memory by reflecting on logs to fix mistakes or produce new notes and representations. This process is often called dreaming (Figure 1).
智能体记忆可以采用类似的工作分工。智能体会将其大部分工作记录在日志或转录文本中。Letta 和加州大学伯克利分校的研究人员提出了“睡眠时计算”(sleep-time compute)的概念,作为一种让模型利用交互之间的空闲时间来重新组织现有上下文的方法。同样的想法可以帮助智能体通过反思日志来纠正错误、生成新的笔记和表征,从而组织其记忆。这个过程通常被称为做梦(图 1)。
We’ve found that dreaming has been a useful tool for helping us give Claude effective memory. In this post, we share how we’ve come to think about agent memory and walk through several evaluations we’ve used to explore agent memory, including the use of dreaming, and what each component contributes to memory organization.
我们发现,做梦是帮助我们赋予 Claude 有效记忆的有力工具。在这篇文章中,我们将分享对智能体记忆的思考方式,并介绍我们用于探索智能体记忆的几项评估,包括使用做梦的情况,以及每个组件对记忆组织的贡献。
Claude can use dreaming to organize memory. This can correct mistakes, create notes, build new memory representations, or shape what’s preemptively loaded into future sessions.
Claude 可以利用做梦来组织记忆。这可以纠正错误、创建笔记、构建新的记忆表征,或塑造预加载到未来会话中的内容。
Memory notes
记忆笔记
By “agent memory,” we mean knowledge that Claude gains from experience—including interactions with users and tasks it’s been assigned—and that it retains between sessions, saved as context it can read later. It excludes other ways models can learn or manage context, such as changes to their weights (the internal parameters set during training), in-context learning (knowledge gained within a single conversation), and compaction (summaries written by Claude that replace its older turns so it can continue working in a new context window).
所谓“智能体记忆”,是指 Claude 从经验中获得的知识——包括与用户的互动以及被分配的任务——并在会话之间保留下来,保存为稍后可读取的上下文。它不包括模型学习或管理上下文的其他方法,例如权重的变化(训练期间设置的内部参数)、上下文内学习(在单次对话中获取的知识)以及压缩(由 Claude 撰写的摘要,用于替换其较早的对话轮次,以便它能在新的上下文窗口中继续工作)。
In the human brain, chemical signals released before, during, or after an experience can mark a memory as important. Marked memories tend to be replayed more often than unmarked ones during offline periods. This process, called replay, helps stabilize and integrate them into long-term memory.
在人脑中,在经历之前、期间或之后释放的化学信号可以将一段记忆标记为重要。被标记的记忆在离线期间往往比未被标记的记忆更频繁地被重放。这个过程被称为重放(replay),有助于稳定这些记忆并将其整合到长期记忆中。
Similarly, Claude can tag salient events in a session log as they happen, so they’re easier to find later, or it can write them to a memory store, such as a folder of memory notes (Figure 2). But how can Claude tell what’s salient in the moment, before it knows what’s coming next?
同样,Claude 可以在会话日志中实时标记显著事件,以便日后更容易查找,或者将其写入记忆存储,例如记忆笔记文件夹(图 2)。但 Claude 如何在不知道接下来会发生什么的情况下,判断当下哪些内容是显著的?
Claude can write notes to memory.
Claude 可以将笔记写入记忆。
Memory can be a prediction about what the future will need
记忆有时是对未来需求的预测。
Memory is, occasionally, a prediction. By writing down a rule, an agent predicts that the pattern it’s describing will be relevant again. For instance, writing down a verified fact is a prediction that an agent in a future session will want to rely on that fact without double-checking it. Over time, Claude has become much better at making these kinds of predictions.
记忆偶尔也是一种预测。通过写下一条规则,智能体预测它所描述的模式将来会再次相关。例如,写下一条经过验证的事实,意味着智能体预测未来的会话中的智能体会希望依赖该事实而无需二次核实。随着时间的推移,Claude 在这类预测方面变得强得多。
Consider a task from Continual Learning Bench (CL-Bench) 1.0, a benchmark that measures an agent’s ability to use memory in order to tackle long-horizon tasks. One particular task asks Claude to answer a series of questions by looking up information in a database. After Claude gives an answer, it’s told the correct solution and can write a memory to help answer future questions.
考虑来自 Continual Learning Bench (CL-Bench) 1.0 的一项任务,这是一个衡量智能体利用记忆来解决长周期任务能力的基准测试。其中一项特定任务要求 Claude 通过查阅数据库信息来回答一系列问题。在 Claude 给出答案后,它会被告知正确答案,并可以写入记忆以帮助回答未来的问题。
Memory can support a learning loop here. If Claude gets a question wrong, it can record the failure, come up with theories about what went wrong, test those theories, and turn what it finds into a rule about how to answer in the future.
记忆在此处可以支持一个学习循环。如果 Claude 答错问题,它可以记录失败原因,提出关于出错原因的理论,测试这些理论,并将发现转化为关于未来如何作答的规则。
We ran the CL-Bench 1.0 task using Claude Managed Agents. Claude started each question in a fresh session, with one exception: it could retrieve files from a memory directory that persisted from one session to the next.
我们使用 Claude Managed Agents 运行了 CL-Bench 1.0 任务。Claude 在每个问题的开始时启动一个新会话,唯一的例外是:它可以从一个跨会话持久化的记忆目录中检索文件。
Different models achieved different levels of success at creating their own learning loops. Claude Sonnet 4.6 got as far as generating theories about why an answer was wrong. Its memory directory contained a scattering of files, each listing several untested guesses.
不同的模型在构建自身学习循环方面取得了不同程度的成功。Claude Sonnet 4.6 能够生成关于答案为何错误的理论。其记忆目录中包含零散的文件,每个文件列出了几个未经测试的猜测。
CL-Bench database task, comparing memory with a stateless baseline across models.
CL-Bench 数据库任务,比较不同模型在有记忆与无状态基线下的表现。
Claude Opus 4.7 consolidated its notes into a single reference document and began marking which facts it had checked and which were still unconfirmed. Claude Sonnet 5 marked each answer as confirmed after the grader had checked it, and wrote a correction when it had answered wrong.
Claude Opus 4.7 将笔记整合成一份单一参考文档,并开始标记哪些事实已经过核查、哪些仍未确认。Claude Sonnet 5 在评分器检查后将每个答案标记为已确认,并在回答错误时写入更正内容。
Claude Opus 5 was the first of these models to close the loop. Most of its entries included a rule (and also how it knew the rule was true), answers to earlier questions, and clear warnings about traps it had discovered along the way (Figure 3).
Claude Opus 5 是首批实现闭环的这些模型之一。其大部分条目都包含一条规则(以及它如何得知该规则为真)、对先前问题的回答,以及关于它在过程中发现的陷阱的明确警告(图 3)。
Like Opus 5, Claude Opus 5.5 and Claude Sonnet 5.5 both closed the loop, using memory to capture validated rules about how to best answer future questions. With memory, both scored about the same as Opus 5, though their baseline performance without memory was slightly higher.
与 Opus 5 类似,Claude Opus 5.5 和 Claude Sonnet 5.5 也都实现了闭环,利用记忆来捕获已验证的规则,以便更好地回答未来的问题。借助记忆功能,两者的得分均与 Opus 5 大致相同,尽管在没有记忆的情况下,它们的基线性能略高一些。
Claude has learned to judge salience
Claude 已学会判断显著性
We also evaluated Claude’s ability to play Pokémon Red, a game that challenges Claude to navigate complex long-horizon tasks, as a test of Claude’s judgment about what to save to memory. At the start of each run, we gave each model a folder of memory files that it could read from and write to while it played (Figure 4).
我们还评估了 Claude 玩《宝可梦 红》的能力,这是一款考验 Claude 导航复杂长周期任务能力的游戏,以此测试 Claude 对于应将哪些内容保存到记忆的判断力。在每次运行的开始时,我们给每个模型提供了一个记忆文件文件夹,供其在游戏过程中读取和写入(图 4)。
We compared the memory folders from one run each of Claude Sonnet 3.7 and Claude Fable 5, when each was about 10,000 steps into the game. A key difference we noticed was what each model thought was worth remembering. Sonnet 3.7 assumed everything might matter and wrote to memory indiscriminately. Its memory folder contained an archive of encounters, often with a separate file for each battle it fought, each item it found, and each non-player character it met. Ultimately, Sonnet 3.7 wrote 413 memory files across 225 folders and earned one badge (badges mark a player’s progress through the game).
我们比较了 Claude Sonnet 3.7 和 Claude Fable 5 各运行一次后的记忆文件夹,此时两款模型均已进行到约 10,000 步。我们注意到的一个关键差异在于,每个模型认为值得记住的内容是什么。Sonnet 3.7 假设一切可能都有关联,因此不加选择地将信息写入记忆。其记忆文件夹中包含大量遭遇记录的归档,通常每场战斗、每件找到的物品以及遇到的每个非玩家角色都有单独的文件。最终,Sonnet 3.7 在 225 个文件夹中创建了 413 个记忆文件,并获得了一枚徽章(徽章标记玩家在游戏中的进度)。
Fable 5, by comparison, wrote nine files in two folders, plus a single top-level file called global.md, and earned four badges.
相比之下,Fable 5 仅创建了两个文件夹中的九个文件,外加一个名为 global.md 的顶层文件,并获得了四枚徽章。
Claude’s memory directories for Sonnet 3.7 versus Fable 5 while playing Pokémon.
Claude 在玩《宝可梦》时,Sonnet 3.7 与 Fable 5 的记忆目录对比。
Sonnet 3.7’s approach was a problem mainly because the game state of Pokémon changes constantly—Sonnet 3.7’s detailed record was continuously going out of date. As a result, as Claude progressed, it had to spend more time and resources combing through its memories rather than playing the game. Around step 10,000, for example, Sonnet 3.7 started its fourth folder of “master” memory files. Over the next 17 steps, it created six files, deleted nine others, and took no actions in the game itself.
Sonnet 3.7 的方法主要存在问题,因为《宝可梦》的游戏状态不断变化——Sonnet 3.7 的详细记录会持续过时。因此,随着 Claude 游戏的推进,它不得不花费更多时间和资源来梳理记忆,而不是专注于玩游戏本身。例如,在第 10,000 步左右,Sonnet 3.7 开始创建第四个“主”记忆文件文件夹。在接下来的 17 步中,它创建了六个文件,删除了另外九个文件,而在游戏本身上没有采取任何行动。
Fable 5’s approach used memory for things the game didn’t explicitly tell it. Some of the kinds of information Sonnet 3.7 wrote to memory—such as how much money the player has or where the player is on the map—can be read off the screen every turn, so storing it is redundant. By contrast, memory files about strategy, plans, and tested rules exist only if Claude works them out, and they disappear unless Claude writes them down.
《神鬼寓言5》采用的方法是将游戏未明确指示的信息存入记忆。Sonnet 3.7 写入记忆的某些类型的信息——例如玩家拥有多少金钱或玩家在地图上的位置——每回合都可以从屏幕上读取,因此存储这些信息是多余的。相比之下,关于策略、计划和经过测试的规则的记忆文件仅在 Claude 自行推导时才存在,除非 Claude 将其记录下来,否则这些文件就会消失。
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力