A Theory of Data Augmentation
Orbit averaging, variance reduction and when augmentation provably helps.
Why does training on rotated copies help, and when can it hurt? Give augmentation a mathematical setting, a group of transformations acting on the inputs, and the answers become theorems. Augmentation is averaging over orbits; when the data distribution is invariant it provably reduces variance, sometimes as much as multiplying the data; in a kernel model it is averaged features plus a variance penalty; and building the invariance into the model can beat augmenting by an exact, computable margin.
What you’ll learn
- Set up augmentation with a group acting on the inputs (orbits, invariant functions, the orbit-averaging operator) and show that augmented training is ERM on the orbit-averaged loss.
- Prove the invariance lemma (orbit averaging is a conditional expectation) and derive the variance reduction of augmented estimators, exactly in a worked example (Chen, Dobriban & Lee, 2020).
- Derive the kernel view of augmentation: first-order feature averaging plus a second-order variance penalty (Dao et al., 2019).
- State the strict generalization benefit of invariant linear models (Elesedy & Zaidi, 2021), describe learned augmentation distributions, and explain how approximate and label-changing transformations break the theory.
Groups, orbits and averaging
Two facts organize everything that follows. First, is invariant: , because maps the uniform distribution on to itself. Averaging over a group projects any function onto the invariant ones.
Second, augmented training is an ordinary ERM. Sampling afresh for each example makes SGD an unbiased method for the augmented loss , so the augmented estimator minimizes : the same empirical risk minimization, with each loss replaced by its orbit average.
Augmentation reduces variance
Under exact invariance, once you know which orbit lies on, its position within the orbit looks like with : for a finite group acting freely, each of the orbit's points is equally likely. Averaging over is therefore conditioning on the orbit, which is (1):
The tower property gives (2), the law of total covariance gives (3), and Jensen's inequality for conditional expectations gives (4):
This is the Rao–Blackwell theorem in disguise: replace a statistic by its conditional expectation given (here) the orbit, keep the mean, and shed the within-orbit variance. Applied to the loss, the augmented empirical risk has the same expectation as the original for every and smaller variance; applied to an estimator , its average has the same bias and a covariance smaller in the Loewner order, so smaller error under every convex loss.
Let with (all coordinates equal), and let be the cyclic shifts of coordinates. Shifting permutes independent coordinates with equal means, so the distribution is exactly invariant. Estimate with the loss . ERM gives the sample mean vector:
The augmented risk is minimized by the orbit average of , which sets every coordinate to the average of all observed coordinates:
A factor- reduction: augmentation is worth as much as times more data here, because the symmetry lets each observation inform every coordinate.
In the example, take coordinates and samples. How many samples would un-augmented ERM need to reach the augmented estimator's mean squared error?
Show the answer
400 samples
ERM's error is and the augmented error is ; equating gives .
Real symmetries are rarely exact. If is only close in distribution to , averaging over the orbit also adds bias. Chen, Dobriban and Lee quantify the resulting trade-off: the variance removed depends on how much the loss varies along orbits, the bias on a Wasserstein distance between and its transformed copies. Augmentation helps when the first outweighs the second, which is why the safe range of a transformation is an empirical question.
The kernel view: averaged features plus a variance penalty
Dao, Gu, Ratner, Smith, De Sa and Ré (2019) analyzed augmentation for linear models on features, , which covers kernel machines and a network's last layer, with a loss twice differentiable in . Expand the augmented loss of one example around the orbit-averaged feature :
Write with , and Taylor-expand in its first argument around :
The first-order term vanishes because . Evaluating at the center leaves
The first term trains on invariant features, equivalent to using the averaged kernel . The second is a data-dependent Tikhonov penalty on how much the prediction varies across the orbit, weighted by the loss curvature, the same structure as dropout's Fisher-weighted penalty and mixup's term. Dao et al. used the approximation to train faster on augmented data and to predict, before training, whether a transformation will help.
In the expansion of the augmented loss, why does the first-order term vanish?
- Because the loss is minimized, so its derivative is zero
- Because the group is finite
- Because the deviations average to zero over the group by construction
- Because the features are normalized to unit length
Show the answer
C. Because the deviations average to zero over the group by construction
Expanding around the orbit mean makes the linear term proportional to , whatever is. What survives at second order is the variance of the prediction across the orbit.
Architecture versus augmentation
Instead of teaching an invariance with data, one can build it into the model: convolutions are translation-equivariant by construction, group convolutions and steerable networks add rotations and reflections, and equivariant graph networks respect permutations and 3D symmetries (Rotation-Equivariant & Steerable CNNs, Equivariant Networks for 3D Geometry). For linear regression the benefit is exactly computable:
Built-in invariance is exact for every input, costs no extra data or compute, and is the right choice when the symmetry is known and implementable. Augmentation is more flexible: it can express approximate symmetries and transformations that are not groups at all, such as crops, but enforces invariance only approximately and only near the data, at the price of more training.
Learning the augmentation. Augerino (Benton, Finzi, Izmailov & Wilson, 2020) learns how much invariance to impose. Transformations are sampled as with and generators for translations, rotation, scalings and shear, so is the range of each, and the objective is , minimized jointly over and . The reward for width is needed because the training loss is flat inside the range of the data's true invariance and gives no push to widen it; with the reward, the ranges expand until the loss rises at the edge of the real symmetry. Predictions average over sampled transformations.
When the theory breaks
The theorems assume a group under which the data distribution, and the labels, are invariant. Practice violates this in several ways. Small rotations do not form a group (two 40° turns make 80°), and the label of a digit is invariant only under some of them: averaging over the full rotation group mislabels sixes and nines, adding bias that no variance reduction repays. Crops destroy information and cannot be undone, so they are not group actions; mixup transforms pairs of examples. And invariances can be class-dependent (Balestriero, Bottou & LeCun, 2022), while the theory assumes one group acting on all classes.
In deep networks, augmentation can also act through feature learning rather than through variance alone. Shen, Bubeck and Gunasekar (2022) showed, for a two-layer convolutional network on a "multi-view" data model, that augmentation changes which features are learned, favoring informative features that would otherwise be hard to learn, an effect stronger for nonlinear models than for linear ones.
Key takeaways
- With a group acting on inputs, augmented training is ERM with the loss replaced by its orbit average ; orbit averaging projects any function onto the invariant ones.
- Under exact invariance, orbit averaging is conditioning on the orbit: it keeps means and removes the within-orbit variance (a Rao–Blackwell argument), so augmented estimators are never worse under convex losses and their asymptotic covariance shrinks by (Chen, Dobriban & Lee, 2020).
- For linear models on features, augmentation is to second order training on orbit-averaged features plus a curvature-weighted penalty on the prediction's variance across the orbit (Dao et al., 2019).
- Building the invariance into a linear model gains exactly in test error when (Elesedy & Zaidi, 2021); augmentation trades exactness for flexibility, and its ranges can be learned (Augerino).
- Label-changing, non-group and class-dependent transformations break the assumptions; approximate invariance adds bias, and augmentation also reshapes which features deep networks learn.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Why is the orbit average invariant under the group?
- Because itself must already be invariant
- Because for any , the map leaves the uniform distribution on unchanged, so averages the same values
- Because averaging always produces constant functions
- Because the group has finitely many elements
Show the answer
B. Because for any , the map leaves the uniform distribution on unchanged, so averages the same values
with . This works for any , which is why orbit averaging projects onto invariant functions.
Under exact invariance, how does replacing a loss by its orbit average change it, at every parameter value?
- It lowers the expected loss and raises its variance
- It keeps both the expected loss and its variance
- It introduces a bias proportional to the size of the group
- It keeps the expected loss and lowers its variance, by the average within-orbit variance
Show the answer
D. It keeps the expected loss and lowers its variance, by the average within-orbit variance
The orbit average is a conditional expectation given the orbit, so the tower property keeps the mean and the law of total variance removes the within-orbit part. Bias appears only when the invariance is approximate.
In Elesedy and Zaidi's theorem (Gaussian inputs, invariant linear target, ), which change makes symmetrizing the least-squares estimate more valuable?
- A larger , the dimension of the predictors the symmetry rules out
- More training examples
- Less label noise
- A group whose invariant predictors span all of
Show the answer
A. A larger , the dimension of the predictors the symmetry rules out
The gain is : it grows with the number of directions the symmetry eliminates and with the noise, and shrinks as grows. A group that leaves every predictor invariant has and gives nothing.
Augerino learns the ranges of its transformations jointly with the weights. Why does its objective include a reward for wide ranges?
- To make training faster
- Because without it the ranges would grow without bound
- Because inside the range of the data's true invariance the training loss is flat, so it gives no push toward wider augmentation; the reward supplies it, and the loss stops the expansion at the edge of the symmetry
- To keep the network's weights small
Show the answer
C. Because inside the range of the data's true invariance the training loss is flat, so it gives no push toward wider augmentation; the reward supplies it, and the loss stops the expansion at the edge of the symmetry
If the label really is invariant over a range, augmenting within it barely changes the training loss, so gradient descent has no reason to widen . A small reward for width expands it until augmentation starts to hurt the fit, which marks the boundary of the real invariance.
Further reading
- S. Chen, E. Dobriban & J. H. Lee, "A group-theoretic framework for data augmentation," Journal of Machine Learning Research 21(245), 1–71 (2020).
- T. Dao, A. Gu, A. Ratner, V. Smith, C. De Sa & C. Ré, "A kernel theory of modern data augmentation," ICML (2019).
- B. Elesedy & S. Zaidi, "Provably strict generalisation benefit for equivariant models," ICML (2021).
- G. Benton, M. Finzi, P. Izmailov & A. G. Wilson, "Learning invariances in neural networks from training data," NeurIPS (2020).
- R. Shen, S. Bubeck & S. Gunasekar, "Data augmentation as feature manipulation," ICML (2022).