We often hear that deep learning models are "invariant" to certain changes—like a cat classifier still recognizing a cat even if the image is flipped. But how do we actually know? Usually, we just look at the accuracy score and assume the model "learned" the symmetry. In their NeurIPS 2022 paper, In What Ways Are Deep Neural Networks Invariant and How Should We Measure This?, Henry Kvinge and colleagues argue that we need to stop guessing and start measuring.
The Problem: Conflating Performance with Structure
In machine learning, invariance means the output stays the same when the input is transformed (e.g., rotating a photo of a dog shouldn't change the label "dog"). Equivariance means the output changes in a way that matches the input transformation (e.g., if you rotate an image, the bounding box for a car should rotate too).
While these concepts are fundamental, the ML community lacks a standard way to measure them directly. We usually rely on "proxy" metrics like test accuracy. If a model trained with flipped images performs well, we say it's "flip-invariant." But this conflates performance with structural properties. The authors aim to disentangle these, providing a mathematical "ruler" to see exactly where and how symmetries are captured within a network's architecture.
Methods: Introducing $G$-EED
The core contribution of this paper is the $G$-empirical equivariance deviation ($G$-EED).
Mathematically, a function $f$ is equivariant if $f(gx) = gf(x)$ for some transformation $g$ in a group $G$. The $G$-EED metric measures the "distance" between these two sides of the equation. If the distance is zero, the model is perfectly equivariant.
The beauty of $G$-EED is its flexibility. The authors apply it to three different parts of a network:
- Channelwise EED: Measures if internal convolutional activations move correctly when the input rotates.
- Latent Space EED: Measures if the high-level features (the "embeddings") are invariant.
- Softmax EED: Measures if the final probability distribution remains stable under transformation.
By using different distance functions (like KL-divergence for probabilities or cosine similarity for features), they can probe a model's behavior at every stage of the pipeline.
Key Insights and Ideas
The researchers tested their metrics across several scenarios, including Rotated MNIST, xView Maritime satellite imagery, and various Out-of-Distribution (OOD) datasets. Their findings challenge several widely held assumptions:
- Augmentation $\neq$ Equivariant Layers: A common myth is that training with data augmentation (like random rotations) forces the network to learn equivariant internal layers. $G$-EED shows this isn't true. Standard CNNs trained with augmentation don't develop equivariant activations; instead, they "fix" the lack of symmetry in the very last layers of the network.
- The "Blindness" Trap: Models with random, untrained weights can actually appear more invariant than trained ones. Why? Because they are often insensitive to the input. If a model's output is always a flat line, it's technically "invariant," but it's also useless. This highlights why measuring invariance in isolation can be misleading.
- Pretraining Matters: Models started with ImageNet weights learn invariance differently than those started from scratch. Pretrained models tend to become more invariant over time when fine-tuned on rotated data, whereas models trained from scratch often learn "non-robust" invariant features very early and then refine them.
- Self-Supervision is Selective: Self-supervised models (like SimCLR) only show high invariance if they were explicitly trained with a "contrastive loss" that rewards that specific symmetry.
Key Results: Architecture vs. Training
When comparing models, the authors found that $C_8$-equivariant CNNs (which have symmetry "hard-coded" into their math) maintained significantly higher equivariance in early layers compared to standard CNNs trained with heavy augmentation.
Furthermore, while invariance learned through augmentation does generalize slightly to out-of-distribution data (like blurred or noisy images), it is much less robust than the invariance provided by equivariant architectures. The authors also note that metric sensitivity plays a huge role: the choice of distance metric ($L_2$ vs. Cosine Similarity) can completely change whether a model is judged as "more invariant," suggesting that researchers need to be very specific about what kind of "distance" matters for their task.
Limitations and Future Work
The current $G$-EED framework requires a known symmetry group (like rotations or reflections). It cannot yet measure "informal" invariances, such as a model being invariant to changes in an image's background or lighting, because those don't have a clean mathematical group structure.
The authors suggest that the next frontier is "emergent equivariance"—developing metrics that can discover what symmetries a model has learned without the user having to define the group $G$ upfront. This would allow us to peer into the "black box" and see what patterns the model has decided are irrelevant on its own.
Summary updated