Lambda, Stevens Institute of Technology, and the OpenFold team released TurboPairFormer, an open-source implementation of triangle attention and triangle multiplication for biomolecular structure prediction models. The package, available on PyPI, integrates into OpenFold3 and trains it up to 1.73x faster than the original OpenFold3 Triton backend on 16 NVIDIA H100 GPUs, while producing more accurate and bitwise-identical gradients.
Triangle attention is the main cost driver in models like AlphaFold3 and OpenFold3. Standard attention scales quadratically with token count, but triangle attention scales cubically, so doubling the training crop size makes it roughly 8x more expensive. Existing implementations, including NVIDIA cuEquivariance as part of the NVIDIA BioNeMo platform, ByteDance Protenix, and the OpenFold3 Triton backend, already accelerate this operation, but each trades off speed, numerical precision, or reproducibility. TurboPairFormer aims to keep all three on NVIDIA Hopper GPUs.
How the kernels work
TurboPairFormer combines hardware-aware GPU optimizations with a redesigned attention computation. In the backward pass, where gradients are computed for queries, keys, values, and pair biases, existing kernels often recompute attention probabilities several times, once per gradient. TurboPairFormer recomputes each attention probability tile only once and reuses that result for all four gradients, cutting redundant computation.
The implementation also preserves information lost during BF16 rounding. Existing kernels mix FP32 and BF16 precision, and converting FP32 values to BF16 introduces rounding errors. TurboPairFormer captures the rounding residual when the forward-pass output converts from FP32 to BF16 and uses it to improve backward-pass gradient accuracy. In controlled experiments, this reduced mean gradient error by roughly 28 to 47 percent.
Gradients are made deterministic through a fixed accumulation order. Kernels that use floating-point atomic operations can return slightly different results on identical runs because operation order varies. TurboPairFormer avoids that, producing bitwise-identical gradients every time, which supports more stable training.
Benchmark results
The team integrated TurboPairFormer into OpenFold3 and compared it with seven other backends: ByteDance Protenix, NVIDIA cuEquivariance, TriFast, MegaFold, DeepSpeed-Evo, ScaleFold, and the original OpenFold3 Triton backend. Tests ran on 16 H100 GPUs across two nodes at crop sizes of 384, 640, and 768 tokens. GPU computation time per optimizer step, measured over steps 21 to 200 and excluding data loading, host-to-device transfers, and EMA updates, was lowest for TurboPairFormer at every crop size.
At crop 768, TurboPairFormer was 1.73x faster than OpenFold3 Triton, 1.13x faster than NVIDIA cuEquivariance, and 1.03x to 1.32x faster than the remaining five backends. The gap widened as crop size grew, where triangle attention becomes most expensive. On NVIDIA H200 GPUs, TurboPairFormer trained 1.54x faster than OpenFold3 Triton at crop 768, cutting time per step from 22.53 to 14.67 seconds.
Accuracy and reproducibility
All kernels received identical BF16 inputs, and their gradients were compared against a high-precision FP64 reference. TurboPairFormer had the lowest mean errors for query, key, and pair-bias gradients across tested crop sizes and attention dimensions. Compared with NVIDIA cuEquivariance, it reduced mean gradient error by 31.4 to 44.4 percent for query gradients, 28.7 to 42.4 percent for key gradients, and 16.9 to 37.9 percent for pair-bias gradients. Value-gradient accuracy was essentially tied, which the team attributes to output-residual compensation not directly affecting the value gradient.
Reproducibility was checked on a single H100 GPU with 600 fixed-input cases run five times each. A case counted as reproducible only if all four gradients matched bit for bit across all five runs. TurboPairFormer was reproducible in all 600 cases. To test training stability, the team resumed training from the same checkpoint with each kernel using identical random seeds and training examples on an H100 GPU. With TurboPairFormer, training loss stayed steady with no significant fluctuations and no NaN values.
TurboPairFormer currently supports H100 and H200 GPUs. The package installs via pip, and a quickstart guide and paper describe the full method and results. Authors include researchers from Lambda, Stevens Institute of Technology, and the OpenFold Consortium at Open Molecular Software Foundation.
Sources & references
Lambda: TurboPairFormer: faster, more stable, more accurate OpenFold3 fine-tuning ↗Source consulted: 2026-11-16



