paper-with-me

홈 › Papers

Max-Margin Token Selection in Attention Mechanism

2023-06-23 · NeurIPS 2023 11 · 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(\boldsymbol{X})=\langle \boldsymbol{Xv}, \texttt{softmax}(\boldsymbol{XWp})\rangle$, where $\boldsymbol{X}$ is the token sequence and $(\boldsymbol{v},\boldsymbol{W},\boldsymbol{p})$ are trainable parameters. We prove that running gradient descent on $\boldsymbol{p}$, or equivalently $\boldsymbol{W}$, converges in direction to a max-margin solution that separates $\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 $\textit{optimality}$ of tokens in terms of the value embeddings $\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 $\boldsymbol{v}$ and $\boldsymbol{p}$ simultaneously with logistic loss, we identify conditions under which the regularization paths directionally converge to their respective hard-margin SVM solutions where $\boldsymbol{v}$ separates the input features based on their labels. Interestingly, the SVM formulation of $\boldsymbol{p}$ is influenced by the support vector geometry of $\boldsymbol{v}$. Finally, we verify our theoretical findings via numerical experiments and provide insights.

📄 PDF Abstract BibTeX arXiv:2306.13596

Code (1)

ucr-optml/max_margin_attention 공식 구현 pytorch

Methods 이 논문이 사용한 방법론

SVM A Support Vector Machine, or SVM, is a non-parametric supervised learning model. For non-linear classification and regression, they utilise the kernel trick to map inputs…

Similar Papers 제목 키워드 기반

Optimizing Attention with Mirror Descent: Generalized Max-Margin Token Selection

2024-10-18 · Aaron Alvarado Kristanto Julistiono, Davoud Ataee Tarzanagh, Navid Azizan

Attention mechanisms have revolutionized several domains of artificial intelligence, such as natural language processing and computer vision, by enabling models to selectively focus on relevant parts of the input data. W…

Geometric Analysis of Token Selection in Multi-Head Attention

2026-02-02 · Timur Mudarisov, Mikhal Burtsev, Tatiana Petrova, Radu State arxiv

We present a geometric framework for analysing multi-head attention in large language models (LLMs). Without altering the mechanism, we view standard attention through a top-N selection lens and study its behaviour direc…

Context-Aware Token Selection and Packing for Enhanced Vision Transformer

2024-10-31 · Tianyi Zhang, Baoxin Li, Jae-sun Seo, Yu Cao

In recent years, the long-range attention mechanism of vision transformers has driven significant performance breakthroughs across various computer vision tasks. However, the traditional self-attention mechanism, which p…

GPUobject-detectionObject Detection

Limitations of Normalization in Attention Mechanism

2025-08-25 · Timur Mudarisov, Mikhail Burtsev, Tatiana Petrova, Radu State arxiv

This paper investigates the limitations of the normalization in attention mechanisms. We begin with a theoretical framework that enables the identification of the model's selective ability and the geometric separation in…

Benign Overfitting in Token Selection of Attention Mechanism

2024-09-26 · Keitaro Sakamoto, Issei Sato

Attention mechanism is a fundamental component of the transformer model and plays a significant role in its success. However, the theoretical understanding of how attention learns to select tokens is still an emerging ar…