Learning Linear Regression with Low-Rank Tasks In-Context

Kaito Takanami, Takashi Takahashi, Yoshiyuki Kabashima

TL;DR

This paper provides a theoretical framework for understanding how In-Context Learning (ICL) works in large language models, particularly when tasks share underlying structures. By analyzing a simplified linear attention model, the authors reveal that ICL acts as a noise-reduction mechanism, leveraging implicit regularization from finite data to learn task structures effectively, and exhibiting a sharp phase transition in performance based on task difficulty.

What Problem Does This Paper Address?

In-context learning (ICL) is a remarkable capability of modern large language models (LLMs), allowing them to perform new tasks by simply observing a few examples in the prompt, without any parameter updates. However, the theoretical underpinnings of how ICL achieves this remain largely mysterious, especially in real-world scenarios where tasks are not independent but share common structures. Existing theoretical work often focuses on independent tasks or simplified models, lacking a deep understanding of how transformers learn to generalize across structured task families. This paper aims to bridge this gap by theoretically analyzing ICL in the context of low-rank regression tasks, a setting that captures essential aspects of structured learning.

Methods

The authors employ a theoretical approach using a simplified linear attention model trained on low-rank regression tasks. They analyze this model in the high-dimensional asymptotic limit, which allows for precise characterization of its behavior. Key techniques include:

  • Decomposition of ICL prediction: The prediction is broken down into an algorithmic signal and two noise terms (memorization and structure noise), revealing how ICL selectively suppresses noise.
  • Implicit Regularization: The study demonstrates that finite pre-training data, contrary to intuition, induces an implicit regularization that stabilizes learning, preventing instability observed in idealized, infinite-data scenarios.
  • Spectral Analysis: The authors analyze the eigenvalue distribution of the task covariance matrix to understand how task structure influences model capabilities.
  • Replica Method: This statistical mechanics technique is used for the high-dimensional analysis, allowing for the computation of order parameters and generalization errors.

Datasets

The paper does not introduce new datasets. Instead, it uses synthetic data generated according to specific distributions designed to model:

  • Pre-training tasks: A collection of tasks sampled from a low-dimensional latent structure.
  • In-distribution generalization tasks: Tasks drawn from the same underlying structure as pre-training tasks.
  • Out-of-distribution generalization tasks: Tasks drawn from a standard Gaussian distribution, lacking the learned low-rank structure.

Key Insights and Ideas

  • ICL as Noise Reduction: The core insight is that ICL acts as a sophisticated noise-reduction mechanism. It learns an algorithmic signal and selectively suppresses memorization and structural noise by leveraging the provided context.
  • Finite Data is Crucial for Stability: Counter-intuitively, finite pre-training data, with its inherent statistical fluctuations, induces an implicit regularization that stabilizes the learning process. Idealized, noise-free data can lead to learning instability.
  • Sharp Phase Transition: The model's generalization capabilities exhibit a sharp phase transition governed by the relationship between task difficulty (rank of the task subspace) and task diversity. This highlights a fundamental trade-off between specialization and robustness.
  • Task Structure Dictates Capabilities: The structure of the task distribution (specifically, its rank and diversity) fundamentally dictates the model's learning capabilities and its ability to generalize.

Key Results

  • Decomposition of Generalization Error: The total generalization error is decomposed into an algorithmic signal, memorization noise, and structural noise, providing a clear mechanistic explanation for ICL performance.
  • Implicit Regularization: The study shows that finite data statistics induce an implicit regularization, crucial for stable learning, especially in low-rank settings.
  • Phase Transition at ρ = κ: A sharp phase transition in generalization error is identified at the point where task difficulty (ρ) equals task diversity (κ).
  • In the task-deficient regime (ρ > κ), performance is bottlenecked by task diversity, and errors plateau.
  • In the task-rich regime (ρ < κ), performance improves with simpler tasks, and a strong alignment between TM and IDG errors indicates effective exploitation of the task structure.
  • Trade-off between Specialization and Robustness: The findings reveal that strong specialization to low-rank task structures (task-rich regime) enhances in-distribution performance but degrades out-of-distribution robustness.

Limitations and Future Work

  • Linear Attention Model: The primary theoretical analysis is conducted on a simplified linear attention model. While this provides tractability and fundamental insights, it may not fully capture the complexities of modern, non-linear transformer architectures. The paper does include experiments with a non-linear softmax attention model, which qualitatively reproduce some of the linear model's findings, but a full theoretical understanding of non-linear attention remains an open question.
  • High-Dimensional Limit: The analysis relies on the high-dimensional asymptotic limit. While this is a standard and powerful tool for theoretical analysis, it may not perfectly reflect the behavior of models in finite dimensions.
  • Future Work: The authors suggest that their framework can be extended to study broader classes of ICL models and task structures. The identified phase transition and trade-offs also offer directions for designing more effective pre-training strategies and understanding emergent abilities in LLMs.

Summary updated

BibTeX
@inproceedings{takanami2026learning,
  author = {Kaito Takanami and Takashi Takahashi and Yoshiyuki Kabashima},
  title = {{Learning Linear Regression with Low-Rank Tasks In-Context}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2026},
  url = {https://openreview.net/forum?id=bkhqasdf2u},
}
Figure