Paper commentary
FixMatch: Simplifying Semi-Supervised Learning with Consistency and Confidence
FixMatch combines pseudo-labeling and consistency so semi-supervised learning needs fewer labels
- Problem Recent semi-supervised methods add many loss terms and hyperparameters, which makes them hard to adopt and tune. The paper asks how far a much simpler recipe can go using unlabeled images.
- Method FixMatch joins pseudo-labeling with consistency regularization. It keeps a hard label from a weakly augmented image only when the model is confident, then trains the model to predict that label on a strongly augmented view.
- Results FixMatch reached 94.93% accuracy on CIFAR-10 with 250 labels and 88.61% with 4 labels per class, state of the art on several standard benchmarks.
Why semi-supervised learning needs a simpler recipe
Deep networks usually reach their best accuracy with supervised training on labeled data, and producing labels can be expensive when an expert must do it. Semi-supervised learning addresses this by using unlabeled images, which are cheap to collect, to reduce how many labeled examples are needed. Many recent SSL methods add several loss terms and many hyperparameters, which makes them difficult to adopt and tune.
FixMatch takes two established ingredients, pseudo-labeling and consistency regularization, and joins them with a single rule for when a pseudo-label is kept. Because the design has few extra hyperparameters, the authors can run a thorough ablation over the ones that remain.
How the training target is built
Consistency regularization assumes that a model should give similar predictions for two perturbed versions of the same image. Earlier methods implement this by penalizing the squared difference between two stochastic predictions on unlabeled inputs, where both the augmentation and the model are random.
Pseudo-labeling takes the arg max of the model prediction as a hard label and keeps it only when its largest class probability is above a threshold \\(\\tau\\). This makes pseudo-labeling closely related to entropy minimization, since the model is pushed toward confident predictions on unlabeled data.
The labeled loss \\(\\ell_s\\) is an ordinary cross-entropy on weakly augmented labeled examples. For the unlabeled batch, FixMatch first computes \\(q_b = p_m(y\\mid\\alpha(u_b))\\) on the weak view and takes \\(\\hat q_b = \\arg\\max(q_b)\\) as the label. The unlabeled loss is \\[\\ell_u = \\frac{1}{\\mu B}\\sum_{b=1}^{\\mu B}\\mathbb{1}(\\max(q_b)\\ge\\tau)\\,H(\\hat q_b,\\,p_m(y\\mid A(u_b)))\\] Here \\(A(\\cdot)\\) is the strong augmentation, \\(H\\) is the cross-entropy, and the indicator keeps only pseudo-labels above \\(\\tau\\).
The total objective is \\(\\ell_s + \\lambda_u \\ell_u\\), with \\(\\lambda_u\\) fixed.
The formula resembles the pseudo-labeling loss, but the label comes from the weak view while the loss is applied to the strong view. This second step is what introduces consistency regularization. The authors found that raising the weight of the unlabeled loss during training, which other modern methods do, was unnecessary here. Early in training the maximum probability is usually below \\(\\tau\\), so few examples contribute, and as predictions sharpen more of them pass the threshold.
The authors suggest this acts as a curriculum without an explicit schedule.
Weak and strong views
The weak view is a standard flip-and-shift augmentation. Images are flipped horizontally with probability 50% on all datasets except SVHN, and translated by up to 12.5% vertically and horizontally.
The strong view applies one of two AutoAugment-based policies followed by Cutout. AutoAugment learns its policy with reinforcement learning on labeled data, which is a problem when labels are scarce, so RandAugment and CTAugment are used instead. RandAugment draws one global magnitude from a predefined range for each training step, while CTAugment learns the magnitudes of individual transformations online by weighting magnitude bins according to how well the model fits labeled examples.
Optimizer, schedule and regularization choices
Weight decay is used in every model, and training uses SGD with momentum instead of Adam. The learning rate follows a cosine decay, \\(\\eta\\cos(7\\pi k / 16K)\\), where \\(\\eta\\) is the initial rate, \\(k\\) the current step and \\(K\\) the total number of steps. Final reported performance uses an exponential moving average of the model parameters.
The default hyperparameters are \\(\\lambda_u = 1\\), \\(\\eta = 0.03\\), \\(\\beta = 0.9\\), \\(\\tau = 0.95\\), \\(\\mu = 7\\), \\(B = 64\\) and \\(K = 220\\), shared across CIFAR-10, CIFAR-100, SVHN and STL-10 and not used for ImageNet. Weight decay is 0.0005 for CIFAR-10, SVHN and STL-10, and 0.001 for CIFAR-100, where the wider WRN-28-8 was used.
Where FixMatch sits among earlier methods
Strong data augmentation has recently been shown to improve consistency-based SSL, and UDA and ReMixMatch both use a weak view to create a target and a strong view to match it. Neither of them uses pseudo-labeling; they sharpen the artificial label instead. UDA also enforces consistency only above a probability threshold, and thresholded pseudo-labeling in FixMatch has a similar effect to sharpening.
Against this background, FixMatch can be read as a reduced form of UDA and ReMixMatch that drops sharpening, annealing and the distribution alignment and rotation losses.
A table in the paper places algorithms by the augmentation used for the artificial label, the augmentation used for the prediction, and the post-processing applied. Virtual Adversarial Training is the only listed method with no weak view for the label, which is why it sits apart in that comparison.
Benchmark results on CIFAR, SVHN and STL-10
All baselines and FixMatch were run in one codebase, with the same network and training protocol, following the suggestion in the evaluation literature. Wide ResNet-28-2 is used for CIFAR-10 and SVHN, WRN-28-8 for CIFAR-100, and WRN-37-2 for STL-10, and results are averaged over 5 folds of labeled data.
On CIFAR-10 with 250 labeled examples, FixMatch reached 94.93% accuracy, compared with the previous state of the art of 93.73% in the standard setting of the earlier evaluation study. With 4 labels per class, FixMatch (CTA) has an average error rate of 11.39% on CIFAR-10, and the lowest error among the methods in that earlier study with 400 labels per class was 13.13%.
The 88.61% accuracy at 4 labels per class is the headline number for the extremely scarce regime.
On CIFAR-100, ReMixMatch performs better than FixMatch in the reported comparison. Adding Distribution Alignment to FixMatch (CTA) lowers the CIFAR-100 error with 400 labels from 49.95% to 40.14%, which is below the 44.28% reported for ReMixMatch.
On STL-10, FixMatch reaches the same level of performance as ReMixMatch in the paper's table.
ImageNet with 10% labels
Training uses an unlabeled loss weight of 10 and a threshold of 0.7, together with a weight decay of 0.0003 and an exponential moving average with decay 0.999.
S4L reports a 26.79% error rate, but it adds pseudo-label re-training and supervised fine-tuning phases, and its first phase alone gives 30.27%. The authors note that FixMatch outperforms S4L after its first phase, and that the extra phases could be combined with FixMatch.
Barely supervised learning with one label per class
Four datasets were built by randomly choosing one labeled CIFAR-10 example per class, and each was trained four times. Test accuracy ranged from 48.58% to 85.32%, with a median of 64.28%. Within one dataset the spread was small, while the choice of labeled examples seemed to matter more.
To test this, eight labeled sets were built from eight buckets of an ordering of the CIFAR-10 training set by representativeness. The ordering was produced with models trained on all labels, so it is an experimental check and not a practical way to choose examples. Sets from the most prototypical bucket reached a median of 78% accuracy with a maximum of 84%, sets from the middle reached 65%, and sets from the outliers did not converge and reached 10%.
What the ablations change
The ablations use a single 250-label CIFAR-10 split with CTAugment, where default FixMatch reaches a 4.84% error rate.
Across thresholds from 0.25 to 0.99, the mask rate falls from 100.00 to 92.14 and the impurity falls from 6.39 to 2.06, while the error rate is lowest at 0.95 with 4.84. A threshold of 0.95 gives the lowest error among the tested values, and the paper reports that accuracy drops by more than 1.5% when the threshold is small. The authors read this as quality mattering more than quantity: high thresholds leave fewer but more accurate pseudo-labels, which reduces confirmation bias.
Replacing pseudo-labeling with sharpening and thresholding did not give a notable difference when a confidence threshold is used. Replacing weak with strong augmentation for the label produced divergence early in training, and using weak augmentation for the training prediction peaked at 45% before collapsing to 12%.
With CIFAR-10, CIFAR-100 and SVHN, RandAugment and CTAugment give highly comparable results, while CTAugment gives a clear gain on STL-10. Adam does worse than momentum SGD, and raising its learning rate to 0.002 increases error by more than 8%.
A weight decay value one order of magnitude away from the best can cost ten percentage points or more in low-label regimes. More unlabeled data per batch, meaning a larger \\(\\mu\\), gives a clear drop in error, consistent with UDA.
Extensions: anchoring, alignment and other augmentations
Augmentation Anchoring uses \\(M\\) strong augmentations per unlabeled example, averaging their losses. With \\(M = 4\\) and \\(\\mu = 4\\), FixMatch (CTA) reduces the CIFAR-10 error with 250 labels from 5.07% to 4.81%.
Distribution Alignment rescales the weak-view prediction by the labeled class distribution and the running average of unlabeled predictions before the arg max.
MixUp and Virtual Adversarial Training were tested as replacements for the strong augmentation on CIFAR-10 with 250 labels. The authors report that the MixUp variant is comparable to MixMatch, and the VAT variant has significantly lower error than VAT alone.
Limits of the evidence
The ablation study is run on one 250-label CIFAR-10 split, so its components were not checked on many splits. At 4 labels per class, the variance across folds is 3.35% on CIFAR-10, and the error on a single 40-label split varied from 5.46 to 13.32 across random seeds.
ReMixMatch remains better on CIFAR-100, and the paper attributes part of that to Distribution Alignment. The ImageNet comparison with S4L is not like for like, because S4L uses extra training phases.
Barely supervised results depend strongly on which labeled examples are chosen, and outlier sets did not converge. The authors note that semi-supervised methods can be misused for surveillance, such as person identification from few images.
Paper info
- Authors
- Kihyuk Sohn, David Berthelot, Chun-Liang Li, Zizhao Zhang, Nicholas Carlini, Ekin D. Cubuk, Alex Kurakin, Han Zhang, Colin Raffel
- Venue
- arXiv · Preprint
- First published
- 2020-1-21
- Added
- 2026-11-12
- Updated
- 2020-11-25
- Version
- v2
- arXiv
- 2001.07685
- Category
- cs.LG · cs.CV · 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
Kihyuk Sohn, David Berthelot, Chun-Liang Li, Zizhao Zhang, Nicholas Carlini, Ekin D. Cubuk, Alex Kurakin, Han Zhang, Colin Raffel (2020). FixMatch: Simplifying Semi-Supervised Learning with Consistency and Confidence. arXiv:2001.07685v2. https://arxiv.org/abs/2001.07685v2
BibTeX
@misc{sohn2020fixmatch,
title = {{FixMatch: Simplifying Semi-Supervised Learning with Consistency and Confidence}},
author = {Kihyuk Sohn and David Berthelot and Chun-Liang Li and Zizhao Zhang and Nicholas Carlini and Ekin D. Cubuk and Alex Kurakin and Han Zhang and Colin Raffel},
year = {2020},
eprint = {2001.07685},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2001.07685v2}
}