Paper commentary
Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results
- Problem Temporal Ensembling updates each example's target only once per epoch, so new information reaches training slowly. That makes it unwieldy on large datasets and unsuited to online learning.
- Method Mean Teacher keeps a teacher model whose weights are an exponential moving average of the student's weights. The teacher is updated after every training step, and its predictions serve as consistency targets for the student.
- Results Mean Teacher reaches 4.35% error on SVHN with 250 labels, beating Temporal Ensembling trained with 1000 labels. It also lowers CIFAR-10 error with 4000 labels from 10.55% to 6.28%.
Why Temporal Ensembling targets lag
Consistency-based semi-supervised training asks a model to give the same output for inputs that are similar, and unlabeled examples can supply that signal even though they carry no class label. The quality of the target that the model is pulled towards decides how far this helps, because a model that generates its own targets can lock in its mistakes, which the authors call confirmation bias.
Temporal Ensembling tackles this by keeping, for every training example, an exponential moving average of the predictions the network has made on it, and by penalizing predictions that depart from that average. Because each example's average is refreshed only once per epoch, new information enters the targets slowly, and the gap grows with the number of training examples.
Refreshing targets more often would require evaluating every example many times per epoch, which scales as \\(O(n^2)\\) evaluations per epoch for \\(n\\) training examples, and online learning offers no obvious way to keep the averages current at all.
Averaging weights to build the teacher
Mean Teacher moves the averaging from predictions to parameters. The teacher is not trained by gradient descent; its weights are an exponential moving average of the student's weights, so it aggregates information after every step instead of after every epoch. The authors argue that averaged weights also improve the intermediate layers, not only the output, so the teacher's internal representations are better as well.
After each gradient update of the student, the teacher weights are updated with the rule \\(\\theta'_t = \\alpha\\theta'_{t-1} + (1-\\alpha)\\theta_t\\), where \\(\\alpha\\) is a smoothing coefficient. A larger \\(\\alpha\\) keeps older weights for longer, and the evaluation runs use a smaller decay early in training and a larger one later, because the student improves quickly at first and the teacher benefits from a longer memory once that improvement slows.
The consistency cost is the expected squared distance between the student's output with weights \\(\\theta\\) and noise \\(\\eta\\), and the teacher's output with weights \\(\\theta'\\) and noise \\(\\eta'\\): \\[ J(\\theta) = \\mathbb{E}_{x,\\eta',\\eta}\\left[\\left\\lVert f(x,\\theta',\\eta') - f(x,\\theta,\\eta)\\right\\rVert^2\\right] \\] In training, the expectation is approximated by sampling the noise at each step within stochastic gradient descent, and mean squared error is the cost used in most experiments.
The Π model sets the teacher weights equal to the student weights, and Temporal Ensembling replaces the teacher with a weighted average of successive predictions. Mean Teacher treats the teacher as a constant during optimization, and the classification cost is applied only to labeled examples.
Accuracy on SVHN and CIFAR-10 against prior methods
Error rates are means over 10 runs, or 4 runs when all labels are used, and every model is evaluated with its exponential moving average weights.
The abstract states that the 250-label result of 4.35% beats Temporal Ensembling trained with 1000 labels, and that Mean Teacher improves test accuracy while needing fewer labels.
Scaling with unlabeled data and training curves
The extra-data test keeps 500 labeled SVHN examples and adds the unlabeled pool from the rest of the primary training set plus an extra SVHN set of 531131 examples.
The training curves compare the student and teacher of Mean Teacher with the Π model over the first 100000 training steps, with classification error and classification cost tracked. If that loop is removed, learning is slower and the model starts to overfit earlier.
With 500 labels Mean Teacher learns faster and keeps improving after the Π model stops, while with all labels the two behave almost identically.
Which noise and hyperparameters matter
The noise ablation on 250-label SVHN shows that either input augmentation or dropout is needed for passable performance, while input noise adds nothing once augmentation is in use. Dropout on the teacher side gives only a marginal benefit over dropout on the student side when input augmentation is in use.
Setting the EMA decay to 0 turns the method into a variant of the Π model, although one in which gradients flow only through the student path.
To separate classification from consistency, the authors used two output heads, one trained for classification and one for consistency, joined by an MSE cost between the logits whose weight sets the strength of the coupling. Strong coupling performed well and loose coupling did not, while a moderate decoupling appeared to make the consistency ramp-up unnecessary.
Effect of a residual backbone on CIFAR-10 and ImageNet
The residual experiment on CIFAR-10 uses a 26-layer Residual Network in 12 blocks with Shake-Shake regularization. With 4000 labels, the error falls from 12.31 with the ConvNet to 6.28 with the Residual Network, compared with 10.55 reported for Virtual Adversarial Training in prior work. The 10.55 figure is a published result rather than a run under the same conditions, so the comparison is against prior work only.
On ImageNet 2012 with 10% of the labels, a 152-layer ResNeXt reached 9.11 error, against 35.24 reported as the prior state of the art. The test set is not public, so the results are on the validation set over 2 runs.
Where the teacher idea sits among consistency methods
Distillation transfers the knowledge of a large model to a smaller one after training, whereas consistency regularization operates during training. Label propagation needs a distance metric that is fixed in the input space, while consistency targets use a distance implied by the model's learned features, which change as training proceeds.
Limits of the evidence
The reported benchmarks are SVHN, CIFAR-10 and ImageNet 2012, and the combination of Mean Teacher with Virtual Adversarial Training was not tested. The ablations were run only on 250-label SVHN, and each one varies a small set of settings while the others stay at their evaluation values. The ImageNet result uses 10% of the labels and validation results from 2 runs, and the main comparison relies on the 13-layer ConvNet.
The reported experiments train on fixed datasets for a set number of steps, and no on-line learning run is reported.
Paper info
- Authors
- Antti Tarvainen, Harri Valpola
- Venue
- arXiv · Preprint
- First published
- 2017-3-6
- Added
- 2026-11-12
- Updated
- 2018-4-16
- Version
- v6
- arXiv
- 1703.01780
- Category
- cs.NE · cs.LG · stat.ML
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
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
Antti Tarvainen, Harri Valpola (2017). Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. arXiv:1703.01780v6. https://arxiv.org/abs/1703.01780v6
BibTeX
@misc{tarvainen2017mean,
title = {{Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results}},
author = {Antti Tarvainen and Harri Valpola},
year = {2017},
eprint = {1703.01780},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1703.01780v6}
}