In machine learning, we often want our models to be invariant to certain changes. For example, a handwritten "7" remains a "7" even if it is slightly rotated, scaled, or shifted. The standard, highly effective practice for teaching models these symmetries is data augmentation—manually transforming training images to create "fake" data.
However, this paper, presented at NeurIPS 2018, offers a principled Bayesian alternative to this somewhat "hacky" practice. By baking symmetries directly into Gaussian Process (GP) kernels and using the marginal likelihood as a guide, the authors demonstrate how a model can automatically learn which transformations it should be invariant to.
The Problem with Manual Data Augmentation
While data augmentation works well in practice, it has several notable drawbacks:
- Manual Effort: It requires domain expert knowledge to decide which transformations are "safe" and won't change the underlying label (e.g., a 6 rotated too far becomes a 9).
- Bayesian Inconsistency: From a Bayesian perspective, adding "fake" data makes the model artificially overconfident. It also ruins the reliability of the marginal likelihood, which is a key metric for model selection.
- Hard-coded Parameters: Practitioners usually have to decide the amount of augmentation (e.g., rotating by exactly 10 degrees versus 40 degrees) beforehand, rather than allowing the model to learn the optimal bounds from the data itself.
A Bayesian Approach to Learning Symmetries
Instead of augmenting the dataset, the authors propose a framework to learn these invariances as part of the model's prior.
- Invariant Kernels: They utilize "double-sum" kernels. In this setup, the similarity between two points is calculated by averaging the base kernel over all possible transformations (the "orbit") of those points.
- Variational Inference & Inter-domain Inducing Points: Computing these invariant kernels is usually mathematically intractable or computationally ruinous ($O(N^3)$). To solve this, the authors use "inter-domain" inducing variables. They represent the invariant function using a set of points in the non-invariant base space, making the math tractable.
- Stochastic Estimation: Because it is impossible to integrate over every conceivable transformation, they employ a sampling procedure. They developed a clever, unbiased estimator for the Evidence Lower Bound (ELBO) that allows the use of mini-batches for both data points and transformation samples.
- Learning via Backpropagation: Since the sampling process is differentiable (using the reparameterization trick), the model can backpropagate through the marginal likelihood to learn the parameters of the transformations themselves—such as the maximum angle of rotation.
Key Insights: Marginal Likelihood as Occam's Razor
A central insight of this paper is that the marginal likelihood naturally acts as Occam's Razor, preferring simpler models. An invariant model is inherently "simpler" because it constrains the function to behave identically across many transformed inputs. Therefore, if an invariance is genuinely present in the data, the marginal likelihood will increase when that invariance is incorporated.
Because the authors rely on the marginal likelihood, they can tune the "amount" of data augmentation (the invariance parameters) directly on the training set. This eliminates the need for a separate validation set for cross-validation.
Furthermore, the paper distinguishes between "strict invariance" and "insensitivity." Strict invariance (where a 6 and a 9 are treated as identical rotations) can be detrimental. Instead, the model focuses on insensitivity, learning to be mostly unaffected by small or local transformations.
Results on MNIST
The authors evaluated their approach on several variants of the MNIST handwritten digit dataset, yielding impressive results:
- Parameter Recovery: In a binary MNIST task (Odds vs. Evens), the model successfully "discovered" the true range of rotation applied to the data simply by maximizing the ELBO.
- Performance Boost: On standard MNIST, a standard GP (RBF kernel) achieved an error of 2.15%. By learning affine invariances (scaling, rotation, shear, translation), the error dropped significantly to 1.35%.
- Superiority over Baselines: Across all tests, the invariant GP models significantly outperformed non-invariant baselines in both accuracy and the quality of the marginal likelihood bound.
Limitations and Future Work
While promising, the approach has limitations. The authors noted that jointly optimizing the model's internal parameters alongside the transformation parameters is challenging. In some instances, the optimizer got stuck in local minima, and a model with "fixed" correct invariances outperformed one that had to learn them from scratch.
Additionally, while they used a "Pòlya-Gamma trick" to handle binary classification, the multi-class version currently relies on a Gaussian approximation, which is not ideal. Finally, while this work focuses on Gaussian Processes, the authors suggest that the core principle—using the marginal likelihood to learn invariances—could eventually be applied to deep neural networks, provided accurate marginal likelihood estimates become available for them.
Summary updated