mlsanityData to 14 Oct 2026

In-Context Algebra

arXiv 2512.16902 ↗First posted 18 Dec 2025cs.CL cs.LGcited by 5

Not on the map. Why?

Abstract (arXiv)

We investigate the mechanisms that arise when transformers are trained to solve arithmetic on sequences where tokens are variables whose meaning is determined only through their interactions in-context. While prior work has studied transformers in settings where the answer relies on fixed parametric or geometric information encoded in token embeddings, we devise a new in-context reasoning task where the assignment of tokens to specific algebraic elements varies from one sequence to another. Despite this challenging setup, transformers achieve near-perfect accuracy on the task and even generalize to unseen groups. We develop targeted data distributions to create causal tests of a set of hypothesized mechanisms, and we isolate three mechanisms models consistently learn: commutative copying where a dedicated head copies answers, identity element recognition that distinguishes identity-containing facts, and closure-based cancellation that tracks group membership to constrain valid answers. Our findings show that the kinds of reasoning strategies learned by transformers are dependent on the task structure and that models can develop symbolic reasoning mechanisms when trained to reason in-context about variables whose meanings are not fixed.

Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Builds on 71 of its 88 references that are in the map. First posted on arXiv 18 Dec 2025.

Builds on

71 of 88 references.

References · 71

  1. 2017Attention Is All You Needcited by 60,361
  2. 2020Language Models are Few-Shot Learnerscited by 32,419
  3. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
  4. 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,703
  5. 2013Distributed Representations of Words and Phrases and their Compositionalitycited by 3,474
  6. 2022Locating and Editing Factual Associations in GPTcited by 2,691
  7. 2016Understanding intermediate layers using linear classifier probescited by 1,353
  8. 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,165
  9. 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 938
  10. 2021Probing Classifiers: Promises, Shortcomings, and Advancescited by 876
  11. 2023Progress measures for grokking via mechanistic interpretabilitycited by 839
  12. 2022Transformers learn in-context by gradient descentcited by 732
38 more
  1. 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 684
  2. 2022Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasetscited by 629
  3. 2024GSM-Symbolic: Understanding the Limitations of Mathematical Reasoning in Large Language Modelscited by 550
  4. 2022Emergent World Representations: Exploring a Sequence Model Trained on a Synthetic Taskcited by 431
  5. 2023In-Context Learning Creates Task Vectorscited by 312
  6. 2023Function Vectors in Large Language Modelscited by 308
  7. 2013Direct and Indirect Effectscited by 280
  8. 2022Transformers Learn Shortcuts to Automatacited by 268
  9. 2022Towards Understanding Grokking: An Effective Theory of Representation Learningcited by 230
  10. 2023Finding Alignments Between Interpretable Causal Variables and Distributed Neural Representationscited by 209
  11. 2023Causal Abstraction: A Theoretical Foundation for Mechanistic Interpretabilitycited by 205
  12. 2023The Clock and the Pizza: Two Stories in Mechanistic Explanation of Neural Networkscited by 156
  13. 2024Fine-Tuning Enhances Existing Mechanisms: A Case Study on Entity Trackingcited by 149
  14. 2023Pretraining task diversity and the emergence of non-Bayesian in-context learning for regressioncited by 146
  15. 2022Analyzing Transformers in Embedding Spacecited by 132
  16. 2023Sudden Drops in the Loss: Syntax Acquisition, Phase Transitions, and Simplicity Bias in MLMscited by 124
  17. 2023How do Language Models Bind Entities in Context?cited by 108
  18. 2024Physics of Language Models: Part 2.1, Grade-School Math and the Hidden Reasoning Processcited by 108
  19. 2022Unveiling Transformers with LEGO: a synthetic reasoning taskcited by 106
  20. 2022General-Purpose In-Context Learning by Meta-Learning Transformerscited by 105
  21. 2023Interpretability at Scale: Identifying Causal Mechanisms in Alpacacited by 103
  22. 2024Arithmetic Without Algorithms: Language Models Solve Math With a Bag of Heuristicscited by 97
  23. 2024In-Context Language Learning: Architectures and Algorithmscited by 89
  24. 2024What needs to go right for an induction head? A mechanistic study of in-context learning circuits and their formationcited by 89
  25. 2022Meaning without reference in large language modelscited by 76
  26. 2025Language Models Use Trigonometry to Do Additioncited by 70
  27. 2025Which Attention Heads Matter for In-Context Learning?cited by 61
  28. 2024Competition Dynamics Shape Algorithmic Phases of In-Context Learningcited by 54
  29. 2024ICLR: In-Context Learning of Representationscited by 50
  30. 2024A Mechanistic Analysis of a Transformer Trained on a Symbolic Multi-Step Reasoning Taskcited by 49
  31. 2024Identifying Semantic Induction Heads to Understand In-Context Learningcited by 47
  32. 2024NNsight and NDIF: Democratizing Access to Open-Weight Foundation Model Internalscited by 45
  33. 2024Talking Heads: Understanding Inter-layer Communication in Transformer Language Modelscited by 41
  34. 2024Loss Landscape Degeneracy and Stagewise Development in Transformerscited by 40
  35. 2024Learning to grok: Emergence of in-context learning and skill composition in modular arithmetic taskscited by 40
  36. 2024Pre-trained Large Language Models Use Fourier Features to Compute Additioncited by 39
  37. 2025Language Models use Lookbacks to Track Beliefscited by 39
  38. 2024The broader spectrum of in-context learningcited by 35

50 most cited of 71 All 71 (JSON)

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2026: 5.

5 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2026To See the Unseen: on the Generalization Ability of Transformers in Symbolic Reasoning
  2. 2024Unraveling Arithmetic in Large Language Models: The Role of Algebraic Structures
  3. 2025Tokenization Constraints in LLMs: A Study of Symbolic and Arithmetic Reasoning Limits
  4. 2024Grokked Transformers are Implicit Reasoners: A Mechanistic Journey to the Edge of Generalization
  5. 2026The Geometry of Logic: Stratification Induces Semantic Structure and Robust Reasoning
  6. 2025How do Transformers Learn Implicit Reasoning?
  7. 2026Artificial Intelligence for Mathematical Reasoning: An Integrated Survey of Language Models, Neuro-symbolic Systems, and Verified Discovery
  8. 2025Semantic Deception: When Reasoning Models Can't Compute an Addition