Using and Abusing Equivariance

Tom Edixhoven, Attila Lengyel, Jan van Gemert

In the world of computer vision, we often take symmetries for granted. We expect a cat to be recognized as a cat whether it’s in the top-left corner of a photo or the bottom-right. Standard Convolutional Neural Networks (CNNs) handle this well through translation equivariance. But what about rotations? If you rotate a medical tissue sample, the diagnosis shouldn't change.

Group Equivariant Convolutional Neural Networks (GCNNs) were designed to solve this by providing mathematical guarantees that their internal representations change predictably with rotations. However, a new paper from researchers at Delft University of Technology reveals a hidden flaw: common operations like pooling can secretly "break" these guarantees, leading to networks that are only approximately equivariant.

TL;DR

GCNNs often lose their mathematical guarantee of rotation symmetry due to how subsampling (like MaxPool) interacts with input dimensions. While "exactly equivariant" networks generalize better to unseen rotations, "approximately equivariant" networks can actually perform better on standard benchmarks by learning to "abuse" these broken symmetries to exploit biases in the data.

What Problem Does This Paper Address?

The mathematical proof that a GCNN is equivariant to rotations assumes the convolution operation covers the entire input perfectly. In practice, modern architectures use subsampling—strided convolutions and pooling layers—to reduce feature map sizes and increase receptive fields.

The authors point out that if the combination of input size, kernel size, and stride isn't perfectly aligned, the network samples different pixels depending on whether the image was rotated before or after the pooling layer. As shown in Figure 1, this small grid misalignment means the network's output for a rotated image is no longer just a rotated version of the original output. It becomes a different set of values entirely.

Figure 1: Example of how subsampling can break equiv- ariance. Dotted arrows indicate a Rotation and the dashed arrows indicate a MaxPool subsampling layer with a ker- nel size and stride of 2. The locations where MaxPool ap- plies its pooling are coloured. One can see that f(T(x)) and T ′(f(x)) contain completely different numerical val- ues, breaking equivariance.

Methods

The researchers first derived a formal condition for Exact Equivariance. They proved that for a layer to maintain perfect symmetry, the following equation must hold for the input size ($i$), kernel size ($k$), and stride ($s$):

$$(i - k) \mod s = 0$$

If this condition is met, the network is "Exactly Equivariant." If not, it is "Approximately Equivariant." Surprisingly, a difference of just one pixel in input size (e.g., 32x32 vs. 33x33) is enough to flip a network from one category to the other.

To test the impact of this, they monitored the Equivariance Error—the difference between the output of a rotated input and the rotated output of a normal input—throughout training. They also used a technique called CircleCrop (Figure 2) to ensure that rotation artifacts at image corners didn't interfere with their measurements.

Datasets

The authors evaluated their findings across a diverse range of datasets:

  • MNIST / RotMNIST: Used for controlled experiments on how networks generalize to rotations they haven't seen during training.
  • ImageNet: A massive real-world dataset that has a strong "upright" bias (most photos are taken horizontally).
  • PatchCamelyon: A histopathology dataset where images are naturally rotationally invariant (cells have no "up" or "down").
  • CIFAR-10 & CIFAR-100: Standard object recognition benchmarks.
  • Flowers102: A dataset where many classes have natural rotational symmetry.

Key Insights and Ideas

  • The "One-Pixel" Trap: You might think your GCNN is perfectly symmetric, but if your input is 32x32 and you use a 3x3 kernel with stride 2, you've broken the guarantee. The network now has the capacity to distinguish between a 0° and 90° rotation.
  • Networks are Opportunistic: If a network can break equivariance to improve its loss, it will. In Figure 3, the authors show a GCNN explicitly learning a filter that produces completely different values for rotated versions of the same input, effectively "learning" to see the rotation.
  • The Generalization Trade-off: Exact equivariance is a superpower for out-of-distribution generalization. If you train a model on images rotated only between 0° and 45°, an exactly equivariant model will still work perfectly at 270°. An approximate model will fail miserably because it learned to rely on specific pixel alignments seen during training.
  • The "Abuse" Benefit: On datasets like ImageNet, approximate networks often outperform exact ones. Why? Because ImageNet has an upright bias. A perfectly equivariant network is forced to treat an upside-down dog the same as an upright dog. An approximate network can "relax" this constraint, realizing that in the real world, dogs are usually upright, and using that bias to improve accuracy.
Figure 3: A subsampling Group Equivariant net f that is equivariant to the 90◦rotation transformation T can learn a filter that returns almost inverted values for f(x) and T −1(f(T(x))), while these outputs should be identical in theory. Because the outputs are not equal, a network using the filter f can perfectly distinguish between x and T(x).

Key Results

  • Generalization: On RotMNIST, exactly equivariant networks significantly outperformed approximate ones when tested on unseen rotations (Figure 5).
  • Benchmark Performance: On CIFAR-10, an exactly equivariant ResNet-44 achieved 93.41% accuracy on unseen rotations, while the approximate version dropped to 79.19%.
  • Equivariance Drift: As shown in Figure 4, the equivariance error in the final layers of a GCNN often increases during training. The network actively learns to become less equivariant to better fit the data.

Limitations and Future Work

The study primarily focuses on the p4 group (90-degree rotations and reflections). Extending this to more complex groups (like 45-degree rotations or 3D symmetries) remains an open challenge.

The authors also noted that padding has a significant, yet poorly understood, effect on how well these networks generalize. Finally, they suggest that the "desirability" of equivariance might change depending on the depth of the layer—perhaps we want exact symmetry in early layers but more flexibility in the final classification layers.

For researchers building GCNNs, the message is clear: check your $(i - k) \mod s$. Whether you want to "use" or "abuse" equivariance, you should at least be doing it on purpose.

Summary updated

Abstract

In this paper we show how Group Equivariant Convolutional Neural Networks use subsampling to learn to break equivariance to their symmetries. We focus on 2D rotations and reflections and investigate the impact of broken equivariance on network performance. We show that a change in the input dimension of a network as small as a single pixel can be enough for commonly used architectures to become approximately equivariant, rather than exactly. We investigate the impact of networks not being exactly equivariant and find that approximately equivariant networks generalise significantly worse to unseen symmetries compared to their exactly equivariant counterparts. However, when the symmetries in the training data are not identical to the symmetries of the network, we find that approximately equivariant networks are able to relax their own equivariant constraints, causing them to match or outperform exactly equivariant networks on common benchmark datasets.
BibTeX
@misc{edixhoven2023using,
  author = {Tom Edixhoven and Attila Lengyel and Jan van Gemert},
  title = {{Using and Abusing Equivariance}},
  year = {2023},
  eprint = {2308.11316},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2308.11316},
}
Figure