Softmax $\geq$ Linear: Transformers may learn to classify in-context by kernel gradient descent

Sara Dragutinović, Andrew M. Saxe, Aaditya K. Singh
10/12/2025
cs.LG

No confident code implementation found for this paper.

Abstract

The remarkable ability of transformers to learn new concepts solely by reading examples within the input prompt, termed in-context learning (ICL), is a crucial aspect of intelligent behavior. Here, we focus on understanding the learning algorithm transformers use to learn from context. Existing theoretical work, often based on simplifying assumptions, has primarily focused on linear self-attention and continuous regression tasks, finding transformers can learn in-context by gradient descent. Given that transformers are typically trained on discrete and complex tasks, we bridge the gap from this existing work to the setting of classification, with non-linear (importantly, softmax) activation. We find that transformers still learn to do gradient descent in-context, though on functionals in the kernel feature space and with a context-adaptive learning rate in the case of softmax transformer. These theoretical findings suggest a greater adaptability to context for softmax attention, which we empirically verify and study through ablations. Overall, we hope this enhances theoretical understanding of in-context learning algorithms in more realistic settings, pushes forward our intuitions and enables further theory bridging to larger models.

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{dragutinovi2025softmax,
  title  = {Softmax $\geq$ Linear: Transformers may learn to classify in-context by kernel gradient descent},
  author = {Sara Dragutinović and Andrew M. Saxe and Aaditya K. Singh},
  year   = {2025},
  eprint = {2510.10425},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2510.10425v1}
}

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

Discussion