mlsanityData to 7 Oct 2026

Softplus Attention with Re-weighting Boosts Length Extrapolation in Large Language Models

arXiv 2501.13428 ↗First posted 23 Jan 2025cs.CL cs.AI cs.LGcited by 0

Not on the map. Why?

Abstract (arXiv)

Large language models have achieved remarkable success in recent years, primarily due to self-attention. However, traditional Softmax attention suffers from numerical instability and reduced performance as the number of inference tokens increases. This work addresses these issues by proposing a new design principle for attention, viewing it as a two-stage process. The first stage (normalisation) refines standard attention by replacing Softmax with the more numerically stable Softplus followed by l1-normalisation. Furthermore, we introduce a dynamic scale factor based on invariance entropy. We show that this novel attention mechanism outperforms conventional Softmax attention, and state-of-the-art Softmax-free alternatives. Our second proposal is to introduce a second processing stage (sharpening) which consists of a re-weighting mechanism that amplifies significant attentional weights while diminishing weaker ones. This enables the model to concentrate more effectively on relevant tokens, mitigating the attention sink phenomenon, and fundamentally improving length extrapolation. This novel, two-stage, replacement for self-attention is shown to ensure numerical stability and dramatically improve length extrapolation, maintaining a nearly constant validation loss at 16× the training length while achieving superior results on challenging long-context retrieval tasks and downstream benchmarks. Furthermore, symbolic regression experiments demonstrate that our method enables models to recover Newton's gravitational law from orbital trajectory sequences, providing evidence that appropriate attention mechanisms are crucial for foundation models to develop genuine physical world models. Our code is available at https://github.com/iminfine/freeattn.

Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 64 of its 93 references that are in the map. First posted on arXiv 23 Jan 2025.

Builds on

64 of 93 references.

References · 64

  1. 2024The Llama 3 Herd of Modelscited by 14,192
  2. 2020Measuring Massive Multitask Language Understandingcited by 7,768
  3. 2016Layer Normalizationcited by 5,579
  4. 2018Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challengecited by 4,710
  5. 2023Mamba: Linear-Time Sequence Modeling with Selective State Spacescited by 4,616
  6. 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
  7. 2019HellaSwag: Can a Machine Really Finish Your Sentence?cited by 4,018
  8. 2017MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applicationscited by 3,827
  9. 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
  10. 2016Gaussian Error Linear Units (GELUs)cited by 3,431
  11. 2020Longformer: The Long-Document Transformercited by 3,362
  12. 2019PIQA: Reasoning about Physical Commonsense in Natural Languagecited by 2,818
38 more
  1. 2016Categorical Reparameterization with Gumbel-Softmaxcited by 2,708
  2. 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,551
  3. 2023Efficient Streaming Language Models with Attention Sinkscited by 2,115
  4. 2024Qwen2 Technical Reportcited by 2,076
  5. 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 1,979
  6. 2023Pythia: A Suite for Analyzing Large Language Models Across Training and Scalingcited by 1,734
  7. 2020Rethinking Attention with Performerscited by 1,584
  8. 2021Swin Transformer V2: Scaling Up Capacity and Resolutioncited by 1,215
  9. 2024The FineWeb Datasets: Decanting the Web for the Finest Text Data at Scalecited by 1,104
  10. 2016The LAMBADA dataset: Word prediction requiring a broad discourse contextcited by 960
  11. 2017Crowdsourcing Multiple Choice Science Questionscited by 742
  12. 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 721
  13. 2023Scaling Vision Transformers to 22 Billion Parameterscited by 690
  14. 2023Textbooks Are All You Needcited by 561
  15. 2024FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precisioncited by 507
  16. 2016From Softmax to Sparsemax: A Sparse Model of Attention and Multi-Label Classificationcited by 337
  17. 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 319
  18. 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
  19. 2020Query-Key Normalization for Transformerscited by 266
  20. 2022cosFormer: Rethinking Softmax in Attentioncited by 212
  21. 2019Transformer Dissection: A Unified Understanding of Transformer's Attention via the Lens of Kernelcited by 211
  22. 2023Landmark Attention: Random-Access Infinite Context Length for Transformerscited by 206
  23. 2024Simple linear attention language models balance the recall-throughput tradeoffcited by 197
  24. 2022Transformer Quality in Linear Timecited by 189
  25. 2023FLatten Transformer: Vision Transformer using Focused Linear Attentioncited by 170
  26. 2019Sparse Sequence-to-Sequence Modelscited by 167
  27. 2021Primer: Searching for Efficient Transformers for Language Modelingcited by 162
  28. 2019Mish: A Self Regularized Non-Monotonic Activation Functioncited by 141
  29. 2017On the Properties of the Softmax Function with Application in Game Theory and Reinforcement Learningcited by 136
  30. 2021SOFT: Softmax-free Transformer with Linear Complexitycited by 128
  31. 2023Scaling Laws of RoPE-based Extrapolationcited by 124
  32. 2020Infinite attention: NNGP and NTK for deep attention networkscited by 117
  33. 2022Overcoming a Theoretical Limitation of Self-Attentioncited by 110
  34. 2022KERPLE: Kernelized Relative Positional Embedding for Length Extrapolationcited by 84
  35. 2021SummScreen: A Dataset for Abstractive Screenplay Summarizationcited by 80
  36. 2020Improve Transformer Models with Better Relative Position Embeddingscited by 73
  37. 2024Theory, Analysis, and Best Practices for Sigmoid Self-Attentioncited by 62
  38. 2024Isambard-AI: a leadership class supercomputer optimised specifically for Artificial Intelligencecited by 59

50 most cited of 64 All 64 (JSON)

Built on by

Not cited yet.

Similar, not cited

Close in wording, no citation either way

  1. 2024When Attention Sink Emerges in Language Models: An Empirical View
  2. 2026Double-P: Hierarchical Top-P Sparse Attention for Long-Context LLMs
  3. 2024Beyond Linear Approximations: A Novel Pruning Approach for Attention Matrix
  4. 2025Gated Attention for Large Language Models: Non-linearity, Sparsity, and Attention-Sink-Free
  5. 2024TurboAttention: Efficient Attention Approximation For High Throughputs LLMs
  6. 2025Training-free Context-adaptive Attention for Efficient Long Context Modeling
  7. 2024Cross-layer Attention Sharing for Pre-trained Large Language Models
  8. 2024A Training-free Sub-quadratic Cost Transformer Model Serving Framework With Hierarchically Pruned Attention