NeFut Logo NeFut
Admin Login

[CS.AI] In-Context Learning: Unveiling Closed-Form Solutions in Linear Regression with Transformers

Published at: 2026-07-21 22:00 Last updated: 2026-07-22 01:01
#algorithm #AI #Machine Learning

In transformer models, in-context learning is a remarkable feature that has gained significant attention recently. Many studies on in-context learning have shown that transformers can solve linear and non-linear regression problems, with most implementing gradient descent algorithms. However, it remains unclear whether these implementations are genuinely acquired through training.

In this paper, we construct a transformer with linear self-attention that in-context learns the least squares estimate in a simple regression task. The key point is that the closed form (analytical) solution is approximately obtained using layer normalization instead of an approximate solution based on the gradient descent algorithm.

We present an experimental example where our implementation is mainly utilized in a transformer trained with l1 regularization, with the target output being the least squares estimate. This method enables effective in-context learning of closed-form solutions for linear regression.

Blogger's Review: This paper showcases the potential of transformers to acquire closed-form solutions in regression tasks through in-context learning, particularly with the innovative use of layer normalization, breaking away from traditional gradient descent implementations. This research contributes to a deeper understanding of transformer models and enhances their application in regression analysis.

Original Source: https://arxiv.org/abs/2607.15819

[h] Back to Home