StableMask: Refining Causal Masking in Decoder-only Transformer
Not on the map. Why?
Abstract (arXiv)
The decoder-only Transformer architecture with causal masking and relative position encoding (RPE) has become the de facto choice in language modeling. Despite its exceptional performance across various tasks, we have identified two limitations: First, it requires all attention scores to be non-zero and sum up to 1, even if the current embedding has sufficient self-contained information. This compels the model to assign disproportional excessive attention to specific tokens. Second, RPE-based Transformers are not universal approximators due to their limited capacity at encoding absolute positional information, which limits their application in position-critical tasks. In this work, we propose StableMask: a parameter-free method to address both limitations by refining the causal mask. It introduces pseudo-attention values to balance attention distributions and encodes absolute positional information via a progressively decreasing mask ratio. StableMask's effectiveness is validated both theoretically and empirically, showing significant enhancements in language models with parameter sizes ranging from 71M to 1.4B across diverse datasets and encoding methods. We further show that it naturally supports (1) efficient extrapolation without special tricks such as StreamingLLM and (2) easy integration with existing attention optimization techniques.
Key facts. Cited by 20 papers in the map (data through 7 Oct 2026). Builds on 22 of its 35 references that are in the map. First posted on arXiv 7 Feb 2024.
Builds on
22 of 35 references.
References · 22
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
- 2016Pointer Sentinel Mixture Modelscited by 2,992
- 2023Efficient Streaming Language Models with Attention Sinkscited by 2,115
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
- 2016The LAMBADA dataset: Word prediction requiring a broad discourse contextcited by 960
- 2023Vision Transformers Need Registerscited by 844
10 more
- 2022Efficiently Scaling Transformer Inferencecited by 529
- 2019Are Transformers universal approximators of sequence-to-sequence functions?cited by 404
- 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 319
- 2020Rethinking Positional Encoding in Language Pre-trainingcited by 197
- 2022Transformer Quality in Linear Timecited by 189
- 2023Quantizable Transformers: Removing Outliers by Helping Attention Heads Do Nothingcited by 147
- 2023The MiniPile Challenge for Data-Efficient Language Modelscited by 74
- 2022Your Transformer May Not be as Powerful as You Expectcited by 55
- 2022Bidirectional Language Models Are Also Few-shot Learnerscited by 48
- 2019Rethinking Softmax Cross-Entropy Loss for Adversarial Robustnesscited by 1
Built on by
Citing papers per year: 2024: 6; 2025: 9; 2026: 5.
20 papers.
Sort:
By area:
- 2024When Attention Sink Emerges in Language Models: An Empirical Viewcited by 200
- 2025Seeing Far and Clearly: Mitigating Hallucinations in MLLMs with Attention Causal Decodingcited by 42
- 2024Deeper Insights Without Updates: The Power of In-Context Learning Over Fine-Tuningcited by 20
- 2024When Precision Meets Position: BFloat16 Breaks Down RoPE in Long-Context Trainingcited by 15
- 2024MiSS: Revisiting the Trade-off in LoRA with an Efficient Shard-Sharing Structurecited by 6
- 2025Rethinking Causal Mask Attention for Vision-Language Inferencecited by 6
- 2024AERO: Entropy-Guided Framework for Private LLM Inferencecited by 3
- 2025DenoMAE2.0: Improving Denoising Masked Autoencoders by Classifying Local Patchescited by 3
- 2025Induction Head Toxicity Mechanistically Explains Repetition Curse in Large Language Modelscited by 3
- 2026A Structural Theory of Position Bias in Transformerscited by 3
- 2025NanoVLMs: How small can we go and still make coherent Vision Language Models?cited by 2
- 2025MODA: MOdular Duplex Attention for Multimodal Perception, Cognition, and Emotion Understandingcited by 2
8 more
- 2025Rethinking Key-frame-based Micro-expression Recognition: A Robust and Accurate Framework Against Key-frame Errorscited by 2
- 2026Aligning What Vision-Language Models See and Perceive with Adaptive Information Flowcited by 2
- 2026Mask-Based Priors Are More Persistent than Query-Key Initializationscited by 1
- 2024CaTs and DAGs: Integrating Directed Acyclic Graphs with Transformers for Causally Constrained Predictionscited by 0
- 2025ModRWKV: Transformer Multimodality in Linear Timecited by 0
- 2025Enhancing Instruction-Following Capabilities in Seq2Seq Models: DoLA Adaptations for T5cited by 0
- 2026A Circuit, Not The Circuit: Non-Unique Causal Localisation of the Mamba-2 State Sinkcited by 0
- 2026From Attention Masks to Inert Zero-Vector Tokens: OAttention and O-Closure for Token Dynamicscited by 0
- 2026From Attention Masks to Inert Zero-Vector Tokens: OAttention and O-Closure for Token Dynamics21 Aug 2026
- 2026Mask-Based Priors Are More Persistent than Query-Key Initializations1 Aug 2026
- 2026A Circuit, Not The Circuit: Non-Unique Causal Localisation of the Mamba-2 State Sink30 May 2026
- 2026Aligning What Vision-Language Models See and Perceive with Adaptive Information Flow17 Apr 2026
- 2026A Structural Theory of Position Bias in Transformers18 Feb 2026
- 2025Enhancing Instruction-Following Capabilities in Seq2Seq Models: DoLA Adaptations for T53 Dec 2025
- 2025Rethinking Key-frame-based Micro-expression Recognition: A Robust and Accurate Framework Against Key-frame Errors8 Aug 2025
- 2025MODA: MOdular Duplex Attention for Multimodal Perception, Cognition, and Emotion Understanding7 Jul 2025
- 2025Rethinking Causal Mask Attention for Vision-Language Inference24 May 2025
- 2025Seeing Far and Clearly: Mitigating Hallucinations in MLLMs with Attention Causal Decoding22 May 2025
- 2025ModRWKV: Transformer Multimodality in Linear Time20 May 2025
- 2025Induction Head Toxicity Mechanistically Explains Repetition Curse in Large Language Models17 May 2025
8 more
- 2025DenoMAE2.0: Improving Denoising Masked Autoencoders by Classifying Local Patches25 Feb 2025
- 2025NanoVLMs: How small can we go and still make coherent Vision Language Models?11 Feb 2025
- 2024When Precision Meets Position: BFloat16 Breaks Down RoPE in Long-Context Training20 Nov 2024
- 2024CaTs and DAGs: Integrating Directed Acyclic Graphs with Transformers for Causally Constrained Predictions18 Oct 2024
- 2024AERO: Entropy-Guided Framework for Private LLM Inference16 Oct 2024
- 2024When Attention Sink Emerges in Language Models: An Empirical View14 Oct 2024
- 2024Deeper Insights Without Updates: The Power of In-Context Learning Over Fine-Tuning7 Oct 2024
- 2024MiSS: Revisiting the Trade-off in LoRA with an Efficient Shard-Sharing Structure19 Sep 2024
- 2025Seeing Far and Clearly: Mitigating Hallucinations in MLLMs with Attention Causal Decodingcited by 42
- 2025NanoVLMs: How small can we go and still make coherent Vision Language Models?cited by 2
- 2025MODA: MOdular Duplex Attention for Multimodal Perception, Cognition, and Emotion Understandingcited by 2
- 2026Aligning What Vision-Language Models See and Perceive with Adaptive Information Flowcited by 2
- 2026Aligning What Vision-Language Models See and Perceive with Adaptive Information Flow17 Apr 2026
- 2025MODA: MOdular Duplex Attention for Multimodal Perception, Cognition, and Emotion Understanding7 Jul 2025
- 2025Seeing Far and Clearly: Mitigating Hallucinations in MLLMs with Attention Causal Decoding22 May 2025
- 2025NanoVLMs: How small can we go and still make coherent Vision Language Models?11 Feb 2025
- 2024Deeper Insights Without Updates: The Power of In-Context Learning Over Fine-Tuningcited by 20
- 2024When Precision Meets Position: BFloat16 Breaks Down RoPE in Long-Context Trainingcited by 15
- 2024MiSS: Revisiting the Trade-off in LoRA with an Efficient Shard-Sharing Structurecited by 6
- 2024AERO: Entropy-Guided Framework for Private LLM Inferencecited by 3
- 2025DenoMAE2.0: Improving Denoising Masked Autoencoders by Classifying Local Patchescited by 3
- 2025Induction Head Toxicity Mechanistically Explains Repetition Curse in Large Language Modelscited by 3
- 2026A Structural Theory of Position Bias in Transformerscited by 3
- 2025Rethinking Key-frame-based Micro-expression Recognition: A Robust and Accurate Framework Against Key-frame Errorscited by 2
- 2026Mask-Based Priors Are More Persistent than Query-Key Initializationscited by 1
- 2024CaTs and DAGs: Integrating Directed Acyclic Graphs with Transformers for Causally Constrained Predictionscited by 0
- 2025ModRWKV: Transformer Multimodality in Linear Timecited by 0
- 2025Enhancing Instruction-Following Capabilities in Seq2Seq Models: DoLA Adaptations for T5cited by 0
12 most cited of 13 All 13 (JSON)
- 2026From Attention Masks to Inert Zero-Vector Tokens: OAttention and O-Closure for Token Dynamics21 Aug 2026
- 2026Mask-Based Priors Are More Persistent than Query-Key Initializations1 Aug 2026
- 2026A Structural Theory of Position Bias in Transformers18 Feb 2026
- 2025Enhancing Instruction-Following Capabilities in Seq2Seq Models: DoLA Adaptations for T53 Dec 2025
- 2025Rethinking Key-frame-based Micro-expression Recognition: A Robust and Accurate Framework Against Key-frame Errors8 Aug 2025
- 2025ModRWKV: Transformer Multimodality in Linear Time20 May 2025
- 2025Induction Head Toxicity Mechanistically Explains Repetition Curse in Large Language Models17 May 2025
- 2025DenoMAE2.0: Improving Denoising Masked Autoencoders by Classifying Local Patches25 Feb 2025
- 2024When Precision Meets Position: BFloat16 Breaks Down RoPE in Long-Context Training20 Nov 2024
- 2024CaTs and DAGs: Integrating Directed Acyclic Graphs with Transformers for Causally Constrained Predictions18 Oct 2024
- 2024AERO: Entropy-Guided Framework for Private LLM Inference16 Oct 2024
- 2024Deeper Insights Without Updates: The Power of In-Context Learning Over Fine-Tuning7 Oct 2024
12 newest of 13 All 13 (JSON)