mlsanityData to 7 Oct 2026

On the Role of Transformer Feed-Forward Layers in Nonlinear In-Context Learning

arXiv 2501.18187 ↗First posted 30 Jan 2025cs.LG cs.AIcited by 7

Not on the map. Why?

Abstract (arXiv)

Transformer-based models demonstrate a remarkable ability for in-context learning (ICL), where they can adapt to unseen tasks from a few prompt examples without parameter updates. Recent research has illuminated how Transformers perform ICL, showing that the optimal linear self-attention (LSA) mechanism can implement one step of gradient descent for linear least-squares objectives when trained on random linear regression tasks. Building on this, we investigate ICL for nonlinear function classes. We first prove that LSA is inherently incapable of outperforming linear predictors on nonlinear tasks, underscoring why prior solutions cannot readily extend to these problems. To overcome this limitation, we analyze a Transformer block consisting of LSA and feed-forward layers inspired by the gated linear units (GLU), which is a standard component of modern Transformers. We show that this block achieves nonlinear ICL by implementing one step of gradient descent on a polynomial kernel regression loss. Furthermore, our analysis reveals that the expressivity of a single block is inherently limited by its dimensions. We then show that a deep Transformer can overcome this bottleneck by distributing the computation of richer kernel functions across multiple blocks, performing block-coordinate descent in a high-dimensional feature space that a single block cannot represent. Our findings highlight that the feed-forward layers provide a crucial and scalable mechanism by which Transformers can express nonlinear representations for ICL.

Key facts. Cited by 7 papers in the map (data through 7 Oct 2026). Builds on 40 of its 47 references that are in the map. First posted on arXiv 30 Jan 2025.

Builds on

40 of 47 references.

References · 40

  1. 2017Attention Is All You Needcited by 59,932
  2. 2020Language Models are Few-Shot Learnerscited by 32,199
  3. 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
  4. 2023GPT-4 Technical Reportcited by 18,132
  5. 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,530
  6. 2022Robust Speech Recognition via Large-Scale Weak Supervisioncited by 3,972
  7. 2022Emergent Abilities of Large Language Modelscited by 2,483
  8. 2020GLU Variants Improve Transformercited by 1,724
  9. 2024Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Dualitycited by 1,283
  10. 2022In-context Learning and Induction Headscited by 930
  11. 2022Transformers learn in-context by gradient descentcited by 714
  12. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
28 more
  1. 2016Language Modeling with Gated Convolutional Networkscited by 688
  2. 2023The Dawn of LMMs: Preliminary Explorations with GPT-4V(ision)cited by 677
  3. 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 671
  4. 2023Gated Linear Attention Transformers with Hardware-Efficient Trainingcited by 490
  5. 2024Gated Delta Networks: Improving Mamba2 with Delta Rulecited by 483
  6. 2021MetaICL: Learning to Learn In Contextcited by 450
  7. 2023Trained Transformers Learn Linear Models In-Contextcited by 331
  8. 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
  9. 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 274
  10. 2023Looped Transformers as Programmable Computerscited by 224
  11. 2023Transformers as Algorithms: Generalization and Stability in In-context Learningcited by 220
  12. 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 168
  13. 2025MiniMax-01: Scaling Foundation Models with Lightning Attentioncited by 157
  14. 2021Inductive Biases and Variable Creation in Self-Attention Mechanismscited by 144
  15. 2023The mechanistic basis of data dependence and abrupt learning in an in-context classification taskcited by 115
  16. 2024How Transformers Learn Causal Structure with Gradient Descentcited by 114
  17. 2023In-Context Convergence of Transformerscited by 112
  18. 2021Statistically Meaningful Approximation: a Case Study on Approximating Turing Machines with Transformerscited by 101
  19. 2023Linear attention is (maybe) all you need (to understand transformer optimization)cited by 97
  20. 2023How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression?cited by 93
  21. 2023Transformers as Decision Makers: Provable In-Context Reinforcement Learning via Supervised Pretrainingcited by 82
  22. 2023How Do Transformers Learn In-Context Beyond Simple Functions? A Case Study on Learning with Representationscited by 72
  23. 2024Training Dynamics of Multi-Head Softmax Attention for In-Context Learning: Emergence, Convergence, and Optimalitycited by 71
  24. 2023Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In Contextcited by 63
  25. 2023Understanding In-Context Learning in Transformers and LLMs by Learning to Learn Discrete Functionscited by 62
  26. 2024In-Context Learning with Representations: Contextual Generalization of Trained Transformerscited by 36
  27. 2024In-Context Learning of a Linear Transformer Block: Benefits of the MLP Component and One-Step GD Initializationcited by 30
  28. 2024Pretrained transformer efficiently learns low-dimensional target functions in-contextcited by 29

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 2; 2026: 5.

7 papers.