mlsanityData to 14 Oct 2026

When Does Depth Matter For In-Context Learning? Adaptive Inference in Deep Transformers

arXiv 2606.16694 ↗First posted 15 Jun 2026cs.LG cs.AI physics.app-phcited by 0

Not on the map. Why?

Abstract (arXiv)

Transformers perform computations through many successive attention and feedforward blocks, allowing them to learn complex correlations between a large collection of coupled variables. When does stacking successive attention-feedforward computations over many layers provide a computational advantage over a single transformer block? We address this question by examining in-context learning in generalized linear attention transformers. We first introduce a general theory of distributed inference in such transformers, subject to constraints on communication and depth. We show that such systems can exploit internal representations (`function vectors') to infer a latent context variable at increasingly finer scales over its layers. For an in-context linear regression task, the theory predicts that while one-layer transformers without feedforward blocks are optimal for Gaussian priors over the context variable, multi-layer transformers are superior for non-Gaussian, tree-like priors. Trained linear attention transformers reproduce quantitative predictions from the theory. Using causal key-patching experiments, we verify that function vectors in intermediate layers mediate adaptive routing of information. Our results suggest that depth and feedforward blocks enable transformers to implement adaptive inference, and this is advantageous when the distribution over latent variables has hierarchical structure.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 42 of its 61 references that are in the map. First posted on arXiv 15 Jun 2026.

Builds on

42 of 61 references.

References · 42

  1. 2017Attention Is All You Needcited by 60,361
  2. 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 33,744
  3. 2020Language Models are Few-Shot Learnerscited by 32,419
  4. 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 30,186
  5. 2020wav2vec 2.0: A Framework for Self-Supervised Learning of Speech Representationscited by 3,905
  6. 2021HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden Unitscited by 2,342
  7. 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 2,022
  8. 2020Rethinking Attention with Performerscited by 1,601
  9. 2020Linformer: Self-Attention with Linear Complexitycited by 1,474
  10. 2017Deep Setscited by 1,421
  11. 2022In-context Learning and Induction Headscited by 964
  12. 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 938
30 more
  1. 2022Transformers learn in-context by gradient descentcited by 732
  2. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
  3. 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 684
  4. 2021Linear Transformers Are Secretly Fast Weight Programmerscited by 502
  5. 2021Transformers Can Do Bayesian Inferencecited by 360
  6. 2023Trained Transformers Learn Linear Models In-Contextcited by 337
  7. 2023In-Context Learning Creates Task Vectorscited by 312
  8. 2023Function Vectors in Large Language Modelscited by 308
  9. 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 298
  10. 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 279
  11. 2016Key-Value Memory Networks for Directly Reading Documentscited by 223
  12. 2023Birth of a Transformer: A Memory Viewpointcited by 161
  13. 2023The emergence of clusters in self-attention dynamicscited by 140
  14. 2021Sinkformers: Transformers with Doubly Stochastic Attentioncited by 138
  15. 2016Towards a Neural Statisticiancited by 121
  16. 2023The mechanistic basis of data dependence and abrupt learning in an in-context classification taskcited by 118
  17. 2019Meta-learning of Sequential Strategiescited by 70
  18. 2025Which Attention Heads Matter for In-Context Learning?cited by 61
  19. 2024Asymptotic theory of in-context learning by linear attentioncited by 55
  20. 2024ICLR: In-Context Learning of Representationscited by 50
  21. 2025Training Dynamics of In-Context Learning in Linear Attentioncited by 46
  22. 2024Emergence of meta-stable clustering in mean-field transformer modelscited by 39
  23. 2021Attention Approximates Sparse Distributed Memorycited by 29
  24. 2024Finding Visual Task Vectorscited by 24
  25. 2025Theory of Scaling Laws for In-Context Regression: Depth, Width, Context and Timecited by 16
  26. 2022Probabilistic Generative Transformer Language models for Generative Design of Moleculescited by 8
  27. 2025On the Role of Transformer Feed-Forward Layers in Nonlinear In-Context Learningcited by 7
  28. 2025In-context denoising with one-layer transformers: connections between attention and associative memory retrievalcited by 7
  29. 2025In-Context Linear Regression Demystified: Training Dynamics and Mechanistic Interpretability of Multi-Head Softmax Attentioncited by 7
  30. 2026Distinct mechanisms underlying in-context learning in transformerscited by 4

Built on by

Not cited yet.