TL;DR
Pseudo-labeling is a semi-supervised method in which the model labels the unlabelled inputs itself. For each unlabelled input it takes the class the model currently finds most likely, keeps that label only when the model is confident enough, and trains on the kept labels alongside the real ones. No one has to label anything new, and the confidence threshold keeps most of the model's own mistakes out of training.
Builds on: Semi-Supervised Learning, Softmax · Leads to: Consistency Regularization, and FixMatch, which combines pseudo-labels with consistency.
Where it's used
Image classification with few labels. The 2020 FixMatch method by Sohn and colleagues is trained on image benchmarks with very few labels. On CIFAR-10, a ten-class image set, the setting with 250 labelled images leaves the rest of the training set unlabelled, and pseudo-labels from confident predictions are one of its two training signals for the unlabelled images. The paper is a common baseline in later work on semi-supervised images.
Large unlabelled image pools. Google researchers' Noisy Student training in 2019 labels a large pool of unlabelled images with a teacher model, then trains a larger student on those labels while adding noise. The labels come from the model, not from people, and the student ends up better than the teacher that made them.
Customer support text. A support team labels a few thousand tickets by hand, while the platform receives tens of thousands each week. A classifier trained on the hand-labelled tickets labels the new ones it is sure about, and the kept tickets join the next round of training. This is an ordinary, practical use rather than a single famous system.
How it works
Take one tiny instance. A classifier has learned from four labelled photos and has two classes, cat and dog. It now sees three unlabelled photos. For each photo it outputs a probability for cat and dog. The confidence threshold is .
| Photo | Predicted (cat, dog) | Most likely class | Confidence |
|---|---|---|---|
| u1 | (0.97, 0.03) | cat | 0.97 |
| u2 | (0.60, 0.40) | cat | 0.60 |
| u3 | (0.08, 0.92) | dog | 0.92 |
- Predict on the unlabelled inputs. Each photo gets one probability per class, and the two numbers add to 1. Check: , and the same holds for the other two rows.
- Pick the most likely class. Photo u1 gets cat, photo u2 gets cat, and photo u3 gets dog. Check: each label is the class with the larger number.
- Keep only the confident ones. Keep a label when its confidence is at least . Photos u1 and u3 pass, and photo u2 is discarded at 0.60. Check: u2 is not thrown out because the model is wrong. It is thrown out because the model is unsure.
- Grow the training set. Add u1 as cat and u3 as dog. The labelled set grows from 4 photos to 6, and the training loss is computed on all six, with the two pseudo-labelled photos weighted by a number .
- Repeat. Retrain, predict on the unlabelled photos again, and keep the new confident ones. Photo u2 may pass the threshold in a later round, once the model is more sure of it. Check: each round adds only confident predictions, so the set of labels grows slowly.
The model taught itself only what it nearly knew already. The unlabelled photos did not add new facts. They added examples where the model was already confident, which pushes its decision boundary toward those examples.
flowchart LR A["Train on labelled data"] --> B["Predict on unlabelled inputs"] B --> C["Keep confident predictions as labels"] C --> D["Retrain on labelled and pseudo-labelled data"] D --> B
The math
Setting
Let be the labelled pairs and the unlabelled inputs, with much larger. A Softmax classifier with weights outputs , the probability it gives to each class for input . The usual supervised loss is the average cross-entropy over the labelled pairs:
Step 2 in symbols: the pseudo-label and the confidence
Two quantities come from the prediction for each unlabelled input . The pseudo-label is the most likely class, and the confidence is that class's probability:
The returns the class and the returns its probability. In the photo example, and .
Step 3 in symbols: the threshold
The kept set is the unlabelled inputs whose confidence reaches the threshold:
Raising keeps fewer inputs, and each kept label is more likely to be right. Lowering keeps more inputs and more noise.
Step 4 in symbols: the loss
The pseudo-labelled term is the same cross-entropy, applied to the kept inputs with their frozen labels, and it is added to the supervised loss with a weight :
The pseudo-label is computed once and then held fixed. Gradient descent changes to make the prediction match the stored label, but it does not change the label itself. The averaging over is one choice among several; dividing by the full unlabelled count is another, and it changes the weight by a factor that depends on how many inputs are kept.
What the loss does with one kept input
If the model gives for its chosen class, the pseudo-labelled loss for that input is . The loss is small because the model already agrees with itself. A less confident kept prediction costs more, which is the same behaviour as ordinary cross-entropy on a real label.
Worked examples
- Take an unlabelled input with predicted probabilities for three classes, and a threshold .
- The confidence is .
- Since , the input is discarded. Nothing is added to the loss.
- Now a second input has probabilities . Its confidence is , so it is kept.
- Its pseudo-label is the first class, because is the largest entry.
- Its pseudo-labelled loss is .
- Interpretation: the same threshold accepts one input and rejects the other. The accepted one contributes a small loss, because the model is already close to its own label.
Eight unlabelled inputs have confidences 0.95, 0.99, 0.70, 0.91, 0.88, 0.97, 0.60 and 0.93. Use a threshold and a weight . Assume the supervised loss on the labelled batch is . These numbers are made up for illustration.
- Keep the inputs with confidence at least 0.9: 0.95, 0.99, 0.91, 0.97 and 0.93. That is five inputs. The ones at 0.70, 0.88 and 0.60 are discarded.
- Compute the loss for each kept input, : , , , and .
- Sum them: .
- Average over the five kept inputs: . This is .
- Add the supervised loss: .
Interpretation: the pseudo-labelled term is small here, because the kept predictions are confident. The 0.88 input was discarded even though it is close to the threshold, and that choice is what the threshold is for.
A support team has a classifier for ticket topics and 20,000 unlabelled tickets. These numbers are illustrative, not from a real run.
- At threshold 0.9, assume 12,000 tickets are kept, and the team's check on a sample finds that 95 percent of the kept labels are right.
- Correct kept labels: .
- Wrong kept labels: .
- The remaining 8,000 tickets are discarded for now. They are the harder cases, so the model is less accurate on them.
- Now the team raises the threshold to 0.97. Assume only 4,000 tickets are kept, and 99 percent of those are right.
- Wrong kept labels at 0.97: .
- Interpretation: the higher threshold cuts the wrong labels from 600 to 40, at the cost of a smaller training set. The right choice depends on how much the extra data helps against how much the noise hurts.
Try it: at threshold 0.97, how many of the 4,000 kept tickets does the team expect to be wrong, and how does that compare with the 600 at 0.9? Answer: wrong tickets, against 600 at threshold 0.9, so the stricter threshold cuts the wrong labels by a factor of 15.
Common mistakes and tradeoffs
It is tempting to think a confident prediction is a correct one. In fact a neural network can be confidently wrong, especially on inputs unlike its training data, and its probabilities are often poorly calibrated. The threshold only helps when the confidence means what it says, so check the calibration on labelled data before trusting a number like 0.9.
It is tempting to think a pseudo-label is as good as a real label. In fact it is a guess that the model made, and training on it teaches the model its own errors. That loop is confirmation bias: an early mistake becomes a label, and the label makes the mistake more confident.
It is tempting to think that one threshold fits every class. In fact a model is usually more confident on common classes than on rare ones, so a single threshold can keep plenty of frequent examples and almost none of the rare ones. That makes the imbalance worse, and the fix is a per-class threshold or a check that every class still gets pseudo-labels.
It is tempting to let the gradient flow through the pseudo-label. In fact the label must be fixed when it is created. If it were not, the loss could be lowered by changing the label to match the output, and nothing would be learned.
| Situation | Pseudo-labeling | Better choice |
|---|---|---|
| The first model is reasonably accurate and the unlabelled data matches the labelled data | Works well | Keep the threshold and check calibration |
| The first model is weak, with only a handful of labels | Few confident predictions, and the ones kept are often wrong | Pretrain with Self-Supervised Learning first |
| The unlabelled data comes from a different source | The model learns the new source's quirks, a form of distribution shift | Filter the unlabelled data, or use consistency methods |
| You want a soft signal and not a hard label | Hard labels throw away the model's uncertainty | Use the teacher's soft outputs, as in Knowledge Distillation |
| You can afford to augment inputs heavily | Hard labels still need a threshold | Consistency Regularization, which never creates a hard label |
Use pseudo-labeling when labels are scarce, the model is decent, and the unlabelled data looks like the labelled data. Skip it when the first model is near chance, or when the labelled and unlabelled sets come from different places.
History
The idea is older than the name. In the mid-1960s, H. J. Scudder studied pattern recognisers that trained on their own outputs, an early form of self-training. In 2013, Dong-Hyun Lee proposed pseudo-labeling for deep neural networks, where the model's own confident predictions on unlabelled images become training targets. Noisy Student training in 2019 showed that the same idea scales to very large unlabelled pools, when the student is larger than the teacher and trained with noise. FixMatch in 2020 combined pseudo-labels with consistency under augmentation, and it became a common baseline for semi-supervised image classification. Oliver and colleagues, in 2018, showed that many reported gains shrink when methods are compared under a fair evaluation, so a headline improvement should be checked against a careful baseline.
Recap
- The model labels its own confident predictions on unlabelled inputs: the label is the Softmax argmax, and the confidence is its largest probability.
- A threshold keeps only the confident predictions, and the kept pairs join the labelled set through an ordinary cross-entropy loss with weight . The labels are frozen when created.
- It helps when the first model is decent and the unlabelled data matches the labelled data. It hurts through confirmation bias, poor calibration and class imbalance.
- Read next: Consistency Regularization for a penalty that never creates a hard label, and FixMatch for the method that combines both.