Escaping the Gradient Vanishing: Periodic Alternatives of Softmax in Attention Mechanism
Not on the map. Why?
Abstract (arXiv)
Softmax is widely used in neural networks for multiclass classification, gate structure and attention mechanisms. The statistical assumption that the input is normal distributed supports the gradient stability of Softmax. However, when used in attention mechanisms such as transformers, since the correlation scores between embeddings are often not normally distributed, the gradient vanishing problem appears, and we prove this point through experimental confirmation. In this work, we suggest that replacing the exponential function by periodic functions, and we delve into some potential periodic alternatives of Softmax from the view of value and gradient. Through experiments on a simply designed demo referenced to LeViT, our method is proved to be able to alleviate the gradient problem and yield substantial improvements compared to Softmax and its variants. Further, we analyze the impact of pre-normalization for Softmax and our methods through mathematics and experiments. Lastly, we increase the depth of the demo and prove the applicability of our method in deep structures.
Key facts. Cited by 7 papers in the map (data through 7 Oct 2026). Builds on 19 of its 20 references that are in the map. First posted on arXiv 16 Aug 2021.
Builds on
19 of 20 references.
References · 19
- 2017Attention Is All You Needcited by 59,932
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
- 2021Swin Transformer: Hierarchical Vision Transformer using Shifted Windowscited by 12,082
- 2015Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shiftcited by 6,979
- 2016Layer Normalizationcited by 5,579
- 2020Training data-efficient image transformers & distillation through attentioncited by 4,560
- 2020Implicit Neural Representations with Periodic Activation Functionscited by 2,214
- 2018Group Normalizationcited by 1,514
- 2017SphereFace: Deep Hypersphere Embedding for Face Recognitioncited by 733
- 2021LeViT: a Vision Transformer in ConvNet's Clothing for Faster Inferencecited by 475
- 2016Large-Margin Softmax Loss for Convolutional Neural Networkscited by 296
- 2021Escaping the Big Data Paradigm with Compact Transformerscited by 261
7 more
- 2017NormFace: L2 Hypersphere Embedding for Face Verificationcited by 237
- 2017L2-constrained Softmax Loss for Discriminative Face Verificationcited by 96
- 2018Ring loss: Convex Feature Normalization for Face Recognitioncited by 39
- 2015An Exploration of Softmax Alternatives Belonging to the Spherical Loss Familycited by 27
- 2020Exploring Alternatives to Softmax Functioncited by 16
- 2014Efficient Exact Gradient Update for training Deep Networks with Very Large Sparse Targetscited by 10
- 2018Ensemble Soft-Margin Softmax Loss for Image Classificationcited by 3
Built on by
Citing papers per year: 2022: 1; 2023: 1; 2024: 3; 2025: 2.
7 papers.
- 2022Simplicial Embeddings in Self-Supervised Learning and Downstream Classificationcited by 23
- 2023Eureka-Moments in Transformers: Multi-Step Tasks Reveal Softmax Induced Optimization Problemscited by 14
- 2024What Does It Mean to Be a Transformer? Insights from a Theoretical Hessian Analysiscited by 9
- 2024Rethinking Attention: Polynomial Alternatives to Softmax in Transformerscited by 8
- 2025Quantum Doubly Stochastic Transformerscited by 6
- 2024Generalized Probabilistic Attention Mechanism in Transformerscited by 2
- 2025Minimax Rates for Learning Pairwise Interactions in Attention-Style Modelscited by 0
- 2025Minimax Rates for Learning Pairwise Interactions in Attention-Style Models13 Oct 2025
- 2025Quantum Doubly Stochastic Transformers22 Apr 2025
- 2024Rethinking Attention: Polynomial Alternatives to Softmax in Transformers24 Oct 2024
- 2024Generalized Probabilistic Attention Mechanism in Transformers21 Oct 2024
- 2024What Does It Mean to Be a Transformer? Insights from a Theoretical Hessian Analysis14 Oct 2024
- 2023Eureka-Moments in Transformers: Multi-Step Tasks Reveal Softmax Induced Optimization Problems19 Oct 2023
- 2022Simplicial Embeddings in Self-Supervised Learning and Downstream Classification1 Apr 2022