potentialpaper

FlashBoB: I/O-Efficient Exact Backward-over-Backward for Softmax Attention

Anthony Givans, Michael Crawshaw, Mingrui Liu

NeurIPS 2026

Edit this page

Or clone it with git

Run in a terminal:

Needs Git LFS. To push, use an API key from your profile as the password.

Or let your agent set it up

It checks and sets up everything: signing in, git, the clone, credentials and an SSH key.

TL;DR. FlashBoB is an I/O-efficient algorithm for exact backward-over-backward in softmax attention that enables long-context second-order training.

Abstract. 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-written 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×NN \times N intermediate tensors, where NN 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 Θ(N2d2/M)\Theta(N^2 d^2/M) HBM traffic (dd is the head dimension and MM is the on-chip SRAM size) and, within the standard FlashAttention-style score-recomputation model, matches the inherited large-cache lower bound for exact forward attention. Empirically, in an isolated attention-layer benchmark on a single A100 80GB GPU, it computes exact attention BoB at N=262KN=262\text{K}, where prior PyTorch exact baselines exhaust memory by N=16KN=16\text{K}, and it is up to 9.4×9.4\times faster than FlashBack. Across complete second-order steps on GPT-2, Pythia, and five native GQA and MoE models, FlashBoB is 1.61.6--3.8×3.8\times faster than the fastest exact baseline that fits on chip, supports 22--8×8\times longer contexts, and cuts 1B-token Sophia-H training time and peak memory on FineWeb by 2.2×2.2\times. These results make exact second-order attention practical at long-context sequence lengths where prior implementations cannot run efficiently.

Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.

Claim this paper
How does this paper connect to your work? Write how you built on it, compared with it or reproduced it, or add a summary, a critique or errata.
Or make it interactive:
Start writing

edit · history

DateVersionSubmitted toPDFEvidence
2 May 2026NeurIPS 2026submittedNeurIPS 2026Accept (poster)reviews ↓[1]PDF[1]
Missing a version?

NeurIPS 2026

Accept (poster) · 3 reviews · OpenReview

Updated 25 Nov 2026, 03:47 UTC.

Program Chairs · DecisionOpenReview ↗
Decision
Accept (poster)
Read decision
Meta-review

This paper proposes FlashBoB, a memory-efficient method for computing gradients over attention for long sequences. The authors leverage a clever affine structure to reduce a four-pass algorithm to a two-pass algorithm while preserving correctness. The reviewers find the evaluation strong, though some reviewers ask for broader experiments on more workloads and better disentanglement of the algorithm from framework-level changes. Such experiments would make the paper stronger.

Final justification

The reviewers opinions of the paper remain strong after the rebuttal process.

Area Chair SB5J · Meta-reviewOpenReview ↗
Final justification
The reviewers opinions of the paper remain strong after the rebuttal process.
Read meta-review
Meta-review

This paper proposes FlashBoB, a memory-efficient method for computing gradients over attention for long sequences. The authors leverage a clever affine structure to reduce a four-pass algorithm to a two-pass algorithm while preserving correctness. The reviewers find the evaluation strong, though some reviewers ask for broader experiments on more workloads and better disentanglement of the algorithm from framework-level changes. Such experiments would make the paper stronger.

Reviewer yBiROpenReview ↗
Rating
6/6
Confidence
3/5
Quality
4/4
Clarity
3/4
Significance
4/4
Originality
4/4
Contribution type
general
Ethical concerns
NO or VERY MINOR ethics concerns only
Read review
Summary

The paper presents FlashBoB, an algorithm designed to compute the exact backward-over-backward derivative for softmax attention. Existing software implementations run out of memory on longer sequences. To resolve this limitation, the authors restructure the double-backward computation into a two-pass schedule. By leveraging an internal hierarchical affine structure, the algorithm separates gradient calculations into distinct row-major and column-major sweeps. This specific execution model allows the system to process intermediate variables strictly within on-chip static memory instead of utilizing off-chip high-bandwidth storage. Theoretical modeling confirms the methodology matches established data traffic bounds, and empirical testing demonstrates successful scaling up to 262,144 tokens on a single graphics processing unit.

Strengths and weaknesses

This is a well-written, clever paper that addresses a narrow but important problem. The separation of the complex NxN problem into order(N) row-major and column-major steps is insightful and clearly a great idea. This leads to more efficient data-local computation and allows an elegant back-propagation approach. The experimentation is strong, but the only weaknesses are in a narrow testing domain. It would be interesting to see their ideas applied to attention-aware Post-Training Quantization (PTQ) or optimal transport models. Further, the claim to scale to 262K tokens may not be so useful as in a real case, as one is limited by storage limits imposed by saving non-attention activation tensors.

Questions

What happens if you use versions of Triton optimized to particular advanced architectures rather than generic Triton

Limitations

There are limitations, but they do not invalidate the method's utility, and the authors do not make unreasonable claims.

Formatting concerns

None noted

3 comments
Authors · RebuttalOpenReview ↗
Rebuttal

We thank the reviewer for the thoughtful review and positive comments. We answer your questions below.

W1: Application breadth.

A1: Attention-aware post-training quantization (PTQ) is a natural application direction for FlashBoB. In particular, Q-BERT [1] estimates Transformer-layer Hessian spectra through matrix-free Hessian-vector products, for which FlashBoB can directly accelerate the softmax-attention BoB component without introducing any additional approximation. Recent attention-aware PTQ methods such as APTQ and BoA avoid exact attention BoB through approximate or backpropagation-free curvature constructions [5, 6]. FlashBoB opens a complementary, previously impractical design point: attention-aware PTQ based on exact Hessian-vector products, which can retain curvature information omitted by these approximations. We have not yet evaluated this direction end to end, so we present it as a newly enabled application rather than an established empirical improvement.

Optimal-transport models based on Sinkhorn attention [2] use a different normalization operator from row-wise softmax. Supporting them would require a new BoB derivation and kernel, and is an interesting extension rather than a direct application of the current implementation.

W2: The 262262K-token claim.

A2: We agree that 262262K should be described explicitly as an isolated attention-layer feasibility result, not a full-model training context. Our full-model benchmarks reach N=32,768N=32{,}768 for GPT-2 Small and N=16,384N=16{,}384 for GPT-2 Medium/Large, where non-attention activations and model state also consume memory.

We will revise the first mention to:

On a single A100 80GB GPU, FlashBoB computes exact BoB for an isolated GPT-2 Small attention layer at N=262N=262K; the PyTorch math baseline OOMs at N=8N=8K and the HVP baselines by N=16N=16K. This is an attention-layer benchmark, not a full-model training length.

Q1: Architecture-specialized implementations.

A3: Our implementation uses upstream Triton. Although Triton lowers tl.dot to the target GPU, we do not explicitly use Tensor Memory Accelerator (TMA) pipelines, warp specialization, or architecture-specific Matrix Multiply Accumulate (MMA) schedules. Hopper- or Blackwell-specialized implementations could therefore improve absolute runtime, as demonstrated by FlashAttention-3/4 [3, 4]. The magnitude of this improvement requires measurement, but it would not change FlashBoB's exactness, two-pass ownership structure, or asymptotic

References

[1] S. Shen, Z. Dong, J. Ye, L. Ma, Z. Yao, A. Gholami, M. W. Mahoney, and K. Keutzer. Q-BERT: Hessian based ultra low precision quantization of BERT. In Proceedings of the AAAI Conference on Artificial Intelligence, 2020.

[2] M. E. Sander, P. Ablin, M. Blondel, and G. Peyré. Sinkformers: Transformers with doubly stochastic attention. In Proceedings of the International Conference on Artificial Intelligence and Statistics, 2022.

[3] J. Shah, G. Bikshandi, Y. Zhang, V. Thakkar, P. Ramani, and T. Dao. FlashAttention-3: Fast and accurate attention with asynchrony and low-precision. In Advances in Neural Information Processing Systems, 2024.

[4] T. Zadouri et al. FlashAttention-4: Algorithm and kernel pipelining co-design for asymmetric hardware scaling. In Proceedings of Machine Learning and Systems, 2026.

[5] Ziyi Guan, Hantao Huang, Yupeng Su, Hong Huang, Ngai Wong, and Hao Yu. APTQ: Attention-aware post-training mixed-precision quantization for large language models. In Proceedings of the 61st ACM/IEEE Design Automation Conference (DAC), Article 107, pages 1--6, 2024. doi:10.1145/3649329.3658498.

[6] Junhan Kim, Ho-Young Kim, Eulrang Cho, Chungman Lee, Joonyoung Kim, and Yongkweon Jeon. BoA: Attention-aware post-training quantization without backpropagation. In Proceedings of the 42nd International Conference on Machine Learning (ICML), volume 267 of Proceedings of Machine Learning Research, pages 30132--30152, 2025.

Reviewer yBiR · CommentOpenReview ↗

Rebuttals Strengthen my Positivity

I have read the authors' responses to my review and to the other reviewers. I commend the authors on a strong rebuttal. The additional experiments demonstrating efficacy on head dimensions of d=128, as well as across broader architectures, resolve my concern regarding a 'narrow testing domain.' Furthermore, I appreciate the authors' agreement to clarify that the 262K token claim is an isolated operator limit rather than an end-to-end training reality, and their clear answer regarding architecture-specific Triton optimizations. The paper is theoretically rigorous, practically impactful, and the rebuttal has only made it stronger. I happily maintain my score of 6 (Strong Accept)

Authors · CommentOpenReview ↗

Thank You

A heartfelt thank you for your thoughtful follow-up comment, along with your careful and methodical evaluation of our work. We are glad that our discussions and additional experiments were able to address your concerns. Your comment was immensely helpful in improving our paper!

Reviewer eTzoOpenReview ↗
Rating
5/6
Confidence
4/5
Quality
3/4
Clarity
3/4
Significance
4/4
Originality
3/4
Contribution type
general
Ethical concerns
NO or VERY MINOR ethics concerns only
Read review
Summary

This work introduced FlashBoB, which extends the Flash attention scheduling style to exact backward over backward computation for softmax attention useful for meta-learning/ second-order optimization methods. The authors uses the hierarchical affine structure in the softmax double backward utilising a two-pass tiled schedule without materialisation full NXN intermediates, thus making it practical at long-context lengths too. The authors also provide experiment with second order optimizer Sophia-H with their FlashBOB implementation.

Strengths and weaknesses

Overall the paper is easy to follow and presents a timely effort as second-order optimizers are on rise again for large-scale training. This work starts to fill an important gap by making exact backward-over-backward computation practical for long-context attention.

Strengths:

  • The authors leverage a hierarchical affine structure that enables reducing a natural four-pass BoB computation into a two-pass schedule while preserving exactness.
  • The evaluation benchmarks are comprehensive, covering kernel-level benchmarks, end-to-end training comparisons with baselines, wall-clock time, peak memory, and maximum supported context length.
  • The authors provide an I/O complexity analysis showing optimality under the Flash-attn style score-recomputation model.
  • The reported improvements in runtime and memory efficiency are substantial and consistently demonstrated across experiments.

Weaknesses:

  • Part of the reported end-to-end training speedup appears to arise from retaining optimized attention backends that are unavailable in PyTorch's standard double-backward path, making it somewhat difficult to disentangle algorithmic gains from framework-level integration advantages.
Questions

How does FlashBoB integrate with distributed training strategies such as FSDP and context/sequence parallelism, and are the reported gains expected to persist when communication costs become significant?

Limitations

yes

Final justification

I retain my original score of accept after rebuttal, it was overall a nice read.

Formatting concerns

NA

3 comments
Authors · RebuttalOpenReview ↗
Rebuttal

We thank the reviewer for the thoughtful review and positive comments. We address the stated weakness and question below.

W1: Separating the BoB-kernel and integration gains.

A1: We added a matched hybrid control that uses FlashAttention for the ordinary forward and first backward in both methods; only the attention BoB computation during Hessian estimation differs. The hybrid baseline uses PyTorch's math path, while FlashBoB uses our exact kernel. All other settings are identical.

Table R1. End-to-end comparison with the matched hybrid control on 8×8\times A100 80GB GPUs.

Hessian interval Hybrid baseline (hr) FlashBoB (hr) Speedup
Every 10 steps 0.77 0.63 1.22×1.22\times
Every 5 steps 1.12 0.79 1.42×1.42\times
Every 2 steps 2.11 1.24 1.70×1.70\times

FlashBoB remains 1.221.22–1.70×1.70\times faster, with larger gains when Hessian estimation is more frequent. This isolates a clear benefit from the BoB kernel itself; the original 2.17×2.17\times result additionally includes the benefit of the optimized forward and first-backward integration. We will distinguish these two effects clearly.

Q1: Distributed training.

A2: FlashBoB plays the same local role for attention BoB that FlashAttention plays for the forward and first backward. Our 8-GPU Sophia-H experiment already uses data parallelism: FlashBoB changes only the local attention BoB computation and leaves gradient communication unchanged. The same principle applies to head-wise tensor parallelism, pipeline parallelism, and Ulysses-style sequence parallelism, where each device performs local attention for a subset of heads.

Ring or context parallelism requires embedding FlashBoB's two passes into the block-circulation and communication-overlap schedule used by distributed FlashAttention; we have not yet implemented this extension. If both methods share communication cost TcommT_{\mathrm{comm}}, the distributed speedup is $\frac{T_{\mathrm{comm}} + T_{\mathrm{base}}} {T_{\mathrm{comm}} + T_{\mathrm{FlashBoB}}}$, so the local compute and memory gains persist, while the end-to-end speedup decreases toward 1×1\times as communication dominates. Standard PyTorch FSDP currently does not support double backward, making FSDP compatibility a framework-level integration issue rather than a limitation specific to FlashBoB.

Reviewer eTzo · CommentOpenReview ↗

Thank you to the authors for the detailed rebuttal and for addressing my comments. I appreciate the additional hybrid-control experiment, which better isolates the algorithmic contribution of FlashBoB from framework-level integration benefits, as well as the detailed discussion on distributed training. Overall, I had a good time reading this paper.

Authors · CommentOpenReview ↗

Thank you for your review

Thank you very much for your thoughtful follow-up comment and your careful evaluation of our work. We are glad that the additional experiment and discussion addressed your concerns. We will incorporate the additional results and clarifications into the revised version. Thank you for helping us improve the paper!

Reviewer chBbOpenReview ↗
Rating
5/6
Confidence
3/5
Quality
2/4
Clarity
2/4
Significance
2/4
Originality
3/4
Contribution type
general
Ethical concerns
NO or VERY MINOR ethics concerns only
Read review
Summary

This work presents a memory efficient implementation of taking gradients over the backward pass of attention. It describes fused kernels for backward over backward that deploy the same principles behind FlashAttention which rely on recomputing intermediates rather than materializing them, hence minimizing slow memory transfers and taking advantage of modern GPUs which allow for more compute to balance out the reconstruction. Further, the method establishes a 2-pass split in calculating the backboard over backward of the queries, keys, and values with minimal intermediates stored between the passes. This allows the passes to focus on reductions along different axes. The paper presents theoretical estimates of the memory movements and complexity to further support their method. It claims that this method allows for backward over backward to be calculated much faster and with a much smaller memory budget compared to existing methods.

Strengths and weaknesses

Strengths:

  1. The paper presents a clear addition over the previous methods which reduces bandwidth and memory requirements for attention backward over backward. In particular, the choice of the 2-pass kernel split with only O(N) intermediates, makes for a very memory efficient implementation which caters to compute:bandwidth skew of modern accelerators
  2. The paper does a through job of covering the I/O analysis for HBM transfers and prescribes a clear way of understanding the cache / SRAM requirements of the implementation
  3. The paper studies performance and quality over a large sweep of sequence length, which is a useful aspect to highlight for this method that saves a lot of memory compared to other techniques

Weaknesses:

  1. The main benchmark of focus is chosen to be a model with head dimension 64. While the results claimed here are impressive and useful to know, the more common head dimension 128 is not discussed as much as the brief mention in section N shows much more modest results. The spread of ablation, benchmarks, and comparisons are not shown head dimension 128 - particularly, comparison with FlashBack, the closest implementation in spirit, have not been shown at head dimension 128. This choice makes the potential impact of the study weaker.
  2. While the theoretical implications and prescriptions for the block sizes Br and Bc to use are discussed at length, the real block sizes used for the shown examples are not presented in the paper. While this might show up later in the code, it is useful to have in the paper as well since it can give an indication for scaling of a very register-constrained kernel. Particularly as head-dimension scales up, it is useful to know if the Br and Bc remain above the threshold to maintain performance when fed to tensor cores.
  3. The range of the experiments is mostly limited to one model family in GPT-2, and one or two other models, especially in the end to end training tests would be a great way to further solidify the message
Questions

Key questions:

  1. Did the authors have a chance to run more extensive tests with head-dimension 128 beyond what is presented in section N ? Do the authors expect the scaling between the sequence length and time taken by FlashBoB behaves similarly at head-dim 128 ?
  2. Did the authors run performance comparisons of FlashBoB at head-dim 128 and FlashBack at head-dim128 ? Do the authors expect one to have the advantage ?
  3. In Table 2, it seems the wall clock times of FlashBoB for GPT-2 Large are smaller than those at GPT-2 Medium. It also looks like less memory is used as well. Is this expected behavior ? How do the authors understand this difference ?

Other questions:

  1. Line 41-42 in the introduction read "exhausts memory at sequence length N = 8,192 on a single A100 80GB GPU". Can authors clarify the head dimension, number of heads, query grouping, or the data type in question ? Is this line discussing the GPT2 model attention discussed later in the work and if so, is that clarified somewhere in the introduction around this ?
Limitations

Yes

Final justification

My primary concern was the paper adding sufficient information for practitioners to understand how to apply the method in useful models, or at least understand the extent of limitations. The authors have not only expanded on the limitations of the method and kernels at head-dim 128, but also further shown the method to be an improvement even in other models with a good coverage. This goes beyond my expectations of the scope of additions, so I would be happy to increase my score up to a 5 - on the understanding that the authors make the promised changes to a revision.

Formatting concerns

None

6 comments
Authors · RebuttalOpenReview ↗
Rebuttal

Thank you for a careful and specific review. You identified three evidence gaps (head dimension d=128d=128, the matched FlashBack comparison, and model-family breadth) and two clarifications. We addressed your concerns below.

W1 (Q1): Head dimension 128.

A1: We ran new experiments with d=128d=128, and the new experiments support the same central conclusion as the d=64d=64 results in the main paper. FlashBoB remains faster wherever the baselines fit, uses substantially less memory, and is the only evaluated method that can handle sequence length N≥32N \geq 32K.

Table R1. Isolated attention BoB at d=128d=128. Batch 4, 12 heads, causal, BF16 with FP32 reductions, NVIDIA B300. Median of 100 timed iterations after 25 warmup iterations. Speedup is relative to the fastest baseline that fits.

NN Math (ms) HVP-M (ms) HVP-S (ms) FlashBoB (ms) Speedup FlashBoB memory (MiB)
256 1.3 1.1 1.7 0.7 1.47×1.47\times 133
512 2.1 1.2 1.6 0.9 1.26×1.26\times 250
1,024 6.8 2.9 3.3 1.8 1.61×1.61\times 485
2,048 24.9 11.6 10.8 5.2 2.08×2.08\times 553
4,096 94.2 41.5 39.1 18.2 2.15×2.15\times 1,106
8,192 366.3 178.6 160.7 68.2 2.36×2.36\times 2,211
16,384 OOM 620.0 602.6 263.6 2.29×2.29\times 4,422
32,768 OOM OOM OOM 1,037.0 -- 8,844
65,536 OOM OOM OOM 4,124.2 -- 17,688

Table R1 shows the new experimental results at d=128d=128. At N=2,048N=2{,}048--16,38416{,}384, FlashBoB is 2.082.08--2.36×2.36\times faster than the best surviving baseline. Its observed pattern matches what was observed at d=64d=64. We originally used d=64d=64 because it matches the default configurations of GPT-2.

W1 (Q2): FlashBoB versus FlashBack at head dimension 128.

A2: Thank you for this suggestion. We added a matched comparison with FlashBack at d=128d=128. Under the same batch size, number of heads, precision, causal mask, and hardware, FlashBoB is faster at every tested sequence length, with speedup increasing from 1.63×1.63\times at N=256N=256 to 9.43×9.43\times at N=65,536N=65{,}536.

Table R2. Matched FlashBack comparison at d=128d=128. Batch 4, 12 heads, causal BF16, NVIDIA B300.

NN FlashBack (ms) FlashBoB (ms) Speedup
256 1.217 0.747 1.63×1.63\times
512 3.241 0.921 3.52×3.52\times
1,024 10.689 1.786 5.98×5.98\times
2,048 39.030 5.186 7.53×7.53\times
4,096 156.033 18.232 8.56×8.56\times
8,192 619.004 68.227 9.07×9.07\times
16,384 2,451.531 263.646 9.30×9.30\times
32,768 9,754.575 1,037.029 9.41×9.41\times
65,536 38,902.585 4,124.157 9.43×9.43\times

For both methods, we tested multiple kernel configurations and report the fastest at each NN. For FlashBack, we swept block sizes in 16,32{16,32}, stages in 1,2,3{1,2,3}, and warp counts in 4,8{4,8}. The widening gap is consistent with FlashBack's contended global atomic updates, whereas FlashBoB assigns each output to a unique owning tile and avoids cross-tile accumulation. We report runtime only because different allocation paths make peak-memory measurements not directly comparable.

W2: Concrete block sizes and Tensor Core compatibility.

A3: Thank you for pointing this out. At d=128d=128, the selected row-pass configurations use (Br,Bc)∈(16,16),(32,16)(B_r,B_c)\in{(16,16),(32,16)} with two stages, while the column pass uses (Bm,Bn)∈(16,16),(16,32)(B_m,B_n)\in{(16,16),(16,32)} with two or three stages. All use four warps, and the tile dimensions remain multiples of 16 and Tensor Core-compatible. For larger dd, configurations exceeding the register or shared-memory budgets are pruned. We will add these practical configurations to the implementation details in the revised version of this paper.

W3: Model-family breadth.

A4: Thank you for this suggestion. To evaluate whether our end-to-end results extend beyond GPT-2 and to the d=128d=128 setting requested in the main text, we added experiments on Pythia-160M and Pythia-410M. Pythia is based on the GPT-NeoX architecture, providing a distinct model family from GPT-2.

Table R3. End-to-end second-order steps on Pythia (GPT-NeoX) at d=128d=128. Batch 4, BF16 with FP32 reductions, NVIDIA B300. Speedup is relative to the fastest baseline that fits.

Model NN Math (ms) HVP-M (ms) HVP-S (ms) FlashBoB (ms) FlashBoB memory (MiB) Speedup
Pythia-160M 512 87.9 91.0 101.8 79.1 5,062 1.11×1.11\times
Pythia-160M 1,024 103.2 106.0 106.2 99.3 8,942 1.04×1.04\times
Pythia-160M 2,048 152.4 161.4 142.7 115.7 16,702 1.23×1.23\times
Pythia-160M 4,096 420.8 437.0 361.7 239.8 32,222 1.51×1.51\times
Pythia-160M 8,192 OOM 1,563.1 1,195.0 659.0 63,263 1.81×1.81\times
Pythia-160M 16,384 OOM 5,069.5 4,088.9 2,064.2 126,273 1.98×1.98\times
Pythia-160M 32,768 OOM OOM OOM 7,114.6 250,435 --
Pythia-410M 512 93.7 91.5 92.2 81.7 8,763 1.12×1.12\times
Pythia-410M 1,024 161.1 158.5 148.4 126.3 14,502 1.17×1.17\times
Pythia-410M 2,048 368.0 393.8 328.7 242.9 25,992 1.35×1.35\times
Pythia-410M 4,096 1,074.1 1,125.0 918.4 583.7 48,974 1.57×1.57\times
Pythia-410M 8,192 OOM 4,121.5 3,121.7 1,652.8 94,937 1.89×1.89\times
Pythia-410M 16,384 OOM OOM OOM 5,280.2 186,863 --

As shown in Table R3, FlashBoB outperforms the fastest baseline that fits in memory across both model sizes. The gains become particularly pronounced at long sequence lengths, reaching 1.98×1.98\times for Pythia-160M at N=16,384N=16{,}384 and 1.89×1.89\times for Pythia-410M at N=8,192N=8{,}192, the longest sequence lengths supported by the baselines. Moreover, FlashBoB continues to N=32,768N=32{,}768 and N=16,384N=16{,}384, respectively, after all baselines run out of memory.

These results show that the end-to-end speedups and memory advantages extend beyond GPT-2 to the GPT-NeoX model family, across two model scales, and in the requested d=128d=128 regime. As expected, the end-to-end speedups are smaller than the isolated attention gains because the non-attention computation remains unchanged.

Q3: GPT-2 Medium versus Large in Table 2.

A5: Regarding Table 2, we apologize for the confusing presentation. The sequence-length sweep restarts for each model, so reading across the Medium–Large boundary compares Medium at N=16,384N=16{,}384 with Large at N=2,048N=2{,}048. At every matched NN, GPT-2 Large is slower and uses more memory, as expected. We will clarify in the caption that NN restarts for each model and make the model boundaries more prominent.

Q4: Configuration behind the introductory memory result.

A6: The quoted result refers to the isolated GPT-2 Small attention layer evaluated later in the paper, not to a full-model training step. It uses batch size 4, 12 standard multi-head attention heads with head dimension d=64d=64 (hidden size 768), causal masking, BF16 inputs with FP32 reductions, and a single A100 80GB GPU. No grouped-query or multi-query attention is used. We will state this configuration at the first mention of the result.

Authors · CommentOpenReview ↗

Additional Experiments

Additional evaluation: Native GQA models.

A7: To evaluate whether our gains extend to native grouped-query attention (GQA) and mixture-of-experts (MoE) models, we added complete model-level second-order experiments on five released architectures: Llama 3.2 1B, SmolLM2-135M, SmolLM2-360M, Qwen2.5-1.5B, and Granite 3.1 1B-A400M.

We denote the numbers of query and key/value heads by HQH_Q and HKVH_{KV}, respectively. The models use their native HQ/HKVH_Q/H_{KV} configurations of 32/832/8, 9/39/3, 15/515/5, 12/212/2, and 16/816/8. The first four models are dense. Granite is an MoE model with 32 experts, top-8 routing, and approximately 400M active parameters per token.

HVP-M and HVP-S accept GQA inputs only by repeating the key/value heads before applying equal-head kernels. FlashBack supports native multi-query attention (MQA), where HKV=1H_{KV}=1, but not intermediate GQA configurations with 1<HKV<HQ1 < H_{KV} < H_Q. FlashBoB operates directly on the original HQ/HKVH_Q/H_{KV} layout for both GQA and MQA. We therefore use the exact PyTorch math-attention double-backward path as the model-level baseline.

Table: Complete model-level second-order calculations on native GQA models. Batch size 1, BF16, one NVIDIA B300. Latencies are synchronized CUDA-event medians. Peak memory is PyTorch max_memory_allocated, measured identically for both methods.

Model (dd) NN FlashBoB (ms) Math (ms) Speedup [x] FlashBoB (GiB) Math (GiB) Reduction [x]
Llama 3.2 1B (64) 1,024 68.681 96.664 1.41 16.489 22.987 1.39
2,048 116.920 220.275 1.88 23.755 51.946 2.19
4,096 247.073 653.269 2.64 39.761 152.469 3.83
SmolLM2-135M (64) 1,024 110.231 113.387 1.03 4.211 7.753 1.84
2,048 105.555 146.113 1.38 7.601 21.576 2.84
4,096 147.941 360.238 2.44 14.381 69.893 4.86
8,192 319.350 1,208.060 3.78 27.942 249.214 8.92
SmolLM2-360M (64) 1,024 100.320 116.980 1.17 7.712 13.981 1.81
2,048 122.291 213.072 1.74 13.298 38.021 2.86
4,096 212.327 599.298 2.82 24.470 122.664 5.01
Qwen2.5-1.5B (128) 1,024 111.551 116.835 1.05 21.780 25.944 1.19
2,048 176.361 224.462 1.27 34.482 51.476 1.49
4,096 365.433 568.491 1.56 59.886 128.555 2.15
Granite 3.1 1B-A400M (64) 1,024 113.701 125.384 1.10 15.517 20.222 1.30
2,048 151.667 229.960 1.52 23.167 42.935 1.85
4,096 272.416 593.166 2.18 38.729 118.548 3.06

As shown in the table, FlashBoB is faster and uses less memory across all five models. At the largest sequence length completed by both methods for each model, FlashBoB achieves 1.56--3.78x speedup and 2.15--8.92x peak-memory reduction.

In separate power-of-two capacity sweeps, FlashBoB reaches maximum successful sequence lengths 4×4\times larger than math attention for Llama 3.2 1B and Qwen2.5-1.5B, and 8×8\times larger for both SmolLM2 models and Granite. SmolLM2 measurements beyond its released 8,1928{,}192-token context use RoPE extrapolation and support only the hardware-capacity claim. On Granite, FlashBoB is 2.18×2.18\times faster and provides a 3.06×3.06\times peak-memory advantage at N=4,096N=4{,}096, showing that the gains also extend to the tested MoE workload.

Matched MQA comparison. Because FlashBack supports native MQA, we also compare the two methods directly in this shared setting. At the saved-state second-order attention boundary, using batch size 1, HQ/HKV=8/1H_Q/H_{KV}=8/1, matched BF16 inputs and returned tensors, and the same B300, FlashBoB is 3.96×3.96\times--5.04×5.04\times faster at d=64d=64 and 5.87×5.87\times--8.90×8.90\times faster at d=128d=128 across N=2,048N=2{,}048--131,072131{,}072. This comparison isolates the second-order attention operators and excludes model and optimizer work.

Authors · CommentOpenReview ↗

Follow-up

As the rebuttal deadline is approaching, we would greatly appreciate it if the reviewer could kindly respond and let us know whether our experiments address your concerns. Thanks.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Missing a submission?

Loading the discussion…