Lune

NeurIPS2023顶会

Max-Margin Token Selection in Attention Mechanism

Davoud Ataee Tarzanagh, Yingcong Li, Xuechen Zhang, Samet Oymak

摘要

Attention mechanism is a central component of the transformer architecture which led to the phenomenal success of large language models. However, the theoretical principles underlying the attention mechanism are poorly understood, especially its nonconvex optimization dynamics. In this work, we explore the seminal softmax-attention model f(X)=⟨Xv,softmax(XWp)⟩f(\boldsymbol{X})=\langle \boldsymbol{Xv}, \texttt{softmax}(\boldsymbol{XWp})\rangle, where X\boldsymbol{X} is the token sequence and (v,W,p)(\boldsymbol{v},\boldsymbol{W},\boldsymbol{p}) are trainable parameters. We prove that running gradient descent on p\boldsymbol{p}, or equivalently W\boldsymbol{W}, converges in direction to a max-margin solution that separates locally-optimal\textit{locally-optimal} tokens from non-optimal ones. This clearly formalizes attention as an optimal token selection mechanism. Remarkably, our results are applicable to general data and precisely characterize optimality\textit{optimality} of tokens in terms of the value embeddings Xv\boldsymbol{Xv} and problem geometry. We also provide a broader regularization path analysis that establishes the margin maximizing nature of attention even for nonlinear prediction heads. When optimizing v\boldsymbol{v} and p\boldsymbol{p} simultaneously with logistic loss, we identify conditions under which the regularization paths directionally converge to their respective hard-margin SVM solutions where v\boldsymbol{v} separates the input features based on their labels. Interestingly, the SVM formulation of p\boldsymbol{p} is influenced by the support vector geometry of v\boldsymbol{v}. Finally, we verify our theoretical findings via numerical experiments and provide insights.

问 Lune

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

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

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

可以从这些问题问起

Lune 可以查阅

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

获取答案

免费开始,无需绑卡

脉络

  • Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in Transformers 引用了 How Transformers Learn Causal Structure with Gradient Descent
  • Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in Transformers 引用了 JoMA: Demystifying Multilayer Transformers via Joint Dynamics of MLP and Attention
  • Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in Transformers 引用了 Language Models are Few-Shot Learners
  • Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in Transformers 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in Transformers 引用了 Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer
  • An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale 引用了 Language Models are Few-Shot Learners
  • How Transformers Learn Causal Structure with Gradient Descent 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • How Transformers Learn Causal Structure with Gradient Descent 引用了 JoMA: Demystifying Multilayer Transformers via Joint Dynamics of MLP and Attention
  • How Transformers Learn Causal Structure with Gradient Descent 引用了 Language Models are Few-Shot Learners
  • How Transformers Learn Causal Structure with Gradient Descent 引用了 Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer
  • JoMA: Demystifying Multilayer Transformers via Joint Dynamics of MLP and Attention 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • JoMA: Demystifying Multilayer Transformers via Joint Dynamics of MLP and Attention 引用了 Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer
  • 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
  • Training data-efficient image transformers & distillation through attention 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Transformers Learn to Achieve Second-Order Convergence Rates for In-Context Linear Regression 引用了 Language Models are Few-Shot Learners
  • Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer 引用了 Language Models are Few-Shot Learners
  • Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer 引用了 Learning Transferable Visual Models From Natural Language Supervision
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper52

  1. Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer TransformerYuandong Tian, Yiping Wang, Beidi Chen, Simon S. DuNeurIPS 2023 · 125 次引用
  2. How Transformers Learn Causal Structure with Gradient DescentEshaan Nichani, Alex Damian, Jason D. LeeICML 2024 · 117 次引用
  3. Transformers Learn to Achieve Second-Order Convergence Rates for In-Context Linear RegressionDeqing Fu, Tianqi Chen, Robin Jia, Vatsal SharanNeurIPS 2024 · 54 次引用
  4. JoMA: Demystifying Multilayer Transformers via Joint Dynamics of MLP and AttentionYuandong Tian, Yiping Wang, Zhenyu Zhang, Beidi Chen 等ICLR 2024 · 49 次引用
  5. Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in TransformersSiyu Chen, Heejune Sheen, Tianhao Wang, Zhuoran YangNeurIPS 2024 · 48 次引用

它引用的 Paper41

  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. Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma 等NeurIPS 2022 · 22,562 次引用
  4. An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn 等ICLR 2021 · 21,477 次引用
  5. Training data-efficient image transformers & distillation through attentionHugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa 等ICML 2021 · 8,974 次引用

相关 Paper

  1. Attention with Trained Embeddings Provably Selects Important TokensDiyuan Wu, Aleksandr Shevchenko, Samet Oymak, Marco MondelliNeurIPS 2025
  2. Unraveling the Gradient Descent Dynamics of TransformersBingqing Song, Boran Han, Shuai Zhang, Jie Ding 等NeurIPS 2024 · 13 次引用
  3. Softmax as Linear Attention in the Large-Prompt Regime: a Measure-based PerspectiveEtienne Boursier, Claire BoyerICML 2026 · 4 次引用
  4. Understanding Softmax Attention Layers: Exact Mean-Field Analysis on a Toy ProblemElvis DohmatobNeurIPS 2025 · 3 次引用
  5. Limitations of Normalization in AttentionTimur Mudarisov, Mikhail Burtsev, Tatiana Petrova, Radu StateNeurIPS 2025
黄昏的海面,两侧是细线勾勒的悬崖