按年被提到
20222023 · 5 次2026
机器学习与深度学习›优化与可微编程·arXiv:2212.07677 · cs.LG

Transformers learn in-context by gradient descent

Transformer 通过梯度下降进行上下文学习
Johannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento, Alexander Mordvintsev, Andrey Zhmoginov, Max Vladymyrov · 2022

证明线性自注意力可实现梯度下降,解释上下文学习的机制

开始阅读 ↗PDFalphaXiv 讨论
被推荐 · 7 人首次 2022-12-17 · 最近 2026-11-02
7不同的人
6活跃月份
7讨论串
105被引(OpenAlex)

论文提出,用自回归目标训练 Transformer 与基于梯度的元学习密切相关:先给出一个权重构造,证明单个线性自注意力层引起的数据变换与回归损失上的梯度下降等价。在简单回归任务上训练仅含自注意力的 Transformer,其学到的模型与梯度下降所得高度相似,甚至权重与该构造吻合,所以训练后的 Transformer 成为 mesa-optimizer,即在前向传播中用梯度下降学习模型。作者还讨论了它与 induction head 的联系。

HN 为什么提它

评论者用它说明 LLM 的上下文学习内部可能在做类似梯度下降的事(mesa-optimizer),把它作为这一机制的证据来引用,也有人只把它当作一种声称。

实证研究难度 5 / 5约 50 分钟经得起时间
读之前最好知道
1Transformer 与自注意力
2上下文学习(in-context learning)
3梯度下降与线性回归
4元学习(meta-learning)

HN 书评

推荐在前,同类按时间 · 每篇最多保留 20 条,统计用全部提及
推荐spyder · 2023-04

“Some additional interesting papers about it:”

把它列为相关的有趣论文,说明上下文学习是 transformer 内部的梯度下降
Teaching ChatGPT to Speak My Son’s Invented Language原评论 ↗
推荐sebzim4500 · 2023-04

“The paper that made me unsure was "Transformers learn in-context by gradient descent" [1].”

称这篇让自己动摇,它论证 transformer 能在上下文中学到梯度下降
GPT-4 gets a B on my quantum computing final exam原评论 ↗
引用cmorez · 2023-01

“See work from Anthropic[1] and Google[2] that explores this.”

指出 Anthropic 和 Google 的相关工作探讨过训练后权重在计算什么
Do Large Language Models learn world models or just surface statistics?原评论 ↗
引用benlivengood · 2023-02

“by performing gradient descent within the overall network [1].”

拿它说明 transformer 通过网络内部的梯度下降实现上下文学习
ChatGPT Hype Is Proof Nobody Understands AI原评论 ↗
引用sebzim4500 · 2023-04

“Presumably doing something that looks a bit like gradient decent, see Transformers learn in-context by gradient descent”

拿它说明 transformer 在上下文中大概在做类似梯度下降的事
GPT-4 gets a B on my quantum computing final exam原评论 ↗
引用pona-a · 2025-03

“This paper claimed transformers learn a gradient-descent mesa-optimizer as part of in-context learning”

指出它声称 transformer 在上下文学习中学到梯度下降式 mesa-optimizer
ARC-AGI without pretraining原评论 ↗
看全部 7 条 →
引用joe_the_user · 2026-11

“A few years ago it was discovered that LLMs can implement gradient descent in their processes.”

拿它说明 LLM 可以在上下文中实现梯度下降
Astra can read and write weights to improve Qwen原评论 ↗
被提交为 story · 1 次