English

In-Context Deep Learning via Transformer Models

Machine Learning 2025-04-15 v2

Abstract

We investigate the transformer's capability to simulate the training process of deep models via in-context learning (ICL), i.e., in-context deep learning. Our key contribution is providing a positive example of using a transformer to train a deep neural network by gradient descent in an implicit fashion via ICL. Specifically, we provide an explicit construction of a (2N+4)L(2N+4)L-layer transformer capable of simulating LL gradient descent steps of an NN-layer ReLU network through ICL. We also give the theoretical guarantees for the approximation within any given error and the convergence of the ICL gradient descent. Additionally, we extend our analysis to the more practical setting using Softmax-based transformers. We validate our findings on synthetic datasets for 3-layer, 4-layer, and 6-layer neural networks. The results show that ICL performance matches that of direct training.

Keywords

Cite

@article{arxiv.2411.16549,
  title  = {In-Context Deep Learning via Transformer Models},
  author = {Weimin Wu and Maojiang Su and Jerry Yao-Chieh Hu and Zhao Song and Han Liu},
  journal= {arXiv preprint arXiv:2411.16549},
  year   = {2025}
}

Comments

v2 added numerical results and fixed typos

R2 v1 2026-06-28T20:11:43.034Z