Theory of Scaling Laws for In-Context Regression: Depth, Width, Context and Time

Blake Bordelon, Mary I. Letey, Cengiz Pehlevan · DOI

Abstract

This paper provides a theoretical framework for understanding how transformer width, depth, context length, and training time interact to determine performance in in-context learning (ICL). By analyzing a solvable "deep linear attention" model, the authors derive Chinchilla-style scaling laws and reveal that while depth is redundant for simple, repetitive tasks, it becomes essential for mastering diverse, structured problems.

Introduction

While scaling up transformers—increasing both width and depth—consistently improves performance, the precise trade-offs between these architectural parameters remain poorly understood. Most existing scaling laws treat models as black boxes, failing to explain how to optimally distribute a compute budget or why certain tasks demand deeper architectures. This is particularly relevant for In-Context Learning (ICL), where a model must solve new tasks using only provided examples. This work bridges the gap between empirical scaling and theoretical understanding by investigating the optimal shape of transformers for ICL.

Theoretical Framework: Deep Linear Self-Attention

To analyze the complex dynamics of transformers, the authors introduce a Deep Linear Self-Attention model. By removing softmax and non-linear activations, they create a mathematically tractable "toy model" that preserves the core residual dynamics of real transformers. The study employs a joint limit where data dimension ($D$), context length ($P$), and model width ($N$) scale proportionally. Using tools from Free Probability Theory and Dynamical Mean Field Theory (DMFT), the authors track information evolution through the residual stream, deriving exact asymptotic formulas for prediction risk.

Task Complexity and the Role of Depth

The research utilizes synthetic dataset types to represent varying ICL task complexities, most notably the Randomly Rotated Structured (RRS) setting. In RRS, each context has a unique covariance, requiring the model to learn a general algorithm rather than memorizing specific data distributions.

A key finding is the "Depth is Redundant" trap: in simple settings with sufficient context, a single layer often suffices. However, in complex settings like RRS, depth becomes an "algorithmic engine." Here, each layer acts as a step in an iterative optimization algorithm (like Gradient Descent), making depth critical for performance.

Asymptotic prediction risk $\mathcal{L}(\alpha)$ as a function of task complexity/context ratio $\alpha$ for varying depths $L$. Theoretical curves (solid lines) closely match simulation results (points).

Scaling Laws and Training Dynamics

The authors derive a unified "ICL Chinchilla Law" for the loss ($\mathcal{L}$): $$\mathcal{L}(t, N, L, P) \approx c_t t^{-\beta_t} + c_N N^{-\beta_N} + c_L L^{-\beta_L} + c_P P^{-\beta_P}$$ This formula demonstrates that training time ($t$), width ($N$), depth ($L$), and context length ($P$) all serve as potential bottlenecks. Scaling one parameter in isolation leads to diminishing returns and eventual plateaus in performance.

Training loss $\mathcal{L}(t, L)$ over pretraining time $t$ for models of different depths $L$. The loss plateaus at lower values for deeper models, illustrating the depth bottleneck.

The study also identifies that the optimal "aspect ratio" (width vs. depth) depends on data complexity, suggesting that for certain tasks, optimal depth should scale with width as $L \propto N^\nu$.

Conclusion

This theoretical work successfully derives power-law exponents for ICL risk and identifies critical bottlenecks in model scaling. While based on linear models, the qualitative findings are validated by experiments on standard Softmax Transformers. Future work may explore "looped" transformers, where the number of layers can be dynamically adjusted at test-time to solve increasingly difficult problems—a concept directly supported by this theory.

Summary updated

BibTeX
@inproceedings{bordelon2026theory,
  author = {Blake Bordelon and Mary I. Letey and Cengiz Pehlevan},
  title = {{Theory of Scaling Laws for In-Context Regression: Depth, Width, Context and Time}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=qA42mWsnbl},
}
Figure