In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitzness

Liam Collins, Advait Parulekar, Aryan Mokhtari, Sujay Sanghavi, Sanjay Shakkottai
2/18/2024
cs.LGcs.AIcs.CL

No confident code implementation found for this paper.

Abstract

A striking property of transformers is their ability to perform in-context learning (ICL), a machine learning framework in which the learner is presented with a novel context during inference implicitly through some data, and tasked with making a prediction in that context. As such, that learner must adapt to the context without additional training. We explore the role of softmax attention in an ICL setting where each context encodes a regression task. We show that an attention unit learns a window that it uses to implement a nearest-neighbors predictor adapted to the landscape of the pretraining tasks. Specifically, we show that this window widens with decreasing Lipschitzness and increasing label noise in the pretraining tasks. We also show that on low-rank, linear problems, the attention unit learns to project onto the appropriate subspace before inference. Further, we show that this adaptivity relies crucially on the softmax activation and thus cannot be replicated by the linear activation often studied in prior theoretical analyses.

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. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

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

Similar Papers

Cite this paper

@article{collins2024incontext,
  title  = {In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitzness},
  author = {Liam Collins and Advait Parulekar and Aryan Mokhtari and Sujay Sanghavi and Sanjay Shakkottai},
  year   = {2024},
  eprint = {2402.11639},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2402.11639},
  url    = {http://arxiv.org/abs/2402.11639v2},
  journal = {NEURIPS 2024 2024}
}

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

Discussion