From Compression to Expression: A Layerwise Analysis of In-Context Learning
On the map: Offline RL and imitation learning from data → Language-conditioned policies and VLAs
Abstract (arXiv)
In-context learning (ICL) enables large language models (LLMs) to adapt to new tasks without weight updates by learning from demonstration sequences. While ICL shows strong empirical performance, its internal representational mechanisms are not yet well understood. In this work, we conduct a statistical geometric analysis of ICL representations to investigate how task-specific information is captured across layers. Our analysis reveals an intriguing phenomenon, which we term *Layerwise Compression-Expression*: early layers progressively produce compact and discriminative representations that encode task information from the input demonstrations, while later layers express these representations to incorporate the query and generate the prediction. This phenomenon is observed consistently across diverse tasks and a range of contemporary LLM architectures. We demonstrate that it has important implications for ICL performance -- improving with model size and the number of demonstrations -- and for robustness in the presence of noisy examples. To further understand the effect of the compact task representation, we propose a bias-variance decomposition and provide a theoretical analysis showing how attention mechanisms contribute to reducing both variance and bias, thereby enhancing performance as the number of demonstrations increases. Our findings reveal an intriguing layerwise dynamic in ICL, highlight how structured representations emerge within LLMs, and showcase that analyzing internal representations can facilitate a deeper understanding of model behavior.
Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). Placed in Language-conditioned policies and VLAs, one of 13 directions in Offline RL and imitation learning from data. Builds on 40 of its 51 references that are in the map. First posted on arXiv 22 May 2025.
Builds on
40 of 51 references.
References · 40
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2023Mamba: Linear-Time Sequence Modeling with Selective State Spacescited by 4,718
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,455
- 2023Qwen Technical Reportcited by 3,344
- 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 2,022
- 2023Pythia: A Suite for Analyzing Large Language Models Across Training and Scalingcited by 1,786
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
- 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,135
- 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 938
- 2022Transformers learn in-context by gradient descentcited by 732
- 2020Prevalence of Neural Collapse during the terminal phase of deep learning trainingcited by 719
28 more
- 2024ShortGPT: Layers in Large Language Models are More Redundant Than You Expectcited by 383
- 2018Efficient Attention: Attention with Linear Complexitiescited by 368
- 2020DeeBERT: Dynamic Early Exiting for Accelerating BERT Inferencecited by 332
- 2023In-Context Learning Creates Task Vectorscited by 312
- 2025Layer by Layer: Uncovering Hidden Representations in Language Modelscited by 311
- 2023Function Vectors in Large Language Modelscited by 308
- 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 279
- 2023In-context Vectors: Making In Context Learning More Effective and Controllable Through Latent Space Steeringcited by 245
- 2023Label Words are Anchors: An Information Flow Perspective for Understanding In-Context Learningcited by 236
- 2021A Geometric Analysis of Neural Collapse with Unconstrained Featurescited by 227
- 2022Why Can GPT Learn In-Context? Language Models Implicitly Perform Gradient Descent as Meta-Optimizerscited by 204
- 2021Exploring Deep Neural Networks via Layer-Peeled Model: Minority Collapse in Imbalanced Trainingcited by 166
- 2021Meta-learning via Language Model In-context Tuningcited by 164
- 2020Learning Diverse and Discriminative Representations via the Principle of Maximal Coding Rate Reductioncited by 142
- 2023LLM360: Towards Fully Transparent Open-Source LLMscited by 104
- 2021On the Role of Neural Collapse in Transfer Learningcited by 100
- 2023How Does Information Bottleneck Help Deep Learning?cited by 93
- 2023In-Context Learning Learns Label Relationships but Is Not Conventional Learningcited by 51
- 2023Generalized Neural Collapse for a Large Number of Classescited by 39
- 2024Tracing Representation Progression: Analyzing and Enhancing Layer-Wise Similaritycited by 36
- 2023Understanding Deep Representation Learning via Layerwise Feature Compression and Discriminationcited by 32
- 2025Adaptive Layer-skipping in Pre-trained LLMscited by 27
- 2022Nearest Class-Center Simplification through Intermediate Layerscited by 20
- 2024How do Large Language Models Learn In-Context? Query and Key Matrices of In-Context Heads are Two Towers for Metric Learningcited by 18
- 2024In-Context Learning State Vector with Inner and Momentum Optimizationcited by 15
- 2024A Law of Next-Token Prediction in Large Language Modelscited by 15
- 2024The representation landscape of few-shot learning and fine-tuning in large language modelscited by 15
- 2024DETAIL: Task DEmonsTration Attribution for Interpretable In-context Learningcited by 5
Built on by
Citing papers per year: 2025: 3; 2026: 3.
6 papers.
- 2025Task Vectors, Learned Not Extracted: Performance Gains and Mechanistic Insightcited by 3
- 2025Localizing Task Recognition and Task Learning in In-Context Learning via Attention Head Analysiscited by 2
- 2026Learning to Adapt: In-Context Learning Beyond Stationaritycited by 2
- 2026Decomposing how prompting steers behaviorcited by 2
- 2025In-Context Learning for Non-Stationary MIMO Equalizationcited by 1
- 2026A Study of Crosslinguistic Influence in Language Modelscited by 0
- 2026Decomposing how prompting steers behavior2 Jun 2026
- 2026Learning to Adapt: In-Context Learning Beyond Stationarity13 Apr 2026
- 2026A Study of Crosslinguistic Influence in Language Models29 Jan 2026
- 2025In-Context Learning for Non-Stationary MIMO Equalization9 Oct 2025
- 2025Task Vectors, Learned Not Extracted: Performance Gains and Mechanistic Insight29 Sep 2025
- 2025Localizing Task Recognition and Task Learning in In-Context Learning via Attention Head Analysis29 Sep 2025
Similar, not cited
Close in wording, no citation either way
- 2024Does In-Context Learning Really Learn? Rethinking How Large Language Models Respond and Solve Tasks via In-Context Learning
- 2025On the Relationship Between the Choice of Representation and In-Context Learning
- 2023Is attention required for ICL? Exploring the Relationship Between Model Architecture and In-Context Learning Ability
- 2025Illusion or Algorithm? Investigating Memorization, Emergence, and Symbolic Processing in In-Context Learning
- 2026The Alchemy of Thought: Understanding In-Context Learning Through Supervised Classification
- 2024Revisiting In-context Learning Inference Circuit in Large Language Models
- 2024Can Custom Models Learn In-Context? An Exploration of Hybrid Architecture Performance on In-Context Learning Tasks
- 2024Focused Large Language Models are Stable Many-Shot Learners