High-performance training and inference for deep equivariant interatomic potentials

Chuin Wei Tan, Marc L. Descoteaux, Mit Kotak, Gabriel de Miranda Nascimento, Seán R. Kavanagh, Laura Zichi, Menghang Wang, Aadit Saluja, Yizhong R. Hu, Tess E. Smidt, Anders Johansson, William C. Witt, Boris Kozinsky, Albert MusaelianarXiv 2025 · DOI

Introduction

Equivariant neural networks have emerged as the gold standard for high-accuracy machine learning interatomic potentials (MLIPs). However, their computational complexity often limits their application in large-scale molecular dynamics (MD) simulations. This work presents a significant performance overhaul for the NequIP and Allegro frameworks, leveraging modern compilation techniques and custom kernels to achieve dramatic speedups in both training and inference.

The Challenge of Equivariant Potentials

MLIPs require computing forces as exact negative derivatives of potential energy to ensure energy conservation. This necessitates executing the model's backward pass during inference, a requirement that standard neural network compilers are not natively designed to handle. Furthermore, the complex mathematical operations, such as tensor products, and the dynamic nature of molecular systems (varying atom and neighbor counts) pose significant challenges for traditional optimization frameworks like TorchScript.

Methodology

The authors implemented several key software innovations to overcome these bottlenecks:

  • Full-Graph Compilation: By tracing the entire model—including the automatic differentiation steps for force computation—into a single torch.fx graph, the team enabled PyTorch 2.0’s TorchInductor to generate optimized, dynamic-shape-aware kernels.
  • Custom Distributed Data Parallel (DDP): To maximize kernel fusion, a custom DDP implementation was developed that delays gradient communication until the completion of the entire backward pass, preventing the compiler from fragmenting the computational graph.
  • Ahead-of-Time (AOT) Compilation: For seamless integration with C++ MD codes like LAMMPS, the framework utilizes the Ahead-of-Time Inductor (AOTI). This exports models as self-contained native code, bypassing Python interpreter overhead.
  • Custom Triton Tensor Product Kernel: A specialized Triton kernel was developed for Allegro’s most expensive operation. By using a compressed sparse format, the kernel avoids materializing large intermediate tensors, significantly reducing memory usage.

Experimental Setup

Performance was evaluated using the SPICE 2 dataset, which contains a diverse range of organic systems. Scaling tests were conducted on massive biomolecular systems, including a 23,558-atom DHFR protein and a 408,609-atom cellulose polymer, using the Amber20 Benchmark.

Key Results

Training Performance

The transition to torch.compile yielded substantial improvements in training efficiency. On NVIDIA A100 and AMD MI250X GPUs, the authors observed speedups ranging from 2.4x to 5.0x compared to the legacy TorchScript implementation.

Training performance comparison between TorchScript and torch.compile across different GPU architectures.

Inference and MD Throughput

The combination of AOTI and the custom Triton kernel delivered even more impressive gains in MD simulations. Throughput increased by 4x to 18x across MI250X, A100, and H100 hardware. This optimization also allowed for massive leaps in system size; the "large" Allegro model can now simulate over 5,000 atoms on a single H100 GPU.

Inference throughput and scaling as a function of system size, showing up to 18x speedup with AOTI and custom tensor product kernels.

Supercomputer Scaling

The framework demonstrated excellent strong scaling on supercomputers like Frontier and Perlmutter, effectively utilizing up to 512 nodes for massive systems like the 408k-atom cellulose polymer.

Discussion and Future Work

The results demonstrate that breaking standard deep learning practices—such as disabling gradient bucketing—can be beneficial when it allows for deeper compiler-driven optimizations in specialized domains like MLIPs. While the current custom Triton kernel is optimized for inference, future work will extend this support to the training backward pass. Additionally, exploring per-edge-type cutoffs and lower-precision arithmetic (e.g., TensorFloat32) could provide further performance enhancements.

Summary updated

BibTeX
@misc{tan2025high,
  author = {Chuin Wei Tan and Marc L. Descoteaux and Mit Kotak and Gabriel de Miranda Nascimento and Seán R. Kavanagh and Laura Zichi and Menghang Wang and Aadit Saluja and Yizhong R. Hu and Tess E. Smidt and Anders Johansson and William C. Witt and Boris Kozinsky and Albert Musaelian},
  title = {{High-performance training and inference for deep equivariant interatomic potentials}},
  year = {2025},
  eprint = {2504.16068},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.16068},
}
Figure