Benchmarking Graphormer on Large-Scale Molecular Modeling Datasets

Yu Shi, Shuxin Zheng, Guolin Ke, Yifei Shen, Jiacheng You, Jiyan He, Shengjie Luo, Chang Liu, Di He, Tie-Yan Liu

TL;DR

This technical note introduces key architectural updates to Graphormer, a Transformer-based model for graph data, enabling it to achieve state-of-the-art results on massive molecular datasets like PCQM4M and OC20. By switching to Post-Layer Normalization and adapting the architecture for 3D spatial coordinates, the authors demonstrate that Graphormer’s global receptive field makes it theoretically and empirically more powerful than traditional local message-passing Graph Neural Networks (GNNs).

What Problem Does This Paper Address?

Traditional Graph Neural Networks (GNNs) typically rely on "message passing," where nodes only aggregate information from their immediate neighbors. While effective, this local approach often leads to two major bottlenecks: limited expressiveness (the inability to distinguish certain graph structures) and over-smoothing (where node representations become indistinguishable as the network gets deeper).

Graphormer was originally proposed to solve this by applying the Transformer architecture—famous for its global attention mechanism—to graphs. However, applying a standard Transformer to molecular modeling requires two things: a way to inject structural information (like bond types and spatial distances) and an architecture that generalizes well to massive, noisy datasets. This paper specifically tackles how to optimize Graphormer for large-scale 2D property prediction and how to extend it to 3D molecular dynamics.

Methods

The authors introduce three primary modifications to the Graphormer framework:

  1. Post-LN vs. Pre-LN: While many modern Transformers use "Pre-Layer Normalization" (Pre-LN) for training stability, the authors found that Post-Layer Normalization (Post-LN) significantly improved generalization on molecular tasks, despite being slightly harder to initialize.
  2. 3D Structural Encoding: To handle 3D coordinates, the authors replaced simple edge encodings with a Gaussian basis function to model Euclidean distances between atoms. They also introduced a new centrality encoding that sums these spatial relations to represent an atom's importance in 3D space.
  3. Rotational Equivariant 3D Attention: The model features a new attention layer that decomposes the attention probability into three spatial directions based on relative position offsets. This ensures the model respects physical symmetries (rotational equivariance) when predicting energy and forces.
  4. Recursive Feeding: Borrowing a trick from AlphaFold2, the authors found that repeatedly feeding the model's output back into itself (four times) markedly improved accuracy with minimal extra training cost.

Datasets

The study benchmarks these updates on two massive datasets:

  • PCQM4M (v1 & v2): A quantum chemistry dataset containing 3.8 million molecular graphs. The goal is to predict the HOMO-LUMO gap (a fundamental chemical property).
  • OC20 (Open Catalyst 2020): A dataset of over 660,000 catalyst-adsorbate reaction systems (140M+ structure-energy estimations). This is used to test the model's ability to predict relaxed energy from initial 3D structures.

Key Insights and Ideas

  • The Power of Global Sight: The most significant theoretical insight is the comparison between Graphormer and the CONGESTED CLIQUE model from distributed computing. In traditional GNNs (Local MP), nodes are limited by their local neighborhood. In Graphormer (Non-local MP), every node can communicate with every other node.
  • Breaking Complexity Barriers: The authors prove that several graph problems (like cycle detection or finding the maximum independent set) that are computationally "hard" for local GNNs become significantly easier for models with a global receptive field.
A comparison of local vs. non-local message passing complexity for various graph problems.
  • Generalization Paradox: Interestingly, while scaling from a 12-layer "Base" model to a 24-layer "Large" model reduced training error, it actually increased validation error on some tasks. This suggests that for molecular graphs, simply adding more parameters isn't enough; better regularization or architectural inductive biases are still needed.

Key Results

The architectural tweaks led to substantial performance gains:

  • PCQM4M: The Post-LN variant achieved a Mean Absolute Error (MAE) of 0.0864 on PCQM4v2, significantly outperforming the Pre-LN baseline.
Table showing the performance of Pre-LN vs. Post-LN variants on PCQM4M datasets.
  • Open Catalyst Challenge: GraphormerBase achieved an average MAE of 0.4980 eV on the IS2RE task, which was further improved to 0.4722 eV through ensembling. The model proved particularly adept at handling "Out of Domain" catalysts, which is crucial for discovering new materials.
Results on the OC20 IS2RE task, showing performance across different domain splits.

Limitations and Future Work

The authors acknowledge that while Graphormer is powerful, the generalization gap in larger models remains a challenge. The PostLN-Large model struggled to outperform the Base model on validation sets, indicating that the community needs to investigate better ways to scale graph Transformers without overfitting. Future work will likely focus on more sophisticated 3D geometric priors and improving the efficiency of the global attention mechanism for even larger molecular systems.

Summary updated

BibTeX
@misc{shi2022benchmarking,
  author = {Yu Shi and Shuxin Zheng and Guolin Ke and Yifei Shen and Jiacheng You and Jiyan He and Shengjie Luo and Chang Liu and Di He and Tie-Yan Liu},
  title = {{Benchmarking Graphormer on Large-Scale Molecular Modeling Datasets}},
  year = {2022},
  eprint = {2203.04810},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2203.04810},
}
Figure