mlsanityData to 14 Oct 2026

Gated recurrent neural networks discover attention

arXiv 2309.01775 ↗First posted 4 Sep 2023cs.LG cs.NEcited by 7

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

  1. 2017Attention Is All You Needcited by 60,361
  2. 2020Language Models are Few-Shot Learnerscited by 32,419
  3. 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,548
  4. 2021Efficiently Modeling Long Sequences with Structured State Spacescited by 2,465
  5. 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 2,022
  6. 2020Rethinking Attention with Performerscited by 1,601
  7. 2014On the Properties of Neural Machine Translation: Encoder-Decoder Approachescited by 1,304
  8. 2022In-context Learning and Induction Headscited by 964
  9. 2023RWKV: Reinventing RNNs for the Transformer Eracited by 827
  10. 2022Simplified State Space Layers for Sequence Modelingcited by 788
  11. 2022Transformers learn in-context by gradient descentcited by 732
  12. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
20 more
  1. 2016Language Modeling with Gated Convolutional Networkscited by 702
  2. 2020Long Range Arena: A Benchmark for Efficient Transformerscited by 700
  3. 2023Retentive Network: A Successor to Transformer for Large Language Modelscited by 613
  4. 2021Linear Transformers Are Secretly Fast Weight Programmerscited by 502
  5. 2022Hungry Hungry Hippos: Towards Language Modeling with State Space Modelscited by 499
  6. 2023Resurrecting Recurrent Neural Networks for Long Sequencescited by 408
  7. 2018Efficient Attention: Attention with Linear Complexitiescited by 368
  8. 2021Random Feature Attentioncited by 354
  9. 2022Diagonal State Spaces are as Effective as Structured State Spacescited by 350
  10. 2023Trained Transformers Learn Linear Models In-Contextcited by 337
  11. 2022Data Distributional Properties Drive Emergent In-Context Learning in Transformerscited by 309
  12. 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 279
  13. 2019Transformer Dissection: A Unified Understanding of Transformer's Attention via the Lens of Kernelcited by 213
  14. 2016Using Fast Weights to Attend to the Recent Pastcited by 170
  15. 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 170
  16. 2018Differentiable plasticity: training plastic neural networks with backpropagationcited by 84
  17. 2021A Practical Survey on Faster and Lighter Transformerscited by 73
  18. 2017Universal discrete-time reservoir computers with stochastic inputs and linear readouts using non-homogeneous state-affine systemscited by 39
  19. 2023Universality of Linear Recurrences Followed by Non-linear Projections: Finite-Width Guarantees and Benefits of Complex Eigenvaluescited by 36
  20. 2023Online learning of long-range dependenciescited by 25

Built on by

Cited by year

Citing papers per year: 2023: 1; 2024: 6.

7 papers.