Gated recurrent neural networks discover attention
Not on the map. Why?
Abstract (arXiv)
Recent architectural developments have enabled recurrent neural networks (RNNs) to reach and even surpass the performance of Transformers on certain sequence modeling tasks. These modern RNNs feature a prominent design pattern: linear recurrent layers interconnected by feedforward paths with multiplicative gating. Here, we show how RNNs equipped with these two design elements can exactly implement (linear) self-attention, the main building block of Transformers. By reverse-engineering a set of trained RNNs, we find that gradient descent in practice discovers our construction. In particular, we examine RNNs trained to solve simple in-context learning tasks on which Transformers are known to excel and find that gradient descent instills in our RNNs the same attention-based in-context learning algorithm used by Transformers. Our findings highlight the importance of multiplicative interactions in neural networks and suggest that certain RNNs might be unexpectedly implementing attention under the hood.
Key facts. Cited by 7 papers in the map (data through 14 Oct 2026). Builds on 32 of its 54 references that are in the map. First posted on arXiv 4 Sep 2023.
Builds on
32 of 54 references.
References · 32
- 2017Attention Is All You Needcited by 60,361
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,548
- 2021Efficiently Modeling Long Sequences with Structured State Spacescited by 2,465
- 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 2,022
- 2020Rethinking Attention with Performerscited by 1,601
- 2014On the Properties of Neural Machine Translation: Encoder-Decoder Approachescited by 1,304
- 2022In-context Learning and Induction Headscited by 964
- 2023RWKV: Reinventing RNNs for the Transformer Eracited by 827
- 2022Simplified State Space Layers for Sequence Modelingcited by 788
- 2022Transformers learn in-context by gradient descentcited by 732
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
20 more
- 2016Language Modeling with Gated Convolutional Networkscited by 702
- 2020Long Range Arena: A Benchmark for Efficient Transformerscited by 700
- 2023Retentive Network: A Successor to Transformer for Large Language Modelscited by 613
- 2021Linear Transformers Are Secretly Fast Weight Programmerscited by 502
- 2022Hungry Hungry Hippos: Towards Language Modeling with State Space Modelscited by 499
- 2023Resurrecting Recurrent Neural Networks for Long Sequencescited by 408
- 2018Efficient Attention: Attention with Linear Complexitiescited by 368
- 2021Random Feature Attentioncited by 354
- 2022Diagonal State Spaces are as Effective as Structured State Spacescited by 350
- 2023Trained Transformers Learn Linear Models In-Contextcited by 337
- 2022Data Distributional Properties Drive Emergent In-Context Learning in Transformerscited by 309
- 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 279
- 2019Transformer Dissection: A Unified Understanding of Transformer's Attention via the Lens of Kernelcited by 213
- 2016Using Fast Weights to Attend to the Recent Pastcited by 170
- 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 170
- 2018Differentiable plasticity: training plastic neural networks with backpropagationcited by 84
- 2021A Practical Survey on Faster and Lighter Transformerscited by 73
- 2017Universal discrete-time reservoir computers with stochastic inputs and linear readouts using non-homogeneous state-affine systemscited by 39
- 2023Universality of Linear Recurrences Followed by Non-linear Projections: Finite-Width Guarantees and Benefits of Complex Eigenvaluescited by 36
- 2023Online learning of long-range dependenciescited by 25
Built on by
Citing papers per year: 2023: 1; 2024: 6.
7 papers.
- 2024State Space Model for New-Generation Network Alternative to Transformers: A Surveycited by 59
- 2024Understanding the differences in Foundation Models: Attention, State Space Models, and Recurrent Neural Networkscited by 26
- 2024Fine-grained Analysis of In-context Linear Estimation: Data, Architecture, and Beyondcited by 24
- 2024Learning in the Recurrent State: Gradient Descent with Linear Recurrent Networkscited by 3
- 2023Meta predictive learning model of languages in neural circuitscited by 2
- 2024Learning Randomized Algorithms with Transformerscited by 2
- 2024Fine-tuned network relies on generic representation to solve unseen cognitive taskcited by 0
- 2024Learning in the Recurrent State: Gradient Descent with Linear Recurrent Networks15 Oct 2024
- 2024Learning Randomized Algorithms with Transformers20 Aug 2024
- 2024Fine-grained Analysis of In-context Linear Estimation: Data, Architecture, and Beyond13 Jul 2024
- 2024Fine-tuned network relies on generic representation to solve unseen cognitive task27 Jun 2024
- 2024Understanding the differences in Foundation Models: Attention, State Space Models, and Recurrent Neural Networks24 May 2024
- 2024State Space Model for New-Generation Network Alternative to Transformers: A Survey15 Apr 2024
- 2023Meta predictive learning model of languages in neural circuits8 Sep 2023