mlsanityData to 7 Oct 2026

Towards Understanding How Transformers Learn In-context Through a Representation Learning Lens

arXiv 2310.13220 ↗First posted 20 Oct 2023cs.LGcited by 15

Not on the map. Why?

Abstract (arXiv)

Pre-trained large language models based on Transformers have demonstrated remarkable in-context learning (ICL) abilities. With just a few demonstration examples, the models can implement new tasks without any parameter updates. However, it is still an open question to understand the mechanism of ICL. In this paper, we attempt to explore the ICL process in Transformers through a lens of representation learning. Initially, leveraging kernel methods, we figure out a dual model for one softmax attention layer. The ICL inference process of the attention layer aligns with the training procedure of its dual model, generating token representation predictions that are equivalent to the dual model's test outputs. We delve into the training process of this dual model from a representation learning standpoint and further derive a generalization error bound related to the quantity of demonstration tokens. Subsequently, we extend our theoretical conclusions to more complicated scenarios, including one Transformer layer and multiple attention layers. Furthermore, drawing inspiration from existing representation learning methods especially contrastive learning, we propose potential modifications for the attention layer. Finally, experiments are designed to support our findings.

Key facts. Cited by 15 papers in the map (data through 7 Oct 2026). Builds on 46 of its 59 references that are in the map. First posted on arXiv 20 Oct 2023.

Builds on

46 of 59 references.

References · 46

  1. 2017Attention Is All You Needcited by 59,932
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  3. 2020Language Models are Few-Shot Learnerscited by 32,199
  4. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
  5. 2020A Simple Framework for Contrastive Learning of Visual Representationscited by 11,979
  6. 2018Representation Learning with Contrastive Predictive Codingcited by 7,662
  7. 2019Momentum Contrast for Unsupervised Visual Representation Learningcited by 7,482
  8. 2018GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understandingcited by 4,854
  9. 2020Bootstrap your own latent: A new approach to self-supervised Learningcited by 4,712
  10. 2016Gaussian Error Linear Units (GELUs)cited by 3,431
  11. 2020Exploring Simple Siamese Representation Learningcited by 2,853
  12. 2020Unsupervised Learning of Visual Features by Contrasting Cluster Assignmentscited by 2,845
34 more
  1. 2022Emergent Abilities of Large Language Modelscited by 2,483
  2. 2020Improved Baselines with Momentum Contrastive Learningcited by 2,282
  3. 2021Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processingcited by 2,222
  4. 2019HuggingFace's Transformers: State-of-the-art Natural Language Processingcited by 2,201
  5. 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 1,979
  6. 2018Unsupervised Feature Learning via Non-Parametric Instance-level Discriminationcited by 1,838
  7. 2020Rethinking Attention with Performerscited by 1,584
  8. 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 915
  9. 2021Towards a Unified View of Parameter-Efficient Transfer Learningcited by 863
  10. 2022Transformers learn in-context by gradient descentcited by 714
  11. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
  12. 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 671
  13. 2019A Theoretical Analysis of Contrastive Unsupervised Representation Learningcited by 530
  14. 2021Linear Transformers Are Secretly Fast Weight Programmerscited by 471
  15. 2015Deep Metric Learning via Lifted Structured Feature Embeddingcited by 449
  16. 2021Random Feature Attentioncited by 350
  17. 2023Trained Transformers Learn Linear Models In-Contextcited by 331
  18. 2021CMT: Convolutional Neural Networks Meet Vision Transformerscited by 310
  19. 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
  20. 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 274
  21. 2021Understanding self-supervised Learning Dynamics without Contrastive Pairscited by 254
  22. 2023Label Words are Anchors: An Information Flow Perspective for Understanding In-Context Learningcited by 235
  23. 2023Transformers as Algorithms: Generalization and Stability in In-context Learningcited by 220
  24. 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 168
  25. 2023Large Language Models Are Latent Variable Models: Explaining and Finding Good Demonstrations for In-Context Learningcited by 149
  26. 2016A vector-contraction inequality for Rademacher complexitiescited by 141
  27. 2021SOFT: Softmax-free Transformer with Linear Complexitycited by 128
  28. 2023What and How does In-Context Learning Learn? Bayesian Model Averaging, Parameterization, and Generalizationcited by 112
  29. 2023Uncovering mesa-optimization algorithms in Transformerscited by 94
  30. 2016Orthogonal Random Featurescited by 89
  31. 2022The Dual Form of Neural Networks Revisited: Connecting Test Time Predictions to Training Patterns via Spotlights of Attentioncited by 45
  32. 2023CausalLM is not optimal for in-context learningcited by 26
  33. 2023Non-Parametric Representation Learning with Kernelscited by 11
  34. 2023Simplex Random Featurescited by 9

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 3; 2025: 5; 2026: 7.

15 papers.

Sort:

By area: