mlsanityData to 14 Oct 2026

Understanding In-context Learning of Addition via Activation Subspaces

arXiv 2505.05145 ↗First posted 8 May 2025cs.LG cs.AI cs.CLcited by 8

Not on the map. Why?

Abstract (arXiv)

To perform few-shot learning, language models extract signals from a few input-label pairs, aggregate them into a learned prediction rule, and apply this rule to new inputs. How is this implemented in the forward pass of modern transformer models? To explore this question, we study a structured family of few-shot learning tasks for which the true prediction rule is to add an integer k to the input. We introduce a novel method that localizes the model's few-shot learning ability to only a few attention heads. This method and the findings generalize to four additional task families spanning arithmetic and semantic tasks. We then perform an in-depth analysis of individual heads via dimensionality reduction and decomposition of the heads' output spaces. For example, in Llama-3-8B-Instruct, we reduce the mechanism underlying these tasks to just three attention heads with six-dimensional subspaces, in which four dimensions track the units digit using trigonometric functions with periods 2, 5, and 10, while two dimensions track magnitude using low-frequency components. To deepen our understanding of this mechanism, we also derive a mathematical identity relating the ''aggregator'' and ''extractor'' subspaces of attention heads, allowing us to track the flow of information from individual examples to a final aggregated concept. Our results demonstrate how tracking low-dimensional subspaces of localized heads throughout a forward pass can provide insight into fine-grained computational structures in language models. Our code is available at https://github.com/xyVickyHu/addition-subspaces.

Key facts. Cited by 8 papers in the map (data through 14 Oct 2026). Builds on 46 of its 68 references that are in the map. First posted on arXiv 8 May 2025.

Builds on

46 of 68 references.

References · 46

  1. 2024The Llama 3 Herd of Modelscited by 14,715
  2. 2024Qwen2.5 Technical Reportcited by 4,942
  3. 2022Locating and Editing Factual Associations in GPTcited by 2,691
  4. 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,434
  5. 2023Sparse Autoencoders Find Highly Interpretable Features in Language Modelscited by 1,420
  6. 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,165
  7. 2023Steering Llama 2 via Contrastive Activation Additioncited by 1,085
  8. 2019What Does BERT Look At? An Analysis of BERT's Attentioncited by 1,003
  9. 2023Progress measures for grokking via mechanistic interpretabilitycited by 839
  10. 2022Transformers learn in-context by gradient descentcited by 732
  11. 2023The Linear Representation Hypothesis and the Geometry of Large Language Modelscited by 716
  12. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
34 more
  1. 2024Phi-4 Technical Reportcited by 711
  2. 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 684
  3. 2018What you can cram into a single vector: Probing sentence embeddings for linguistic propertiescited by 457
  4. 2021Causal Abstractions of Neural Networkscited by 422
  5. 2023Trained Transformers Learn Linear Models In-Contextcited by 337
  6. 2023In-Context Learning Creates Task Vectorscited by 312
  7. 2023Function Vectors in Large Language Modelscited by 308
  8. 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 298
  9. 2023Transformers as Algorithms: Generalization and Stability in In-context Learningcited by 222
  10. 2024Not All Language Model Features Are One-Dimensionally Linearcited by 212
  11. 2023How does GPT-2 compute greater-than?: Interpreting mathematical abilities in a pre-trained language modelcited by 202
  12. 2023Birth of a Transformer: A Memory Viewpointcited by 161
  13. 2023The Clock and the Pizza: Two Stories in Mechanistic Explanation of Neural Networkscited by 156
  14. 2023The mechanistic basis of data dependence and abrupt learning in an in-context classification taskcited by 118
  15. 2024How Transformers Learn Causal Structure with Gradient Descentcited by 118
  16. 2023How do Language Models Bind Entities in Context?cited by 108
  17. 2023Interpretability at Scale: Identifying Causal Mechanisms in Alpacacited by 103
  18. 2024Arithmetic Without Algorithms: Language Models Solve Math With a Bag of Heuristicscited by 97
  19. 2023How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression?cited by 96
  20. 2023A Mechanistic Interpretation of Arithmetic Reasoning in Language Models using Causal Mediation Analysiscited by 89
  21. 2024What needs to go right for an induction head? A mechanistic study of in-context learning circuits and their formationcited by 89
  22. 2023Successor Heads: Recurring, Interpretable Attention Heads In The Wildcited by 77
  23. 2023How Do Transformers Learn In-Context Beyond Simple Functions? A Case Study on Learning with Representationscited by 75
  24. 2025Language Models Use Trigonometry to Do Additioncited by 70
  25. 2022Rethinking the Role of Scale for In-Context Learning: An Interpretability-based Case Study at 66 Billion Scalecited by 64
  26. 2025Which Attention Heads Matter for In-Context Learning?cited by 61
  27. 2024Induction Heads as an Essential Mechanism for Pattern Matching in In-context Learningcited by 46
  28. 2024Interpreting and Improving Large Language Models in Arithmetic Calculationcited by 45
  29. 2024Pre-trained Large Language Models Use Fourier Features to Compute Additioncited by 39
  30. 2024Interpreting the Second-Order Effects of Neurons in CLIPcited by 36
  31. 2024Language Models Encode Numbers Using Digit Representations in Base 10cited by 32
  32. 2024Revisiting In-context Learning Inference Circuit in Large Language Modelscited by 17
  33. 2023Arithmetic with Language Models: from Memorization to Computationcited by 12
  34. 2025Contextualize-then-Aggregate: Circuits for In-Context Learning in Gemma-2 2Bcited by 10

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 4; 2026: 4.

8 papers.