Lune

NeurIPS2023顶会

What can a Single Attention Layer Learn? A Study Through the Random Features Lens

Hengyu Fu, Tianyu Guo, Yu Bai, Song Mei

摘要

Attention layers -- which map a sequence of inputs to a sequence of outputs -- are core building blocks of the Transformer architecture which has achieved significant breakthroughs in modern artificial intelligence. This paper presents a rigorous theoretical study on the learning and generalization of a single multi-head attention layer, with a sequence of key vectors and a separate query vector as input. We consider the random feature setting where the attention layer has a large number of heads, with randomly sampled frozen query and key matrices, and trainable value matrices. We show that such a random-feature attention layer can express a broad class of target functions that are permutation invariant to the key vectors. We further provide quantitative excess risk bounds for learning these target functions from finite samples, using random feature attention with finitely many heads. Our results feature several implications unique to the attention structure compared with existing random features theory for neural networks, such as (1) Advantages in the sample complexity over standard two-layer random-feature networks; (2) Concrete and natural classes of functions that can be learned efficiently by a random-feature attention layer; and (3) The effect of the sampling distribution of the query-key weight matrix (the product of the query and key matrix), where Gaussian random weights with a non-zero mean result in better sample complexities over the zero-mean counterpart for learning certain natural target functions. Experiments on simulated data corroborate our theoretical findings and further illustrate the interplay between the sample size and the complexity of the target function.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 29 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • From Self-Attention to Markov Models: Unveiling the Dynamics of Generative Transformers 引用了 Language Models are Few-Shot Learners
  • An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale 引用了 Language Models are Few-Shot Learners
  • Decision Transformer: Reinforcement Learning via Sequence Modeling 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Decision Transformer: Reinforcement Learning via Sequence Modeling 引用了 Language Models are Few-Shot Learners
  • Do Transformers Really Perform Badly for Graph Representation? 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Do Transformers Really Perform Badly for Graph Representation? 引用了 Language Models are Few-Shot Learners
  • Transformers as Decision Makers: Provable In-Context Reinforcement Learning via Supervised Pretraining 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Transformers as Decision Makers: Provable In-Context Reinforcement Learning via Supervised Pretraining 引用了 Decision Transformer: Reinforcement Learning via Sequence Modeling
  • Transformers as Decision Makers: Provable In-Context Reinforcement Learning via Supervised Pretraining 引用了 Language Models are Few-Shot Learners
  • In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitzness 引用了 Transformers as Decision Makers: Provable In-Context Reinforcement Learning via Supervised Pretraining
  • In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitzness 引用了 Language Models are Few-Shot Learners
  • Learning Transferable Visual Models From Natural Language Supervision 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Learning Transferable Visual Models From Natural Language Supervision 引用了 Language Models are Few-Shot Learners
  • Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamics 引用了 Transformers as Decision Makers: Provable In-Context Reinforcement Learning via Supervised Pretraining
  • Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamics 引用了 Language Models are Few-Shot Learners
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper29

  1. Transformers as Decision Makers: Provable In-Context Reinforcement Learning via Supervised PretrainingLicong Lin, Yu Bai, Song MeiICLR 2024 · 74 次引用
  2. From Self-Attention to Markov Models: Unveiling the Dynamics of Generative TransformersMuhammed Emrullah Ildiz, Yixiao Huang, Yingcong Li, Ankit Singh Rawat 等ICML 2024 · 45 次引用
  3. Towards a Theoretical Understanding of the 'Reversal Curse' via Training DynamicsHanlin Zhu, Baihe Huang, Shaolun Zhang, Michael I. Jordan 等NeurIPS 2024 · 37 次引用
  4. A Phase Transition between Positional and Semantic Learning in a Solvable Model of Dot-Product AttentionHugo Cui, Freya Behrens, Florent Krzakala, Lenka ZdeborováNeurIPS 2024 · 35 次引用
  5. In-Context Learning with Transformers: Softmax Attention Adapts to Function LipschitznessLiam Collins, Advait Parulekar, Aryan Mokhtari, Sujay Sanghavi 等NeurIPS 2024 · 33 次引用

它引用的 Paper28

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
  2. Learning Transferable Visual Models From Natural Language SupervisionAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh 等ICML 2021 · 47,906 次引用
  3. An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn 等ICLR 2021 · 21,477 次引用
  4. Decision Transformer: Reinforcement Learning via Sequence ModelingLili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee 等NeurIPS 2021 · 2,557 次引用
  5. Do Transformers Really Perform Badly for Graph Representation?Chengxuan Ying, Tianle Cai, Shengjie Luo, Shuxin Zheng 等NeurIPS 2021 · 1,632 次引用

相关 Paper

  1. Provably Learning a Multi-head Attention LayerSitan Chen, Yuanzhi LiSTOC 2025 · 3 次引用
  2. Single-Head Attention in High Dimensions: A Theory of Generalization, Weights Spectra, and Scaling LawsFabrizio Boncoraglio, Vittorio Erba, Emanuele Troiani, Yizhou Xu 等ICML 2026 · 5 次引用
  3. Attention-based clusteringRodrigo Maulen-Soto, Pierre Marion, Claire BoyerNeurIPS 2025 · 3 次引用
  4. Are Transformers with One Layer Self-Attention Using Low-Rank Weight Matrices Universal Approximators?Tokio Kajitsuka, Issei SatoICLR 2024 · 31 次引用
  5. Memorization Capacity of Multi-Head Attention in TransformersSadegh Mahdavi, Renjie Liao, Christos ThrampoulidisICLR 2024 · 34 次引用
黄昏的海面,两侧是细线勾勒的悬崖