All articles
AI

把每一次交互写进模型

Writing every interaction into the model

我想要的个人 AI 只有一个要求:每一次交互都影响下一次交互,记忆不放在有限的上下文里,而是进入模型本身。本文解释模型为什么记得住世界知识却记不住你,上下文、记忆表和权重的本质关系,已有工作做到了哪里,以及一种两层参数记忆的方案。

The personal AI I want has one requirement. Every interaction affects the next one, and memory lives in the model itself and not in a limited context. This post explains why models remember world knowledge but not you, how context, memory tables and weights relate, what existing work has achieved, and a two-layer design for parametric memory.

我想要的个人 AI 只有一个要求:用户和模型的每一次交互,都影响下一次交互。

今天的大模型做不到这一点。训练结束后,权重只读。模型能「记得」你,是因为外部程序把过去的内容找出来,放回这次的上下文。上下文有上限,内容每次都要重读,读完也不留下任何变化。

所以我的想法是:记忆不再放在上下文里,而是进入模型的参数。 这篇文章是《动态智能》的延续。上一篇定义了运行同时也写入模型的形态,这一篇只讨论其中最具体的目标:怎样让模型记住你。

这个想法不是我最先提出的。2024 年,AI-native Memory 提出为每个人训练一个个人模型。2026 年,User as Engram 已经能在一毫秒内把用户事实写进参数,谷歌的 Sleep 框架也让模型在离线阶段把短期记忆巩固进长期参数。这篇文章想把这些工作放在一起看,说清楚问题的本质,以及还缺什么。

模型为什么记得住世界知识

模型不会说 1+1=3,说明它能可靠地记住知识。一个直接的想法是:把每次交互也当成世界知识写进去。

这个想法成立,但要先弄清可靠从哪里来。

训练的目标是让全部文本的平均预测误差最小。一条内容出现 100 万次,它在目标里的权重就是只出现一次的内容的 100 万倍。所以模型的记忆按频率分配,不按事实是否确定分配。冷门事实因此经常答错:在 PopQA 最冷门的 4,000 个问题上,GPT-3 的准确率只有 19%。

这是训练目标造成的,不是神经网络的能力上限。神经网络能完全拟合随机标签,这些标签没有任何规律可学。How LoRA Remembers 用一种专门面向记忆的微调方法训练 Qwen3-8B,在电话簿任务上做到了 100% 精确复现。可靠地记住小众事实是可以做到的,前提是训练目标要求这样做。

上下文、记忆表和权重的关系

Domingos 在 2020 年指出,用梯度下降训练的模型近似于核机器。核机器直接保存训练样本,预测时按相似度加权。按这个视角,神经网络的权重实际上是训练样本的叠加。

这给了我一个更本质的理解:上下文、记忆表和权重保存的都是过去的样本,区别主要在压缩程度。

形态 怎么保存 写入 读取 泛化
上下文 原文 放进去即可 每次全部重读,有上限 靠当场推理
记忆表 按地址保存未压缩的样本 一次写入 只读相关条目 弱
权重 所有样本压缩后叠加 慢,要反复训练 不需要查找 强

记忆的四种存放形态

所谓内化,就是记忆被逐步压缩进共享表示。记忆表的条目也是模型的参数,模型在前向计算里直接读取它们,不占上下文。这和 RAG 不同:RAG 取回的是文本,要放进输入重新读一遍。

为什么不能只用权重

快速写入和泛化互相冲突。泛化要求相似内容共用同一批参数,这样没见过的问题也能落到已有知识附近。快速写入要求内容之间不重叠,否则改一处就会影响全局。

McClelland 等人在 1995 年用这个矛盾解释了大脑为什么有两套学习系统:海马快速记录具体经历,新皮层通过缓慢、交错的学习提取结构。

User as Engram 给出了一个直接的测量。把用户事实写成 LoRA,模型在无关文本上的预测质量明显变差,val bpb 上升 1.784;写成 Engram 哈希表里的几行,只上升 0.00005,相差约 3.3 万倍。LoRA 改的是共享权重,哈希表改的是一个地址。

不同领域都走到了相似的结构:

领域 快速层 慢速层
大脑 海马 新皮层
数据库 LSM 树的内存表 磁盘上合并后的文件
推荐系统 用户和物品向量,分钟级同步 主模型,按天同步
大模型(Sleep) 高频记忆模块 低频记忆模块
个人模型 记忆表 个体权重

只要既要写得快,又要泛化好,就很难只靠一层。所以我不再把问题看成“怎样让微调足够快”,而是拆成两步:实时写入,持续巩固。

写进权重需要什么

第二步本质上就是自动微调。目前最完整的工作是谷歌的 Sleep 框架。模型清醒时接收新信息,睡眠时暂停输入,做两件事:

  • 巩固:把短期记忆蒸馏进新增的低秩专家,不覆盖旧参数,然后清空快速记忆。
  • 做梦:用强化学习生成合成练习,筛选后继续训练。

它的知识注入实验很说明问题。不给上下文时,基座模型在 SQuAD 上的准确率是 31.9%,普通微调是 33.4%,去掉做梦的 Sleep 是 35.7%,完整的 Sleep 是 48.9%。连续注入 200 段时,完整的 Sleep 是 46.2%。

提升主要来自合成练习,而结果还不到 50%。这比前面的电话簿任务难得多:电话簿只要求复现见过的内容,SQuAD 要回答关于段落的新问题。记住和用得出来是两件事。

Synthetic Document Finetuning(SDF)用了更大的曝光量:为每个事实生成 4 万篇合成文档,再用 LoRA 训练。合理的事实常常表现得像真实知识,能推广到相关推理,也能扛住质疑;违背基本常识的事实仍然脆弱。

两项工作都说明,内化靠足够的合成曝光。4 万篇的成本太高,但有两个原因让我认为个人记忆用不了这么多:

  • 一致的信息整合更快。 Kumaran、Hassabis 和 McClelland 指出,新信息的整合速度取决于它和已有知识是否一致。“用户住在上海”这类事实不违背世界知识,不需要改写大量已有结构。
  • 回放可以有选择。 相似度加权的交错学习只回放和新内容相似的旧样本,用少得多的旧样本就能保持接近的效果。一篇 2026 年的预印本发现,同样的回放比例下,间隔重复调度比均匀回放保留更多旧知识。

一条个人记忆到底要多少曝光,目前没有答案。现有实验从 Sleep 的每段 5 个 dream、Reversal Curse 的 30 次改写,一直到 SDF 的 4 万篇文档,差了几个数量级,这是这个方向最重要的未知数。

我的方案:两层参数记忆

按上一篇的分级,记忆表属于 1 级,个体权重属于 2 级。

层 写入时机 保存内容 作用
共享基座 数月一次 世界知识 所有用户共用
个体权重 后台持续巩固 常用事实、偏好、习惯 不用查就知道
记忆表 每次交互后立刻写入 全部交互,带时间和来源 下一次交互立刻受影响

两层参数记忆

有三点设计很重要:

  • 记忆表是事实源,个体权重是可以重建的缓存。 基座升级、用户删除记忆、记忆写错,都可以用记忆表重新巩固个体权重来解决。这是和 Sleep 最大的不同:Sleep 巩固后会清空快速记忆,而个人记忆要能修改和删除,原始记录必须一直保留。
  • 写入的是事件,不是真相。 系统记录的是“用户在这一天说过 X”,而不是把 X 当成事实。这样说错的话不会污染世界知识,“搬家了”这类变化也能按时间区分。
  • 不是所有记忆都要内化。 全部交互都留在记忆表里,能取回;常用的、有规律的内容才进入权重。

巩固的方法不需要重新发明,可以直接借鉴 Sleep 的知识蒸馏和做梦。

和已有工作的区别

工作 做到了什么 还缺什么
Memory、RAG 最成熟,多个系统在 LoCoMo 上自报超过 90 分 记忆在模型外,要占上下文
AI-native Memory、Second Me 每人一个模型,记忆进入参数 离线训练,只有单个试点用户的结果
User as Engram 写入不到 1 毫秒,直接回忆 100%,间接推理约 41% 基座不超过 1.22B;1,000 个事实时 top-1 为 35%;真正需要组合事实的多跳回忆只有 12.9%
Sleep 框架 短期记忆周期性巩固进新增参数,不覆盖旧参数 睡眠时暂停输入;知识注入准确率不到 50%;没有讨论个人记忆、事实更新和删除
SDF 植入的事实接近真实知识 每个事实 4 万篇文档,一次性实验
知识编辑 直接修改权重中的事实 相关事实不一定跟着更新
Titans、TTT 运行时更新模型内部状态 主要解决长上下文,不是跨会话的个人记忆

这些工作各自解决了一部分:有人定义了个人模型,有人做到了实时写入,Sleep 接通了从短期记忆到长期参数的闭环。Sleep 面向通用的持续学习,我关心的是个人记忆:每一次交互都立刻进入模型,记忆有持久的事实源,能更新和删除,效果也用个人记忆来衡量。这部分更偏系统设计,是我想做的。

我不确定的地方

  • 检索可能一直够用。 RAG 在小规模上更准确,也更容易审计。如果记忆表的回忆不比 RAG 好,第一层的优势就只剩不占上下文,真正的差异要靠巩固体现。
  • 互相关联的记忆还没被解决。 Engram 的多跳回忆很低,SDF 也只测了较简单的事实。一个人的长期记忆彼此牵连,规模和结构都超出现有实验。
  • 字面上的“无限”做不到。 记忆表的存储可以一直增长,但我不看好让每一条记忆都和世界知识一样可靠。较现实的目标是:每次交互都进入模型并影响之后的对话,全部记忆都能取回,高频记忆逐步内化。
  • 这篇文章里的方案还没有实验验证。

下一步

下一步是定义一个个人记忆基准,让每次交互都进入连续的长期对话,并测量回忆、推理、更新旧事实和成本随历史增长的变化。先用它测 RAG、自动微调、Engram 式写入和 Sleep 式巩固,再回答“一条记忆要多少曝光”。


说明:2026 年 11 月 2 日更新。初版写的是“没有查到把实时写入和持续巩固接成闭环的完整系统”,这个判断漏掉了谷歌的 Sleep 框架,现已修正。

参考资料:

The personal AI I want has one requirement: every interaction between a user and the model affects the next one.

Today's large models cannot do this. After training, their weights are read-only. A model "remembers" you because an outside program finds past content and puts it back into the current context. Context has a limit, its contents must be read again every time, and reading them leaves no change behind.

So my idea is this: memory should stop living in the context and move into the model's parameters. This post continues "Dynamic intelligence". That post defined the form in which running also writes to the model. This one covers its most concrete goal: how to make a model remember you.

I did not come up with this first. In 2024, AI-native Memory proposed training a personal model for each person. In 2026, User as Engram wrote user facts into parameters in under a millisecond, and Google's Sleep framework had models consolidate short-term memory into long-term parameters offline. This post looks at that work together, explains what I think the problem really is, and says what is still missing.

Why models remember world knowledge

A model will not tell you that 1+1=3, which suggests it can remember knowledge reliably. The direct idea follows: write every interaction in as world knowledge.

The idea holds, but first we need to see where reliability comes from.

Training minimizes the average prediction error over all text. Something that appears a million times carries a million times the weight of something that appears once. A model's memory is therefore allocated by frequency, not by whether a fact is certain. That is why rare facts often come out wrong: on the 4,000 least popular questions in PopQA, GPT-3 was right 19% of the time.

This comes from the training objective. It is not a limit on what neural networks can do. Neural networks can fully fit random labels, which have no pattern to learn. How LoRA Remembers fine-tuned Qwen3-8B with a method designed for memorization and reached 100% exact recall on a phone-book task. Remembering rare facts reliably is possible when the training objective asks for it.

How context, memory tables and weights relate

In 2020, Domingos pointed out that models trained by gradient descent approximate kernel machines. A kernel machine keeps its training examples and predicts by weighting them by similarity. Seen this way, the weights of a neural network are effectively a superposition of the training examples.

This gave me a more basic way to see the problem: context, memory tables and weights all hold past examples, and they differ mainly in how compressed those examples are.

Form Stored as Writing Reading Transfer
Context Original text Just add it All reread each time, with a limit Reasoned on the spot
Memory table Raw examples, by address One write Only relevant entries Weak
Weights All examples, compressed together Slow, needs repeated training No lookup Strong

Four forms of memory

Internalizing means memory is gradually compressed into shared representations. Memory table entries are parameters of the model too: the model reads them directly during its forward pass, without using context. That differs from RAG, which retrieves text that must be read again as input.

Why weights alone are not enough

Fast writing and generalization conflict. Generalization needs similar content to share parameters, so that unseen questions land near existing knowledge. Fast writing needs content not to overlap, or a change in one place affects everything.

In 1995, McClelland and colleagues used this conflict to explain why the brain has two learning systems: the hippocampus records specific experiences quickly, and the neocortex extracts structure through slow, interleaved learning.

User as Engram gives a direct measurement. When user facts were written as a LoRA, prediction on unrelated text got clearly worse, with val bpb up 1.784. When written as a few rows of an Engram hash table, it rose 0.00005, a difference of about 33,000 times. A LoRA changes shared weights. A hash table changes an address.

Different fields have reached similar structures:

Field Fast layer Slow layer
Brain Hippocampus Neocortex
Databases LSM-tree memtable Merged files on disk
Recommender systems User and item vectors, synced in minutes Main model, synced daily
Large models (Sleep) High-frequency memory modules Low-frequency memory modules
Personal models Memory table Individual weights

When you need both fast writes and good generalization, one layer is hard to make work. So I no longer see the problem as making fine-tuning fast enough. I split it in two: write in real time, consolidate continuously.

What writing into weights takes

The second step is essentially automatic fine-tuning. The most complete work so far is Google's Sleep framework. A model takes in new information while awake. During sleep it pauses input and does two things:

  • Consolidation: it distills short-term memory into newly added low-rank experts without overwriting old parameters, then clears the fast memory.
  • Dreaming: it uses reinforcement learning to generate synthetic practice, filters it, and keeps training.

Its knowledge injection experiment is telling. Without context, the base model scores 31.9% on SQuAD, plain fine-tuning 33.4%, Sleep without dreaming 35.7%, and full Sleep 48.9%. Injecting 200 paragraphs in sequence, full Sleep reaches 46.2%.

Most of the gain comes from synthetic practice, and the result is still under 50%. This is far harder than the phone-book task above: a phone book only asks the model to reproduce what it has seen, while SQuAD asks new questions about a paragraph. Remembering something and being able to use it are different things.

Synthetic Document Finetuning (SDF) uses much more exposure: it generates 40,000 synthetic documents for each fact and trains a LoRA on them. Plausible facts often behave like real knowledge, carrying into related reasoning and holding up under challenge. Facts that contradict basic knowledge stay brittle.

Both results show that internalizing depends on enough synthetic exposure. Forty thousand documents is far too expensive, but I have two reasons to think personal memory needs fewer:

  • Consistent information integrates faster. Kumaran, Hassabis and McClelland note that the speed of integration depends on how consistent new information is with existing knowledge. A fact like "the user lives in Shanghai" does not contradict world knowledge, so little existing structure has to change.
  • Replay can be selective. Similarity-weighted interleaved learning replays only old examples similar to the new content, and keeps comparable results with far fewer of them. A 2026 preprint found that at the same replay share, spaced-repetition scheduling retains more old knowledge than uniform replay.

Nobody yet knows how much exposure one personal memory needs. Existing experiments run from 5 dreams per paragraph in Sleep and 30 rewrites in the Reversal Curse to 40,000 documents in SDF, several orders of magnitude apart. This is the most important unknown in this direction.

My design: two layers of parametric memory

In the levels from the previous post, the memory table is level 1 and the individual weights are level 2.

Layer When it is written What it holds Purpose
Shared base Every few months Knowledge of the world Shared by all users
Individual weights Consolidated continuously in the background Common facts, preferences, habits Known without lookup
Memory table Right after every interaction All interactions, with time and source The next interaction is affected at once

Two layers of parametric memory

Three design points matter:

  • The memory table is the source of truth, and the individual weights are a rebuildable cache. Base upgrades, deletion requests and wrong memories can all be handled by consolidating the weights again from the table. This is the biggest difference from Sleep, which clears fast memory after consolidation. Personal memory has to be editable and deletable, so the original records must stay.
  • What gets written is an event, not the truth. The system records "the user said X on this day" and does not treat X as fact. Mistakes then stay out of world knowledge, and changes such as moving house can be told apart by time.
  • Not every memory has to be internalized. All interactions stay retrievable in the memory table. Only frequent, patterned content moves into the weights.

Consolidation does not need to be reinvented. It can borrow directly from Sleep's knowledge distillation and dreaming.

How this differs from existing work

Work What it achieved What is missing
Memory, RAG Most mature; several systems self-report over 90 on LoCoMo Memory sits outside the model and uses context
AI-native Memory, Second Me One model per person, with memory in parameters Offline training; results from a single pilot user
User as Engram Writes in under 1ms; 100% direct recall; about 41% indirect reasoning Bases up to 1.22B; 35% top-1 at 1,000 facts; 12.9% multi-hop recall when facts must really be combined
Sleep framework Short-term memory is periodically consolidated into added parameters without overwriting old ones Pauses input during sleep; under 50% on knowledge injection; does not discuss personal memory, fact updates or deletion
SDF Implanted facts come close to real knowledge 40,000 documents per fact; a one-off experiment
Knowledge editing Changes facts directly in the weights Related facts do not always update
Titans, TTT Update internal state while running Aimed at long context, not personal memory across sessions

Each of these solves a part: some define the personal model, some achieve real-time writing, and Sleep closes the loop from short-term memory to long-term parameters. Sleep targets general continual learning. I care about personal memory: every interaction enters the model at once, memory has a durable source of truth, it can be updated and deleted, and results are measured on personal memory. This part is more about system design, and it is what I want to build.

What I am unsure about

  • Retrieval may stay good enough. RAG is more accurate at small scale and easier to audit. If the memory table recalls no better than RAG, the first layer's only advantage is not using context, and the real difference has to come from consolidation.
  • Interconnected memory is unsolved. Multi-hop recall in Engram is low, and SDF only tested fairly simple facts. A person's long-term memory is interconnected, and its scale and structure go beyond existing experiments.
  • Literally unlimited is out of reach. The memory table can keep growing, but I do not expect every memory to become as reliable as world knowledge. A realistic goal is that every interaction enters the model and affects later conversations, all memories can be retrieved, and frequent memories are gradually internalized.
  • The design in this post has not been tested.

Next

The next step is a personal memory benchmark that runs every interaction through one long continuous conversation and measures recall, reasoning, updates to old facts, and cost as history grows. It will first measure RAG, automatic fine-tuning, Engram-style writing and Sleep-style consolidation, then answer how much exposure one memory needs.


Note: updated on November 2, 2026. The first version said I had found no complete system connecting real-time writing and continuous consolidation. That missed Google's Sleep framework and has been corrected.

References:

Updated