- Home
- Library
- Computational Quantum Field Theory
- Learning to Sample Field Configurations
- Invariant and Equivariant Maps on a Lattice
Invariant and Equivariant Maps on a Lattice
If an input vector is rotated, should a model's answer stay fixed or rotate with it? An energy should stay fixed. A force should rotate. Confusing these requirements can remove information that the next layer needs or impose the wrong physical constraint.
First project a nonlinear map onto the eight rotations and reflections of a square. Then use that transformation law to construct and fit a periodic lattice predictor. Its local Ising-energy predictions move between sites, while their sum stays invariant. Compare the physical prediction error with the defect in the symmetry identity. The fit uses ridge regression and the finite Ising ensemble.
Specify the action on each space
Let a group act linearly on input and output spaces through representations and . Thus each representation obeys
A map is equivariant when
It is invariant if the output representation is trivial: . Inputs and outputs need not have the same dimension or representation. This intertwining formulation is the starting point of group-equivariant networks. Cohen and Welling 2016, §2, Eq. (1).
For a scalar function of a vector, invariance reads . If is orthogonal and differentiable, the chain rule gives
The corresponding force is equivariant. The converse requires care: an arbitrary equivariant vector field need not be the gradient of an energy. Symmetry does not replace an integrability or conservation condition.
For the square group , choose exact integer matrices
They satisfy and . The order matters: a reflection followed by a rotation is generally different from the reverse order. The companion checks all products and all inverses with integer matrices. No floating-point angle reconstruction is needed.
Pullbacks explain the inverse
A feature can itself be a function on positions. If a spatial point moves as , define the transformed scalar field by
The value originally at appears at . With this inverse,
Using instead would reverse the composition order. The error can remain hidden if tests use only commuting translations or a single reflection. Cohen and Welling, §4.4, Eqs. (4)–(5).
A vector-valued spatial field has both a coordinate pullback and a component transformation,
A rank-two tensor instead transforms as . Merely storing two or four channels does not determine which transformation law those channels carry. It must be specified.
Constructing an equivariant map by averaging
For a finite group and any map with a linear output space, define its Reynolds projection
The output is transformed back before averaging. To prove equivariance, set :
The proof works for nonlinear . If was already equivariant, every summand in (8) equals , so . Therefore : averaging is a projection onto the equivariant maps. With a trivial output representation it becomes ordinary invariant group averaging.
Take the vector representation on both sides and
The cubic vector already transforms correctly under sign changes and coordinate permutations. The linear part has matrix . Averaging its conjugates removes it: reflection averaging removes the off-diagonal part, while a square-equivariant linear map must be a scalar multiple of . Here . Thus
A symbolic sum of all eight terms verifies (11) independently of the numerical equivariance test. Fixed generic-point tests give a relative equivariance defect below in binary64 arithmetic. Such a test checks the implementation; the algebra establishes the identity.
Because the output representation is orthogonal, its squared norm gives an invariant readout:
It is invariant under , not under every planar rotation. At it equals ; after a rotation it equals . Nor is it a complete label of square-group orbits. An invariant readout can identify physically distinct inputs.
Nonlinearities depend on the representation
Componentwise nonlinearities commute with permutations of channels. They do not commute with arbitrary matrices mixing or changing the signs of components.
A simple failure uses the vector representation and . With and ,
The difference has norm . A layer that is linear-equivariant before this activation need not remain equivariant afterward.
There is a useful alternative: let channels be indexed by group elements. For a fixed vector , scalar bias , and arbitrary scalar nonlinearity , define
Under ,
This is a permutation of the orientation channels—the regular representation. Applying another identical pointwise scalar nonlinearity to every channel commutes with the permutation. Summing the channels gives an invariant readout. Keeping them instead retains orientation information for subsequent equivariant processing. Cohen and Welling, §6.2, Eq. (15).
A bias shared by all orientation channels also respects this action. Different biases for different orientations generally do not. Similar reasoning applies to normalization: its estimated statistics and trainable parameters must obey the declared channel action. The word “convolutional” does not make an arbitrary sequence of operations equivariant.
For orthogonal vector representations one can instead use a radial nonlinearity, . Its scalar coefficient is invariant, so the output remains a vector. This is a different construction from applying the same function independently to vector components.
Averaging, augmentation and restricted architectures
Three procedures often appear together but solve different computational problems.
| Procedure | What is changed | What follows |
|---|---|---|
| Average a fitted map using (8) | The prediction rule | Exact finite-group equivariance |
| Add transformed training examples | The empirical loss | More constraints on the fitted map |
| Restrict the architecture | The admissible functions | Equivariance for every parameter value, if all layers respect the action |
Finite data augmentation alone cannot establish (2) on every input. For example, consider
On the entire orbit of , its predictions equal the identity map exactly. Yet
whereas equivariance under requires zero. Thus interpolation on the sampled orbit can violate equivariance elsewhere.
There are special cases where augmentation does yield an exactly invariant optimum. The Ising local-energy fit below uses a linear readout, a complete group-augmented squared-error loss, an orthogonal parameter action and a strictly positive ridge penalty. Uniqueness forces the optimum into the invariant parameter subspace, so a tied fit and the fully augmented fit agree. The hypotheses explain the equality; it is not a general equivalence between augmentation and equivariant neural networks.
Projecting a fitted map also need not agree with fitting within the projected class. Projection changes the function after optimization, whereas a restricted fit optimizes the loss over that class from the beginning. Both can preserve symmetry while having different prediction errors.
What the implementation establishes
The companion finite_group_maps.py defines the integer group, its multiplication table and inverse, vector Reynolds projection, and pullbacks on a periodic square. group_map_checks.py verifies the polynomial result symbolically, then tests generic real points and selected exact points. The tests include idempotence, invariant readout and noncommuting composition.
The retained negative controls distinguish actual mistakes from roundoff:
| Control | Defect |
|---|---|
| Correct orientation permutation | in the retained tests |
| Replace by | |
| Vector ReLU under | |
| Projected cubic under | in vector norm |
| Augmented-orbit interpolant away from its orbit | in vector norm |
Defects have different explicitly stated tests and normalizations; their magnitudes are not prediction-error rankings. In particular, testing a transformation outside is a limitation check, not a bug in a map designed for .
A symmetry of an architecture also does not establish that the data-generating dynamics possess that symmetry. External fields, boundaries, anisotropic couplings and channel definitions can change the relevant group. The physical action and observable must be identified before choosing the constraint.
Periodicity defines the representation
Apply the square transformations to a field on sites as well as to its channels. Positions are . The point group is , represented by the square's integer rotation and reflection matrices. A point operation followed by a translation acts as . For a scalar field,
with coordinates reduced modulo . The composition law is
This is a semidirect product: a rotation changes the direction of a translation. The inverse in (18) is essential. Our implementation uses coordinates rather than an image library's implicit choice of rotation center.
For a finite-offset kernel , define a periodic correlation layer
This is the correlation convention commonly called convolution in neural-network implementations. Its offsets have the displayed plus sign. Translation equivariance follows directly:
No padding approximation enters because the domain is a torus. The same derivation does not establish full translation equivariance for a finite array with zero padding. Correlation versus convolution and the corresponding group action are derived in Cohen and Welling 2016, §§4.4–5, Eqs. (4)–(9).
Rotations act on channels as well as positions
An arbitrary kernel generally breaks point-group covariance if its output is treated as a single scalar channel. One solution is to require . Another preserves the differently oriented responses in separate channels.
For each base filter , introduce one channel for every ,
The label identifies a base filter; it is not a translation in this equation. Inserting (18) and changing summation variable to gives
The spatial argument is pulled back and the orientation index is permuted. Rotating the pixels while leaving orientation channels fixed is an implementation error.
A common scalar pointwise function preserves (23). We use
The square additionally gives , appropriate for the spin-flip-even energy. It is an explicit global constraint, distinct from the spatial group. Orientation channels carry a permutation representation, which is why a common pointwise nonlinearity is permitted. The general group-correlation construction is discussed in Cohen and Welling, §§6.1–6.2, Eqs. (10)–(15).
For deeper models, a layer acting on these features must transform both the spatial and orientation indices. For example, on a finite group a correlation obeys after the substitution . A stack of such layers and compatible nonlinearities remains equivariant. Arbitrarily mixing orientation channels between them need not.
A physical local target
Use the periodic Ising Hamiltonian of the collective-variable example, with . A site-centered local energy is
The factor corrects the two appearances of each undirected bond in the site sum. This local energy obeys
It is a scalar field of predictions: its values move between sites. Only the sum or spatial mean is invariant. It is not a continuous scalar-field force.
The exact target is cheap to evaluate, making this a controlled learning example rather than a proposal to replace a useful formula by an expensive approximation. We can independently distinguish approximation error from failure of a transformation law.
Training uses the first retained configurations at , and all sixteen sites in each. Tests use independent configurations at each of five temperatures on both and . The Gibbs samples come from exact categorical sampling, without Markov-chain correlations. No test configurations are used to select filters, a penalty or training duration.
What is actually fitted
Draw four filters once from independent standard normal entries and normalize each to Euclidean norm one. Their seeds are fixed in the companion. Every filter has all eight orientations, producing features (24) per site. The filters are fixed, while the readout is genuinely fitted:
The nonlinear-feature ridge model has trainable coefficients. It has translation equivariance for every coefficient vector, because the same readout acts at every site. Point-group covariance requires additional structure.
Let contain one row of features, including the intercept feature , per training site, and let contain the corresponding exact local energy. With and , minimize
The stated penalty includes the intercept. All examples use the same convention. We solve the stacked least-squares system
by singular-value decomposition. This avoids explicitly forming an inverse of . The largest retained half-gradient residual, , is across the three fits. That checks the specified finite optimization problem, not the adequacy of the feature family.
We fit three versions:
- Untied: all coefficients are free on the original training configurations.
- Augmented: use the same coefficients and penalty on all eight point-group transforms of each training configuration, transforming the target field too. Normalize the squared-error sum by .
- Tied: replace the eight orientation coefficients for each base filter by one coefficient and fit directly on the original data.
The normalization of the tied model matters. Define
The prediction becomes , with five fitted coefficients. The embedding is isometric:
Using the raw channel sum while leaving the penalty unchanged would define a different optimization problem.
When augmentation and tying agree
Complete augmentation makes the loss invariant under permutation of the orientation coefficients. The ridge term is also invariant because this permutation is orthogonal. Since , the objective is strictly convex and has a unique minimizer .
For every group element, a transformed coefficient vector has the same loss as and must therefore equal it. Hence has constant coefficients within each orientation orbit. It lies in the tied subspace. On that subspace, transformed training examples give exactly the same losses as their originals. Equations (30)–(31) then show that the augmented and tied minimizers coincide.
The actual numerical coefficient difference is . The augmented and tied objective values both round to . The untied fit minimizes a different, unaugmented objective and obtains on that problem.
This equality uses complete augmentation, compatible targets and feature actions, the same loss normalization, an invariant penalty and uniqueness. It does not imply that finite augmentation and constrained architectures are interchangeable for an arbitrary nonlinear network or a partially converged optimizer.
For comparison, we also project the already fitted untied model by averaging each set of eight coefficients. This is a Reynolds projection of its prediction rule and requires no new fit. It preserves the point-group law exactly, but its coefficient vector differs from the tied optimum by in Euclidean norm. Averaging after fitting and fitting within the averaged class are different operations.
Prediction error and symmetry error answer different questions
At , the independent test results are:
| Prediction rule | Local-energy RMSE | Energy-density RMSE |
|---|---|---|
| Untied | ||
| Tied | ||
| Fully augmented | ||
| Projected untied |
These differences do not establish a statistically resolved accuracy advantage. The same test configurations feed all models, so their errors are paired; their displayed standard errors must not be treated as independent when comparing models.
For the local RMSE, define the squared error of independent configuration by
The companion records the sample standard error of , and uses . It never counts the correlated sites as independent configurations. For energy-density error, it first averages the signed local residual within a configuration, then squares that mean. These errors condition on the one frozen training set and fitted map; they do not include retraining variability.
Separately, for the first sixteen test configurations at each size, we apply every translation and every point-group element. Define
where the norms include the retained test configurations. The results are:
| Size | Untied | Tied | Augmented | Projected untied |
|---|---|---|---|---|
This evaluates the actual fitted outputs, not only the already symmetric target. The small tied-model defects reflect a structural identity. The tied model still has a local RMSE of approximately .
The figure places these two diagnostics side by side.
Left: independent-test local-energy RMSE of the tied model at both sizes, with configuration-based delta-method standard errors. The model was fitted only at . Right: maximum relative equivariance defects under all translations and square point operations on sixteen test configurations per size. Small transformation defects and small physical prediction errors are different requirements.
Size, boundaries and stride are separate tests
The same local filters and coefficients act on without refitting. This is actual size transfer of the local rule, unlike the separate PCA fits on different-dimensional spin vectors. At , its local RMSE is , while its energy-density RMSE is . At , the local RMSE rises to on and on . Exact equivariance does not protect against a change in the statistical importance of local patterns.
Boundary conditions change the representation. A zero-padded feature extractor tested against the periodic translation law gives a relative defect on fixed generic real fields. This is a large domain mismatch, not a roundoff problem. The periodic predictor evaluated against an open-boundary Ising target at has edge-site RMSE , compared with interior RMSE . The open target omits boundary-crossing bonds; the physical question has changed.
Stride also reduces the translation group. For , retaining only sites commutes with translations by two fine sites, which become one coarse-site translation. A one-site shift changes the sampling sublattice and cannot generally be represented by a coarse-grid translation. This subgroup issue is distinct from point-group channel indexing. Cohen and Welling, §6.3.
The companion checks orientation channels on sixteen generic real-valued fields as well as on Ising spins. Correct channel transport differs by at most . Replacing by produces a defect . Even-stride translation is exact in the retained test, while the odd shift differs from every coarse-grid translation by at least in the stated relative maximum norm. These controls make errors in the action visible rather than testing only specially symmetric configurations.
Reproduction and scope
The fixed exact Ising archive is shared with the collective-variable calculation. The pure lattice_local_model.py implements oriented filters and the stacked ridge fit; lattice_local_checks.py writes all models, coefficients, independent-test errors and transformation controls to lattice-local-results.json. The plotter reads those retained results. The chapter companion README records the seeds and commands.
This calculation learns a local observable using a small fixed nonlinear feature family. Its purpose is to make approximation, optimization, statistical testing and exact transformation laws separately calculable.
Summary
A Reynolds projection gives an equivariant prediction rule once the input and output actions are specified. On the periodic Ising lattice the correctly transported orientation channels enforce exact square symmetry. A unique ridge optimum explains why the fully augmented and symmetry-tied fits coincide here. Their local-energy RMSE is still at the training temperature and size. A gauge field adds a new requirement: the link output must transform at both endpoints.
Exercises
1. Projection and a symmetry outside the group
Prove from (8), compute , and test its equivariance under a rotation at . Does failure of the last test contradict the projection theorem?
Solution
Equation (9) shows that is equivariant. Applying (8) to any equivariant gives term by term, so . Setting proves idempotence.
The vector commutes with the coordinate permutations and sign changes in . For the linear part, conjugating by reverses the off-diagonal entries, so its pairwise reflection average is zero. Therefore .
Let be the rotation. Then
Their difference has norm . Since , this does not contradict the theorem. Averaging over a finite subgroup imposes that subgroup, not the full continuous rotation group.
2. Why channel labels matter
Evaluate the failure of componentwise ReLU under . Then let be a permutation matrix and prove for any common scalar pointwise function . Explain why fitting an augmented finite orbit still does not prove a global equivariance identity.
Solution
For , ReLU gives . Transforming afterward gives , while transforming first and applying ReLU gives . Thus the vector-representation identity fails.
If , then
No linearity or oddness of is needed. The proof uses only a permutation action and the same function in every channel. It does not apply to arbitrary component mixing or sign changes.
Finally, (16) agrees with the identity on all augmented points of the unit-vector orbit, because the extra term vanishes there. Equation (17) shows that it violates equivariance elsewhere. Training constraints on a finite set leave many functions undetermined away from that set; a structural proof needs additional assumptions.
3. A three-parameter square-invariant kernel
A scalar-to-scalar linear correlation uses a kernel and must be equivariant under on a periodic square. Determine its independent coefficients and its Fourier multiplier. Use a test field with .
Solution
The offsets have three orbits: the center, four nearest axial neighbors, and four diagonal corners. Assign coefficients to those orbits. The kernel is
Substituting the plane wave in (20) yields with
This multiplier is unchanged by coordinate interchange and sign reversal, as required. A generic fixed kernel does not have these orbit equalities. Retaining all its orientations in separate channels instead allows it to detect directional information while transforming equivariantly. Summing those channels at a later readout produces a scalar.
4. Why the augmented and tied fits coincide
Assume a linear feature map transforms by orthogonal channel permutations, targets transform compatibly, and the empirical loss contains every group transform with equal weight. Prove that a positive ridge penalty forces its unique optimum to have invariant coefficients. Explain why the factor in (30) is needed, and why the proof does not repair a one-site translation after stride-two sampling.
Solution
Write the coefficient action as an orthogonal permutation , leaving the intercept fixed. Reindexing a complete augmented dataset gives . The penalty preserves this equality. Its Hessian is
The minimizer is therefore unique. Since is another minimizer, it must equal . In the regular orientation representation, this means a constant coefficient over each eight-element orbit.
Let embed the five tied coefficients in the full space using and the unchanged intercept. Then . Consequently , and restricting the augmented objective gives exactly the tied objective with the same ridge strength. Because the output of a tied model is equivariant, averaging its loss over transformed examples is identical to the original-data loss. Thus the fits agree.
Using while applying the same penalty to would instead change the regularization: the full-space squared norm has an extra factor eight on those coefficients.
Finally, stride-two sampling does not retain an action of every fine-lattice translation on the sampled values. A one-site translation moves to the other sublattice. The prerequisite representation identity fails before optimization, so uniqueness of a fitted objective cannot restore it. Two-site translations do have a consistent coarse-grid action.
References
- T. S. Cohen and M. Welling, “Group Equivariant Convolutional Networks,” Proceedings of the 33rd International Conference on Machine Learning, PMLR 48, 2990–2999 (2016), proceedings; arXiv:1602.07576v3, §2, §§4.4–5 and §§6.1–7.1 for pullbacks, orientation channels, correlation layers and stride.
Scrollable formula. Use Left and Right arrow keys to reveal hidden content.
Scrollable table. Use Left and Right arrow keys to reveal hidden columns.
Scrollable figure. Use Left and Right arrow keys to reveal hidden content.