Bayes optimal learning of attention-indexed models

Fabrizio Boncoraglio, Emanuele Troiani, Vittorio Erba, Lenka Zdeborová
6/1/2025
7 citations
transformer-attention

Official code: SPOC-group/ExtensiveRankAttention (0 stars).

Abstract

We introduce the attention-indexed model (AIM), a theoretical framework for analyzing learning in deep attention layers. Inspired by multi-index models, AIM captures how token-level outputs emerge from layered bilinear interactions over high-dimensional embeddings.

Show full abstract

Unlike prior tractable attention models, AIM allows full-width key and query matrices, aligning more closely with practical transformers. Using tools from statistical mechanics and random matrix theory, we derive closed-form predictions for Bayes-optimal generalization error and identify sharp phase transitions as a function of sample complexity, model width, and sequence length. We propose a matching approximate message passing algorithm and show that gradient descent can reach optimal performance. AIM offers a solvable playground for understanding learning in self-attention layers, that are key components of modern architectures.

View on arXivView PDF

Code Implementations(1)

Code repository for "Bayes optimal learning of attention-indexed models"

00

Similar Papers

Cite this paper

@article{boncoraglio2025bayes,
  title  = {Bayes optimal learning of attention-indexed models},
  author = {Fabrizio Boncoraglio and Emanuele Troiani and Vittorio Erba and Lenka Zdeborová},
  year   = {2025},
  eprint = {2506.01582},
  archivePrefix = {arXiv},
  doi    = {10.52202/085713-3509},
  url    = {https://doi.org/10.52202/085713-3509},
  journal = {Neural Information Processing Systems}
}

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

Discussion