AI 与机器学习2022arxiv.org
Memorizing Transformers
Memorizing Transformers
进阶 · 约 60 分钟读完前置知识:Transformer 注意力机制、k/v 缓存、检索增强模型基础
导读
这篇 DeepMind 论文提出为 Transformer 增加外部记忆机制:将之前见过的 token 的 k,v 缓存起来,模型在自注意力时可以选择关注缓存中的历史内容,从而记住远超上下文窗口的信息。实验主要针对长文档任务,显示记忆机制能显著提升性能。
HN 关注点:外部记忆/检索机制让预训练模型能访问事实和数据库,是当时 ML 领域最受关注的方向之一,HN 读者热衷讨论其实现与应用前景。
HN 评论精选
这几条评论里:支持 2 补充 2
补充提供了论文的开源 PyTorch 实现
我基于这篇论文做了一个 PyTorch 实现(github.com/lucidrains/memorizing-transformers-pytorch),供研究注意力网络中检索与记忆的研究者使用。
lucidrains查看英文原文
have an implementation of this over at https://github.com/lucidrains/memorizing-transformers-pytorch, for any researcher exploring retrieval and memory with attention networks
补充补充相关资料:DeepMind 的 RETRO 检索式 Transformer
另可参见 RETRO,一种检索式 Transformer:DeepMind 的'从数万亿 token 中检索以改进语言模型'论文、Jay Alammar 的图解文章,以及检索式 Transformer 在医学领域的应用文章。
axg11查看英文原文
See also RETRO, a type of retrieval transformer: [0], [1], [2] [0] - https://www.deepmind.com/publications/improving-language-models-by-retrieving-from-trillions-of-tokens [1] - https://jalammar.github.io/illustrated-retrieval-transformer/ [2] - https://arsham.substack.com/p/retrieval-transformers-for-medicine?s=r
支持认为外部记忆是 ML 最激动人心的方向之一
给预训练模型配备外部记忆(或更广义的、不必可微的外部记忆)是当前 ML 最令人兴奋的领域之一,它让模型能够接入事实、数据库等外部资源。
6gvONxR4sf7o查看英文原文
External memory with pretrained models (or more generally, external not-necessarily-differentiable memory) is one of the most exciting areas of ML right now. It opens up models to external things like facts and databases.
支持解释核心机制,并期待在视频等时序任务上的后续研究
基本思路是维护一个包含所有已见 token 的 q,k,v 缓存并随时间更新。Transformer 可以选择做普通自注意力(忽略缓存),或关注缓存中的元素(从而注意到之前见过的 token)。论文主要应用于大文档,我很想看到后续在视频等时序任务上的研究。
jerpint查看英文原文
The basic idea is to have a q,k,v cache of all the previously seen tokens that gets updated over time. The transformer can decide to do self-attention (and ignore the cache) or focus on elements from the cache (enabling it to attend to previously seen tokens). They mainly apply this to large documents, i'd be very curious to see a followup on time-dependent tasks like videos
相关资源
从这篇论文所有 HN 讨论帖的全部评论里整理出来的链接。
历次讨论
- 2022Hacker News 讨论帖179 分 · 32 评
同领域还值得读
DeepSeek-R1:通过强化学习激励 LLM 的推理能力
DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via RL
研究如何用强化学习激励大语言模型的推理能力,提出 DeepSeek-R1,并探讨 RL 训练对模型推理表现的影响。
AI 与机器学习2025 · 1,351 分 · 1,056 评 · 引用 30进阶 · 约 80 分钟编辑精选1-bit LLM 时代:面向低成本计算的三值参数
The Era of 1-bit LLMs: ternary parameters for cost-effective computing
提出用三值参数 {-1, 0, 1} 替代 LLM 中的浮点权重,即所谓“1-bit LLM”。
AI 与机器学习2024 · 1,040 分 · 447 评 · 引用 19进阶 · 约 45 分钟编辑精选DeepSeek-V3.2:推进开放大语言模型的前沿
DeepSeek-v3.2: Pushing the frontier of open large language models
这是 DeepSeek-V3.2 的技术报告,延续了 DeepSeek 开源权重模型的路线,目标是让开放模型继续逼近甚至追平前沿闭源模型。
AI 与机器学习2025 · 982 分 · 465 评进阶 · 约 90 分钟编辑精选通过自我对弈与通用强化学习掌握国际象棋和将棋(AlphaZero)
Mastering Chess and Shogi by Self-Play with General Reinforcement Learning
DeepMind 的 AlphaZero 论文:用通用强化学习算法(自我博弈 + MCTS + 神经网络),从零开始仅数小时训练便在国际象棋和将棋上击败了世界顶级引擎 Stock…
AI 与机器学习2017 · 539 分 · 270 评 · 引用 13进阶 · 约 90 分钟编辑精选用强化学习发现更快的矩阵乘法算法
Discovering faster matrix multiplication algorithms with reinforcement learning
论文提出 AlphaTensor,用强化学习搜索矩阵乘法算法。
AI 与机器学习2022 · 518 分 · 111 评专业 · 约 90 分钟编辑精选