Equivariance: What It Means and Why It Matters

9 minute read

Published:

TL;DR: A network \(\Phi\) is G-equivariant if \(\Phi(\rho_{\text{in}}(g)\, x) = \rho_{\text{out}}(g)\, \Phi(x)\) for every group element \(g\), where \(\rho_{\text{in}}\) and \(\rho_{\text{out}}\) say how \(g\) acts on inputs and on outputs. Invariance is the special case \(\rho_{\text{out}} \equiv I\), giving \(\Phi(\rho(g)\, x) = \Phi(x)\). Geometric deep learning builds this into the architecture, so it holds exactly rather than approximately.
Equivariance illustration
Equivariance under rotation and translation in 3D graphs (Satorras et al., 2021)

Groups and Symmetry

Intuition First: Think of a compass. No matter which direction you hold it, it still points north — the reading is invariant to how you rotate your body. Now think of your shadow: if you rotate 90°, your shadow rotates 90° too — the shadow is equivariant to your rotation. These two everyday observations capture the entire mathematical framework of geometric deep learning.

A group \(G\) is a set of transformations \(\{g\}\) with a composition rule, an identity, and inverses. The groups relevant to 3D geometry differ in exactly two questions: are translations included, and are reflections?

GroupRotationsReflectionsTranslations
\(\mathrm{SO}(3)\)yesnono
\(\mathrm{O}(3)\)yesyesno
\(\mathrm{SE}(3)\)yesnoyes
\(\mathrm{E}(3)\)yesyesyes
\(\mathrm{E}(n)\)yesyesyes (in \(n\) dimensions)

\(\mathrm{O}(3) = \{Q \in \mathbb{R}^{3\times 3} : Q^{\!\top}Q = I\}\), and \(\mathrm{SO}(3)\) is its subgroup with \(\det Q = +1\) — the “S” is for special, meaning determinant one, meaning no reflections. Adding translations turns \(\mathrm{O}(3)\) into \(\mathrm{E}(3)\) and \(\mathrm{SO}(3)\) into \(\mathrm{SE}(3)\); the “E” is for Euclidean.

For molecular tasks the choice between \(\mathrm{SE}(3)\) and \(\mathrm{E}(3)\) is substantive: an \(\mathrm{E}(3)\)-invariant model gives mirror-image molecules identical predictions, which is right for energy and wrong for anything that depends on chirality.

Invariance vs Equivariance

Let \(\rho_{\text{in}}\) and \(\rho_{\text{out}}\) be the representations of \(G\) on the input and output spaces — the concrete matrices by which a group element acts on each.

\(G\)-invariant: the output does not move when the input is transformed.

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

Example: molecular potential energy. Rotating the molecule doesn’t change its energy.

\(G\)-equivariant: the output transforms too, by the group’s action on the output space.

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

Example: atomic forces, where \(\rho_{\text{in}}(R) = \rho_{\text{out}}(R) = R\), so rotating the molecule rotates the forces.

Note: invariance is the special case of equivariance in which \(\rho_{\text{out}}\) is the trivial representation, \(\rho_{\text{out}}(g) = I\) for every \(g\). Every invariant map is equivariant; the converse is false. Conflating the two is the most common error in this area, and the formulas above are the cheapest way to avoid it: if the right-hand side has a \(\rho_{\text{out}}(g)\) in it, the property is equivariance, not invariance.

Note also that \(\rho_{\text{in}}\) and \(\rho_{\text{out}}\) need not coincide even when both are non-trivial. A model mapping coordinates to a quadrupole moment is equivariant with \(\rho_{\text{in}}(R) = R\) but \(\rho_{\text{out}}(R) = D^{2}(R)\), a \(5 \times 5\) matrix.

Why Equivariance Is Better Than Augmentation

Data augmentation approach: train on random rotations of the molecule, hoping the model learns rotational invariance from data.

Problems:

  1. Requires many rotations per sample → expensive
  2. The model might learn approximate invariance, not exact invariance
  3. Generalisation to unseen orientations is not guaranteed

Equivariant approach: build the constraint into the architecture. The model is exactly equivariant by design — for any input orientation, the output transforms correctly. No augmentation needed.

Practical advantage: on molecular benchmarks, equivariant models generally reach a given accuracy from substantially fewer training samples than augmentation-based ones. The size of the gap depends on the task and the symmetry group, so treat it as a consistent direction rather than a fixed factor.

The CNN analogy: A CNN is equivariant to translations — shifting the image shifts the feature maps by the same amount. This is baked into the convolution operation (shared weights + sliding window). We don't augment with all possible image shifts; instead, the architecture encodes translation equivariance. Geometric GNNs do the same for rotations and reflections.

Worked Example: Invariant vs Equivariant in 2D

Setup: two atoms at positions \(x_1 = (1, 0)\) and \(x_2 = (0, 1)\). Apply a 90° counter-clockwise rotation \(R : (a, b) \mapsto (-b, a)\).

After rotation: \(x_1' = (0, 1)\), \(x_2' = (-1, 0)\).

Invariant quantity — distance:

  • Before: \(\lVert x_1 - x_2 \rVert = \lVert (1, -1) \rVert = \sqrt{2}\)
  • After: \(\lVert x_1' - x_2' \rVert = \lVert (1, 1) \rVert = \sqrt{2}\) ✓ same

Equivariant quantity — force vector (suppose \(F = (0.5, -0.5)\) before rotation):

  • After rotation: \(R F = (0.5, 0.5)\) — the force has rotated by 90° too
  • A model that outputs \((0.5, -0.5)\) for the original and \((0.5, 0.5)\) for the rotated version satisfies \(\Phi(Rx) = R\,\Phi(x)\) and is equivariant.
  • A model that outputs \((0.5, -0.5)\) regardless of orientation satisfies \(\Phi(Rx) = \Phi(x)\). That is invariance, and for a force it is simply wrong — it would predict the same force direction for a molecule lying in any orientation.

This is the pair to keep in mind: the same input transformation, two different correct-looking equations, and only one of them is the right specification for a vector-valued target.

Before rotation d r₁ r₂ F R(90°) After 90° rotation d r₁' r₂' F'=R·F d is unchanged (invariant) · F turns by the same R (equivariant)
The same rotation R is applied to the whole configuration. The separation d between the two atoms is drawn at identical length in both panels — that scalar is invariant. The force arrow, by contrast, turns through the same 90° as the molecule: F points up-and-right before, down-and-right after. That is equivariance, F′ = R·F.

Representations: Scalars, Vectors, Tensors

The representation \(\rho_{\text{out}}\) determines how the output transforms:

Scalar (\(\ell = 0\), invariant): a single number. Energy, charge, mass. Unchanged by rotation: \(\rho(R) = 1\).

Vector (\(\ell = 1\), equivariant): a 3D vector. Forces, velocities, dipole moment. Rotates with the molecule: \(\rho(R) = R\).

Rank-2 tensor: a \(3 \times 3\) matrix, e.g. the stress tensor or the polarisability. It transforms as \(T \mapsto R T R^{\!\top}\), which on the flattened 9-vector is \(\rho(R) = R \otimes R\).

Irreducible representations (irreps) of \(\mathrm{SO}(3)\): indexed by a degree \(\ell = 0, 1, 2, \dots\), with \(\rho(R) = D^{\ell}(R)\) the \((2\ell+1) \times (2\ell+1)\) Wigner-D matrix. So \(\ell = 0\) is a scalar (1 component) and \(\ell = 1\) is a vector (3 components).

A rank-2 tensor is not the same thing as an \(\ell = 2\) feature. The 9-dimensional representation \(R \otimes R\) is reducible: it decomposes as \(\ell = 0 \oplus \ell = 1 \oplus \ell = 2\), corresponding to the trace (1 component), the antisymmetric part (3 components), and the traceless symmetric part (5 components). It is that last 5-dimensional piece that is the \(\ell = 2\) irrep. Higher \(\ell\) captures finer angular detail at increasing computational cost.

Types of Equivariant Models

Type 1: Distance-based invariance Features: only interatomic distances and angles. Output: scalar only. Architectures: SchNet, DimeNet. Limitation: cannot output vectors (forces require equivariant outputs), and because distances are \(\mathrm{E}(3)\)-invariant, cannot distinguish mirror images.

Type 2: Vector-based equivariance (\(\mathrm{E}(n)\) / \(\mathrm{SE}(3)\)) Features: positions as vectors, combined with scalar features. Output: scalars + vectors (\(\ell \le 1\)). Architectures: EGNN, PaiNN, NequIP.

Type 3: Tensor field networks (full irreps) Features: spherical harmonics up to degree \(L\). Output: features at any degree \(\ell \le L\). Architectures: TFN, SE(3)-Transformers, MACE. Limitation: expensive. The number of admissible \((\ell_{\text{in}}, \ell_f, \ell_{\text{out}})\) tensor-product paths grows roughly as \(O(L^3)\), and each path contracts irreps of dimension up to \(2L+1\), so a naive implementation is far worse than linear in \(L\). Practical libraries exploit the sparsity of the Clebsch–Gordan coefficients to cut this down considerably.

Building Equivariant Layers

A layer stays equivariant if it is built only from:

  1. Equivariant linear maps — acting on the irrep index, i.e. mixing channels within a degree, never across degrees arbitrarily
  2. Invariant scalars (distances, norms, inner products) used as coefficients
  3. Tensor products of irreps, contracted with Clebsch–Gordan coefficients

The key constraint: never feed raw coordinates into an arbitrary MLP alongside scalars. \(\mathrm{MLP}(Rx) \ne R\,\mathrm{MLP}(x)\) in general, and one such layer destroys the equivariance of the whole network — the property is only as strong as its weakest layer.

Summary

ConceptDefinitionExample
Invariant\(\Phi(\rho(g)x) = \Phi(x)\)Potential energy
Equivariant\(\Phi(\rho_{\text{in}}(g)x) = \rho_{\text{out}}(g)\Phi(x)\)Forces
RelationshipInvariance is equivariance with \(\rho_{\text{out}} = I\)
AugmentationLearn symmetry from dataExpensive, approximate
Architectural equivarianceBaked-in symmetryExact, sample-efficient
Scalar (\(\ell = 0\))\(\rho(R) = 1\)Energy, charge
Vector (\(\ell = 1\))\(\rho(R) = R\)Force, velocity
Degree \(\ell\)\(\rho(R) = D^{\ell}(R)\), size \(2\ell+1\)Quadrupole (\(\ell = 2\))

Equivariance is the mathematical foundation of geometric deep learning. Every architecture in the next posts — EGNN, SE(3)-Transformers, TFN — is a concrete instantiation of these principles.

References