[Paper Review] Normalized Attention Without Probability Cage
This paper proposes normalized attention (NAP), a softmax-free attention mechanism that replaces probability-simplex constraints with L2 normalization to avoid the convex hull limitation of softmax-attention. The method improves model robustness to hyperparameters and data biases, achieving state-of-the-art performance on sequence tasks—outperforming Transformers, max pooling, and sum pooling across 25,000 experiments, especially in long-context and high-vocabulary settings.
Attention architectures are widely used; they recently gained renewed popularity with Transformers yielding a streak of state of the art results. Yet, the geometrical implications of softmax-attention remain largely unexplored. In this work we highlight the limitations of constraining attention weights to the probability simplex and the resulting convex hull of value vectors. We show that Transformers are sequence length dependent biased towards token isolation at initialization and contrast Transformers to simple max- and sum-pooling - two strong baselines rarely reported. We propose to replace the softmax in self-attention with normalization, yielding a hyperparameter and data-bias robust, generally applicable architecture. We support our insights with empirical results from more than 25,000 trained models. All results and implementations are made available.
Motivation & Objective
- To investigate the theoretical and practical limitations of constraining attention weights to the probability simplex via softmax.
- To challenge the assumption that attention must represent a probability distribution, especially given its impact on model expressivity and initialization bias.
- To propose a general-purpose, robust attention mechanism that avoids the convex hull constraint of softmax-attention.
- To empirically compare NAP against Transformers, max pooling, sum pooling, and other attention variants across diverse tasks and hyperparameter settings.
- To demonstrate that removing the probability simplex constraint enhances model generalization, especially in long-context and high-vocabulary scenarios.
Proposed method
- Replace the softmax operation in self-attention with L2 normalization to project attention weights to the unit sphere instead of the probability simplex.
- Define the attention mechanism as a normalized weighted sum: o_i^m = Σ_j (a_i,j^m / ||a_i^m||_2) · v_j^m, where a_i,j^m = <q_i^m, k_j^m> / √d_h.
- Introduce a learnable bias term b in the attention logits to allow for residual behavior resembling sum pooling when normalization is ineffective.
- Train models using standard backpropagation and evaluate performance across multiple tasks: case distinction, mode finding, and sequence classification.
- Conduct a large-scale ablation study with over 25,000 trained models across varying sequence lengths, model depths, learning rates, and vocabulary sizes.
- Use RGB heatmaps to visualize model performance across hyperparameter spaces, highlighting robustness and generalization.
Experimental results
Research questions
- RQ1How does constraining attention weights to the probability simplex limit the expressivity of self-attention mechanisms?
- RQ2What are the initialization-level biases introduced by softmax-attention, particularly in terms of token isolation and convex hull constraints?
- RQ3Can a normalization-based attention mechanism outperform softmax-attention and traditional pooling methods (sum/max) in terms of robustness and accuracy?
- RQ4How does the proposed normalized attention mechanism perform under distribution shift, such as longer sequence lengths or larger vocabularies?
- RQ5To what extent does the new attention mechanism reduce sensitivity to hyperparameters like learning rate and model depth?
Key findings
- Normalized attention (NAP) achieves a mean validation accuracy of 93.8% on the case distinction task with sequence length 128, significantly outperforming BERT (71.5%) and MTE (57.7%).
- On the mode finding task with vocabulary size 256, NAP achieves 84.6% mean validation accuracy, outperforming BERT (74.4%), MTE (64.9%), and max pooling (3.1%).
- NAP shows superior robustness to hyperparameter choices: it maintains high performance across a wide range of learning rates and model dimensions, especially in long-context settings.
- Max pooling achieves high accuracy (90.9% on case distinction) but fails on the mode finding task with larger vocabularies, indicating poor generalization under distribution shift.
- Sum pooling performs poorly (29.1% accuracy) on the case distinction task, highlighting limitations in modeling complex dependencies without attention.
- The NAP architecture generalizes well to longer sequences (N=256) in the mode finding task, achieving 64.3% accuracy on validation, while max pooling drops to 2.1%.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.