Linear Transformers Are Versatile In-Context Learners

Abstract

Recent research has demonstrated that transformers, particularly linear attention models, implicitly execute gradient-descent-like algorithms on data provided in-context during their forward inference step. However, their capability in handling more complex problems remains unexplored. In this paper, we prove that each layer of a linear transformer maintains a weight vector for an implicit linear regression problem and can be interpreted as performing a variant of preconditioned gradient descent. We also investigate the use of linear transformers in a challenging scenario where the training data is corrupted with different levels of noise. Remarkably, we demonstrate that for this problem linear transformers discover an intricate and highly effective optimization algorithm, surpassing or matching in performance many reasonable baselines. We analyze this algorithm and show that it is a novel approach incorporating momentum and adaptive rescaling based on noise levels. Our findings show that even linear transformers possess the surprising ability to discover sophisticated optimization strategies.

Cite

Text

Vladymyrov et al. "Linear Transformers Are Versatile In-Context Learners." Neural Information Processing Systems, 2024. doi:10.52202/079017-1546

Markdown

[Vladymyrov et al. "Linear Transformers Are Versatile In-Context Learners." Neural Information Processing Systems, 2024.](https://mlanthology.org/neurips/2024/vladymyrov2024neurips-linear/) doi:10.52202/079017-1546

BibTeX

@inproceedings{vladymyrov2024neurips-linear,
  title     = {{Linear Transformers Are Versatile In-Context Learners}},
  author    = {Vladymyrov, Max and von Oswald, Johannes and Sandler, Mark and Ge, Rong},
  booktitle = {Neural Information Processing Systems},
  year      = {2024},
  doi       = {10.52202/079017-1546},
  url       = {https://mlanthology.org/neurips/2024/vladymyrov2024neurips-linear/}
}