mlsanityData to 13 Oct 2026

Emergence and Effectiveness of Task Vectors in In-Context Learning: An Encoder Decoder Perspective

arXiv 2412.12276 ↗First posted 16 Dec 2024cs.CL cs.AI cs.LGcited by 9

Not on the map. Why?

Abstract (arXiv)

Autoregressive transformers exhibit adaptive learning through in-context learning (ICL), which begs the question of how. Prior works have shown that transformers represent the ICL tasks as vectors in their representations. In this paper, we leverage the encoding-decoding framework to study how transformers form task vectors during pretraining and how their task encoding quality predicts ICL task performance. On synthetic ICL tasks, we analyze the training dynamics of a small transformer and report the coupled emergence of task encoding and decoding. As the model learns to encode different latent tasks (e.g., "Finding the first noun in a sentence.") into distinct, separable representations, it concurrently builds conditional decoding algorithms and improves its ICL performance. We validate this phenomenon across pretrained models of varying scales (Gemma-2 2B/9B/27B, Llama-3.1 8B/70B) and over the course of pretraining in OLMo-7B. Further, we demonstrate that the quality of task encoding inferred from representations predicts ICL performance, and that, surprisingly, finetuning the earlier layers can improve the task encoding and performance more than finetuning the latter layers. Our empirical insights shed light into better understanding the success and failure modes of large language models via their representations.

Key facts. Cited by 9 papers in the map (data through 13 Oct 2026). Builds on 42 of its 57 references that are in the map. First posted on arXiv 16 Dec 2024.

Builds on

42 of 57 references.

References · 42

  1. 2020Language Models are Few-Shot Learnerscited by 32,320
  2. 2023Mamba: Linear-Time Sequence Modeling with Selective State Spacescited by 4,658
  3. 2020The Pile: An 800GB Dataset of Diverse Text for Language Modelingcited by 2,379
  4. 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 1,994
  5. 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,424
  6. 2023Sparse Autoencoders Find Highly Interpretable Features in Language Modelscited by 1,391
  7. 2016Understanding intermediate layers using linear classifier probescited by 1,313
  8. 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 925
  9. 2022Fine-Tuning can Distort Pretrained Features and Underperform Out-of-Distributioncited by 732
  10. 2022Transformers learn in-context by gradient descentcited by 720
  11. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 706
  12. 2023The Geometry of Truth: Emergent Linear Structure in Large Language Model Representations of True/False Datasetscited by 693
30 more
  1. 2024Dolma: an Open Corpus of Three Trillion Tokens for Language Model Pretraining Researchcited by 477
  2. 2023In-Context Learning Creates Task Vectorscited by 305
  3. 2023Function Vectors in Large Language Modelscited by 299
  4. 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 293
  5. 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 276
  6. 2023Transformers as Algorithms: Generalization and Stability in In-context Learningcited by 221
  7. 2024How to use and interpret activation patchingcited by 202
  8. 2020Causal Mediation Analysis for Interpreting Neural NLP: The Case of Gender Biascited by 187
  9. 2023Take a Step Back: Evoking Reasoning via Abstraction in Large Language Modelscited by 158
  10. 2023Large Language Models Are Latent Variable Models: Explaining and Finding Good Demonstrations for In-Context Learningcited by 149
  11. 2022Impact of Pretraining Term Frequencies on Few-Shot Reasoningcited by 142
  12. 2023Pretraining task diversity and the emergence of non-Bayesian in-context learning for regressioncited by 138
  13. 2023Circuit Component Reuse Across Tasks in Transformer Language Modelscited by 105
  14. 2023Language Models Implement Simple Word2Vec-style Vector Arithmeticcited by 98
  15. 2023Phenomenal Yet Puzzling: Testing Inductive Reasoning Capabilities of Language Models with Hypothesis Refinementcited by 89
  16. 2024In-Context Language Learning: Architectures and Algorithmscited by 88
  17. 2024Truth is Universal: Robust Detection of Lies in LLMscited by 79
  18. 2022Discovering Latent Concepts Learned in BERTcited by 56
  19. 2024Value Augmented Sampling for Language Model Alignment and Personalizationcited by 49
  20. 2024Learning to grok: Emergence of in-context learning and skill composition in modular arithmetic taskscited by 40
  21. 2022Prompting Language Models for Linguistic Structurecited by 39
  22. 2024Emergence of Hidden Capabilities: Exploring Learning Dynamics in Concept Spacecited by 34
  23. 2024Not All LLM Reasoners Are Created Equalcited by 30
  24. 2023Prompting Frameworks for Large Language Models: A Surveycited by 29
  25. 2024Refusal in LLMs is an Affine Functioncited by 28
  26. 2024Does learning the right latent variables necessarily improve in-context learning?cited by 13
  27. 2024Abstraction-of-Thought Makes Language Models Better Reasonerscited by 11
  28. 2020On Convergence of Nearest Neighbor Classifiers over Feature Transformationscited by 7
  29. 2024Comparing Abstraction in Humans and Large Language Models Using Multimodal Serial Reproductioncited by 2
  30. 2024Why does in-context learning fail sometimes? Evaluating in-context learning on open and closed questionscited by 2

Built on by

Cited by year (2026 to 13 Oct)

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

9 papers.