Our new X account is live! Follow @wizwand_team for updates
WorkDL logo mark

Scalable-Softmax Is Superior for Attention

About

The maximum element of the vector output by the Softmax function approaches zero as the input vector size increases. Transformer-based language models rely on Softmax to compute attention scores, causing the attention distribution to flatten as the context size grows. This reduces the model's ability to prioritize key information effectively and potentially limits its length generalization. To address this problem, we propose Scalable-Softmax (SSMax), which replaces Softmax in scenarios where the input vector size varies. SSMax can be seamlessly integrated into existing Transformer-based architectures. Experimental results in language modeling show that models using SSMax not only achieve faster loss reduction during pretraining but also significantly improve performance in long contexts and key information retrieval. Furthermore, an analysis of attention scores reveals that SSMax enables the model to focus attention on key information even in long contexts. Additionally, although models that use SSMax from the beginning of pretraining achieve better length generalization, those that have already started pretraining can still gain some of this ability by replacing Softmax in the attention layers with SSMax, either during or after pretraining.

Ken M. Nakanishi• 2025

Related benchmarks

TaskDatasetResultRank
Language ModelingFineWeb (val)--
156
Language UnderstandingMMLU (test)--
136
Commonsense ReasoningARC-E
Accuracy57.15
62
Needle-in-a-HaystackNeedle-in-a-Haystack
Accuracy100
44
Needle-in-a-HaystackRuler NIAH (Single 2)
Accuracy1
25
Language ModelingWikiText (held-out)
Perplexity (PPL)18.4967
25
Long-context Language UnderstandingLongBench v2
Overall Accuracy24.2
20
Needle-in-a-HaystackRuler NIAH Single 3
Accuracy30
13
Commonsense ReasoningARC Challenge (test)
Accuracy41.23
2
Showing 9 of 9 rows

Other info

Follow for update