How Well Can Transformers Emulate In-context Newton's Method?

Angeliki Giannou, Liu Yang, Tianhao Wang, Dimitris Papailiopoulos, Jason D. Lee
3/5/2024
cs.LGcs.AImath.OC

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

Transformer-based models have demonstrated remarkable in-context learning capabilities, prompting extensive research into its underlying mechanisms. Recent studies have suggested that Transformers can implement first-order optimization algorithms for in-context learning and even second order ones for the case of linear regression. In this work, we study whether Transformers can perform higher order optimization methods, beyond the case of linear regression. We establish that linear attention Transformers with ReLU layers can approximate second order optimization algorithms for the task of logistic regression and achieve $ε$ error with only a logarithmic to the error more layers. As a by-product we demonstrate the ability of even linear attention-only Transformers in implementing a single step of Newton's iteration for matrix inversion with merely two layers. These results suggest the ability of the Transformer architecture to implement complex algorithms, beyond gradient descent.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 1 weaker match is hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Cite this paper

@article{giannou2024well,
  title  = {How Well Can Transformers Emulate In-context Newton's Method?},
  author = {Angeliki Giannou and Liu Yang and Tianhao Wang and Dimitris Papailiopoulos and Jason D. Lee},
  year   = {2024},
  eprint = {2403.03183},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2403.03183v1}
}

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/2403.03183.svg)](https://codeofpaper.com/paper/2403.03183)

Discussion