# Unsupervised Data Augmentation for Consistency Training

Stronger data augmentation makes consistency training work better on unlabeled data

Qizhe Xie, Zihang Dai, Eduard Hovy, Minh-Thang Luong, Quoc V. Le · arXiv · 2019-4-29

- **Problem** Consistency training on unlabeled data relies on noise, but most methods use simple Gaussian, dropout or adversarial noise. The quality of that noise has rarely been studied, so its effect on results stays unclear.
- **Method** UDA (Unsupervised Data Augmentation) swaps the simple noise for augmentations that work in supervised learning. It uses RandAugment for images and back-translation for text, inside one consistency loss on unlabeled examples.
- **Results** With 20 labeled IMDb examples and BERT initialization, UDA reaches an error rate of 4.20, compared with 6.50 without UDA.

## What the noise choice is meant to fix

Consistency training uses unlabeled inputs by asking a model to give the same prediction when its input or hidden states are slightly perturbed. The perturbations used in earlier work are typically additive Gaussian noise, dropout noise or adversarial noise, and differences between methods mostly lie in how and where that noise is injected.

The authors set aside the question of where noise goes and ask how the quality of the noising operation changes the outcome, a question prior methods largely left open.

Their hypothesis is that augmentations found to be strong in supervised learning, because they are more diverse and more natural, should also make better perturbations when applied to unlabeled data in the same consistency framework. The resulting method, named Unsupervised Data Augmentation (UDA), is evaluated on six language tasks and three vision tasks.

## The training objective

Training minimizes a sum of two terms: a supervised negative log-likelihood on labeled examples and a consistency term on unlabeled examples, weighted by λ. The consistency term is written as follows. \\\[ J(\\theta)=\\mathbb{E}\_{x\_1\\sim p\_L(x)}\\bigl\[-\\log p\_\\theta(f^\*(x\_1)\\mid x\_1)\\bigr\]+\\lambda\\,\\mathbb{E}\_{x\_2\\sim p\_U(x)}\\mathbb{E}\_{\\hat x\\sim q(\\hat x\\mid x\_2)}\\bigl\[\\mathrm{CE}(\\tilde p\_\\theta(y\\mid x\_2)\\,\\\|\\,p\_\\theta(y\\mid \\hat x))\\bigr\] \\\] Here q(x̂\|x) is the augmentation, and the distribution on the left of the cross entropy comes from a copy θ̃ of the current parameters.

That copy is held fixed, so no gradient flows through it, which follows the virtual adversarial training approach. λ is 1 in most experiments. Each iteration draws a labeled mini-batch and a larger unlabeled mini-batch, and the two losses are summed.

The target distribution on the unlabeled side is sharpened with a softmax temperature τ, which lowers its entropy and pushes predictions toward a single class. \\\[ p^{(\\mathrm{sharp})}\_{\\tilde\\theta}(y\\mid x)=\\frac{\\exp(z\_y/\\tau)}{\\sum\_{y'}\\exp(z\_{y'}/\\tau)} \\\] A confidence mask then drops unlabeled examples whose largest unsharpened target probability does not exceed β, so the indicator is applied to the unsharpened target while the cross entropy uses the sharpened one.

\\\[ \\frac{1}{\|B\|}\\sum\_{x\\in B} I\\bigl(\\max\_{y'}\\tilde p\_\\theta(y'\\mid x)\>\\beta\\bigr)\\,\\mathrm{CE}\\bigl(p^{(\\mathrm{sharp})}\_{\\tilde\\theta}(y\\mid x)\\,\\\|\\,p\_\\theta(y\\mid \\hat x)\\bigr) \\\] The threshold β is 0.8 for CIFAR-10 and SVHN and 0.5 for ImageNet, and τ is 0.4 for CIFAR-10, SVHN and ImageNet.

In vision, the labeled pipeline uses cropping and flipping, and the same simple transformations are applied to unlabeled inputs when computing the target, so training and prediction see matching inputs. The advanced augmentation is used only to produce the noised copy x̂, which is the input whose prediction is matched to the target. When the unlabeled pool comes from a different domain, the baseline model labels the candidates and, for each category, the examples it is most confident about are kept.

## Augmentations for vision and text

For images the authors use RandAugment, which is derived from AutoAugment but drops the policy search: it draws transformations uniformly from the Python Image Library operations. Each sub-policy contains two operations, and each operation draws one of 15 transformations with a magnitude in \[1, 10) and a fixed probability of 0.5. The magnitude range and probability were not tuned.

For text, back-translation sends each sentence from English to French and back using WMT'14 translation models in both directions. Random sampling with a tunable temperature replaces beam search, since the authors found the diversity of paraphrases to matter. Temperatures of 0.7, 0.8 or 0.9 gave the best results, because temperature 0 yields identical paraphrases and temperature 1 yields paraphrases that are hard to read.

Back-translation keeps the overall meaning but gives little control over which words survive, which matters for topic tasks such as DBPedia where some keywords decide the label. The TF-IDF based replacement therefore swaps low-score words for other words and keeps high-score keywords. The chance of replacing a word grows as its TF-IDF score falls below the sentence maximum, and the sampled replacement avoids words with high keyword scores.

## Why better augmentation can need fewer labels

The analysis assumes that augmented examples have non-zero probability under the unlabeled distribution, that augmentation keeps the label of its source, and that the augmentation can be reversed. Under these assumptions, a graph whose edges connect an example to its possible augmentations has at least one connected component per class, since examples with different labels cannot share a component.

Within one component, a single labeled example suffices to label the rest if UDA can walk the whole component, whereas supervised augmentation only passes labels to the immediate neighbors of the labeled example. The number of components therefore sets a lower bound on the labeled examples needed, and a richer augmentation that connects more examples gives fewer components.

Under the same assumptions, m equal to O(k/ε) labeled examples give a failure probability of O(ε), where k is the number of components. The appendix maximizes this sum subject to the P\_i summing to one, which gives equal masses of 1/k and a bound of (1 - 1/k)^m.

This is a bound on a failure probability under the stated assumptions, not a measured error curve. The link to real augmentations is the authors' argument, illustrated with a toy graph in which supervised augmentation labels 9 of 15 nodes and UDA with advanced augmentation labels all 15.

## Supervised and semi-supervised gains move together

To test the central idea, the authors compare augmentations under both supervised and semi-supervised training. On CIFAR-10 they use crop and flip, Cutout and RandAugment, and on Yelp-5 they use no augmentation, Switchout and back-translation.

On CIFAR-10 with 50k supervised examples, the error is 5.36, 4.42 and 4.23 for the three methods. With 4k semi-supervised examples it is 10.94, 5.43 and 4.32, so the same ordering appears in both columns. On Yelp-5 the supervised error (650k examples) is 38.36, 37.24 and 36.71, and the semi-supervised error (2.5k examples) is 50.80, 43.38 and 41.35, again with the more advanced method lower in each column.

These are only two datasets and three methods on each, so the ordering is consistent here but is not a general test; the authors read it as support for their idea.

## CIFAR-10 and SVHN results

With a Wide-ResNet-28-2 backbone, UDA is compared with virtual adversarial training and MixMatch across varying numbers of labeled examples from 250 to 4000. UDA consistently has lower error than both baselines in the varied-size comparison. The authors attribute the gap to VAT versus UDA mainly to the noise itself: adversarial noise often has high-frequency artifacts absent from real images, whereas augmentations produce diverse and realistic images.

Under the same architecture, UDA with RandAugment reaches 4.32 on CIFAR-10 with 4k labeled examples and 2.23 on SVHN with 1k, against 6.24 and 2.89 for MixMatch with WRN-28-2. Higher-capacity models reach lower error with UDA: 3.7 with Shake-Shake and 2.7 with PyramidNet and ShakeDrop. These rows use different architectures and parameter counts from the WRN-28-2 rows, so they are not a controlled comparison.

The authors compare these numbers with fully supervised models trained on 50,000 CIFAR-10 examples without RandAugment, which give 5.4 for Wide-ResNet-28-2 and 2.7 for PyramidNet with ShakeDrop.

At 250 labeled CIFAR-10 examples UDA reaches 5.43 and at 250 SVHN examples 2.72.

## Text classification and BERT initialization

Four initializations are compared: a randomly initialized Transformer, BERT base, BERT large, and BERT large fine-tuned on in-domain unlabeled data. Each is run with and without UDA. On IMDb with 20 labeled examples, the error falls from 43.27 to 25.23 for the random Transformer, from 18.40 to 5.45 for BERT base, and from 11.72 to 4.78 for BERT large.

With BERT fine-tuned on in-domain data, the error on IMDb falls from 6.50 to 4.20. The 4.20 result sits below the pre-BERT state of the art of 4.32 trained on 25k labeled IMDb examples and below BERT large's fully supervised 4.51.

With the same 20-example setting, UDA with BERT fine-tuning reaches 2.05 on Yelp-2 and 3.50 on Amazon-2, where the fully supervised pre-BERT rows are 2.16 and 3.32, and the authors describe the binary tasks as competitive. On the five-category tasks, the best UDA row with 2.5k labeled examples reaches 32.08 on Yelp-5 and 37.12 on Amazon-5, against 29.32 and 34.17 for fully supervised BERT large, so a clear gap remains.

BERT fine-tuning was not run on DBPedia because the authors found it gave no further gain there, which they link to BERT having been trained on Wikipedia.

## ImageNet results

Two settings are tested with ResNet-50. In the first, 10% of the ImageNet labels are used and the remaining images are unlabeled in-domain data. In the second, all ImageNet labels are used and 1.3M images are filtered from JFT with the domain-relevance method, so that unlabeled data may be out-of-domain.

With 10% of labels, top-1 accuracy is 55.09 for ResNet-50, 58.84 with RandAugment and 68.78 with UDA with RandAugment. The top-5 accuracy for UDA is 88.80. With all labels, top-1 is 77.28 for ResNet-50, 78.43 with RandAugment and 79.05 with UDA with RandAugment. The 10% gain is therefore measured against the RandAugment baseline, not the plain ResNet-50 row, and the full-label gain is small.

The 10% setting uses a 512-example supervised batch and a 15,360-example unsupervised batch, with λ set to 20, the mask threshold at 0.5, the softmax temperature at 0.4 and 40k training steps. The full-label setting uses an 8,192 supervised batch and a 16,384 unsupervised batch, with λ set to 1, a base learning rate of 1.6, and entropy minimization instead of the temperature-based sharpening described above.

## Ablations: data size, transformation count and TSA

On CIFAR-10 with 4,000 labeled examples, the error is 4.32 with 50,000 unlabeled examples, 7.31 with 20,000, 10.32 with 10,000 and 13.19 with 5,000. Reducing the unlabeled set hurts more than reducing the labeled set by the same ratio, so the authors judge abundant unlabeled data more important than extra labels. SVHN shows the same pattern in its own table.

To test whether RandAugment's diversity matters, the number of transformations it may sample is restricted on CIFAR-10 with 1000 and 4000 labeled examples. Error decreases as more transformations are allowed, from 2 up to 16 on the axis. The authors read this as evidence that diversity of transformations, not search, explains RandAugment's success.

The paper gives the trend in a figure rather than exact values.

Training Signal Annealing removes a labeled example from the loss once the model's probability on its correct class exceeds a threshold η\_t, which rises from 1/K to 1 over training, with K the number of classes. On Yelp-5 with a randomly initialized Transformer, 2.5k labeled examples and about 6m unlabeled examples, the error is 50.81 without TSA, 49.06 with the log schedule, 45.41 with the linear schedule and 41.35 with the exp schedule.

The no-TSA value of 50.81 differs from the 50.80 shown for the same semi-supervised setting in the augmentation comparison table. The Table 8 caption also names CIFAR-10, but only Yelp-5 values appear. The exp schedule works best because it holds the supervised signal back until late training, which suits settings where overfitting is likely.

## Limitations

Five-category sentiment still trails fully supervised BERT, and the authors expect it to leave room for future work. The theoretical results depend on three assumptions about augmentation, and the paper does not check them for RandAugment or back-translation separately.

Stronger augmentation trades diversity against label validity, so a temperature that is too high yields paraphrases that are hard to read. The ImageNet unlabeled set from JFT is not guaranteed to match the target class distribution, and the Yelp and Amazon unlabeled sets may have label distributions that differ from the labeled ones. The ImageNet runs were trained on TPU pods of v3-64 and v3-128 with batch sizes in the thousands, so their cost is far above the small-scale experiments.

## Paper info

- **Authors**: Qizhe Xie, Zihang Dai, Eduard Hovy, Minh-Thang Luong, Quoc V. Le
- **Venue**: arXiv · Preprint
- **First published**: 2019-4-29
- **Added**: 2026-11-12
- **Updated**: 2020-11-5
- **Version**: v6
- **arXiv**: 1904.12848
- **Category**: cs.LG · cs.AI · cs.CL · cs.CV · 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/1904.12848v6) · [PDF ↗](https://arxiv.org/pdf/1904.12848v6)

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

Qizhe Xie, Zihang Dai, Eduard Hovy, Minh-Thang Luong, Quoc V. Le (2019). Unsupervised Data Augmentation for Consistency Training. arXiv:1904.12848v6. https://arxiv.org/abs/1904.12848v6

**BibTeX**

```
@misc{xie2019unsupervised,
  title = {{Unsupervised Data Augmentation for Consistency Training}},
  author = {Qizhe Xie and Zihang Dai and Eduard Hovy and Minh-Thang Luong and Quoc V. Le},
  year = {2019},
  eprint = {1904.12848},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1904.12848v6}
}
```

## Other paper commentary

- [Universal Sentence Encoder](https://refivu.com/en/papers/832f78a9-5914-4e69-88eb-9c85196eb17b-universal-sentence-encoder.md)
- [Deep Learning Based Text Classification: A Comprehensive Review](https://refivu.com/en/papers/f32bf8ee-1bca-48a8-92cd-28ac97a169bd-deep-learning-based-text-classification-a-comprehensive.md)
- [Deep Learning for Sentiment Analysis : A Survey](https://refivu.com/en/papers/423bc94d-8ef5-42e2-a68f-87cb54c7636d-deep-learning-for-sentiment-analysis-a-survey.md)
- [CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation](https://refivu.com/en/papers/eb07d47d-3eb5-4fba-ba4e-7d3bd33335aa-codet5-identifier-aware-unified-pre-trained-encoder-decoder.md)
- [Supervised Learning of Universal Sentence Representations from Natural Language Inference Data](https://refivu.com/en/papers/3b717e36-7795-4260-9240-213b394ce804-supervised-learning-of-universal-sentence-representations.md)
- [Natural Language Processing: State of The Art, Current Trends and Challenges](https://refivu.com/en/papers/96f7443d-3832-4114-ab52-f019f5aec932-natural-language-processing-state-of-the-art-current.md)
- [Attention Gated Networks: Learning to Leverage Salient Regions in Medical Images](https://refivu.com/en/papers/63b212b7-3fc0-42f4-b6d8-1724e918c784-attention-gated-networks-learning-to-leverage-salient.md)
- [Federated Learning for Mobile Keyboard Prediction](https://refivu.com/en/papers/e56197ce-a521-4965-9369-f978e10dc5fe-federated-learning-for-mobile-keyboard-prediction.md)
- [Ethical and social risks of harm from Language Models](https://refivu.com/en/papers/d42d41ba-833b-45f6-8837-7bfc3f4d36d8-ethical-and-social-risks-of-harm-from-language.md)
- [ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders](https://refivu.com/en/papers/d6599a02-0aa8-4eec-a1c3-2bdc45716f23-convnext-v2-co-designing-and-scaling-convnets-with.md)
- [Deeper Depth Prediction with Fully Convolutional Residual Networks](https://refivu.com/en/papers/4ef3d92a-82ea-4f76-8b77-ec72d726dd77-deeper-depth-prediction-with-fully-convolutional-residual.md)
- [Deep Learning for Sensor-based Activity Recognition: A Survey](https://refivu.com/en/papers/2047ba14-2bcc-42f2-a0fe-57280553acee-deep-learning-for-sensor-based-activity-recognition-a.md)

## Terms in this paper

- [ImageNet](https://refivu.com/en/terms/5eadad128667-imagenet)
- [Top-1 accuracy](https://refivu.com/en/terms/653c0b9eaa58-top-1-accuracy)
- [BERT](https://refivu.com/en/terms/45b639a1d317-bert)
- [SVHN](https://refivu.com/en/terms/c24d35c2e4d0-svhn)
- [semi-supervised learning](https://refivu.com/en/terms/437382161673-semi-supervised-learning)
- [IMDb](https://refivu.com/en/terms/72b8a8b81376-imdb)
- [RandAugment](https://refivu.com/en/terms/af9276f4a77b-randaugment)
- [sharpening](https://refivu.com/en/terms/408e83eb058e-sharpening)
- [Back-translation](https://refivu.com/en/terms/c84c48f96399-back-translation)
- [consistency training](https://refivu.com/en/terms/5fe6eaed3c59-consistency-training)
- [MixMatch](https://refivu.com/en/terms/4b38a21e225b-mixmatch)
- [Virtual Adversarial Training](https://refivu.com/en/terms/14345b878066-virtual-adversarial-training)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/7940975d-f8e6-4178-9d29-c4dc7f994398-unsupervised-data-augmentation-for-consistency-training)
