Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In Context

Xiang Cheng, Yuxin Chen, S. Sra
2/12/2026

No official code found. Best implementation: Anthoooooony1105/TF-FGD (0 stars, last commit 2025-09-02).

Abstract

Many neural network architectures are known to be Turing Complete, and can thus, in principle implement arbitrary algorithms. However, Transformers are unique in that they can implement gradient-based learning algorithms under simple parameter configurations. This paper provides theoretical and empirical evidence that (non-linear) Transformers naturally learn to implement gradient descent in function space, which in turn enable them to learn non-linear functions in context. Our results apply to a broad class of combinations of non-linear architectures and non-linear in-context learning tasks. Additionally, we show that the optimal choice of non-linear activation depends in a natural way on the class of functions that need to be learned.

View on arXivView PDF

Code Implementations(1)

This repository contains the code for the reproducing some of the experiments in the paper Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In Context

00PythonSep 2, 20251 years ago

Similar Papers

Cite this paper

@article{cheng2026transformers,
  title  = {Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In Context},
  author = {Xiang Cheng and Yuxin Chen and S. Sra},
  year   = {2026},
  eprint = {2312.06528},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2312.06528},
  journal = {ICML 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2312.06528.svg)](https://codeofpaper.com/paper/2312.06528)

Discussion