Why Geometry Matters in Graph Neural Networks

7 minute read

Published:

TL;DR: A molecule is not just a graph of atoms and bonds — it is a 3D geometric object. The same chemical formula with different 3D arrangements (stereoisomers) can have completely different properties. A GNN that ignores 3D coordinates cannot distinguish them. Geometric GNNs incorporate position data while respecting the symmetries of 3D space.
Geometric structure in molecules
E(n) Equivariant GNN captures 3D molecular geometry (Satorras et al., 2021)

The Geometric Setting

Intuition First: Imagine you have a molecular model kit. You can describe the connectivity — carbon bonded to two oxygens — without saying how those bonds are arranged in 3D space. But a flat (180°) CO₂ and a bent (120°) arrangement have wildly different properties. Standard GNNs only read the assembly instructions; geometric GNNs also read the 3D blueprint.

L-Alanine C NH₂ COOH CH₃ H ✓ Biologically active D-Alanine C NH₂ COOH CH₃ H ✗ Inactive (mirror) Same connectivity — opposite chirality → different biology
Stereoisomers: identical bond graph, completely different 3D structure and biological activity. A connectivity-only GNN gives them the same embedding.

Consider a molecule modelled as a graph \(G = (V, E, H, X)\):

  • \(V\): atoms (nodes), \(E\): bonds (edges), \(H = \{h_v\}\): atomic features (atom type, charge)
  • \(X = \{x_v\}\) with \(x_v \in \mathbb{R}^3\): the 3D coordinate of each atom

Standard GNNs use only \((V, E, H)\) and ignore \(X\). This loses crucial information:

Stereoisomers: molecules with the same atoms and bonds but different 3D arrangement. L-alanine and D-alanine are mirror images — identical connectivity, different biological activity. A GNN without 3D coordinates assigns them the same embedding; so, as it happens, does any model built purely from interatomic distances, since distances survive reflection unchanged.

Conformation: proteins fold into specific 3D shapes that determine their function. Two proteins with the same sequence but different folds (conformers) have different biological roles — invisible to connectivity-only GNNs.

Distances and angles: in chemistry, reaction rates depend on bond angles and dihedral angles — geometric properties that cannot be inferred from connectivity alone.

The Symmetry Problem

3D coordinates are not unique to a molecule. Writing \(g\) for a symmetry transformation acting on coordinates as \(x_v \mapsto Q x_v + t\):

  • Translation (\(t\)): moving the molecule in space leaves chemistry unchanged
  • Rotation (\(Q\) with \(\det Q = +1\)): rotating the molecule leaves chemistry unchanged
  • Reflection (\(Q\) with \(\det Q = -1\)): mirroring leaves most scalar properties unchanged, but swaps enantiomers, and those can differ biologically

Rotations plus translations form \(\mathrm{SE}(3)\); adding reflections gives \(\mathrm{E}(3)\). Which one you want is a modelling decision, not a detail: an \(\mathrm{E}(3)\)-invariant model is by construction unable to tell L-alanine from D-alanine, because it assigns mirror images the same output. If chirality matters for your target, you want \(\mathrm{SE}(3)\) and features that change sign under reflection.

Failure mode: naive addition of coordinates to node features gives the model different inputs for the same molecule in different orientations. The model must learn the symmetry from data — requiring training examples covering all orientations, and even then only approximately.

Invariance vs Equivariance

Let \(\Phi\) be the network, \(g\) a group element, and \(\rho(g)\) the representation of \(g\) — the concrete matrix by which \(g\) acts on a given space.

Invariant: the output does not move at all when the input is transformed.

\[ \Phi\big( \rho(g)\, x \big) = \Phi(x) \qquad \text{for all } g \in G \]

For graph-level scalar properties (energy, solubility): the property is invariant. Rotating the molecule doesn’t change its energy.

Equivariant: the output transforms too, under the group’s action on the output space, which need not be the same as its action on the input space.

\[ \Phi\big( \rho_{\text{in}}(g)\, x \big) = \rho_{\text{out}}(g)\, \Phi(x) \qquad \text{for all } g \in G \]

For node-level vector properties (forces, velocities): the property is equivariant with \(\rho_{\text{out}}(g) = Q\). Rotate the molecule and the forces rotate with it.

Invariance is the special case \(\rho_{\text{out}}(g) = I\) for every \(g\) — the trivial representation. Writing both with \(\rho_{\text{in}}\) and \(\rho_{\text{out}}\) made explicit is worth the extra symbols, because “\(\Phi(g x) = g \Phi(x)\)” hides the fact that the two \(g\)’s act on different spaces and are generally different matrices.

Why you need both: In molecular dynamics simulations, you need to predict both energy (invariant — a scalar) and forces (equivariant — 3D vectors). An equivariant force field model outputs forces that automatically rotate with the molecule — no data augmentation needed, no invariance violation possible.

What Standard GNNs Cannot Do

TaskRequiresStandard GNN
Distinguish stereoisomersReflection-sensitive 3D featuresCannot
Predict 3D forcesEquivariant vectors (\(\rho_{\text{out}}(g) = Q\))Cannot
Learn protein structure3D coordinates + symmetryCannot
Model crystal symmetrySpace group symmetryCannot
Point cloud processing3D positionCannot

What Geometric GNNs Add

Three levels of geometric sophistication:

Level 1: Distance-based (invariant) Add interatomic distances \(\lVert x_u - x_v \rVert\) as edge features. Distances are unchanged by translation, rotation and reflection, so such a model is \(\mathrm{E}(3)\)-invariant. Two consequences: it cannot predict vector quantities at all, and it cannot distinguish enantiomers.

Level 2: Angle-based (richer invariant) Add angles between bond triplets \((u, v, w)\) and dihedral angles \((u, v, w, z)\). DimeNet and SphereNet operate at this level. Bond angles are still reflection-invariant; it is the signed dihedral angle that flips sign under reflection, which is why torsions — not angles — are what buy you chirality sensitivity.

Level 3: Equivariant (full 3D) Process 3D vectors as vectors — not just their magnitudes. EGNN, SE(3)-Transformers, NequIP, MACE operate at this level.

Real Applications

Drug discovery: predict binding affinity, toxicity, ADMET properties from 3D molecular structure.

Protein structure prediction: model protein folding and protein-protein interaction geometry.

Materials science: predict crystal properties (band gap, stability) from atomic positions in unit cell.

Robotics: process point cloud sensor data while maintaining rotational equivariance.

Particle physics: predict particle interaction properties with detector geometry.

Key Insight: Every symmetry you bake into the architecture is one fewer thing the model needs to learn from data. A rotation-invariant model trained on one molecular orientation generalises to all orientations for free, exactly and not approximately. That is a real reduction in what has to be learned from data, and it shows up as better sample efficiency on molecular benchmarks — though how much depends heavily on the task, and it is not a fixed multiplier.

Summary

Adding geometry to GNNs is not optional for applications where 3D structure matters. The challenge is doing so while respecting the symmetries of 3D space — translation, rotation, and (depending on the target) reflection. State which group you actually want: \(\mathrm{E}(3)\) invariance is the right default for energies, but it forecloses chirality by construction. The subsequent posts in this section cover the architectures (EGNN, SE(3)-Transformers, TFN) that build these constraints in systematically.

References