Geometric Transformer with Interatomic Positional Encoding

Yusong Wang, Shaoning Li, Tong Wang, Bin Shao, Nanning Zheng, Tie-Yan LiuNeurIPS 2023

Geoformer is a novel Transformer architecture designed to close the performance gap between standard Transformers and equivariant Graph Neural Networks (GNNs) in molecular modeling. By introducing Interatomic Positional Encoding (IPE)—a method that parameterizes complex 3D atomic environments directly into the attention mechanism—Geoformer achieves state-of-the-art results on major benchmarks like QM9 and Molecule3D.

The Challenge of Molecular Modeling

In computational chemistry, predicting chemical properties (such as energy or electronic gaps) from a molecule's 3D structure is a fundamental task. For years, Equivariant GNNs have been the gold standard because they naturally process geometric features like bond angles and torsion (dihedral) angles.

While standard Transformers have revolutionized Natural Language Processing and Computer Vision, they have historically struggled with molecules. Most existing "Graph Transformers" rely on simple pairwise distances between atoms as positional encodings. However, molecules are defined by complex, "many-body" interactions—how three or four atoms relate to each other in 3D space. The central challenge addressed by this research is designing a Transformer capable of capturing these high-order geometric intricacies as effectively as GNNs.

The Geoformer Architecture and Methods

To solve this, the authors introduce Geoformer, an architecture centered around a new technique called Interatomic Positional Encoding (IPE).

Geoformer Architecture

The model follows an Encoder-Decoder structure. The Encoder consists of multiple attention blocks where the IPE is updated at each layer based on evolving atomic features, ensuring that the geometry and chemical context remain tightly coupled throughout the network.

Interatomic Positional Encoding (IPE)

IPE fundamentally changes how the Transformer understands space, moving beyond simple distances:

  1. Atomic Cluster Expansion (ACE) Theory: IPE is grounded in ACE theory, a mathematical framework that describes an atom's environment through a hierarchical expansion (capturing 2-body, 3-body, and 4-body interactions).
  2. Cluster Merging: Unlike standard ACE, which looks at a single atom's neighborhood, IPE considers the interaction between two atomic clusters. This allows the model to capture "torsion-like" features (4-body interactions) that are critical for understanding molecular stability and reactivity.
  3. Hadamard Product Attention: Instead of simply adding a geometric bias to the attention scores (the standard approach in previous models), Geoformer uses a Hadamard product (element-wise multiplication) between the Query-Key results and the IPE matrix.
Interatomic Positional Encoding and Cluster Merging

This "gating" mechanism allows the geometric information to more effectively modulate which atoms the model "attends" to, acting as a structural filter rather than just a background bias.

Datasets and Key Results

The model was rigorously evaluated on two primary benchmarks:

  • QM9: A classic dataset of ~130,000 small organic molecules with 12 different quantum chemical properties.
  • Molecule3D: A much larger, more recent dataset containing ~3.9 million molecules. It tests the model's ability to scale and generalize, specifically using random splits and scaffold splits (where the test set contains molecular "skeletons" never seen during training).

Geoformer demonstrated significant improvements over both previous Transformers and top-tier GNNs:

  • State-of-the-Art on QM9: Geoformer achieved the best performance on 8 out of 12 properties, outperforming highly specialized models like Equiformer and PaiNN.
  • Record-Breaking on Molecule3D: On this large-scale dataset, Geoformer set a new record, reducing the Mean Absolute Error (MAE) for the HOMO-LUMO gap by 32.56% on random splits and 3.98% on scaffold splits compared to the previous best model (ComENet).

Key Insights

  • Beyond Pairwise Distances: The critical insight is that pairwise distance is merely a "2-body" feature. To compete with GNNs, Transformers need "many-body" awareness. IPE provides this by natively encoding angles and dihedrals into the positional matrix.
  • Multiplication > Addition: Multiplying the attention weights by the geometric encoding proved vastly superior to adding them. Geometry should act as a mask for chemical interactions.
  • Efficiency via Simplification: While full ACE theory is computationally heavy, using simplified settings (focusing on 3-body and 4-body approximations) provides a massive performance boost without the cubic complexity of higher-order tensors.

Limitations and Future Work

Like many deep Transformer architectures, Geoformer is sensitive to hyperparameters and requires careful tuning (e.g., a relatively small learning rate) to avoid instability during training. Additionally, calculating many-body interactions inherently carries more computational overhead than simple 2D graph processing.

Moving forward, the authors suggest extending Geoformer to even larger systems, such as proteins, polymers, and crystalline materials, where long-range geometric interactions are even more complex. The principles behind IPE also hold exciting potential for inspiring new encoding schemes in other 3D domains, such as robotics or point cloud processing.

Summary updated

BibTeX
@inproceedings{wang2023geometric,
  author = {Yusong Wang and Shaoning Li and Tong Wang and Bin Shao and Nanning Zheng and Tie-Yan Liu},
  title = {{Geometric Transformer with Interatomic Positional Encoding}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=9o6KQrklrE},
}
Figure