Label Words are Anchors: An Information Flow Perspective for Understanding In-Context Learning
Lean Wang, Lei Li, Damai Dai, Deli Chen, Hao Zhou, Fandong Meng, Jie Zhou, Xu Sun
Abstract
In-context learning (ICL) emerges as a promising capability of large language models (LLMs) by providing them with demonstration examples to perform diverse tasks. However, the underlying mechanism of how LLMs learn from the provided context remains under-explored. In this paper, we investigate the working mechanism of ICL through an information flow lens. Our findings reveal that label words in the demonstration examples function as anchors: (1) semantic information aggregates into label word representations during the shallow computation layers' processing; (2) the consolidated information in label words serves as a reference for LLMs' final predictions. Based on these insights, we introduce an anchor re-weighting method to improve ICL performance, a demonstration compression technique to expedite inference, and an analysis framework for diagnosing ICL errors in GPT2-XL. The promising applications of our findings again validate the uncovered ICL working mechanism and pave the way for future studies. 1
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
133 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Function Vectors in Large Language Models cites An Explanation of In-context Learning as Implicit Bayesian Inference
- Function Vectors in Large Language Models cites Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?
- Function Vectors in Large Language Models cites Language Models are Few-Shot Learners
- Function Vectors in Large Language Models cites Transformers Learn In-Context by Gradient Descent
- Implicit In-context Learning cites A Survey on In-context Learning
- Implicit In-context Learning cites An Explanation of In-context Learning as Implicit Bayesian Inference
- Implicit In-context Learning cites Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?
- Implicit In-context Learning cites Language Models are Few-Shot Learners
- Implicit In-context Learning cites Transformers Learn In-Context by Gradient Descent
- What needs to go right for an induction head? A mechanistic study of in-context learning circuits and their formation cites An Explanation of In-context Learning as Implicit Bayesian Inference
- What needs to go right for an induction head? A mechanistic study of in-context learning circuits and their formation cites Language Models are Few-Shot Learners
- What needs to go right for an induction head? A mechanistic study of in-context learning circuits and their formation cites Transformers Learn In-Context by Gradient Descent
- A Survey on In-context Learning cites An Explanation of In-context Learning as Implicit Bayesian Inference
- A Survey on In-context Learning cites Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?
- A Survey on In-context Learning cites Language Models are Few-Shot Learners
- A Survey on In-context Learning cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- A Survey on In-context Learning cites Transformers Learn In-Context by Gradient Descent
- From Yes-Men to Truth-Tellers: Addressing Sycophancy in Large Language Models with Pinpoint Tuning cites Language Models are Few-Shot Learners
- From Yes-Men to Truth-Tellers: Addressing Sycophancy in Large Language Models with Pinpoint Tuning cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- An Explanation of In-context Learning as Implicit Bayesian Inference cites Language Models are Few-Shot Learners
- Rethinking the Role of Demonstrations: What Makes In-Context Learning Work? cites Language Models are Few-Shot Learners
- Rethinking the Role of Demonstrations: What Makes In-Context Learning Work? cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Transformers Learn In-Context by Gradient Descent cites Language Models are Few-Shot Learners
Cited by top-tier papers133
- Implicit In-context LearningZhuowei Li, Zihao Xu, Ligong Han, Yunhe Gao et al.ICLR 2025 · 1,989 citations
- A Survey on In-context LearningQingxiu Dong, Lei Li, Damai Dai, Ce Zheng et al.EMNLP 2024 · 479 citations
- Function Vectors in Large Language ModelsEric Todd, Millicent L. Li, Arnab Sen Sharma, Aaron Mueller et al.ICLR 2024 · 229 citations
- What needs to go right for an induction head? A mechanistic study of in-context learning circuits and their formationAaditya K. Singh, Ted Moskovitz, Felix Hill, Stephanie C. Y. Chan et al.ICML 2024 · 77 citations
- From Yes-Men to Truth-Tellers: Addressing Sycophancy in Large Language Models with Pinpoint TuningWei Chen, Zhen Huang, Liang Xie, Binbin Lin et al.ICML 2024 · 55 citations
Builds on11
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
- An Explanation of In-context Learning as Implicit Bayesian InferenceSang Michael Xie, Aditi Raghunathan, Percy Liang, Tengyu MaICLR 2022 · 1,030 citations
- Transformers Learn In-Context by Gradient DescentJohannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento et al.ICML 2023 · 729 citations
- Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?Sewon Min, Xinxi Lyu, Ari Holtzman, Mikel Artetxe et al.EMNLP 2022 · 634 citations
Related papers
- Revisiting In-context Learning Inference Circuit in Large Language ModelsHakaze Cho, Mariko Kato, Yoshihiro Sakai, Naoya InoueICLR 2025
- Interpret and Improve In-Context Learning via the Lens of Input-Label MappingsChenghao Sun, Zhen Huang, Yonggang Zhang, Le Lu et al.ACL 2025 · 1 citation
- What Do Language Models Learn in Context? The Structured Task HypothesisJiaoda Li, Yifan Hou, Mrinmaya Sachan, Ryan CotterellACL 2024 · 5 citations
- In-Context Learning Learns Label Relationships but Is Not Conventional LearningJannik Kossen, Yarin Gal, Tom RainforthICLR 2024 · 61 citations
- Improving Input-label Mapping with Demonstration Replay for In-context LearningZhuocheng Gong, Jiahao Liu, Qifan Wang, Jingang Wang et al.EMNLP Findings 2023
