Transformer Feed-Forward Layers Are Key-Value Memories
Mor Geva, Roei Schuster, Jonathan Berant, Omer Levy
摘要
Feed-forward layers constitute two-thirds of a transformer model's parameters, yet their role in the network remains under-explored. We show that feed-forward layers in transformerbased language models operate as key-value memories, where each key correlates with textual patterns in the training examples, and each value induces a distribution over the output vocabulary. Our experiments show that the learned patterns are human-interpretable, and that lower layers tend to capture shallow patterns, while upper layers learn more semantic ones. The values complement the keys' input patterns by inducing output distributions that concentrate probability mass on tokens likely to appear immediately after each pattern, particularly in the upper layers. Finally, we demonstrate that the output of a feed-forward layer is a composition of its memories, which is subsequently refined throughout the model's layers via residual connections to produce the final output distribution.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 524 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Implicit In-context Learning 引用了 Language Models are Few-Shot Learners
- Towards Automated Circuit Discovery for Mechanistic Interpretability 引用了 Locating and Editing Factual Associations in GPT
- Towards Automated Circuit Discovery for Mechanistic Interpretability 引用了 Compositional Explanations of Neurons
- Locating and Editing Factual Associations in GPT 引用了 Investigating Gender Bias in Language Models Using Causal Mediation Analysis
- Locating and Editing Factual Associations in GPT 引用了 Fast Model Editing at Scale
- Locating and Editing Factual Associations in GPT 引用了 Language Models are Few-Shot Learners
- Fast Model Editing at Scale 引用了 Language Models are Few-Shot Learners
- Towards a Unified View of Parameter-Efficient Transfer Learning 引用了 Language Models are Few-Shot Learners
引用它的顶会 Paper524
- Locating and Editing Factual Associations in GPTKevin Meng, David Bau, Alex Andonian, Yonatan BelinkovNeurIPS 2022 · 3,415 次引用
- Implicit In-context LearningZhuowei Li, Zihao Xu, Ligong Han, Yunhe Gao 等ICLR 2025 · 1,989 次引用
- Towards a Unified View of Parameter-Efficient Transfer LearningJunxian He, Chunting Zhou, Xuezhe Ma, Taylor Berg-Kirkpatrick 等ICLR 2022 · 1,182 次引用
- Towards Automated Circuit Discovery for Mechanistic InterpretabilityArthur Conmy, Augustine N. Mavor-Parker, Aengus Lynch, Stefan Heimersheim 等NeurIPS 2023 · 861 次引用
- Fast Model Editing at ScaleEric Mitchell, Charles Lin, Antoine Bosselut, Chelsea Finn 等ICLR 2022 · 527 次引用
它引用的 Paper7
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
- Comprehensive Privacy Analysis of Deep Learning: Passive and Active White-box Inference Attacks against Centralized and Federated LearningMilad Nasr, Reza Shokri, Amir HoumansadrS&P 2019 · 1,778 次引用
- Investigating Gender Bias in Language Models Using Causal Mediation AnalysisJesse Vig, Sebastian Gehrmann, Yonatan Belinkov, Sharon Qian 等NeurIPS 2020 · 851 次引用
- Compositional Explanations of NeuronsJesse Mu, Jacob AndreasNeurIPS 2020 · 229 次引用
- Explaining Black Box Predictions and Unveiling Data Artifacts through Influence FunctionsXiaochuang Han, Byron C. Wallace, Yulia TsvetkovACL 2020 · 91 次引用
相关 Paper
- Transformer Feed-Forward Layers Build Predictions by Promoting Concepts in the Vocabulary SpaceMor Geva, Avi Caciularu, Kevin Ro Wang, Yoav GoldbergEMNLP 2022 · 92 次引用
- Birth of a Transformer: A Memory ViewpointAlberto Bietti, Vivien Cabannes, Diane Bouchacourt, Hervé Jégou 等NeurIPS 2023 · 182 次引用
- Distributional Associations vs In-Context Reasoning: A Study of Feed-forward and Attention LayersLei Chen, Joan Bruna, Alberto BiettiICLR 2025
- Probability Distributions Computed by Autoregressive TransformersAndy Yang, Anej Svete, Jiaoda Li, Anthony W. Lin 等ICLR 2026 · 2 次引用
- Bigram Subnetworks: Mapping to Next Tokens in Transformer Language ModelsTyler A. Chang, Benjamin BergenNeurIPS 2025 · 5 次引用
