FlashBoB: I/O-Efficient Exact Backward-over-Backward for Softmax Attention
Anthony Givans, Michael Crawshaw, Mingrui Liu
NeurIPS page · Open on the map
Category: Efficient LLM Inference & Training › Efficient Attention Mechanisms · Type: new method · Keywords: softmax attention, backward-over-backward, memory-efficient algorithm, long-context transformers, second-order optimization
Areas: Memory › Model Memory Optimization › Efficient Attention for LLMs; Long Context › Long-context mechanisms › Attention optimizations; Model Architectures & Sequence Modeling › Language Model Architectures › Sparse Attention
Summary
FlashBoB introduces an exact, memory-efficient algorithm for backward-over-backward (BoB) in softmax attention that scales to long sequences without materializing large intermediate tensors.
Explained to a 5-year-old
FlashBoB helps computers learn from long texts without forgetting. It works like a clever shortcut that avoids storing huge memory blocks. This makes it possible to do advanced learning tricks on regular GPUs. It lets the computer think about its own learning steps more precisely. All of this helps the computer understand longer sentences better.
Explained to a 5-year-old, longer
Imagine you have a big book of rules that a computer follows when it reads sentences. Usually, the computer needs to keep a lot of notes while it learns from those rules, which takes a lot of space. FlashBoB is a new trick that lets the computer learn from those rules without writing down every single note. It uses a smart pattern where only a few small numbers decide everything else, so it saves memory. This means the computer can handle very long sentences without running out of memory. It also makes the computer faster, so it can do more complicated learning tasks like teaching itself new tricks. All of this happens on a normal GPU, not just on super-expensive machines, so many people can use it.
For a technical reader
FlashBoB computes the second derivative of softmax attention efficiently by exploiting an affine structure that reduces memory traffic. It processes data in two passes, keeping on-chip SRAM usage bounded and avoiding large N×N intermediate tensors. This allows exact BoB to scale to sequence lengths of 262K on a single A100 GPU, far beyond previous methods, while also being up to 6.3× faster than existing baselines.
Problem
Exact differentiation through attention for second-order optimization and related applications is limited because current BoB methods either materialize large intermediate tensors or exceed GPU memory at long sequence lengths.
Method
The approach exploits a hierarchical affine structure in the softmax double backward, using two row-wise scalars to compute outputs via affine transformations, and schedules computation in two passes to bound on-chip SRAM usage and minimize off-chip HBM traffic.
Results
The approach scales exact attention BoB to sequence length N=262K on a single A100 80GB GPU, where prior baselines fail at N=16K, and runs up to 6.3× faster than FlashBack.
Contributions
It provides an exact, memory-efficient algorithm for BoB in softmax attention that avoids materializing N×N intermediate tensors and fits within bounded on-chip memory, enabling long-sequence second-order attention.
Practical relevance
Enables exact second-order attention for long contexts, making advanced techniques like meta-learning and gradient-based memory feasible on standard GPUs.
This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction