Transformers Meet In-Context Learning: A Universal Approximation Theory

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Li, Gen, Jiao, Yuchen, Huang, Yu, Wei, Yuting, Chen, Yuxin
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866908507210514432
author Li, Gen
Jiao, Yuchen
Huang, Yu
Wei, Yuting
Chen, Yuxin
author_facet Li, Gen
Jiao, Yuchen
Huang, Yu
Wei, Yuting
Chen, Yuxin
contents Large language models are capable of in-context learning, the ability to perform new tasks at test time using a handful of input-output examples, without parameter updates. We develop a universal approximation theory to elucidate how transformers enable in-context learning. For a general class of functions (each representing a distinct task), we demonstrate how to construct a transformer that, without any further weight updates, can predict based on a few noisy in-context examples with vanishingly small risk. Unlike prior work that frames transformers as approximators of optimization algorithms (e.g., gradient descent) for statistical learning tasks, we integrate Barron's universal function approximation theory with the algorithm approximator viewpoint. Our approach yields approximation guarantees that are not constrained by the effectiveness of the optimization algorithms being mimicked, extending far beyond convex problems like linear regression. The key is to show that (i) any target function can be nearly linearly represented, with small $\ell_1$-norm, over a set of universal features, and (ii) a transformer can be constructed to find the linear representation -- akin to solving Lasso -- at test time.
format Preprint
id arxiv_https___arxiv_org_abs_2506_05200
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Transformers Meet In-Context Learning: A Universal Approximation Theory
Li, Gen
Jiao, Yuchen
Huang, Yu
Wei, Yuting
Chen, Yuxin
Machine Learning
Statistics Theory
Large language models are capable of in-context learning, the ability to perform new tasks at test time using a handful of input-output examples, without parameter updates. We develop a universal approximation theory to elucidate how transformers enable in-context learning. For a general class of functions (each representing a distinct task), we demonstrate how to construct a transformer that, without any further weight updates, can predict based on a few noisy in-context examples with vanishingly small risk. Unlike prior work that frames transformers as approximators of optimization algorithms (e.g., gradient descent) for statistical learning tasks, we integrate Barron's universal function approximation theory with the algorithm approximator viewpoint. Our approach yields approximation guarantees that are not constrained by the effectiveness of the optimization algorithms being mimicked, extending far beyond convex problems like linear regression. The key is to show that (i) any target function can be nearly linearly represented, with small $\ell_1$-norm, over a set of universal features, and (ii) a transformer can be constructed to find the linear representation -- akin to solving Lasso -- at test time.
title Transformers Meet In-Context Learning: A Universal Approximation Theory
topic Machine Learning
Statistics Theory
url https://arxiv.org/abs/2506.05200