mlsanityData to 14 Oct 2026

Learning Task Representations from In-Context Learning

arXiv 2502.05390 ↗First posted 8 Feb 2025cs.CL cs.LGcited by 11

Not on the map. Why?

Abstract (arXiv)

Large language models (LLMs) have demonstrated remarkable proficiency in in-context learning (ICL), where models adapt to new tasks through example-based prompts without requiring parameter updates. However, understanding how tasks are internally encoded and generalized remains a challenge. To address some of the empirical and technical gaps in the literature, we introduce an automated formulation for encoding task information in ICL prompts as a function of attention heads within the transformer architecture. This approach computes a single task vector as a weighted sum of attention heads, with the weights optimized causally via gradient descent. Our findings show that existing methods fail to generalize effectively to modalities beyond text. In response, we also design a benchmark to evaluate whether a task vector can preserve task fidelity in functional regression tasks. The proposed method successfully extracts task-specific information from in-context demonstrations and excels in both text and regression tasks, demonstrating its generalizability across modalities.

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

Builds on

49 of 78 references.

References · 49

  1. 2017Attention Is All You Needcited by 60,361
  2. 2014Adam: A Method for Stochastic Optimizationcited by 37,240
  3. 2020Language Models are Few-Shot Learnerscited by 32,419
  4. 2022Locating and Editing Factual Associations in GPTcited by 2,691
  5. 2015Character-level Convolutional Networks for Text Classificationcited by 2,330
  6. 2018CommonsenseQA: A Question Answering Challenge Targeting Commonsense Knowledgecited by 1,822
  7. 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,434
  8. 2023Inference-Time Intervention: Eliciting Truthful Answers from a Language Modelcited by 1,302
  9. 2022Editing Models with Task Arithmeticcited by 1,120
  10. 2023Steering Llama 2 via Contrastive Activation Additioncited by 1,085
  11. 2019What Does BERT Look At? An Analysis of BERT's Attentioncited by 1,003
  12. 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 938
37 more
  1. 2019Attention is not Explanationcited by 929
  2. 2019Analyzing Multi-Head Self-Attention: Specialized Heads Do the Heavy Lifting, the Rest Can Be Prunedcited by 856
  3. 2022Transformers learn in-context by gradient descentcited by 732
  4. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
  5. 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 684
  6. 2019Attention is not not Explanationcited by 636
  7. 2023Dissecting Recall of Factual Associations in Auto-Regressive Language Modelscited by 528
  8. 2017Word Translation Without Parallel Datacited by 487
  9. 2023Larger language models do in-context learning differentlycited by 394
  10. 2023Learning to Compress Prompts with Gist Tokenscited by 390
  11. 2023In-Context Learning Creates Task Vectorscited by 312
  12. 2019Revealing the Dark Secrets of BERTcited by 301
  13. 2013Direct and Indirect Effectscited by 280
  14. 2023In-context Vectors: Making In Context Learning More Effective and Controllable Through Latent Space Steeringcited by 245
  15. 2023Label Words are Anchors: An Information Flow Perspective for Understanding In-Context Learningcited by 236
  16. 2022Extracting Latent Steering Vectors from Pretrained Language Modelscited by 225
  17. 2023Transformers as Algorithms: Generalization and Stability in In-context Learningcited by 222
  18. 2019Visualizing and Measuring the Geometry of BERTcited by 216
  19. 2023Linearity of Relation Decoding in Transformer Language Modelscited by 200
  20. 2022Instruction Induction: From Few Examples to Natural Language Task Descriptionscited by 152
  21. 2023What In-Context Learning "Learns" In-Context: Disentangling Task Recognition and Task Learningcited by 152
  22. 2023Large Language Models Are Latent Variable Models: Explaining and Finding Good Demonstrations for In-Context Learningcited by 149
  23. 2023The Learnability of In-Context Learningcited by 127
  24. 2019Open Sesame: Getting Inside BERT's Linguistic Knowledgecited by 120
  25. 2023What and How does In-Context Learning Learn? Bayesian Model Averaging, Parameterization, and Generalizationcited by 118
  26. 2022Ground-Truth Labels Matter: A Deeper Look into Input-Label Demonstrationscited by 116
  27. 2023Task-Specific Skill Localization in Fine-tuned Language Modelscited by 105
  28. 2023Language Models Implement Simple Word2Vec-style Vector Arithmeticcited by 98
  29. 2018Context-Aware Neural Machine Translation Learns Anaphora Resolutioncited by 97
  30. 2019Do Attention Heads in BERT Track Syntactic Dependencies?cited by 88
  31. 2023Overthinking the Truth: Understanding how Language Models Process False Demonstrationscited by 81
  32. 2022Finding Skill Neurons in Pre-trained Transformer-based Language Modelscited by 66
  33. 2019Learning to Make Analogies by Contrasting Abstract Relational Structurecited by 53
  34. 2017Distinguishing Antonyms and Synonyms in a Pattern-based Neural Networkcited by 19
  35. 2023Dissecting Chain-of-Thought: Compositionality through In-Context Filtering and Learningcited by 19
  36. 2024In-Context Learning State Vector with Inner and Momentum Optimizationcited by 15
  37. 2024From Unstructured Data to In-Context Learning: Exploring What Tasks Can Be Learned and Whencited by 3

Built on by

Cited by year (2026 to 14 Oct)

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

11 papers.