Self-Adjust Softmax

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Zheng, Chuanyang, Gao, Yihang, Chen, Guoxuan, Shi, Han, Xiong, Jing, Ren, Xiaozhe, Huang, Chao, Jiang, Xin, Li, Zhenguo, Li, Yu
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866929731867246592
author Zheng, Chuanyang
Gao, Yihang
Chen, Guoxuan
Shi, Han
Xiong, Jing
Ren, Xiaozhe
Huang, Chao
Jiang, Xin
Li, Zhenguo
Li, Yu
author_facet Zheng, Chuanyang
Gao, Yihang
Chen, Guoxuan
Shi, Han
Xiong, Jing
Ren, Xiaozhe
Huang, Chao
Jiang, Xin
Li, Zhenguo
Li, Yu
contents The softmax function is crucial in Transformer attention, which normalizes each row of the attention scores with summation to one, achieving superior performances over other alternative functions. However, the softmax function can face a gradient vanishing issue when some elements of the attention scores approach extreme values, such as probabilities close to one or zero. In this paper, we propose Self-Adjust Softmax (SA-Softmax) to address this issue by modifying $softmax(x)$ to $x \cdot softmax(x)$ and its normalized variant $\frac{(x - min(x_{\min},0))}{max(0,x_{max})-min(x_{min},0)} \cdot softmax(x)$. We theoretically show that SA-Softmax provides enhanced gradient properties compared to the vanilla softmax function. Moreover, SA-Softmax Attention can be seamlessly integrated into existing Transformer models to their attention mechanisms with minor adjustments. We conducted experiments to evaluate the empirical performance of Transformer models using SA-Softmax compared to the vanilla softmax function. These experiments, involving models with up to 2.7 billion parameters, are conducted across diverse datasets, language tasks, and positional encoding methods.
format Preprint
id arxiv_https___arxiv_org_abs_2502_18277
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Self-Adjust Softmax
Zheng, Chuanyang
Gao, Yihang
Chen, Guoxuan
Shi, Han
Xiong, Jing
Ren, Xiaozhe
Huang, Chao
Jiang, Xin
Li, Zhenguo
Li, Yu
Computation and Language
The softmax function is crucial in Transformer attention, which normalizes each row of the attention scores with summation to one, achieving superior performances over other alternative functions. However, the softmax function can face a gradient vanishing issue when some elements of the attention scores approach extreme values, such as probabilities close to one or zero. In this paper, we propose Self-Adjust Softmax (SA-Softmax) to address this issue by modifying $softmax(x)$ to $x \cdot softmax(x)$ and its normalized variant $\frac{(x - min(x_{\min},0))}{max(0,x_{max})-min(x_{min},0)} \cdot softmax(x)$. We theoretically show that SA-Softmax provides enhanced gradient properties compared to the vanilla softmax function. Moreover, SA-Softmax Attention can be seamlessly integrated into existing Transformer models to their attention mechanisms with minor adjustments. We conducted experiments to evaluate the empirical performance of Transformer models using SA-Softmax compared to the vanilla softmax function. These experiments, involving models with up to 2.7 billion parameters, are conducted across diverse datasets, language tasks, and positional encoding methods.
title Self-Adjust Softmax
topic Computation and Language
url https://arxiv.org/abs/2502.18277