When Precision Meets Position: BFloat16 Breaks Down RoPE in Long-Context Training
Not on the map. Why?
Abstract (arXiv)
Extending context window sizes allows large language models (LLMs) to process longer sequences and handle more complex tasks. Rotary Positional Embedding (RoPE) has become the de facto standard due to its relative positional encoding properties that benefit long-context training. However, we observe that using RoPE with BFloat16 format results in numerical issues, causing it to deviate from its intended relative positional encoding, especially in long-context scenarios. This issue arises from BFloat16's limited precision and accumulates as context length increases, with the first token contributing significantly to this problem. To address this, we develop AnchorAttention, a plug-and-play attention method that alleviates numerical issues caused by BFloat16, improves long-context capabilities, and speeds up training. AnchorAttention reduces unnecessary attention computations, maintains semantic coherence, and boosts computational efficiency by treating the first token as a shared anchor with a consistent position ID, making it visible to all documents within the training context. Experiments on three types of LLMs demonstrate that AnchorAttention significantly improves long-context performance and reduces training time by over 50% compared to standard full attention mechanisms, while preserving the original LLM's capabilities on general tasks. Our code is available at https://github.com/haonan3/AnchorContext.
Key facts. Cited by 15 papers in the map (data through 14 Oct 2026). Builds on 51 of its 61 references that are in the map. First posted on arXiv 20 Nov 2024.
Builds on
51 of 61 references.
References · 51
- 2017Attention Is All You Needcited by 60,361
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,703
- 2019HellaSwag: Can a Machine Really Finish Your Sentence?cited by 4,100
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,373
- 2023Mistral 7Bcited by 3,164
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
- 2023Efficient Streaming Language Models with Attention Sinkscited by 2,186
- 2024Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phonecited by 1,917
- 2023GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpointscited by 1,346
- 2024RULER: What's the Real Context Size of Your Long-Context Language Models?cited by 1,346
- 2018Self-Attention with Relative Position Representationscited by 1,120
38 more
- 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 740
- 2020Aligning AI With Shared Human Valuescited by 723
- 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 601
- 2023Ring Attention with Blockwise Transformers for Near-Infinite Contextcited by 457
- 2024∞Bench: Extending Long Context Evaluation Beyond 100K Tokenscited by 367
- 2023Effective Long-Context Scaling of Foundation Modelscited by 303
- 2024Massive Activations in Large Language Modelscited by 294
- 2023DeepSpeed Ulysses: System Optimizations for Enabling Training of Extreme Long Sequence Transformer Modelscited by 245
- 2023LongLoRA: Efficient Fine-tuning of Long-Context Large Language Modelscited by 244
- 2019A Study of BFLOAT16 for Deep Learning Trainingcited by 232
- 2024When Attention Sink Emerges in Language Models: An Empirical Viewcited by 208
- 2024Many-Shot In-Context Learningcited by 206
- 2020Rethinking Positional Encoding in Language Pre-trainingcited by 197
- 2024Data Engineering for Scaling Language Models to 128K Contextcited by 186
- 2024How to Train Long-Context Language Models (Effectively)cited by 146
- 2024Physics of Language Models: Part 3.3, Knowledge Capacity Scaling Lawscited by 144
- 2024LLM Maybe LongLM: Self-Extend LLM Context Window Without Tuningcited by 136
- 2023Unlimiformer: Long-Range Transformers with Unlimited Length Inputcited by 128
- 2021Sequence Parallelism: Long Sequence Training from System Perspectivecited by 126
- 2023Scaling Laws of RoPE-based Extrapolationcited by 125
- 2024HELMET: How to Evaluate Long-Context Language Models Effectively and Thoroughlycited by 125
- 2024Leave No Document Behind: Benchmarking Long-Context LLMs with Extended Multi-Doc QAcited by 122
- 2023Randomized Positional Encodings Boost Length Generalization of Transformerscited by 117
- 2024LongCite: Enabling LLMs to Generate Fine-grained Citations in Long-context QAcited by 81
- 2024One Thousand and One Pairs: A "novel" challenge for long-context language modelscited by 80
- 2024Attention Score is not All You Need for Token Importance Indicator in KV Cache Reduction: Value Also Matterscited by 73
- 2024What is Wrong with Perplexity for Long-context Language Modeling?cited by 69
- 2024Active-Dormant Attention Heads: Mechanistically Demystifying Extreme-Token Phenomena in LLMscited by 56
- 2024Base of RoPE Bounds Context Lengthcited by 52
- 2024Sparser is Faster and Less is More: Efficient Sparse Attention for Long-Range Transformerscited by 52
- 2024Can Perplexity Reflect Large Language Model's Ability in Long Text Understanding?cited by 45
- 2023CLEX: Continuous Length Extrapolation for Large Language Modelscited by 44
- 2024Resonance RoPE: Improving Context Length Generalization of Large Language Modelscited by 27
- 2024Analysing The Impact of Sequence Composition on Language Model Pre-Trainingcited by 25
- 2024StableMask: Refining Causal Masking in Decoder-only Transformercited by 20
- 2024LongSkywork: A Training Recipe for Efficiently Extending Context Length in Large Language Modelscited by 19
- 2022Lifelong and Continual Learning Dialogue Systemscited by 9
- 2024A Little Goes a Long Way: Efficient Long Context Training and Inference with Partial Contextscited by 9
50 most cited of 51 All 51 (JSON)
Built on by
Citing papers per year: 2024: 1; 2025: 8; 2026: 6.
15 papers.
Sort:
By area:
- 2025Scaling Laws for Forgetting during Finetuning with Pretraining Data Injectioncited by 35
- 2024Attention Entropy is a Key Factor: An Analysis of Parallel Context Encoding with Full-attention-based Pre-trained Language Modelscited by 26
- 2025LongRoPE2: Near-Lossless LLM Context Window Scalingcited by 24
- 2025Sailor2: Sailing in South-East Asia with Inclusive Multilingual LLMscited by 18
- 2026Addressable Memory for Video World Modelscited by 15
- 2025Efficient Many-Shot In-Context Learning with Dynamic Block-Sparse Attentioncited by 12
- 2025Does quantization affect models' performance on long-context tasks?cited by 10
- 2026AgentLongBench: A Controllable Long Benchmark For Long-Contexts Agents via Environment Rolloutscited by 9
- 2025SkyLadder: Better and Faster Pretraining via Context Window Schedulingcited by 6
- 2025An Inquiry into Datacenter TCO for LLM Inference with FP8cited by 5
- 2026Fractional Rotation, Full Potential? Investigating Performance and Convergence of Partial RoPEcited by 4
- 2025Scaling Context, Not Parameters: Training a Compact 7B Language Model for Efficient Long-Context Processingcited by 2
- 2026RoPE is Dead, Long Live RoPE: Towards Scalable Data-aware Positional Encodings28 Sep 2026
- 2026Addressable Memory for Video World Models7 Aug 2026
- 2026AdapShot: Adaptive Many-Shot In-Context Learning with Semantic-Aware KV Cache Reuse5 May 2026
- 2026Fractional Rotation, Full Potential? Investigating Performance and Convergence of Partial RoPE12 Mar 2026
- 2026LaCy: What Small Language Models Can and Should Learn is Not Just a Question of Loss12 Feb 2026
- 2026AgentLongBench: A Controllable Long Benchmark For Long-Contexts Agents via Environment Rollouts28 Jan 2026
- 2025Does quantization affect models' performance on long-context tasks?26 May 2025
- 2025Scaling Context, Not Parameters: Training a Compact 7B Language Model for Efficient Long-Context Processing13 May 2025
- 2025SkyLadder: Better and Faster Pretraining via Context Window Scheduling19 Mar 2025
- 2025Efficient Many-Shot In-Context Learning with Dynamic Block-Sparse Attention11 Mar 2025
- 2025LongRoPE2: Near-Lossless LLM Context Window Scaling27 Feb 2025
- 2025Sailor2: Sailing in South-East Asia with Inclusive Multilingual LLMs18 Feb 2025
3 more
- 2025Scaling Laws for Forgetting during Finetuning with Pretraining Data Injection9 Feb 2025
- 2025An Inquiry into Datacenter TCO for LLM Inference with FP83 Feb 2025
- 2024Attention Entropy is a Key Factor: An Analysis of Parallel Context Encoding with Full-attention-based Pre-trained Language Models21 Dec 2024
- 2026Addressable Memory for Video World Modelscited by 15
- 2026Addressable Memory for Video World Models7 Aug 2026
- 2025Scaling Laws for Forgetting during Finetuning with Pretraining Data Injectioncited by 35
- 2024Attention Entropy is a Key Factor: An Analysis of Parallel Context Encoding with Full-attention-based Pre-trained Language Modelscited by 26
- 2025LongRoPE2: Near-Lossless LLM Context Window Scalingcited by 24
- 2025Sailor2: Sailing in South-East Asia with Inclusive Multilingual LLMscited by 18
- 2025Efficient Many-Shot In-Context Learning with Dynamic Block-Sparse Attentioncited by 12
- 2025Does quantization affect models' performance on long-context tasks?cited by 10
- 2025SkyLadder: Better and Faster Pretraining via Context Window Schedulingcited by 6
- 2025An Inquiry into Datacenter TCO for LLM Inference with FP8cited by 5
- 2026Fractional Rotation, Full Potential? Investigating Performance and Convergence of Partial RoPEcited by 4
- 2025Scaling Context, Not Parameters: Training a Compact 7B Language Model for Efficient Long-Context Processingcited by 2
- 2026LaCy: What Small Language Models Can and Should Learn is Not Just a Question of Losscited by 0
- 2026RoPE is Dead, Long Live RoPE: Towards Scalable Data-aware Positional Encodingscited by 0
- 2026RoPE is Dead, Long Live RoPE: Towards Scalable Data-aware Positional Encodings28 Sep 2026
- 2026Fractional Rotation, Full Potential? Investigating Performance and Convergence of Partial RoPE12 Mar 2026
- 2026LaCy: What Small Language Models Can and Should Learn is Not Just a Question of Loss12 Feb 2026
- 2025Does quantization affect models' performance on long-context tasks?26 May 2025
- 2025Scaling Context, Not Parameters: Training a Compact 7B Language Model for Efficient Long-Context Processing13 May 2025
- 2025SkyLadder: Better and Faster Pretraining via Context Window Scheduling19 Mar 2025
- 2025Efficient Many-Shot In-Context Learning with Dynamic Block-Sparse Attention11 Mar 2025
- 2025LongRoPE2: Near-Lossless LLM Context Window Scaling27 Feb 2025
- 2025Sailor2: Sailing in South-East Asia with Inclusive Multilingual LLMs18 Feb 2025
- 2025Scaling Laws for Forgetting during Finetuning with Pretraining Data Injection9 Feb 2025
- 2025An Inquiry into Datacenter TCO for LLM Inference with FP83 Feb 2025
- 2024Attention Entropy is a Key Factor: An Analysis of Parallel Context Encoding with Full-attention-based Pre-trained Language Models21 Dec 2024