A personalized AI agent needs a user memory: a persistent model of who the user is, built across many conversations and consulted on each new one. Today this memory is almost always stored as unstructured text, a knowledge graph, or a flat store of facts, and consulted by retrieval -- fetching the entries most similar to the current request. Such "bag-of-facts" memory recalls individual facts well, but because storing a fact and acting on it are separate steps, it struggles to resolve contradictions, aggregate over many records, or enforce rules. We argue that user memory should instead be executable. We introduce User as Code (UaC), a paradigm in which an agent's model of a user is a living software project: typed Python objects hold the user's state and ordinary Python functions encode the rules that govern it, so representing and reasoning about the user happen in one medium an interpreter can run. The enabling mechanism is a two-phase pipeline: an append-only log that never discards a fact, periodically checkpointed into typed code. This changes what memory can do. On standard long-term conversation benchmarks, UaC matches both a full-context upper bound and the strongest prior memory systems on recall (78.8% on LOCOMO). Its advantage emerges where representation matters most. On aggregate questions over a user's history -- "how many international trips did I take last year?" -- retrieval-based memory collapses (6-43%) while UaC stays near-perfect (99%), because the answer is a one-line computation over typed state rather than a search over text. And because its rules execute deterministically whenever the state changes, UaC can surface unsolicited, safety-critical alerts -- such as a newly prescribed drug that conflicts with an allergy recorded months earlier -- a capability query-driven memory cannot provide.


翻译:个性化AI智能体需要用户记忆:跨越多次对话构建的用户持久化模型,并在每次新对话中参考该模型。当前这类记忆几乎全部以非结构化文本、知识图谱或扁平化事实库形式存储,并通过检索方式调用——即提取与当前请求最相似的条目。这种"事实袋"式记忆能良好地回忆单个事实,但由于存储事实与执行操作是分离步骤,其在解决矛盾、聚合多条记录或强制执行规则方面存在困难。我们认为用户记忆应当是可执行的。我们提出"用户即代码"(User as Code, UaC)范式,其中智能体对用户的建模是一个活体软件项目:类型化Python对象存储用户状态,普通Python函数编码管理状态的规则,使得用户表征与推理可在解释器运行的统一媒介中完成。其实现机制是双阶段流水线:持续追加的日志永不丢弃事实,并周期性地检查点转化为类型化代码。这彻底改变了记忆的能力边界。在标准长程对话基准测试中,UaC在召回率(LOCOMO数据集达78.8%)方面既达到全上下文上界,也持平最强先验记忆系统。其优势在表征至关重要的场景尤为突出。针对用户历史聚合类问题——例如"去年我共进行了多少次国际旅行?"——基于检索的记忆性能骤降(6-43%),而UaC保持近乎完美(99%),因为答案是对类型化状态的一行计算而非文本搜索。此外,由于其规则在状态变更时确定性执行,UaC能主动触发安全关键警报——例如新开具的药物与数月前记录的食物过敏相冲突——这种能力是查询驱动型记忆无法提供的。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
AI 智能体系统:体系架构、应用场景及评估范式
AI智能体时代中的记忆:形式、功能与动态综述
专知会员服务
36+阅读 · 2025年12月16日
谷歌《智能体Agent》白皮书,42页pdf
专知会员服务
108+阅读 · 2025年1月5日
用户画像基础
DataFunTalk
12+阅读 · 2020年8月1日
数据中台:基于标签体系的360°用户画像
THU数据派
13+阅读 · 2020年7月25日
浅谈群体智能——新一代AI的重要方向
中国科学院自动化研究所
44+阅读 · 2019年10月16日
【知识图谱】基于知识图谱的用户画像技术
产业智能官
103+阅读 · 2019年1月9日
可能是 Android 上最好用的写作 App
少数派
11+阅读 · 2018年12月21日
深度文本匹配在智能客服中的应用
AI100
18+阅读 · 2018年10月24日
尽早跑通深度学习的实践代码,是入门深度学习的最快途径
算法与数据结构
22+阅读 · 2017年12月13日
【智能客服】智能客服2.0,数字时代的人性化交互
产业智能官
13+阅读 · 2017年11月13日
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
VIP会员
最新内容
学习数据的几何:形状空间分析数学综述
专知会员服务
1+阅读 · 今天14:45
定向能反无人机系统最新发展动态
专知会员服务
5+阅读 · 今天13:50
从燃煤战舰到算法战争:水面指挥的永恒要求
专知会员服务
3+阅读 · 今天13:33
相关资讯
用户画像基础
DataFunTalk
12+阅读 · 2020年8月1日
数据中台:基于标签体系的360°用户画像
THU数据派
13+阅读 · 2020年7月25日
浅谈群体智能——新一代AI的重要方向
中国科学院自动化研究所
44+阅读 · 2019年10月16日
【知识图谱】基于知识图谱的用户画像技术
产业智能官
103+阅读 · 2019年1月9日
可能是 Android 上最好用的写作 App
少数派
11+阅读 · 2018年12月21日
深度文本匹配在智能客服中的应用
AI100
18+阅读 · 2018年10月24日
尽早跑通深度学习的实践代码,是入门深度学习的最快途径
算法与数据结构
22+阅读 · 2017年12月13日
【智能客服】智能客服2.0,数字时代的人性化交互
产业智能官
13+阅读 · 2017年11月13日
相关基金
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员