paper-with-me

Papers

When Precision Meets Position: BFloat16 Breaks Down RoPE in Long-Context Training

2024-11-20 · Haonan Wang, Qian Liu, Chao Du, Tongyao Zhu, Cunxiao Du, Kenji Kawaguchi, Tianyu Pang

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.

📄 PDF Abstract BibTeX arXiv:2411.13476

Code (1)

haonan3/anchorcontext 공식 구현 pytorch

Tasks

Computational EfficiencyPosition

Methods 이 논문이 사용한 방법론

Softmax The Softmax output function transforms a previous layer's output into a vector of probabilities. It is commonly used for multiclass classification. Given an input vector $x$…
Attention 설명 없음

Similar Papers 제목 키워드 기반

A Study of BFLOAT16 for Deep Learning Training

2019-05-29 · Dhiraj Kalamkar, Dheevatsa Mudigere, Naveen Mellempudi, Dipankar Das 외

This paper presents the first comprehensive empirical study demonstrating the efficacy of the Brain Floating Point (BFLOAT16) half-precision format for Deep Learning training across image classification, speech recogniti…

Deep Learningimage-classificationImage ClassificationLanguage Modeling+4

Reparametrizing Shampoo and SOAP for Subspace Basis Updates and BFloat16 Storage

2026-05-25 · Alan Milligan, Zikun Xu, Simon Lacoste-Julien, Felix Dangel 외 arxiv

Shampoo-based methods, such as KL-Shampoo and SOAP, have demonstrated strong performance in training neural networks and rely on QR decomposition. Because existing QR implementations require single-precision (FP32) arith…

Compressed Real Numbers for AI: a case-study using a RISC-V CPU

2023-09-11 · Federico Rossi, Marco Cococcioni, Roger Ferrer Ibàñez, Jesùs Labarta 외

As recently demonstrated, Deep Neural Networks (DNN), usually trained using single precision IEEE 754 floating point numbers (binary32), can also work using lower precision. Therefore, 16-bit and 8-bit compressed format …

CPU

Language Adaptation on a Tight Academic Compute Budget: Tokenizer Swapping Works and Pure bfloat16 Is Enough

2024-08-28 · Konstantin Dobler, Gerard de Melo

We investigate continued pretraining of LLMs for language adaptation on a tight academic budget: a setting in which only a few GPUs can be used in parallel, for a heavily constrained duration. We focus on adapting Mistra…

Representation range needs for 16-bit neural network training

2021-03-29 · Valentina Popescu, Abhinav Venigalla, Di wu, Robert Schreiber

Deep learning has grown rapidly thanks to its state-of-the-art performance across a wide range of real-world applications. While neural networks have been trained using IEEE-754 binary32 arithmetic, the rapid growth of c…