Efficient and Minimax-optimal In-context Nonparametric Regression with Transformers
Michelle Ching, Ioana Popescu, Nico Smith, Tianyi Ma, William G. Underwood, Richard J. Samworth
TL;DR
This work addresses in-context learning for nonparametric regression with $α$-Hölder functions in $d$ dimensions, and proves that a pretrained transformer with $Θ(\log n)$ parameters and $Ω(n^{2α/(2α+d)}\log^3 n)$ pretraining sequences can achieve the minimax rate $O(n^{-2α/(2α+d)})$ in mean squared error. The authors show how a transformer can efficiently approximate local polynomial estimators by implementing a kernel-weighted polynomial basis and then performing gradient descent, leveraging linear attention to realize the optimization steps. The main contributions include a transformer approximation theorem with an $O(1/n)$ excess risk relative to a local polynomial estimator and a global risk bound that matches the minimax rate under mild assumptions, all with significantly fewer parameters and pretraining resources than prior work. This advances the theoretical understanding of ICL for nonparametric regression and suggests practical pathways for building data-efficient, in-context learners using transformer architectures.
Abstract
We study in-context learning for nonparametric regression with $α$-Hölder smooth regression functions, for some $α>0$. We prove that, with $n$ in-context examples and $d$-dimensional regression covariates, a pretrained transformer with $Θ(\log n)$ parameters and $Ω\bigl(n^{2α/(2α+d)}\log^3 n\bigr)$ pretraining sequences can achieve the minimax-optimal rate of convergence $O\bigl(n^{-2α/(2α+d)}\bigr)$ in mean squared error. Our result requires substantially fewer transformer parameters and pretraining sequences than previous results in the literature. This is achieved by showing that transformers are able to approximate local polynomial estimators efficiently by implementing a kernel-weighted polynomial basis and then running gradient descent.
