StableMask: Refining Causal Masking in Decoder-only Transformer
Qingyu Yin, Xuzheng He, Xiang Zhuang, Yu Zhao, Jianhua Yao, Xiaoyu Shen, Qiang Zhang
摘要
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.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 8 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Efficient Streaming Language Models with Attention Sinks 引用了 Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation
- Efficient Streaming Language Models with Attention Sinks 引用了 FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
- Efficient Streaming Language Models with Attention Sinks 引用了 Vision Transformers Need Registers
- Efficient Streaming Language Models with Attention Sinks 引用了 Language Models are Few-Shot Learners
- Aligning What Vision-Language Models See and Perceive with Adaptive Information Flow 引用了 Rethinking Causal Mask Attention for Vision-Language Inference
- Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation 引用了 Language Models are Few-Shot Learners
- FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness 引用了 Language Models are Few-Shot Learners
- ModRWKV: Transformer Multimodality in Linear Time 引用了 FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
- Rethinking Causal Mask Attention for Vision-Language Inference 引用了 Efficient Streaming Language Models with Attention Sinks
引用它的顶会 Paper8
- Rethinking Causal Mask Attention for Vision-Language InferenceXiaohuan Pei, Tao Huang, Yanxiang Ma, Chang XuICLR 2026 · 7 次引用
- MiSS: Revisiting the Trade-off in LoRA with an Efficient Shard-Sharing StructureJiale Kang, Qingyu YinICLR 2026 · 3 次引用
- Aligning What Vision-Language Models See and Perceive with Adaptive Information FlowChengxin Liu, Wonseok Choi, Chenshuang Zhang, Tae-Hyun OhCVPR 2026 · 2 次引用
- Rethinking Key-Frame-Based Micro-Expression Recognition: a Robust and Accurate Framework Against Key-Frame ErrorsZheyuan Zhang, Weihao Tang, Hong ChenICCV 2025 · 2 次引用
- ModRWKV: Transformer Multimodality in Linear TimeJiale Kang, Ziyin Yue, Qingyu Yin, Rui Jiang 等EMNLP 2025
它引用的 Paper17
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
- FlashAttention: Fast and Memory-Efficient Exact Attention with IO-AwarenessTri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra 等NeurIPS 2022 · 5,493 次引用
- Efficient Streaming Language Models with Attention SinksGuangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han 等ICLR 2024 · 1,714 次引用
- Train Short, Test Long: Attention with Linear Biases Enables Input Length ExtrapolationOfir Press, Noah A. Smith, Mike LewisICLR 2022 · 1,168 次引用
- Vision Transformers Need RegistersTimothée Darcet, Maxime Oquab, Julien Mairal, Piotr BojanowskiICLR 2024 · 769 次引用
相关 Paper
- SWAN: An Efficient and Scalable Approach for Long-Context Language ModelingKrishna C. Puvvada, Faisal Ladhak, Santiago Akle Serano, Cheng-Ping Hsieh 等EMNLP 2025
- A Length-Extrapolatable TransformerYutao Sun, Li Dong, Barun Patra, Shuming Ma 等ACL 2023 · 45 次引用
- Transformer Language Models without Positional Encodings Still Learn Positional InformationAdi Haviv, Ori Ram, Ofir Press, Peter Izsak 等EMNLP Findings 2022 · 61 次引用
- Context-aware Biases for Length ExtrapolationAli Veisi, Hamidreza Amirzadeh, Amir MansourianEMNLP 2025 · 2 次引用
- Functional Interpolation for Relative Positions improves Long Context TransformersShanda Li, Chong You, Guru Guruganesh, Joshua Ainslie 等ICLR 2024 · 66 次引用
