mlsanityData to 7 Oct 2026

Towards understanding how attention mechanism works in deep learning

arXiv 2412.18288 ↗First posted 24 Dec 2024cs.LG cs.AI cs.CVcited by 2

Not on the map. Why?

Abstract (arXiv)

Attention mechanism has been extensively integrated within mainstream neural network architectures, such as Transformers and graph attention networks. Yet, its underlying working principles remain somewhat elusive. What is its essence? Are there any connections between it and traditional machine learning algorithms? In this study, we inspect the process of computing similarity using classic metrics and vector space properties in manifold learning, clustering, and supervised learning. We identify the key characteristics of similarity computation and information propagation in these methods and demonstrate that the self-attention mechanism in deep learning adheres to the same principles but operates more flexibly and adaptively. We decompose the self-attention mechanism into a learnable pseudo-metric function and an information propagation process based on similarity computation. We prove that the self-attention mechanism converges to a drift-diffusion process through continuous modeling provided the pseudo-metric is a transformation of a metric and certain reasonable assumptions hold. This equation could be transformed into a heat equation under a new metric. In addition, we give a first-order analysis of attention mechanism with a general pseudo-metric function. This study aids in understanding the effects and principle of attention mechanism through physical intuition. Finally, we propose a modified attention mechanism called metric-attention by leveraging the concept of metric learning to facilitate the ability to learn desired metrics more effectively. Experimental results demonstrate that it outperforms self-attention regarding training efficiency, accuracy, and robustness.

Key facts. Cited by 2 papers in the map (data through 7 Oct 2026). Builds on 18 of its 57 references that are in the map. First posted on arXiv 24 Dec 2024.

Builds on

18 of 57 references.

References · 18

  1. 2017Attention Is All You Needcited by 59,932
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  3. 2020Language Models are Few-Shot Learnerscited by 32,199
  4. 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
  5. 2020Denoising Diffusion Probabilistic Modelscited by 20,851
  6. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
  7. 2020Score-Based Generative Modeling through Stochastic Differential Equationscited by 8,964
  8. 2017Graph Attention Networkscited by 8,854
  9. 2018UMAP: Uniform Manifold Approximation and Projection for Dimension Reductioncited by 2,841
  10. 2021Attention is Not All You Need: Pure Attention Loses Rank Doubly Exponentially with Depthcited by 411
  11. 2016Multi30K: Multilingual English-German Image Descriptionscited by 250
  12. 2020The Lipschitz Constant of Self-Attentioncited by 171
6 more
  1. 2023A mathematical perspective on Transformerscited by 160
  2. 2021Sinkformers: Transformers with Doubly Stochastic Attentioncited by 136
  3. 2023White-Box Transformers via Sparse Rate Reductioncited by 77
  4. 2020A Mathematical Theory of Attentioncited by 43
  5. 2019Manifold Fitting under Unbounded Noisecited by 9
  6. 2021Deep Residual Networks Learn the Geodesic Curve in the Wasserstein Spacecited by 8

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 1; 2026: 1.

2 papers.