FlashBoB: I/O-Efficient Exact Backward-over-Backward for Softmax Attention
Not on the map. Why?
Abstract (arXiv)
Transformer models built on the attention mechanism have become a central building block in modern deep learning, yet softmax attention remains a major bottleneck for long-context workloads. While FlashAttention makes the forward and first backward passes I/O-efficient, it does not support backward-over-backward (BoB), which enables exact differentiation through the backward pass for applications such as second-order optimization, test-time training, gradient-based memory, and meta-learning. Existing BoB implementations either materialize large intermediate tensors or exhaust GPU memory at long sequence lengths. We present FlashBoB, an exact, I/O-efficient algorithm for BoB in softmax attention that keeps computation within on-chip tiles and avoids all N × N intermediate tensors, where N is the sequence length. The key insight is a hierarchical affine structure in the softmax double backward: two row-wise scalars determine all outputs through affine transformations. This yields a two-pass schedule with bounded on-chip static random-access memory (SRAM) usage and minimal off-chip high-bandwidth memory (HBM) traffic. FlashBoB achieves Theta(N2 d2/M) HBM traffic (d is the head dimension and M is the memory size) and, within the standard FlashAttention-style score-recomputation model, matches the inherited large-cache lower bound for exact forward attention. Empirically, it scales exact attention BoB to N=262K on a single A100 80GB GPU, where prior PyTorch exact baselines fail by N=16K, and is up to 6.3× faster than FlashBack. These results make exact second-order attention practical at long-context sequence lengths where prior implementations cannot run efficiently.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 42 of its 57 references that are in the map. First posted on arXiv 21 Sep 2026.
Builds on
42 of 57 references.
References · 42
- 2017Attention Is All You Needcited by 60,361
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,944
- 2017Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networkscited by 4,897
- 2023Mamba: Linear-Time Sequence Modeling with Selective State Spacescited by 4,718
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,673
- 2020Longformer: The Long-Document Transformercited by 3,413
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
- 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 2,022
- 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,850
- 2020Big Bird: Transformers for Longer Sequencescited by 1,684
- 2020Reformer: The Efficient Transformercited by 1,668
30 more
- 2020Rethinking Attention with Performerscited by 1,601
- 2020Linformer: Self-Attention with Linear Complexitycited by 1,474
- 2024The FineWeb Datasets: Decanting the Web for the Finest Text Data at Scalecited by 1,160
- 2018On First-Order Meta-Learning Algorithmscited by 1,018
- 2015Automatic differentiation in machine learning: a surveycited by 855
- 2016Training Deep Nets with Sublinear Memory Costcited by 848
- 2023RWKV: Reinventing RNNs for the Transformer Eracited by 827
- 2015Optimizing Neural Networks with Kronecker-factored Approximate Curvaturecited by 796
- 2019Meta-Learning with Implicit Gradientscited by 525
- 2024FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precisioncited by 519
- 2023Ring Attention with Blockwise Transformers for Near-Infinite Contextcited by 457
- 2018Shampoo: Preconditioned Stochastic Tensor Optimizationcited by 426
- 2023Hyena Hierarchy: Towards Larger Convolutional Language Modelscited by 393
- 2023Sophia: A Scalable Stochastic Second-order Optimizer for Language Model Pre-trainingcited by 265
- 2025FlashInfer: Efficient and Customizable Attention Engine for LLM Inference Servingcited by 258
- 2023DeepSpeed Ulysses: System Optimizations for Enabling Training of Extreme Long Sequence Transformer Modelscited by 245
- 2020ADAHESSIAN: An Adaptive Second Order Optimizer for Machine Learningcited by 202
- 2018Online normalizer calculation for softmaxcited by 162
- 2021Self-attention Does Not Need O(n2) Memorycited by 154
- 2019Checkmate: Breaking the Memory Wall with Optimal Tensor Rematerializationcited by 91
- 2018NVIDIA Tensor Core Programmability, Performance & Precisioncited by 79
- 2019BackPACK: Packing more into backpropcited by 78
- 2026FlashAttention-4: Algorithm and Kernel Pipelining Co-Design for Asymmetric Hardware Scalingcited by 66
- 2025End-to-End Test-Time Training for Long Contextcited by 62
- 2020Dynamic Tensor Rematerializationcited by 46
- 2023FlashFFTConv: Efficient Convolutions for Long Sequences with Tensor Corescited by 33
- 2023DISTFLASHATTN: Distributed Memory-efficient Attention for Long-context LLMs Trainingcited by 29
- 2024On Fine-Grained I/O Complexity of Attention Backward Passescited by 11
- 2026GradMem: Learning to Write Context into Memory with Test-Time Gradient Descentcited by 9
- 2024The I/O Complexity of Attention, or How Optimal is Flash Attention?cited by 6
Built on by
Not cited yet.