Lune

ICLR2021顶会

Hopfield Networks is All You Need

Hubert Ramsauer, Bernhard Schäfl, Johannes Lehner, Philipp Seidl, Michael Widrich, Lukas Gruber, Markus Holzleitner, Thomas Adler, David P. Kreil, Michael K. Kopp, Günter Klambauer, Johannes Brandstetter, Sepp Hochreiter

摘要

We show that the transformer attention mechanism is the update rule of a modern Hopfield network with continuous states. This new Hopfield network can store exponentially (with the dimension) many patterns, converges with one update, and has exponentially small retrieval errors. The number of stored patterns is traded off against convergence speed and retrieval error. The new Hopfield network has three types of energy minima (fixed points of the update): (1) global fixed point averaging over all patterns, (2) metastable states averaging over a subset of patterns, and (3) fixed points which store a single pattern. Transformer and BERT models operate in their first layers preferably in the global averaging regime, while they operate in higher layers in metastable states. The gradient in transformers is maximal for metastable states, is uniformly distributed for global averaging, and vanishes for a fixed point near a stored pattern. Using the Hopfield network interpretation, we analyzed learning of transformer and BERT models. Learning starts with attention heads that average and then most of them switch to metastable states. However, the majority of heads in the first layers still averages and can be replaced by averaging, e.g. our proposed Gaussian weighting. In contrast, heads in the last layers steadily learn and seem to use metastable states to collect information created in lower layers. These heads seem to be a promising target for improving transformers. Neural networks with Hopfield networks outperform other methods on immune repertoire classification, where the Hopfield net stores several hundreds of thousands of patterns. We provide a new PyTorch layer called "Hopfield", which allows to equip deep learning architectures with modern Hopfield networks as a new powerful concept comprising pooling, memory, and attention. GitHub: this https URL

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 140 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • xLSTM: Extended Long Short-Term Memory 引用了 Linear Transformers Are Secretly Fast Weight Programmers
  • Parallelizing Linear Transformers with the Delta Rule over Sequence Length 引用了 Large Associative Memory Problem in Neurobiology and Machine Learning
  • Parallelizing Linear Transformers with the Delta Rule over Sequence Length 引用了 Linear Transformers Are Secretly Fast Weight Programmers
  • Large Associative Memory Problem in Neurobiology and Machine Learning 引用了 Modern Hopfield Networks and Attention for Immune Repertoire Classification
  • Transformers Learn In-Context by Gradient Descent 引用了 Linear Transformers Are Secretly Fast Weight Programmers
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper140

  1. Transformers Learn In-Context by Gradient DescentJohannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento 等ICML 2023 · 729 次引用
  2. xLSTM: Extended Long Short-Term MemoryMaximilian Beck, Korbinian Pöppel, Markus Spanring, Andreas Auer 等NeurIPS 2024 · 703 次引用
  3. Transformer Memory as a Differentiable Search IndexYi Tay, Vinh Tran, Mostafa Dehghani, Jianmo Ni 等NeurIPS 2022 · 506 次引用
  4. Parallelizing Linear Transformers with the Delta Rule over Sequence LengthSonglin Yang, Bailin Wang, Yu Zhang, Yikang Shen 等NeurIPS 2024 · 412 次引用
  5. Linear Transformers Are Secretly Fast Weight ProgrammersImanol Schlag, Kazuki Irie, Jürgen SchmidhuberICML 2021 · 394 次引用

它引用的 Paper4

  1. ELECTRA: Pre-training Text Encoders as Discriminators Rather Than GeneratorsKevin Clark, Minh-Thang Luong, Quoc V. Le, Christopher D. ManningICLR 2020 · 541 次引用
  2. Large Associative Memory Problem in Neurobiology and Machine LearningDmitry Krotov, John J. HopfieldICLR 2021 · 202 次引用
  3. Modern Hopfield Networks and Attention for Immune Repertoire ClassificationMichael Widrich, Bernhard Schäfl, Milena Pavlovic, Hubert Ramsauer 等NeurIPS 2020 · 152 次引用
  4. MEMO: A Deep Network for Flexible Combination of Episodic MemoriesAndrea Banino, Adrià Puigdomènech Badia, Raphael Köster, Martin J. Chadwick 等ICLR 2020 · 41 次引用

相关 Paper

  1. On the Role of Hidden States of Modern Hopfield Network in TransformerTsubasa Masumura, Masato TakiNeurIPS 2025 · 2 次引用
  2. Simplicial Hopfield networksThomas F. Burns, Tomoki FukaiICLR 2023 · 1 次引用
  3. Outlier-Efficient Hopfield Layers for Large Transformer-Based ModelsJerry Yao-Chieh Hu, Pei-Hsuan Chang, Haozheng Luo, Hong-Yu Chen 等ICML 2024 · 46 次引用
  4. Nonparametric Modern Hopfield ModelsJerry Yao-Chieh Hu, Bo-Yu Chen, Dennis Wu, Feng Ruan 等ICML 2025
  5. Energy Landscape-Aware Vision Transformers: Layerwise Dynamics and Adaptive Task-Specific Training via Hopfield StatesRunze Xia, Richard JiangNeurIPS 2025 · 1 次引用
黄昏的海面,两侧是细线勾勒的悬崖