Reproduce “Softmax $\geq$ Linear: Transformers may learn to classify in-context by kernel gradient descent” on OpenResearch

Run Claude Code, Codex or any coding agent as a research agent: literature, hypotheses and experiments on your laptop, cluster or cloud GPUs.

Universal app for Apple silicon and Intel. Requires macOS 11 or later.

About this paper

Sara Dragutinović, Andrew M. Saxe, Aaditya K. Singh

The paper studies in-context learning for discrete classification, asking whether attention uses labeled examples to update a classifier. It shows that linear attention can implement one cross-entropy gradient-descent step, while softmax attention corresponds to an R-B-F-kernel update with a context-adaptive step size. In one synthetic task, softmax outperforms linear attention, but this does not establish behavior in large language models.

Key insights

  • Softmax self-attention's non-linearity allows it to implement a more complex RBF kernel gradient descent with a context-adaptive learning rate, offering greater adaptability than linear attention.
  • Transformers can meta-learn effective hyperparameters for in-context learning, such as an optimal kernel width that adapts to the task's dimensionality.
  • The superior performance of softmax attention in in-context learning is attributed to both its ability to meta-learn kernel width and its use of a dynamic, context-adaptive learning rate.

Summary by alphaXiv.

Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.