A phase transition between positional and semantic learning in a solvable model of dot-product attention

Hugo Cui, Freya Behrens, Florent Krzakala, L. Zdeborov'a
2/1/2024
transformer-attention

No confident code implementation found for this paper.

Abstract

Many empirical studies have provided evidence for the emergence of algorithmic mechanisms (abilities) in the learning of language models, that lead to qualitative improvements in the model capabilities. Yet, a theoretical characterization of how such mechanisms emerge remains elusive.

Show full abstract

In this paper, we take a step in this direction by providing a tight theoretical analysis of the emergence of semantic attention in a solvable model of dot-product attention. More precisely, we consider a non-linear self-attention layer with trainable tied and low-rank query and key matrices. In the asymptotic limit of high-dimensional data and using a comparably large number of training samples, we provide a tight closed-form characterization of the global minimum of the non-convex empirical loss landscape. We show that this minimum corresponds to either a positional attention mechanism (with tokens attending to each other based on their respective positions) or a semantic attention mechanism (with tokens attending to each other based on their meaning), and evidence of an emergent phase transition from the former to the latter with increasing sample complexity. Finally, we compare the dot-product attention layer to a linear positional baseline, and show that it outperforms the latter using the semantic mechanism, provided it has access to sufficient data.

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{cui2024phase,
  title  = {A phase transition between positional and semantic learning in a solvable model of dot-product attention},
  author = {Hugo Cui and Freya Behrens and Florent Krzakala and L. Zdeborov'a},
  year   = {2024},
  eprint = {2402.03902},
  archivePrefix = {arXiv},
  doi    = {10.1088/1742-5468/ade137},
  url    = {https://arxiv.org/abs/2402.03902},
  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.03902.svg)](https://codeofpaper.com/paper/2402.03902)

Discussion