# mixup: Beyond Empirical Risk Minimization

Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, David Lopez-Paz · arXiv · 2017-10-25

- **Problem** Standard empirical risk minimization lets large networks memorize random labels and change their predictions sharply on inputs just outside the training data.
- **Method** mixup trains on convex combinations of pairs of inputs and their one-hot labels, with the mixing weight drawn from a Beta(α, α) distribution.
- **Results** Reached 21.5 top-1 error with ResNet-101 trained for 90 epochs on ImageNet-2012, against 22.1 for ERM.

## Why ERM is questioned for large networks

Standard training minimizes the average loss over the training set, which is the empirical risk minimization rule that mixup is compared against. Two behaviours cause concern: large networks can fit training sets whose labels are assigned at random, and their predictions change sharply on inputs just outside the training distribution. The authors read both as evidence that ERM does not give reliable generalization once test points drift slightly from the training data.

Model size makes the problem sharper: classical learning theory ties the convergence of ERM to a learning machine whose size does not grow with the number of training examples.

Data augmentation is the usual response, and the Vicinal Risk Minimization view formalizes it by drawing virtual examples from a neighborhood around each training point. Its weakness is that the neighborhood has to be designed by hand for each dataset, and it assumes that neighbors share a class, so it says nothing about how examples of different classes relate.

## How a mixup example is built

mixup works on pairs: two training examples (x\_i, y\_i) and (x\_j, y\_j) are drawn at random from the training data. The new input and target are weighted averages of the two pairs, \\\\( \\\\tilde{x} = \\\\lambda x\_i + (1-\\\\lambda) x\_j \\\\) and \\\\( \\\\tilde{y} = \\\\lambda y\_i + (1-\\\\lambda) y\_j \\\\), where \\\\( \\\\lambda \\\\sim \\\\mathrm{Beta}(\\\\alpha, \\\\alpha) \\\\) and \\\\( \\\\alpha \\\\in (0, \\\\infty) \\\\).

Because the labels are one-hot vectors, the target puts weight λ on the class of the first example and 1 − λ on the class of the second.

The mixing parameter α controls how strongly pairs are interpolated, and as α approaches 0 the method recovers ERM. For ImageNet, α values between 0.1 and 0.4 improved on ERM, while the CIFAR experiments fix α = 1, which makes λ uniformly distributed between zero and one.

Implementation adds a few lines to a standard training step: draw λ, mix the inputs and the labels of the batch, and compute the loss on the mixed batch. The implementation uses a single data loader to fetch one minibatch and mixes it with a shuffled copy of itself, which was found to work as well as using two loaders while reducing I/O. Two alternatives gave no gain in preliminary runs: mixing three or more examples with Dirichlet-sampled weights, which also increased computation, and interpolating only between examples that share a label.

## Why linear behaviour between examples

mixup can be read as data augmentation that pushes the network to act linearly between training examples. The argument is that linear behaviour between points reduces unwanted oscillations when the model predicts away from the data, and that linearity is among the simplest behaviours one could choose, which fits Occam's razor.

To test the claim, models are evaluated at points x = λx\_i + (1−λ)x\_j between randomly sampled training examples. A prediction counts as a miss when it does not belong to {y\_i, y\_j}, and the gradient norm is the norm of the loss gradient with respect to the input at those points. Two CIFAR-10 models with the same architecture and training procedure are compared, one trained with ERM and one with mixup, and the mixup model shows fewer misses and smaller gradient norms in-between training samples.

The evidence comes from the average behaviour of two networks at sampled points, so it shows a tendency rather than a guarantee.

## ImageNet classification results

ImageNet-2012 has about 1.3 million training images, 50,000 validation images and 1,000 classes.

Training is data-parallel and distributed in Caffe2 with a minibatch size of 1,024. The learning rate rises linearly from 0.1 to 0.4 over the first 5 epochs, then is divided by 10 after 30, 60 and 80 epochs in 90-epoch runs, or after 60, 120 and 180 epochs in 200-epoch runs. Some ERM rows are taken from prior work, Goyal et al. (2017) and Xie et al.

(2016), while the other rows come from runs in this study.

Table 1 reports top-1 and top-5 error on the ImageNet-2012 development set. With 90 epochs, ResNet-101 reaches 21.5 top-1 error with mixup at α = 0.2, against 22.1 for ERM. With 200 epochs the same pair is 20.8 for mixup and 22.0 for ERM.

The gains are 0.5% to 0.6% for ResNet-101 and ResNeXt-101 at 90 epochs, against 0.2% for ResNet-50. Larger models and longer runs benefit most from mixup. Moving the mixup ResNet-50 from 90 to 200 epochs reduces its top-1 error by 1.2%, while the text describes its ERM counterpart as unchanged. Large α values underfit, so the useful range was α in 0.1 to 0.4.

## CIFAR-10 and CIFAR-100 results

Three architectures are compared with ERM: PreAct ResNet-18, WideResNet-28-10 and DenseNet-BC-190, the last with growth rate 40. All models use α = 1 and train for 200 epochs on one Nvidia Tesla P100 GPU with 128 examples per minibatch, evaluated on the test set.

On CIFAR-10 the test errors of ERM and mixup are 5.6 and 4.2 for PreAct ResNet-18, 3.8 and 2.7 for WideResNet-28-10, and 3.7 and 2.7 for DenseNet-BC-190. On CIFAR-100 the pairs are 25.6 and 21.1 for PreAct ResNet-18, 19.4 and 17.5 for WideResNet-28-10, and 19.0 and 16.8 for DenseNet-BC-190. Every mixup value in the table is lower than its ERM counterpart.

The mixup and ERM curves reach their best test errors at a similar speed. The DenseNet numbers differ from the original DenseNet report because that work trained for 300 epochs with learning rate decays at 150 and 225 epochs, which may explain the gap.

## Speech command results

The Google commands dataset has 65,000 utterances of about one second, in 30 voice-command classes spoken by a few thousand speakers. Waveforms are converted to normalized spectrograms at a 16 kHz sampling rate and zero-padded to 160×101, and mixup is applied to the spectrograms just before the network.

LeNet and VGG-11 each have two convolutional and two fully connected layers and are trained for 30 epochs with minibatches of 100 examples using Adam.

The text stresses the gain for VGG-11, the larger model, and the LeNet rows show no gain on either split.

## Corrupted-label memorization

Following Zhang et al. (2017), 20%, 50% or 80% of CIFAR-10 training labels are replaced by random labels, and test labels are kept intact. ERM, Dropout, mixup and mixup with Dropout are compared, with mixup α chosen from 1, 2, 8 and 32 and Dropout probability p from 0.5, 0.7, 0.8 and 0.9. The combination uses α from 1, 2, 4 and 8 and p from 0.3, 0.5 and 0.7, all with PreAct ResNet-18.

The hypothesis is that a larger α makes virtual examples lie farther from the training points, so memorizing them is harder while learning interpolations of real examples stays easy. Table 2 is read through the best test error over training, the last-epoch test error after 200 epochs, and the last-epoch training error on real and on corrupted labels.

The text's claim of lower real-label training error for mixup therefore holds against Dropout in the table but not against ERM.

The text describes mixup with Dropout as the best of all methods. That holds at 50% and 80% corruption, where mixup with Dropout reaches 10.9 and 24.0 best error against 11.3 and 25.3 for mixup alone. At 20% corruption mixup alone is lower, at 5.9 against 6.2. The 20% mixup with Dropout row lists p = 0.1, which lies outside the 0.3, 0.5 and 0.7 grid given in the setup.

## Adversarial robustness

Adversarial robustness methods such as Jacobian penalties and adversarial training add substantial computation. The argument for mixup is that it gains robustness without that cost, by penalizing the gradient of the loss with respect to the input along directions such as those toward other training points.

The study uses three ResNet-101 models: two trained with ERM on ImageNet-2012 and one trained with mixup. White-box attacks use each model against itself with FGSM or I-FGSM, with a maximum perturbation of 4 for every pixel, and I-FGSM uses 10 iterations with equal step size. Black-box attacks create adversarial examples from the first ERM model and test the second ERM model and the mixup model on them.

Under white-box FGSM, top-1 error is 90.7 for ERM and 75.2 for mixup, and top-5 error is 63.1 for ERM and 49.1 for mixup.

The authors describe mixup as 2.7 times more robust than ERM under white-box FGSM in top-1 error, and 1.25 times more robust under black-box FGSM in top-1 error. They also describe mixup as about 40% more robust than ERM under black-box I-FGSM. Both models fail under white-box I-FGSM, so the white-box gain in this study is confined to FGSM.

## Tabular results on UCI datasets

Six classification datasets from the UCI repository are used, with fully connected networks of two hidden layers of 128 ReLU units.

Table 4 gives the ERM and mixup error for each dataset. The text says mixup improves four of the six datasets and never underperforms ERM, while the table shows lower error on five datasets and equal error on Htru2.

## Stabilizing GAN training

A GAN trains a generator g and a discriminator d as a min-max game, with the binary cross entropy loss ℓ used on real samples x and generated samples g(z). The mixup version trains the discriminator on mixed samples, \\\\( \\\\max\_g \\\\min\_d \\\\mathbb{E}\_{x,z,\\\\lambda}\\\\, \\\\ell(d(\\\\lambda x + (1-\\\\lambda) g(z)), \\\\lambda) \\\\), so its output is pushed toward the mixing weight.

The argument is that this regularizes the discriminator's gradients, so the generator receives a steadier gradient signal.

Training runs for 20,000 minibatches of size 128 with Adam at default parameters, and the discriminator is updated five times per generator update.

## Which design choices matter

Results are median test errors over the last 10 epochs.

Latent variants interpolate the representations before each residual block (Layer 1 to Layer 4) or before the final pooling and fully connected layer (Layer 5). Nearest-neighbour variants mix each sample with a random draw from its 200 nearest neighbours, taken either within the class (SC) or across all classes (AC). Permutation variants mix a minibatch with a random permutation of its indices, per batch (AC) or per class (SC), and label variants either use the mixed one-hot target or take the target of the closer sample.

Label smoothing uses ε/10 for incorrect classes and 1 − 9ε/10 for the correct class, and Gaussian input noise is another baseline.

Among latent variants, Layer 1 gives the lowest error at both weight decay settings, at 4.44 and 4.51.

Among input-only variants, mixing random pairs across all classes has the strongest regularization effect. Label smoothing and Gaussian noise have a smaller regularization effect, and the SMOTE algorithm does not give a noticeable gain.

## Relation to earlier augmentation and smoothing

Earlier augmentation schemes rely on domain knowledge to design transformations, and interpolation-based schemes work within a class. Chawla et al. interpolate nearest neighbours to augment rare classes, and DeVries and Taylor interpolate and extrapolate same-class neighbours in feature space, and neither adjusts the labels to follow the interpolation.

Label smoothing and confidence penalties make the supervision depend on several soft labels, but the smoothing is applied independently of the feature values. mixup ties the target to the same interpolation as the input, which the authors describe as a linear relationship between augmentation and supervision.

## Limitations

The effect of α is not settled: on ImageNet the training error on real data grows as α grows, while on CIFAR-10 it stays very low even at very large α. The authors do not yet have a theory for this bias-variance sweet spot.

The GAN study uses two toy datasets with a qualitative comparison. The adversarial study uses ResNet-101 on ImageNet-2012 with FGSM and I-FGSM only. The corrupted-label study uses CIFAR-10 with PreAct ResNet-18, and the mixup with Dropout ranking does not hold at 20% corruption. Regression, structured prediction, and unsupervised or reinforcement learning are listed as open directions and were not tested.

## Paper info

- **Authors**: Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, David Lopez-Paz
- **Venue**: arXiv · Preprint
- **First published**: 2017-10-25
- **Added**: 2026-10-20
- **Updated**: 2018-4-27
- **Version**: v2
- **arXiv**: 1710.09412
- **Category**: cs.LG · stat.ML
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1710.09412v2) · [PDF ↗](https://arxiv.org/pdf/1710.09412v2)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, David Lopez-Paz (2017). mixup: Beyond Empirical Risk Minimization. arXiv:1710.09412v2. https://arxiv.org/abs/1710.09412v2

**BibTeX**

```
@misc{zhang2017mixup,
  title = {{mixup: Beyond Empirical Risk Minimization}},
  author = {Hongyi Zhang and Moustapha Cisse and Yann N. Dauphin and David Lopez-Paz},
  year = {2017},
  eprint = {1710.09412},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1710.09412v2}
}
```

## Other paper commentary

- [Weight Normalization: A Simple Reparameterization to Accelerate Training of Deep Neural Networks](https://refivu.com/en/papers/c1050ccf-ffa6-4158-8fff-24b3a8223df6-weight-normalization-a-simple-reparameterization-to.md)
- [The Lottery Ticket Hypothesis: Finding Sparse, Trainable Neural Networks](https://refivu.com/en/papers/9c072b5c-bd96-4202-8960-653ce6a7f2fb-the-lottery-ticket-hypothesis-finding-sparse-trainable.md)
- [Adam: A Method for Stochastic Optimization](https://refivu.com/en/papers/1e4ce3cf-c297-4440-9078-a86a09a9caca-adam-a-method-for-stochastic-optimization.md)
- [Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift](https://refivu.com/en/papers/bd3e1105-da91-407a-8b28-4217cd2afedf-batch-normalization-accelerating-deep-network-training-by.md)
- [Instance Normalization: The Missing Ingredient for Fast Stylization](https://refivu.com/en/papers/d30fae5e-d1ad-4ef1-9b41-da9a7a9f25cf-instance-normalization-the-missing-ingredient-for-fast.md)
- [Group Normalization](https://refivu.com/en/papers/73ea525c-b90c-43b2-b656-bb21666ab914-group-normalization.md)
- [Rethinking the Inception Architecture for Computer Vision](https://refivu.com/en/papers/5a8c1d5f-a10c-4a76-a110-b62861a7dc8a-rethinking-the-inception-architecture-for-computer-vision.md)
- [Measuring Massive Multitask Language Understanding](https://refivu.com/en/papers/c93df260-9bcd-49a6-95e1-3da2df6130ee-measuring-massive-multitask-language-understanding.md)
- [Efficient Memory Management for Large Language Model Serving with PagedAttention](https://refivu.com/en/papers/a69a26aa-a470-4bff-9c73-2a7fe8ffd528-efficient-memory-management-for-large-language-model-serving.md)
- [Mamba: Linear-Time Sequence Modeling with Selective State Spaces](https://refivu.com/en/papers/b149783d-1b22-47f2-94df-544d57bb2621-mamba-linear-time-sequence-modeling-with-selective-state.md)
- [Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification](https://refivu.com/en/papers/83083238-3fc6-4f4e-a3b1-6db4f84268de-delving-deep-into-rectifiers-surpassing-human-level.md)
- [Direct Preference Optimization: Your Language Model is Secretly a Reward Model](https://refivu.com/en/papers/b96eaaaa-8c14-4a06-93bf-d13e70a14b14-direct-preference-optimization-your-language-model-is.md)

## Terms in this paper

- [dropout](https://refivu.com/en/terms/db73f75bbdd3-dropout)
- [Data Augmentation](https://refivu.com/en/terms/cc5618231f4a-data-augmentation)
- [Generative adversarial networks](https://refivu.com/en/terms/889f2a50b737-generative-adversarial-networks)
- [CIFAR-100](https://refivu.com/en/terms/5afa3b877d18-cifar-100)
- [test error](https://refivu.com/en/terms/8b10281531ee-test-error)
- [Resnet-101](https://refivu.com/en/terms/e1917778abec-resnet-101)
- [top-5 error](https://refivu.com/en/terms/beb42c9fbaad-top-5-error)
- [speech recognition](https://refivu.com/en/terms/6bb195b2a74a-speech-recognition)
- [Top-1 Error](https://refivu.com/en/terms/2cd2d3a429ea-top-1-error)
- [mixup](https://refivu.com/en/terms/62023d7e891b-mixup)
- [Fast gradient sign method](https://refivu.com/en/terms/75749bc5431d-fast-gradient-sign-method)
- [label smoothing](https://refivu.com/en/terms/92ff7104c813-label-smoothing)
- [Empirical Risk Minimization](https://refivu.com/en/terms/886608d45c77-empirical-risk-minimization)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/cc1e3261-af7e-47fa-99d8-0806fbe6afcf-mixup-beyond-empirical-risk-minimization)
