Foundations to Frontier
Tests
E. Deep Learning › E18 Geometric and Equivariant Networks

E(n)-Equivariant GNN (EGNN)

EGNN (Satorras, Hoogeboom and Welling, ICML 2021) is a graph neural network for points in space, such as atoms or robot swarms. It respects rotations, reflections and translations without expensive spherical harmonics. Messages depend only on node features and squared distances, so features are invariant. Coordinates are updated along relative position vectors, so they rotate and translate with the input. This page covers E(n) symmetry, the layer equations, invariant and equivariant outputs, and how EGNN compares with other equivariant models. In the exercises you check that distances are invariant and that the coordinate update is equivariant. You then predict a pair energy of 6-atom clusters, training on one pose and testing on randomly rotated clusters. Random-weight EGNN features scored R² 0.958 on both. A raw-coordinate model dropped from 0.70 to 0.58, and rotation augmentation reached only 0.72. The coordinate update was equivariant to about 1e-15.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Rotate the molecule, get the same energy

A molecule’s energy does not change if you turn it around, and its predicted forces should turn with it. A plain network reading raw x, y, z coordinates has to learn this from data, and often fails for poses it has not seen. EGNN builds it in: it only ever uses distances between points to compute features, and it moves points along the lines joining them. The demo rotates a point cloud: coordinates change, but the distance between two points does not.

Geometric deep learning lab
Distance between the two red points: 0.2419 before and 0.2419 after rotating by 30°. EGNN builds messages from such invariant distances, so its outputs rotate with the input.
Why engineers care

Equivariant networks predict molecular properties and forces, model particle systems, and control swarms of drones or satellites, where the physics does not depend on the coordinate frame.

📝 Quick check (Level 0)
0/3 answered
  1. 1. Rotating a molecule changes its energy…
  2. 2. EGNN computes features from…
  3. 3. Predicted forces should…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Group E(n): rotations, reflections and translations of n-dimensional space. 3-D rotations have 3 degrees of freedom (n(n − 1)/2).
  • EGNN layer:
    • message m_ij = φ_e(h_i, h_j, ‖x_i − x_j‖², a_ij);
    • coordinates x_i′ = x_i + C Σ_j (x_i − x_j) φ_x(m_ij);
    • features h_i′ = φ_h(h_i, Σ_j m_ij).
  • Invariance of h: distances are unchanged by rotation, reflection and translation, so every h stays the same.
  • Equivariance of x: x_i − x_j rotates with the input and φ_x(m_ij) is invariant, so the update rotates. Translations cancel in the differences.
  • Counting: 6 atoms have 15 pairwise distances and 3·6 − 6 = 12 internal degrees of freedom.
  • Cost: about the same as an ordinary message-passing GNN; no spherical harmonics or Clebsch–Gordan products.
📝 Quick check (Level 1)
0/3 answered
  1. 1. Pairwise distances among 6 atoms:
  2. 2. Internal degrees of freedom of 6 atoms in 3-D:
  3. 3. Coordinates move along…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

EGNN in code

Exercise 1.

  • Squared distances are rotation-invariant.
  • The coordinate update rotates and translates with its input.

Practice.

  • Reference implementations: the authors’ EGNN code and the egnn-pytorch package. PyTorch Geometric’s message passing makes it a few lines.
  • Normalise the coordinate update (divide by n − 1, or by ‖x_i − x_j‖ + 1) to avoid instability.
  • Use a cutoff radius for large systems.
  • For vector outputs (forces), read them from the coordinate updates; for scalars (energy), pool the invariant h.
class EGNNLayer(nn.Module):
    def forward(self, h, x, edges):
        i, j = edges; d2 = ((x[i] - x[j]) ** 2).sum(-1, keepdim=True)
        m = self.phi_e(torch.cat([h[i], h[j], d2], -1))
        x = x + scatter_mean((x[i] - x[j]) * self.phi_x(m), i, dim=0)
        h = self.phi_h(torch.cat([h, scatter_add(m, i, dim=0)], -1))
        return h, x
🐍 Exercise 1: invariance and equivariance
Compute squared distances, an EGNN-style coordinate update and a z-axis rotation.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Energies are read from…
  2. 2. Forces can be read from…
  3. 3. Large systems use…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Equivariance proof. Let g act by x ↦ Qx + t with Q orthogonal. Then ‖Qx_i + t − Qx_j − t‖² = ‖x_i − x_j‖², so m_ij and h are invariant. The update gives Q x_i + t + C Σ Q(x_i − x_j) φ_x(m_ij) = Q x_i′ + t. Stacking layers preserves this.

Expressiveness. EGNN passes only scalar messages (distances), plus coordinates as vectors. Higher-order equivariant networks (Tensor Field Networks, SE(3)-Transformers, NequIP, MACE) carry higher-degree spherical tensors, which can represent angular information more directly. Their per-layer cost is higher, but they are often more data-efficient on molecular benchmarks.

Chirality. E(n) includes reflections, so EGNN cannot tell a molecule from its mirror image. SE(3)-equivariant models can.

📝 Quick check (Level 3)
0/3 answered
  1. 1. EGNN is equivariant to reflections:
  2. 2. So EGNN cannot distinguish…
  3. 3. Higher-order models carry…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

Does built-in invariance beat learning it from data?

History.

  • V. G. Satorras, E. Hoogeboom and M. Welling, “E(n) equivariant graph neural networks” (ICML 2021).
  • Strong results on N-body dynamics and the QM9 molecular benchmark.

Exercise 2.

  • Data: clusters of 6 points in 3-D, elongated along x in their canonical pose.
  • Target: a Morse-like pair energy Σ (1 − exp(−(d_ij − 1)))², which is rotation-invariant.
  • Protocol: train on 1500 canonical clusters; test on 500 canonical and 500 randomly rotated clusters.
  • Features:
    • a random-feature MLP on raw coordinates (512 features);
    • the same trained on randomly rotated clusters (augmentation);
    • two random-weight EGNN layers (64-D), node features summed.
  • Model: ridge regression.
features R², canonical test R², rotated test
raw coordinates 0.704 0.580
raw coordinates, augmented training 0.686 0.717
EGNN 0.958 0.958
  • Equivariance check: max |EGNN(XR) − EGNN(X)R| = 2.7e-15 (machine precision).
  • Invariance is exact: EGNN’s R² is identical for rotated clusters, because only distances enter its features.
  • Raw coordinates fail to generalise across poses: R² drops from 0.70 to 0.58 on rotated clusters.
  • Augmentation fixes the drop, not the gap: with rotated training data the raw model is pose-independent (0.72) but still far below EGNN. It spends capacity learning a symmetry that EGNN has for free.
  • Seeds: seeds 1 and 2 gave EGNN 0.985 and 0.962 (both tests); raw rotated 0.549 and 0.662.
  • Caveat: the target is a pair function, which favours distance-based features.
🐍 Exercise 2 (research): does built-in invariance beat learning it from data?
Predict a pair energy of 6-atom clusters with raw-coordinate random features (with and without rotation augmentation) and random-weight EGNN features; test on rotated clusters and check equivariance.

EGNN in AI, robotics and aerospace

  • Molecular modelling: property prediction and diffusion-based molecule generation (equivariant diffusion models use EGNN).
  • Physics simulation: N-body and particle systems.
  • Swarms: formation control of drones or satellites, where behaviour should not depend on the global frame.
  • Design lesson: if the task has a symmetry, build it into the architecture rather than hoping data augmentation teaches it.

References

  1. V. G. Satorras, E. Hoogeboom and M. Welling (2021). “E(n) equivariant graph neural networks.” Proc. ICML.
  2. E. Hoogeboom, V. G. Satorras, C. Vignac and M. Welling (2022). “Equivariant diffusion for molecule generation in 3D.” Proc. ICML.
  3. S. Batzner et al. (2022). “E(3)-equivariant graph neural networks for data-efficient and accurate interatomic potentials.” Nature Communications 13.