MegaFold: System-Level Optimizations for Accelerating Protein Structure Prediction Models

Hoa La, Ahan Gupta, Alex Morehead, Jianlin Cheng, Minjia Zhang
6/24/2025
q-bio.BMcs.DCcs.LG

Official code: Supercomputing-System-AI-Lab/MegaFold (77 stars, MIT, last commit 2026-04-13).

Abstract

Protein structure prediction models such as AlphaFold3 (AF3) push the frontier of biomolecular modeling by incorporating science-informed architectural changes to the transformer architecture. However, these advances come at a steep system cost, introducing: compute- and memory-intensive operators, 2D attention mechanisms, and retrieval-augmented data pipelines, which collectively hinder the scalability of AF3 training. In this work, we present MegaFold, a cross-platform system to accelerate AF3 training. MegaFold tackles key bottlenecks through ahead-of-time caching to eliminate GPU idle time from the retrieval-augmented data pipeline, Triton-based kernels for memory-efficient EvoAttention on heterogeneous devices, and deep fusion for common and critical small operators in AF3. Evaluation on both NVIDIA H200 and AMD MI250 GPUs shows that MegaFold reduces peak memory usage of AF3 training by up to 1.23$\times$ and improves per-iteration training time by up-to 1.73$\times$ and 1.62$\times$ respectively. More importantly, MegaFold enables training on 1.35$\times$ longer sequence lengths compared to PyTorch baselines without running out-of-memory, significantly improving the scalability of modern protein folding models. We open source our code at https://github.com/Supercomputing-System-AI-Lab/MegaFold/.

View on arXivView PDF

Code Implementations(1)

MIT
777Shell, PythonJun 12, 20256 months agoMIT

Similar Papers

Cite this paper

@article{la2025megafold,
  title  = {MegaFold: System-Level Optimizations for Accelerating Protein Structure Prediction Models},
  author = {Hoa La and Ahan Gupta and Alex Morehead and Jianlin Cheng and Minjia Zhang},
  year   = {2025},
  eprint = {2506.20686},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2506.20686v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2506.20686.svg)](https://codeofpaper.com/paper/2506.20686)

Discussion