1,000 个 Claude Agent 如何在 Lean 中形式化费马大定理|Anthropic 的 Lance Martin
原题1,000 Claude Agents Formalized Fermat's Last Theorem — Lance Martin, Anthropic
看前速览
Lance Martin 讲述了上千个 Claude Agent 如何协作完成 Lean 形式化,也用几项实验区分了记录经历和回头修订记忆的能力。
Agent 自行搭起了一部分协作工具
协调 Agent 创建了用于分配工作、共享进展、发布公告和跟踪合入的 SQL 表。团队需要验证 60 条陈述,虽然撤掉了专用的证明编排工具,全程仍有密集的安全监控。
更强的模型更知道什么值得记
在数据库基准中,有记忆目录对 Sonnet 4.6 的帮助很小。玩《宝可梦》时,Fable 5 留下的笔记更少,也更侧重攻略和策略,比 Sonnet 3.7 走得更远。
离线回顾可以纠错,也可以重组知识
重新检查笔记帮助 Claude 跳出了《宝可梦》里的重复错误。在另一项实验中,增加回顾所用的算力,让基于脱敏公司文档构建的知识库更能回答问题,知识库与搜索结合的结果也超过了仅搜索的基线。
完整摘要
Anthropic 的 Lance Martin 介绍了由一个协调 Agent 和 999 个助手组成的团队,如何在约 30 小时内用 Lean 形式化费马大定理。团队借助 Git 和 SQL 协作,自行建表分配任务、记录进度,运行过程始终受到监控。随后,他对照了不同模型在 40 道数据库问题和《宝可梦》中的记忆表现,再用游戏和公司文档实验说明,离线回顾能纠正错误笔记,也能逐步完善知识库。
章节
文字稿
简要描述Brief Description
Anthropic 的 Lance Martin 介绍了一支由 1,000 个 Claude 智能体组成的团队如何在 Lean 中形式化费马大定理,随后转而探讨智能体如何编写、使用和修订持久记忆的实验。Anthropic's Lance Martin describes how a team of 1,000 Claude agents formalized Fermat's Last Theorem in Lean, then turns to experiments on how agents write, use and revise persistent memory.
目录Table of Contents
- 费马大定理Fermat's Last Theorem
- 在 Lean 中形式化证明Formalizing the proof in Lean
- 1,000 个智能体,没有领域专用的测试框架1,000 agents, no domain harness
- 主代理会构建自己的表格The lead agent builds its own tables
- 代理会在 30 小时内重新分配给自己。Agents reassign themselves over 30 hours
- 记忆:回首时才懂,向前时仍在经历Memory: understood backwards, lived forwards
- 日常记忆与长期知识Daily memory vs long-term knowledge
- 更强大的模型更善于利用记忆Stronger models use memory better
- 宝可梦记忆:Sonnet 3.7 对比 Fable 5Pokemon memory: Sonnet 3.7 vs Fable 5
- 围绕文字记录和笔记展开畅想Dreaming over transcripts and notes
- 梦境修复了一段被毒化的记忆Dreaming fixes a poisoned memory
- 构建公司维基百科Building a company wiki
- 梦境填补空白Dreaming fills the gaps
费马大定理Fermat's Last Theorem
我是 Anthropic 的 Lance。上一场主题演讲时我们遇到了一些问题,不过现在已经准备就绪。接下来我想讲两个故事:如何充分发挥 Claude 的能力,以及探索 Claude 的前沿能力。第一个故事关于多智能体。这是我在 Fable 5.2 发布时写的一篇博客,我想借此讲讲当时发生了什么。费马最后定理是数学领域最著名的命题之一。它有大约 350 年未能得到证明。其实它的表述非常简单:当整数指数 n 大于 2 时,方程 aⁿ + bⁿ = cⁿ 在正整数 a、b 和 c 中没有解。I'm Lance from Anthropic. We had a few issues during the prior keynote, but we're set to go. I'm going to tell two stories about getting the most out of Claude and exploring Claude's frontier capabilities. So the first is multi-agent. This is a blog I wrote with the Fable 5.2 launch and I want to kind of tell the story of what happened here. So Fermat's Last Theorem is one of the most famous claims in mathematics. It's stood unproven for around 350 years. And it's actually a very simple statement. The equation aⁿ + bⁿ = cⁿ has no solution in positive integers a, b and c when the integer exponent n is greater than two.
然而,这种看似简单的命题,结果证明要真正证明它相当困难。上世纪90年代中期,安德鲁·怀尔斯爵士确实证明了它。Now this deceptively simple kind of statement has proven to be quite difficult to actually prove. In the mid '90s, Sir Andrew Wiles did prove it.
在 Lean 中形式化证明Formalizing the proof in Lean
他提出了一个证明,这项工作耗费了他七年时间,过程极其艰辛。从那时起,数学界就投入了大量精力,也对证明形式化产生了浓厚兴趣,或者说,利用计算机逐步检查证明中的每一步。因此,证明可以看作一条条很长的逻辑链,而实际上,我们可以借助不同的系统对证明进行计算机检验;我稍后会介绍其中一种,比如 Lean。这是视频中的一幅画面,展示了怀尔斯为完成证明所经历的艰辛过程。去年九月,我们发布了利用 Claude 将其形式化的成果。这可以说是我们沿着这个方向分享的第一个非常重要的成果。he put out a proof and it took him seven years of work. It was extremely painstaking. And since that time, a major effort and interest in mathematics has been formalizing that proof or basically computationally checking every step. So proofs are kind of long chains of logic and you actually can computationally check proofs using different systems which I'll talk about for example using Lean. This is a visual from a video showing the painstaking process Wiles went through to establish the proof. And in September, we published that we used Claude to formalize it. This was like kind of first very important result that we kind of shared along these lines.
我们用 Lean 来完成这件事。因此,Lean 可以对证明中的每一步进行计算验证。不过,这样做极其费时费力。我们最初组建了一个由大约十几个智能体组成的团队。这张图大致展示了这个团队的示意结构。团队一开始运作得并不高效。于是我们给它配备了一个叫 Prove2Me 的工具。这是一个用于编排数学证明的平台,帮助智能体更好地管理项目状态。你可以把 Lean 看作一个运行框架。简单来说,它为智能体提供了一个可以查询的图结构。也就是说,它围绕这个问题陈述搭建了大量支撑结构。你可以把它理解为一种非常专门、针对特定领域设计的运行框架,好吗?And we used Lean to do it. So Lean allows you to computationally verify every step in a proof. Now doing this though is extremely painstaking. We started with a team of about a dozen agents. And this is kind of just showing a schematic of that team. Very early on that team didn't work very effectively. We had to give it something called Prove2Me. Now this is a kind of a platform for orchestrating mathematics proofs, and it helped the agents significantly manage the state of the project. Lean you can think about as a harness. So basically it provides the agents with a graph that they can query. So it's basically lots of scaffolding around this problem statement. You can think of it as like a very domain specific harness, okay?
那就是我们在九月份报告的形式化结果。That was the formalization we reported in September.
1,000 个智能体,没有领域专用测试框架1,000 agents, no domain harness
我想通过 Fable 5.2 展示的是:一个规模大得多的团队——从十来个智能体扩展到一千个——能否在没有特定领域工具框架(也就是不使用 Prove2Me)的情况下完成这项形式化工作,而且在解决方案方面不需要人类引导。因此,我们在九月份讨论的那份报告,既使用了特定领域工具框架 Prove2Me,也得到了研究人员的大力支持。这项测试要验证的是,一支由大量智能体组成的团队能否自主完成这项形式化工作。这里只是让你大致了解一下这个工具框架。它看起来有点复杂,但其实相当简单。What I wanted to show with Fable 5.2 was whether a much larger team, moving from around a dozen to a thousand agents, could do this formalization with no domain specific harness, so without Prove2Me, and with no human steering with respect to the solution. So the report we talked about in September had both this domain specific harness, Prove2Me, and a lot of support from a researcher. This is testing whether or not a large team of agents can autonomously develop this formalization themselves. So this is just giving you a sense for the harness. It looks kind of complicated, but it's actually pretty simple.
这千个智能体各自都有一个网络访问受限的沙箱。大部分设计都着眼于安全与防护。因此,我们有一千个智能体,每个都有自己的沙箱。它们可以连接到两种不同的东西:Git 和 SQL 数据库。仅此而已。这些就是我们提供给这个团队的核心基础能力。我们还会实时监控每一次工具调用,检查是否存在沙箱逃逸之类的情况。此外,我们也会每隔 10 分钟离线检查所有智能体的运行情况。这大致就是整体设置:一个由一千个智能体组成的团队,基础能力非常简单,只有 Git 和数据库。提示词也很简单:设置一个主智能体和 999 个辅助智能体,让它们了解 Git、数据库和问题陈述。基本上就这些。我们想看看这个团队能否据此完成这项形式化工作。Each of the thousand agents has its own sandbox with restricted network access. Most of this is directed on safety and security. So we have a thousand agents, each have their own sandbox. They can connect to two different things, Git and a SQL database. That's it. That's the those are the core primitives that we give this team. And we have real-time monitoring looking at every tool call for things like escapes. We also have offline monitoring looking at runs of all the agents every 10 minutes. This is kind of the setup. Thousand agent team, very simple primitives, just Git and a database. The prompting is pretty simple. It establishes one lead agent, 999 helper agents. It gives them awareness of Git and the database and the problem statement. That's really it. We want to see if this team could then do this formalization.
主代理会构建自己的表格。The lead agent builds its own tables
有意思的是,这基本上就是团队所做事情的故事。运行开始后没多久,大概 5 分钟时,负责人就创建了这些数据库表。如今,智能体已经足够先进,能够构建解决棘手问题所需的基本组件。我们并没有让它们创建这些表;这些表是智能体自己创建的。有一张表供负责人发布信息、给工作智能体分配角色;每个人——你知道的,智能体——都可以在子任务表中发布备注;还有一张表用来标记任务是否已经合并。负责人就这样创建了这些表来协调整个团队。这张可视化图展示了在整个运行过程中,智能体如何向这些表写入数据,以及如何从中读取数据。What's interesting is this kind of the story of what the team did. The lead very on, 5 minutes into the run, basically created these database tables. So agents now are sufficiently advanced that they can actually build primitives that they need to solve hard problems. We didn't tell them to build these tables. These are the tables that the agent actually just kind of built. A table where the lead can announce things, assign roles to workers, everyone can you know, agents can post note to subtask table, a table that indicates whether or not things are landed. So the lead just creates these tables to orchestrate this team. And this is a visualization showing how the agents wrote to and read from these tables over the course of this run.
现在,顶部的红色表示对表的写入,绿色表示读取。很有意思的是,你偶尔能看到主导代理向 announced 表写入内容。这类操作会发布关于问题的重要全局公告。它还会把这些辅助代理分配给该定理中的不同陈述,让它们逐步推进。Notes 是它们沟通和分享进展的地方。Land 则是它们实际编写 Lean 代码、完成证明的地方。因此,所有代理都能在没有具体提示的情况下,自主地以这种方式使用数据库,协调它们在这项极其困难、周期很长的任务上的工作。整个过程运行了大约 30 个小时。Now red on the top is showing writes to the tables, green is showing reads. What's really interesting is you can see occasionally the lead writing to the announced table. This kind of announces major global like kind of announcements about the problem. it also assigns workers, these helpers to different statements in this theorem as they proceed. Notes are where they communicate and share kind of progress. Land is where they kind of actually write the lean code as part of the proof. And so the agents all autonomously without specific prompting use the database in this way to coordinate their work on this extremely hard long horizon task. This ran for around 30 hours.
对于这段证明中尤其具有挑战性的部分,他们实际上开发了自己的抽象。这实际上是一个关于拉格朗日定理的任务树。这是证明中较难的命题之一。And for particularly challenging parts of this proof, they actually developed their own abstractions. This is actually a task tree for Lagrange's theorem. This is one of the harder statements in the proof.
代理会在30多个小时内重新分配自己。Agents reassign themselves over 30 hours
这实际上展示了这棵树中各项任务之间的不同依赖关系。它还展示了随着时间推移,进度如何从进行中变为已完成(以红色表示)。这一切的重点,其实只是想强调:智能体无需太多脚手架,就能解决时间跨度很长的问题。这大致展示了在本次运行过程中,智能体如何在这些不同任务之间进行整体分配。它还展示了随着问题逐步推进、证明中的 60 个陈述逐一得到解决,负责人和智能体本身如何重新分配任务,并将自己派往问题的不同部分。因此,智能体借助 Git 和数据库这类简单的基本工具,就能在这个极难的问题上相互协调,逐步将其解决。And this is actually showing the different dependencies of the tasks within this tree. And this is actually showing over time how you know the progress from like in progress to done in red. So the point of all this is really just to kind of highlight agents can solve very long horizon problems without much scaffolding. This is showing kind of the overall kind of allocation of the agents across these different tasks over the course of this run. And this kind of shows how the lead and the agents themselves kind of reallocate themselves and kind of reassign themselves to different parts of the problem as it progresses and as the statements, there's 60 statements in this proof, are all solved. So, the agents using simple primitives, Git and the database, can coordinate themselves across this very hard problem to solve it progressively over time.
这确实是关键所在。你可以看到时间在这里不断推进。这是我们其中一次运行的记录。这是代理留下的一条备注,大意是:“起源全面冻结,即刻生效。你们999位都干得太出色了。”这件事真正有趣的地方在于,我们能够展示这种形式化成果,而原本预计这需要很多年。去年9月,我们最初展示了如何借助大约十几个代理、Prove2Me 测试框架以及一位研究人员的积极支持来实现这一点。这项新成果表明,我们在安全性和监控方面提供了大量结构化支持,但在这个案例中,代理团队仅凭简单的原语、无需领域专用测试框架,就完成了这项任务。That's really the key point. And you can see time progressing here. This is from one of our runs. This is one of the notes that the agents left, basically saying total freeze of the origin, effective now, magnificent work all 999 of you. So basically what is really interesting about this is we are able to show this formalization, which was expected to take many years. Back in September, we showed initially we could do it with about a dozen agents, the Prove2Me harness, and active support from a researcher. This new result is showing we provide a lot of structure in terms of safety and monitoring, but the agent team was able to accomplish this task with simple primitives and without a domain-specific harness in this case.
记忆:回望着理解,向前去生活Memory: understood backwards, lived forwards
智能体越来越擅长自我编排,也越来越懂得如何利用这些简单的基本机制进行协作,以完成极具挑战性的长时程任务。这正是这项研究中一个非常有意思的关键发现。现在,我想转换一下话题,谈谈记忆。与多智能体相关的内容相比,记忆完全是另一回事,但它凸显了 Claude 正在显著提升的另一项能力。此前我们谈到过,Claude 有能力编排大型团队来解决极为长期的问题。记忆则是另一种能力,它表明 Claude 越来越能够整理自己的上下文,从而帮助解决长期问题。And agents are getting increasingly good at orchestrating themselves and knowing how to coordinate using these simple primitives for very challenging long horizon tasks. That's really the key kind of observation, which is very interesting from this work. Now, I want to shift gears and talk about memory, which is entirely different when I talk about it in terms of multi-agent, but it's highlighting another area where we're seeing Claude gain significant capabilities. So, previously we talked kind of about Claude's ability to orchestrate large teams to solve very long horizon problems. Memory is a different capability. It's showing that Claude is increasingly capable to organize his context to help solve long horizon problems.
所以,我最近刚发表了一篇工程博客,这实际上就是博客的开篇句。我觉得这句话概括了博客的主旨,也点出了记忆相关的一个核心观点,我认为这个观点很有意思。这句话出自哲学家克尔凯郭尔:“生活只能向后理解,却必须向前生活。”这就是智能体记忆的一个根本悖论:智能体通常会在执行任务的过程中写入记忆。它们遇到奇怪或有趣的事情,就会把它写进记忆。但记忆需要构成一张连贯的知识图谱,让智能体能够回顾并反思。So, I published an Eng blog on this fairly recently and this is actually the lead line of the blog. I think this actually encapsulates the idea of the blog and like one of the central ideas around memory I think is very interesting. And this is from the philosopher Kierkegaard. So, life can only be understood backwards, but it must be lived forwards. This is a fundamental paradox of agent memory because agents write to memory typically as they go about a task. They something weird or interesting, they write to memory. But memory needs to be a coherent a map of an agent's knowledge that agent can look back on and reflect on.
因此,当它们写入记忆时,视野往往比较狭窄。它们会在当前会话中贪婪地筛选信息,心想:“啊,这对眼下这项任务似乎很重要。”但记忆需要整体连贯,而且不能冗余。这就是记忆中一个非常棘手的悖论。坦率地说,我们人类也面临着同样的挑战。So when they're writing to memory, they're writing kind of myopically. They're looking greedily within a session saying, ah, this seems important for this task at hand. But memory needs to be something that's globally coherent and not redundant. So this is like a very tricky paradox of memory. And frankly, we as humans have the same challenge.
每日记忆与长期知识Daily memory vs long-term knowledge
我们度过一天,把信息写入短期记忆,并认为海马体在其中发挥着统筹作用。人们认为,到了夜间,海马体会将记忆重放给新皮层,而长期知识就储存在那里。因此,人们认为,这种做梦过程实际上有助于人类将日常经历中的片段,或者说最重要的部分,整合为长期知识。由此,日常记忆与长期知识之间存在着一种分解。我们发现,智能体也能从同样的分解方式中受益。这正是这篇文章的核心观点。下面来看一些能说明这一点的结果。这实际上是一个名为 CL-bench 的开源持续学习基准测试。We go about our day, we write to short-term memories, believe that the hippocampus kind of is the place that's orchestrated. At night, it's believed that the hippocampus replays to the neocortex is where long-term knowledge is stored. so it's believed that actually this dreaming process for humans help consolidate the fragments or like the most important aspects of our daily experience into long-term knowledge. So there's this decomposition between daily memory and kind of long-term knowledge. And we found agents can benefit from the same decomposition. That's really the key point of the post. Now here are some results kind of telling the story. So this is actually an open source continual learning benchmark called CL-bench.
而这表明,随着你从比如……逐渐过渡,模型会有所不同。And this is showing that different models as you go from like
更强大的模型能更好地利用记忆Stronger models use memory better
从 Sonnet 到 Opus 5.5 之类的模型,使用记忆的能力越来越强。现在,这项任务的设置非常简单:它让 Claude 解答关于某个数据库的 40 个问题。每个问题之间都会开启一个全新的会话,而 Claude 可以在每次会话之间把内容写入笔记,比如写进一个记忆目录。也就是说,这是一系列按顺序提出的问题,Claude 可以写下记忆,帮助回答后续问题,对吧?那么,图中的深色条表示给 Claude 提供了记忆库,而网纹部分则表示没有记忆。现在有意思的是,对于 Sonnet 4.6 来说,给它提供记忆(图中的深蓝色部分)几乎没什么帮助。它基本上不会用记忆。Sonnet up to like Opus 5.5 get increasingly good at using memory. Now this task is a very simple setup. It asks Claude just to ask to solve 40 questions about a database. In between each question, it's a fresh session and Claude can write to notes like a memory directory between each session. So it's kind of like a set of sequential questions and Claude can write memories to help with future questions, right? So what happens is the dark bars are showing when you give Claude the memory store and then the hash is like without memory, okay? Now what's interesting is with Sonnet 4.6, giving Sonnet memory, you can see in the dark blue, has very little benefit. Can't really use memory.
我们查看了结果,发现 Sonnet 并不能可靠地判断什么时候该写入记忆,也不太会自然而然地从记忆中读取信息,对吧?还值得一提的是,这些实验并没有使用特定的记忆提示。它只是告诉智能体有一个目录可用,想用记忆的话就用。仅此而已。所以 Sonnet 4.6 本身并不能有效地使用记忆。Sonnet 5 确实做得更好,Opus 等模型也是如此。基本上,在同样简单的指令下,模型使用记忆的能力会越来越强。这里的关键在于,模型越强,就越能本能地判断什么时候该写入记忆,也能本能地判断什么时候该从记忆中读取信息来进行检索。它们生成的记忆也更好,例如经过高度验证的陈述,或对数据库状态、接下来可能发生什么的预测。较早期的模型往往会写出质量较低的记忆。And we looked in the results and we found Sonnet doesn't doesn't reliably know when to write to memory and also doesn't really naturally read from memory, okay? It's also worth noting that these experiments are done with no specific memory prompting. It just tells the agent that a directory is available, use memory if you want. That's really it. So Sonnet 4.6 doesn't natively use memory effectively. Sonnet 5 does indeed better. Opus and so on. And so basically the models get better and better with the same simple instruction at using memory. And really the key idea here is that what happens is with stronger models they know intrinsically when to write to memory and they kind of know intrinsically when to read from memory to retrieve information. Their memories are also better. They're like they're highly verified statements or predictions about the state of the database or what may happen next. Earlier models tend to write lower-quality memories.
宝可梦记忆:Sonnet 3.7 对比 Fable 5Pokemon memory: Sonnet 3.7 vs Fable 5
我来给你们看一个来自另一款游戏的非常有趣的例子。这是《宝可梦》里的情况。这里展示的是 Sonnet 3.7 在《宝可梦》和《Fable 5》中的记忆目录。关键在于,每个方框的大小表示这些目录中记忆文件的数量,对吧?让 Claude 玩《宝可梦》时,我们会给它一个记忆目录,就像我在之前那个基准测试中做的那样,对吧?Claude 可以在游戏过程中随意往那个目录里写入内容。真正有意思的是,我们看到 Sonnet 3.7 会向记忆中写入海量内容。And I'll show you a very fun example of this from a different game. This is from Pokémon. So this is showing you Sonnet 3.7's memory directory from Pokémon versus Fable 5. here is the key point. The size of each box indicates the number of memory files in each of these directories, okay? So when we have Claude play Pokémon, we give Claude a memory directory just like I did in that prior benchmark, right? Claude can write whatever it wants that directory while plays the game. What's really interesting is Sonnet 3.7 we see it writes a huge amount to memory.
而且当我们查看这些记忆时,会发现它们毫无筛选,基本上把各种经历都记了下来。结果就生成了一个庞大、笨重、简直令人厌烦的记忆目录,里面存着许多与游戏过程并不真正相关、也没有战略价值的内容。它在游戏中的表现也比 Fable 5 差得多。Fable 5 的记忆目录精简得多,记录的确实是战略见解、战术知识,以及那些不容易单凭游戏状态获取的信息。因此我们看到,更好的模型在判断信息显著性以及该把什么写入记忆方面,直觉要好得多。这一点也能从记忆目录的大小看出来:它精简得多,也更具战略性、更贴合游戏过程。事实上,Fable 5 在游戏中推进得比 Sonnet 3.7 远得多。这又让我们对一个观点有了新的认识:Claude 更擅长写入记忆,知道该写些什么,也更懂得判断什么内容值得关注。And when we look at the memories, it's indiscriminate. It's basically writing down all sorts of experience. It creates this huge, unwieldy, just disgusting memory directory of things that are not really relevant or strategic for gameplay. And it proceeds much worse in the game than Fable 5. Fable 5's memory directory is much tighter. It's really strategic insights, tactical knowledge, things you can't just get from game state very easily. So what we see is better models are much are have much better instincts for salience and like what to write to memory. And you can see this reflected in the size of the memory directories. It's much tighter. It's much more strategic and gameplay indeed with Fable 5 gets much further than Sonnet 3.7. So it gives us another intuition around the fact that Claude is better at writing to memory, knowing kind of what to write, and salience, and what's salient.
在文字记录和笔记中遐想Dreaming over transcripts and notes
所以,模型在判断显著性、知道该写什么,以及阅读方面都越来越有效了。在我最初的框架中,我会把这两者都归为体验过程中写入记忆。基本上,在这两项任务中,我们都让 Claude 在玩这个游戏时写入记忆,也让 Claude 在进行 CL Bench 基准测试时写入记忆。但正如我提到的,记忆还有“梦境”这一面。也就是说,让 Claude 回顾记忆并修正其中的问题。我会展示一些有趣的例子。这可以算是对“梦境”的一种界定。So, models are getting more kind of effective at knowing salience, knowing what to write, and also reading. Now, both of these represent what I would consider in my initial framing of like writing to memory during experience. So, basically in both of these tasks, we let Claude write to memory while it plays this game. We let Claude write to memory while it does the CL Bench benchmark. But as I mentioned, there's also the dreaming side of memory. So, this is allowing Claude to reflect over memories to fix things. And I'll show some interesting examples of that. This is kind of a framing of dreaming.
因此,你可以从“存在对话记录”这个角度来理解记忆。你可以把对话记录看作记忆的某种基础。想象一下,一个记忆系统可以非常简单,只提供对话记录搜索功能。Claude 在执行任务的过程中会将内容写入对话记录,未来的会话则可以读取这些记录。当然,对话记录很长,也很难处理。我们在博客文章中多次谈到,对话记录往往包含很多信息,而其中真正重要、值得关注的内容其实只占很小一部分。因此,我们也允许 Claude 做一些事情,比如编写记忆笔记。我刚才也提到,它可以在执行任务的过程中把笔记写入记忆。And so, you can think about memory in terms of there are transcripts. Transcripts you can think about as kind of the foundation of memory. So, imagine a memory system could very simply be just transcript search. Claude writes to a transcript as it goes about a task. Future session can read from the transcript. Of course, transcripts are large. It's very unwieldy. We talk a lot about in the blog post the fact that transcripts often contain information that, you know, a very small amount of information in transcripts is actually salient and matters. So, we also allow Claude to do things like writing memory notes. Also, I just talked about as it goes, it can write notes to memory.
但“梦境”能让你做得更多。它让你能够回顾转录文本和这些书面笔记,并重新表征它们;例如,构建维基这类记忆表征;还可以将某些记忆提升为注入上下文,并预先加载到每个未来会话中。“梦境”是一种处理转录文本和笔记的机制,能够从中构建新内容,包括各种表征和注入上下文。But dreaming lets you do more. Dreaming lets you reflect over transcripts and these written notes and re- re-represent them, build memory representations like wikis as an example, actually promote certain memories to injected context and load it preemptively into every future session. Dreaming is a mechanism for processing transcripts and notes to build new things from them, including representations and injected context.
做梦修复了被污染的记忆Dreaming fixes a poisoned memory
下面是一些有趣的例子,来自《宝可梦》的游戏过程。梦境模拟是纠正记忆错误的有效方式。正如我之前所说,Claude 执行任务时可能会在记忆中写下错误的笔记,只是犯了个错。这次就发生了这样的情况:在这款特定的游戏中,Claude 错误地记下了某个地标的位置。结果,由于这条错误的记忆,Claude 陷入了循环:它会在游戏中的这个特定位置错误地判断自己的位置,掉进活板门,然后被送回上一关。这就是大致的直观理解。具体细节没那么有趣,也不重要。So, some fun examples of this. This is from Pokémon gameplay. Dreaming is an effective way to correct mistakes in memory. So, as I talked about, when Claude's going about a task, it can write incorrect notes to memory. Just it makes a mistake. This happened. This is in this particular game Claude wrote incorrectly wrote the location of a particular landmark in the game. Now, what happened is with this incorrectly written memory, Claude got trapped in a loop where basically it would mislocalize itself at this particular point in the game, fall down this trap door, and it would basically send it back to the prior level. That's like the high-level intuition. The details aren't that interesting or important.
关键在于,注入了一条有毒记忆,而且它一直留在那里。做梦可以修复这一点。这就是为什么做梦在回顾和纠正记忆方面极其强大的直觉所在。这里展示的是游戏中的一些轨迹,其中橙色代表记忆和做梦。向上是好的,基本上向上代表游戏进度,向下则代表游戏倒退。有趣的是,在不做梦、只依靠原始记忆的情况下,我们可以看到游戏崩溃了:植入了一条错误记忆,而 Claude 到达那个特定节点时,就会继续在游戏中倒退或失败。通过做梦,它修复了这个错误,Claude 得以进入下一关。The key idea is a poisoned memory was injected and it's stuck there. Dreaming can rescue that. That's really the intuition on why dreaming is extremely powerful for reflecting over memories and correcting them. So this is showing some trajectories of the game where orange is memory and dreaming. Up is good. So basically up represents game progress and down represents kind of game regression. And what's interesting is raw memory basically without dreaming, we can see crashes out. An incorrect memory is planted and Claude continues to basically regress or fall in the game when it hits that particular point. With dreaming, it rescues that mistake. Claude proceeds to the next level.
构建公司维基百科Building a company wiki
这确实是关键的观察。而且这是一个非常普遍的原理:Claude 可以通过“梦境”来纠正记忆中那些原本就此固定下来的错误。这是一种非常重要的纠错方式。现在来看另一个很有意思的例子,讲的是如何在记忆中构建表征。人们一直对维基很感兴趣,因为它们可以作为 Claude 组织知识的一种通用方式。这是一个非常有意思的例子,素材来自我们五月份收购的公司 Stainless。我们得以访问这家公司的语料库,包括所有文档、Slack 消息等等。我们对内容进行了匿名化处理,并据此构建了一套数据集,用来测试“梦境”机制。具体来说,我们围绕这家公司设计了 25 个问题,只有通过这个语料库才能回答。That's really the key observation. And this is a very general principle that Claude can use dreaming to correct mistakes in memory that are otherwise stuck there. It's a very important way you can kind of kind of correct from errors. Now, this is another fun example of building representations in memory. So there's been a lot of interest in wikis as kind of general kind of ways that Claude can organize knowledge. This is a really fun example from We acquired a company Stainless back in May. And we had access to the company Corpus, all its documents and Slack messages and so forth. And we anonymized things and we built kind of a data set from it which allowed us to test dreaming. So what we did was we created a set of 25 questions about the company that can only be answered from this corpus.
我们允许 Claude 根据这些信息构建一个 wiki,帮助它回答问题。你看到的是,我们将一种原始搜索工具作为基线进行比较:它只是在这类文档中进行某种语义搜索。作为基线,它的表现还不错。你可以看到,仅靠搜索就达到了 53% 左右。我们还测试了让 Claude 基于这些知识构建一个 wiki。你可以看到,随着你不断增加“梦境” token,wiki 会变得越来越好,从而让 Claude 能够更好地回答问题。因此,Claude 本身可以通过 wiki,随着时间推移逐步建立起对这类知识语料的表征。随着你投入更多“梦境”计算资源,wiki 也会变得越来越有用。我们认为,这是一个很好的思维模型,可以帮助我们理解智能体如何随着时间推移逐步积累知识。We allow Claude to build a wiki from this information to help it answer questions. What you see is we compare a raw search tool that's just like some kind of semantic search over this kind of documentation. We compare that as a baseline, which does reasonably well. You can see it's like 53% just for search. We also test letting Claude build a wiki over this knowledge. You can see as you push, you add more and more dreaming tokens, the wiki gets better and better and better allowing Claude to answer questions. So Claude natively can kind of build up over time a representation of this of this kind of corpus of knowledge through a wiki. And as you add more dreaming compute, the wiki gets more and more useful. We think this is a really nice mental model to think about how agents can kind of build knowledge over time.
可以让它们访问一些原始文本语料库、转录文本,然后让它们构建一些表征,从而更轻松地搜索这些上下文,以回答问题,并有效地关联自身知识。我们还发现,把维基和搜索工具结合起来,效果实际上比单纯的原始搜索更进一步。这也带来另一种直觉:Claude 也可以在自己的记忆中构建类似维基的表征,以帮助它解决问题。最后举一个例子,这来自另一个基准测试,展示了 Claude 构建的两个不同维基:一个是在“做梦”之前,另一个是在“做梦”之后。They can be given access to kind of raw corpora of texts, of transcripts, and they can kind of build these representations that allow them to search those contexts much more easily to answer questions and to connect their knowledge in effective ways. We also find that adding the wiki and the search tool together actually bumps further beyond just raw search. So it's kind of another intuition that basically Claude can also build representations like wikis in its kind of memory in order to help it kind of solve problems. And a final example, this is from a different benchmark but this is showing two different wikis that Claude built. So this is prior to dreaming and after dreaming.
我们观察到,在这个特定案例中,Claude 构建维基时存在一些遗漏。What we saw is when Claude was building wikis in this particular case, there were some gaps.
梦境填补空白Dreaming fills the gaps
例如,这个初始维基中有许多指向不存在页面的占位符。当 Claude 构建不同的记忆表征时,就可能出现这种情况。如果没有用于“梦境”的计算资源,可能就没有机会挽救或修正这些错误。我们发现,运行“梦境”后,Claude 可以检查已有的表征,比如维基,并补上错误。在这个例子中,它补上了许多缺失的内容,并创建了一个索引。因此,“梦境”是 Claude 反思并将计算资源应用于记忆的一种方式,从而改进记忆:既可以像我刚才提到的那样纠正错误,也可以像这里展示的那样填补知识空白,或者创建新的表征,例如维基。And for example, this initial wiki had a bunch of placeholders for pages that didn't exist. This can happen when Claude's kind of building different memory representations. And without dreaming compute, there may not be opportunities to rescue or fix those errors. What we saw is when we ran dreaming can look over Claude's existing representation, like for example, a wiki, and can fill in mistakes. So in this case, it fills in a lot of missing gaps. It creates an index. And so again, dreaming is a way that Claude can reflect and kind of apply compute across its memory to improve it by correcting mistakes like I talked about, by filling in gaps in its knowledge like we see here, or for example, by creating new representations like wikis.
那么,我感谢大家的聆听。我会在 Anthropic 展位,欢迎大家来找我,我也很乐意和大家聊聊这些内容。so with that, I thank you all for listening. And I'll be at the at the Anthropic booth, so please come see me and happy to talk about any of this.