paper-with-me

홈 › Papers

Transformers Don't In-Context Learn Least Squares Regression

2025-07-13 · Joshua Hill, Benjamin Eyre, Elliot Creager arxiv

In-context learning (ICL) has emerged as a powerful capability of large pretrained transformers, enabling them to solve new tasks implicit in example input-output pairs without any gradient updates. Despite its practical success, the mechanisms underlying ICL remain largely mysterious. In this work we study synthetic linear regression to probe how transformers implement learning at inference time. Previous works have demonstrated that transformers match the performance of learning rules such as Ordinary Least Squares (OLS) regression or gradient descent and have suggested ICL is facilitated in transformers through the learned implementation of one of these techniques. In this work, we demonstrate through a suite of out-of-distribution generalization experiments that transformers trained for ICL fail to generalize after shifts in the prompt distribution, a behaviour that is inconsistent with the notion of transformers implementing algorithms such as OLS. Finally, we highlight the role of the pretraining corpus in shaping ICL behaviour through a spectral analysis of the learned representations in the residual stream. Inputs from the same distribution as the training data produce representations with a unique spectral signature: inputs from this distribution tend to have the same top two singular vectors. This spectral signature is not shared by out-of-distribution inputs, and a metric characterizing the presence of this signature is highly correlated with low loss.

📄 PDF Abstract BibTeX arXiv:2507.09440

Code (0)

등록된 구현이 없습니다.

Similar Papers 제목 키워드 기반

In-context learning of closed form solution to simple linear regression task using transformer with linear self-attention

2026-07-17 · Katsuyuki Hagiwara arxiv

In-context learning is a remarkable property of transformers and has recently received a lot of interest. In many studies of in-context learning, it has been shown that transformers are capable of implementing solver for…

One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attention

2023-07-07 · Arvind Mahankali, Tatsunori B. Hashimoto, Tengyu Ma

Recent works have empirically analyzed in-context learning and shown that transformers trained on synthetic linear regression tasks can learn to implement ridge regression, which is the Bayes-optimal predictor, given suf…

In-Context Learningregression

Transformers Handle Endogeneity in In-Context Linear Regression

2024-10-02 · Haodong Liang, Krishnakumar Balasubramanian, Lifeng Lai

We explore the capability of transformers to address endogeneity in in-context linear regression. Our main finding is that transformers inherently possess a mechanism to handle endogeneity effectively using instrumental …

regression

A Closer Look at In-Context Learning under Distribution Shifts

2023-05-26 · Kartik Ahuja, David Lopez-Paz

In-context learning, a capability that enables a model to learn from input examples on the fly without necessitating weight updates, is a defining characteristic of large language models. In this work, we follow the sett…

In-Context Learning

What learning algorithm is in-context learning? Investigations with linear models

2022-11-28 · Ekin Akyürek, Dale Schuurmans, Jacob Andreas, Tengyu Ma 외

Neural sequence models, especially transformers, exhibit a remarkable capacity for in-context learning. They can construct new predictors from sequences of labeled examples $(x, f(x))$ presented in the input without furt…

In-Context Learningregression