Repurposing Density Functional Theory to Suit Deep Learning

Alexander Mathiasen, Hatem Helal, Paul Balanca, Kerstin Klaeser, Josef Dean, Carlo Luschi, Dominique Beaini, Andrew W Fitzgibbon, Dominic MastersSynS and ML @ ICML 2023

TL;DR

This paper introduces PySCFIPU, a novel library that significantly accelerates Density Functional Theory (DFT) calculations on specialized hardware (IPUs), enabling the creation of much larger molecular datasets. They demonstrate that simply increasing dataset size, rather than relying on complex inductive biases, leads to improved neural network performance for molecular property prediction.

What Problem Does This Paper Address?

Predicting molecular properties accurately is crucial for drug discovery and materials science. Density Functional Theory (DFT) is a highly accurate method for this, but it's computationally very expensive. This cost limits the size of datasets that can be generated for training machine learning models, like neural networks (NNs), which aim to approximate DFT predictions much faster. While NNs have shown promise, their performance often plateaus due to insufficient training data. Existing molecular datasets, though large by some standards (up to 20 million molecules), are considered small in the broader machine learning context. This bottleneck prevents NNs from fully capturing the complexity of chemical space.

Methods

The core innovation is PySCFIPU, a specialized library built upon the existing PySCF DFT package. The key advancements are:

  • Hardware Acceleration: PySCFIPU is optimized to run on Intelligence Processing Units (IPUs), which offer high memory bandwidth and MIMD parallelism, making them well-suited for the computationally intensive Electron Repulsion Integrals (ERIs) step in DFT.
  • JAX Porting: The DFT calculations were ported from NumPy to JAX, allowing for automatic differentiation and efficient compilation for IPUs.
  • Optimized DFT Calculations: The library focuses on specific DFT functionals (B3LYP) and basis sets (STO3G, 6-31G) suitable for generating large datasets quickly, even if it means slightly lower precision (using float32 instead of float64).
  • Dataset Generation Strategy: The paper emphasizes a strategy of generating large datasets by iterating on DFT calculations and then training NNs, rather than focusing solely on complex NN architectures or inductive biases.

Datasets

  • QM10X: A newly introduced dataset created using PySCFIPU. It contains approximately 100 million conformers derived from molecules with up to 10 heavy atoms. This dataset was generated in about 13 hours.
  • QM9: A publicly available dataset used for comparison and training.
  • QM9F=0 and QM9F≠0: Subsets of QM9 representing equilibrium and off-equilibrium molecular geometries, respectively, used to investigate the impact of molecular configuration on NN performance.

Key Insights and Ideas

  • Data is King (for Molecular ML): The most significant finding is that simply increasing the size of the training dataset (from 10^4 to 10^8 conformers) dramatically improves SchNet's performance, closing the gap between equilibrium and off-equilibrium predictions. This suggests that for molecular property prediction, scaling up data generation is a more effective strategy than solely relying on complex inductive biases in the model architecture.
  • IPUs are Well-Suited for DFT: The paper highlights the inherent advantages of IPUs for DFT calculations, particularly their memory bandwidth and parallelism, which allow for faster generation of large datasets.
  • Trade-offs in DFT for ML: The authors demonstrate that by making pragmatic choices in DFT (e.g., basis set, precision), it's possible to generate massive datasets much faster, which can then be used to train NNs that achieve competitive accuracy.
  • Generalization Challenges: SchNet trained on molecules with a specific number of atoms (10) did not generalize well to molecules with different numbers of atoms. However, augmenting the training set with data from a wider range of atom counts improved generalization.

Key Results

  • QM10X Generation: The QM10X dataset of 100 million conformers was generated in approximately 13 hours using 304 IPUs.
  • SchNet Training Speed: A 9M parameter SchNet model was trained on QM10X (up to 10^8 conformers) in 12 hours.
  • Performance Improvement: Increasing the QM10X dataset size from 10^4 to 10^8 conformers improved the validation Mean Absolute Error (MAE) for HOMO-LUMO gap prediction from 0.348eV to 0.0486eV, comparable to state-of-the-art results on equilibrium molecules.
  • Off-Equilibrium Prediction: SchNet performed worse on off-equilibrium molecules (0.123eV MAE) compared to equilibrium molecules (0.049eV MAE), but this gap was reduced by using larger datasets.
  • Numerical Error: PySCFIPU's numerical error for converged molecules was 0.00605eV for energies and 0.00019eV for HOMO-LUMO gap, which is larger than typical float64 DFT but still within acceptable ranges for NN training.

Limitations and Future Work

  • Memory Constraints: PySCFIPU is currently limited to molecules with a maximum of 12 heavy atoms due to memory constraints, requiring less accurate electron representations (STO3G).
  • Limited Functionals/Basis Sets: The current implementation only supports the B3LYP functional and STO3G/6-31G basis sets.
  • Float32 Precision: The use of float32 instead of float64 introduces some numerical errors, though the authors argue these are acceptable for NN training.
  • Compilation Time: The ahead-of-time compilation model for IPUs adds a small but noticeable overhead (3.19% of total time for QM10X).
  • Future Work: The authors aim to support more DFT functionals by extending JAX-XC. They also plan to improve the memory efficiency of their implementation and explore further optimizations for scaling to larger molecules and more complex DFT calculations. They hope their work will enable the creation of even larger datasets (billions or trillions of molecules) for training foundational quantum chemical models.

Summary updated

BibTeX
@inproceedings{mathiasen2023repurposing,
  author = {Alexander Mathiasen and Hatem Helal and Paul Balanca and Kerstin Klaeser and Josef Dean and Carlo Luschi and Dominique Beaini and Andrew W Fitzgibbon and Dominic Masters},
  title = {{Repurposing Density Functional Theory to Suit Deep Learning}},
  booktitle = {SynS and ML @ ICML},
  year = {2023},
  url = {https://openreview.net/forum?id=kIzat5hJxg},
}
Figure