Simple Algorithm
Machine Learning · Convergence · 26 min

Label Noise & Weak Supervision

Learning from labels that are wrong, partial or programmatic.

Labels are written by tired annotators, inferred from logs, scraped from the web or produced by heuristics, and some fraction of them is always wrong: even the test sets of widely used benchmarks contain a few percent of label errors. This lesson builds the theory of learning from corrupted labels: which noise is harmless and which is not, how to correct a loss so that it is unbiased under noise, how to find the wrong labels, and how to learn from many weak labelers instead of one reliable one.

What you’ll learn

  • Distinguish random, class-conditional and instance-dependent label noise, and derive how each changes the Bayes classifier and the measured error.
  • Derive the unbiased loss of Natarajan et al. for class-conditional noise, and the backward and forward corrections with a noise transition matrix.
  • Explain how confident learning flags label errors, and what label errors in test sets do to benchmark comparisons.
  • Aggregate crowd labels with the Dawid–Skene model and EM, and describe programmatic weak supervision.

A taxonomy of label noise

Write y∈{−1,+1}y\in\{-1,+1\} for the clean label and y~\tilde y for the label you actually observe. Models of label noise differ in what the probability of a flip is allowed to depend on.

Noise modelFlip probabilityTypical source
Random classification noise (Angluin & Laird, 1988)a constant ρ<1/2\rho<1/2careless clicks, transcription slips
Class-conditional noiseρ+1=P(y~=−1∣y=+1)\rho_{+1}=P(\tilde y=-1\mid y=+1) and ρ−1=P(y~=+1∣y=−1)\rho_{-1}=P(\tilde y=+1\mid y=-1), with ρ+1+ρ−1<1\rho_{+1}+\rho_{-1}<1; with KK classes a transition matrix Tij=P(y~=j∣y=i)T_{ij}=P(\tilde y=j\mid y=i)a condition that is under-diagnosed more often than over-diagnosed
Instance-dependent noiseρ(x,y)\rho(\mathbf x,y), varying with the inputblurry or ambiguous images mislabeled more often
Adversarial noisechosen by an adversarydeliberate data poisoning
DerivationWhat noise does to the regression function
  1. η~(x)=(1−ρ+1) η(x)+ρ−1(1−η(x))=(1−ρ+1−ρ−1) η(x)+ρ−1\tilde\eta(\mathbf x)=(1-\rho_{+1})\,\eta(\mathbf x)+\rho_{-1}\big(1-\eta(\mathbf x)\big)=(1-\rho_{+1}-\rho_{-1})\,\eta(\mathbf x)+\rho_{-1}

    Let η(x)=P(y=+1∣x)\eta(\mathbf x)=P(y=+1\mid\mathbf x) and η~(x)=P(y~=+1∣x)\tilde\eta(\mathbf x)=P(\tilde y=+1\mid\mathbf x). Under class-conditional noise, a noisy positive is a clean positive that kept its label or a clean negative that flipped:

  2. η(x)>12  ⟺  η~(x)>1−ρ+1+ρ−12\eta(\mathbf x)>\tfrac12\iff\tilde\eta(\mathbf x)>\frac{1-\rho_{+1}+\rho_{-1}}2

    Because 1−ρ+1−ρ−1>01-\rho_{+1}-\rho_{-1}>0, this is increasing in η\eta, so the clean Bayes decision is a threshold on the noisy probability, at the image of 1/21/2:

  3. R~(g)=P(g(x)≠y~)=(1−ρ) R(g)+ρ (1−R(g))=ρ+(1−2ρ) R(g)\tilde R(g)=P\big(g(\mathbf x)\ne\tilde y\big)=(1-\rho)\,R(g)+\rho\,\big(1-R(g)\big)=\rho+(1-2\rho)\,R(g)

    With symmetric noise, ρ+1=ρ−1=ρ\rho_{+1}=\rho_{-1}=\rho, the threshold stays at 1/21/2. A classifier gg disagrees with the noisy label when it is wrong and the label survives, or right and the label flips:

  4. The noisy 0–1 risk is an increasing affine function of the clean one, so minimizing it minimizes the clean risk: symmetric noise costs samples, not consistency. Class-conditional noise moves the threshold and must be corrected for. Instance-dependent noise is worse: without further assumptions η\eta cannot be recovered from η~\tilde\eta at all, because many pairs of η\eta and ρ(x,y)\rho(\mathbf x,y) produce the same noisy distribution.

Predict before you look

A classifier's true accuracy is 90%. It is scored on a test set whose labels were flipped at random with probability 10%, independently of everything else. What accuracy will you measure, in percent?

Show the answer

82 %

R~=ρ+(1−2ρ)R=0.1+0.8×0.1=0.18\tilde R=\rho+(1-2\rho)R=0.1+0.8\times0.1=0.18, so the measured accuracy is 82%. Even a perfect classifier would score only 90%. Noise in a test set lowers every score and shrinks the gaps between models by the factor 1−2ρ1-2\rho: a 5-point difference in clean accuracy shows up as 4 points.

Correcting the loss

Angluin and Laird (1988) began the theory. Under random classification noise with a known bound ρb<1/2\rho_b<1/2 on the flip rate, minimizing disagreements with the noisy labels over a finite class of NN hypotheses is a PAC learner, with a sample size of order ln⁡(N/δ)/(ε2(1−2ρb)2)\ln(N/\delta)/\big(\varepsilon^2(1-2\rho_b)^2\big). The factor (1−2ρb)−2(1-2\rho_b)^{-2} is the price of noise: as ρb→1/2\rho_b\to1/2 the labels carry no signal.

The identity R~=ρ+(1−2ρ)R\tilde R=\rho+(1-2\rho)R explains why the 0–1 loss tolerates symmetric noise. Convex surrogates do not inherit this property. Long and Servedio (2010) proved that "random classification noise defeats all convex potential boosters," AdaBoost among them: for this whole family of algorithms, randomly flipped labels are not a harmless nuisance but can prevent learning altogether.

DerivationProof
  1. E[ℓ~(t,y~)∣y]=(1−ρy) ℓ~(t,y)+ρy ℓ~(t,−y)\E\big[\tilde\ell(t,\tilde y)\mid y\big]=(1-\rho_y)\,\tilde\ell(t,y)+\rho_y\,\tilde\ell(t,-y)

    Given yy, the observed label is yy with probability 1−ρy1-\rho_y and −y-y with probability ρy\rho_y:

  2. D E[ℓ~(t,y~)∣y]=[(1−ρy)(1−ρ−y)−ρyρ−y] ℓ(t,y)+[ρy(1−ρy)−(1−ρy)ρy] ℓ(t,−y)D\,\E\big[\tilde\ell(t,\tilde y)\mid y\big]=\big[(1-\rho_y)(1-\rho_{-y})-\rho_y\rho_{-y}\big]\,\ell(t,y)+\big[\rho_y(1-\rho_y)-(1-\rho_y)\rho_y\big]\,\ell(t,-y)

    Substitute the definition, writing D=1−ρ+1−ρ−1D=1-\rho_{+1}-\rho_{-1}. The terms in ℓ(t,−y)\ell(t,-y) cancel:

  3. E[ℓ~(t,y~)∣y]=ℓ(t,y)\E\big[\tilde\ell(t,\tilde y)\mid y\big]=\ell(t,y)

    The first bracket equals 1−ρy−ρ−y=D1-\rho_y-\rho_{-y}=D. If ℓ\ell is convex in tt with ℓ′′(t,y)=ℓ′′(t,−y)\ell''(t,y)=\ell''(t,-y), as for the squared and logistic losses, then ℓ~′′=ℓ′′\tilde\ell''=\ell'' and the corrected loss stays convex, although it can take negative values. Natarajan et al. also showed that simply reweighting the loss by class, as biased SVMs and weighted logistic regression do, is provably noise-tolerant.

With KK classes and an invertible transition matrix TT, write ℓ(p)=(ℓ(p,1),…,ℓ(p,K))⊤\boldsymbol\ell(\mathbf p)=\big(\ell(\mathbf p,1),\dots,\ell(\mathbf p,K)\big)^\top for the losses a prediction p\mathbf p would incur under each possible label. Patrini, Rozza, Menon, Nock and Qu (2017) proposed two corrections that need at most a matrix inversion and a multiplication:

  • Backward: train on T−1ℓ(p)T^{-1}\boldsymbol\ell(\mathbf p). The noisy label is jj with probability TyjT_{yj}, so the expected corrected loss is (TT−1ℓ(p))y=ℓ(p,y)(TT^{-1}\boldsymbol\ell(\mathbf p))_y=\ell(\mathbf p,y): unbiased, as in the binary case.
  • Forward: pass the model's clean-label probabilities through the noise and train on ℓ(T⊤p^(x),y~)\ell\big(T^\top\hat{\mathbf p}(\mathbf x),\tilde y\big). With cross-entropy, the best fit to the noisy labels has T⊤p^=T⊤pT^\top\hat{\mathbf p}=T^\top\mathbf p, so p^\hat{\mathbf p} recovers the clean posterior.

TT itself can be estimated from anchor points, inputs that belong to class ii with probability one: for such an input the noisy-label probabilities are exactly the row Ti⋅T_{i\cdot}.

Finding the wrong labels

Could you find wrong labels by training a model and looking at the examples it gets wrong? Not from training error. Zhang, Bengio, Hardt, Recht and Vinyals (2017) showed that standard image-classification networks easily fit a random labeling of their training data. The order of fitting helps, though: Arpit et al. (2017) found that networks tend to learn simple patterns first and memorize noisy examples later, one reason why early stopping and training on the examples with the smallest loss are common defenses.

Confident learning (Northcutt, Jiang & Chuang, 2021) works from out-of-sample predicted probabilities p^(y~=j∣x)\hat p(\tilde y=j\mid\mathbf x), each produced by a model that never trained on that example. For each class jj, set a threshold tjt_j: the average predicted probability of class jj among the examples labeled jj. An example labeled ii is counted as "confidently class jj" if its predicted probability of jj clears tjt_j (taking the most probable such class). These counts form the confident joint, an estimate of how many examples of each true class carry each observed label; its off-diagonal entries count the label errors of each kind, and the examples behind them are the suspects.

python
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import cross_val_predict

# Out-of-sample probabilities: each example is scored by a model that never saw it
P = cross_val_predict(LogisticRegression(max_iter=1000), X, y_noisy,
                      cv=5, method='predict_proba')
K = P.shape[1]
# Per-class threshold: average confidence in class j among examples labeled j
t = np.array([P[y_noisy == j, j].mean() for j in range(K)])

suspects = []
for i in range(len(y_noisy)):
    above = np.flatnonzero(P[i] >= t)        # classes it confidently belongs to
    if above.size:
        j = above[np.argmax(P[i, above])]
        if j != y_noisy[i]:                  # off-diagonal of the confident joint
            suspects.append(i)

A stripped-down version of the counting step, assuming labels 0,…,K−10,\dots,K-1 that all occur. The full method also calibrates the counts into an estimate of the joint distribution of noisy and true labels and ranks the suspects.

Check your understanding

Why must the predicted probabilities used to flag suspicious labels be out-of-sample?

  1. Out-of-sample probabilities are calibrated by definition
  2. A model that trained on an example has partly fitted its label, right or wrong, so it tends to agree with exactly the errors you are looking for
  3. In-sample probabilities cannot be computed for every example
  4. Out-of-sample predictions are cheaper to compute
Show the answer

B. A model that trained on an example has partly fitted its label, right or wrong, so it tends to agree with exactly the errors you are looking for

A flexible model can memorize a wrong label, after which its in-sample prediction confirms the error. Cross-validated predictions come from models that never saw the example, so they reflect what the rest of the data says about it.

Applied to the test sets of ten widely used vision, language and audio benchmarks, with the flagged candidates checked by human reviewers, this approach found that at least 3.3% of test labels are wrong on average, and at least 6% of the ImageNet validation set; about half of the flagged candidates (51%) were confirmed errors (Northcutt, Athalye & Mueller, 2021). Errors at this level can reorder models: on ImageNet with corrected labels, ResNet-18 outperforms ResNet-50 if the share of originally mislabeled test examples rises by just 6%. Random noise only compresses differences between models, by the factor 1−2ρ1-2\rho; errors that are systematic, and that a large model may have learned to reproduce from noisy training labels, can reverse them.

Many weak labelers

When labels are cheap but unreliable, collect several per item. Majority vote is the simplest aggregator, and it silently assumes that annotators are equally reliable and independent.

Think first Three annotators label a binary item independently, each correct with probability 0.70.7. How often is the majority right? What changes if their mistakes are correlated?

0.73+3×0.72×0.3=0.7840.7^3+3\times0.7^2\times0.3=0.784, and with five such annotators 0.8370.837. Independence is doing all the work: if the annotators share a misconception and make the same mistakes on the same items, the majority is no better than any one of them.

DerivationThe Dawid–Skene model and its EM algorithm (1979)
  1. P(labels of item i∣zi=k)=∏r∏l(θkl(r))nil(r)P\big(\text{labels of item }i\mid z_i=k\big)=\prod_r\prod_l\big(\theta^{(r)}_{kl}\big)^{n^{(r)}_{il}}

    Each item ii has a hidden true class zi∈{1,…,K}z_i\in\{1,\dots,K\} with prior πk\pi_k. Annotator rr reports label ll for an item of class kk with probability θkl(r)\theta^{(r)}_{kl}, one confusion matrix per annotator, independently across annotators given the true class. With nil(r)n^{(r)}_{il} the number of times annotator rr gave item ii the label ll:

  2. Tik=P(zi=k∣labels of item i) ∝ πk∏r∏l(θkl(r))nil(r)T_{ik}=P\big(z_i=k\mid\text{labels of item }i\big)\ \propto\ \pi_k\prod_r\prod_l\big(\theta^{(r)}_{kl}\big)^{n^{(r)}_{il}}

    E-step: compute the posterior over each item's true class.

  3. πk=1N∑iTik,θkl(r)=∑iTik nil(r)∑i∑l′Tik nil′(r)\pi_k=\frac1N\sum_iT_{ik},\qquad\theta^{(r)}_{kl}=\frac{\sum_iT_{ik}\,n^{(r)}_{il}}{\sum_i\sum_{l'}T_{ik}\,n^{(r)}_{il'}}

    M-step: re-estimate the prior and every confusion matrix from expected counts over the NN items.

  4. Iterate from a majority-vote start. No iteration decreases the likelihood (the general argument for EM is in the topic Probabilistic Machine Learning). Reliable annotators get more say, consistently wrong ones have their votes read in reverse, and the posteriors TikT_{ik} serve as soft training labels. EM finds only a local optimum, and with few labels per annotator the confusion matrices are poorly estimated.

Weak supervision takes the idea further: the annotators become programs. In Snorkel (Ratner, Bach, Ehrenberg, Fries, Wu & Ré, 2017), users write labeling functions (keyword patterns, heuristics, lookups in an existing knowledge base, the outputs of other models), each of which labels some examples and abstains on the rest. A generative label model estimates the functions' accuracies and correlations from their agreements and disagreements alone, with no ground truth, and turns their votes into probabilistic labels. A discriminative model trained on these labels with a noise-aware loss can then generalize beyond the functions' coverage. In the paper's user study, subject-matter experts built models 2.8 times faster than with seven hours of hand labeling, and their predictive performance was 45.5% higher on average.

Key takeaways

  • Noise models range from random flips (constant ρ\rho) through class-conditional noise (ρ±1\rho_{\pm1}, or a transition matrix TT) to instance-dependent and adversarial noise. Under class-conditional noise η~=(1−ρ+1−ρ−1)η+ρ−1\tilde\eta=(1-\rho_{+1}-\rho_{-1})\eta+\rho_{-1}, so the clean Bayes classifier thresholds η~\tilde\eta at (1−ρ+1+ρ−1)/2(1-\rho_{+1}+\rho_{-1})/2; symmetric noise leaves it unchanged, with R~=ρ+(1−2ρ)R\tilde R=\rho+(1-2\rho)R.
  • With known noise rates, losses can be made unbiased: ℓ~(t,y)=[(1−ρ−y)ℓ(t,y)−ρyℓ(t,−y)]/(1−ρ+1−ρ−1)\tilde\ell(t,y)=\big[(1-\rho_{-y})\ell(t,y)-\rho_y\ell(t,-y)\big]/(1-\rho_{+1}-\rho_{-1}) for binary labels, and backward (T−1ℓT^{-1}\boldsymbol\ell) or forward (T⊤p^T^\top\hat{\mathbf p}) corrections with KK classes, TT estimated from anchor points.
  • Networks can fit any labels, so training error cannot reveal label errors. Confident learning flags them from out-of-sample probabilities and per-class thresholds; common benchmark test sets carry at least 3.3% label errors on average, enough to reorder models.
  • Many weak labels can stand in for a few strong ones: the Dawid–Skene EM algorithm estimates each annotator's confusion matrix, and programmatic weak supervision learns the accuracies of labeling functions from their agreements and trains on probabilistic labels.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

Labels are flipped with probability ρ<1/2\rho<1/2, independently of the input and the label. How is a classifier's 0–1 risk R~\tilde R on noisy labels related to its clean risk RR?

  1. R~=R\tilde R=R
  2. R~=ρ+(1−2ρ)R\tilde R=\rho+(1-2\rho)R
  3. R~=(1−ρ)R\tilde R=(1-\rho)R
  4. R~=R+ρ\tilde R=R+\rho
Show the answer

B. R~=ρ+(1−2ρ)R\tilde R=\rho+(1-2\rho)R

The classifier disagrees with a noisy label when it is wrong and the label survives, (1−ρ)R(1-\rho)R, or when it is right and the label flips, ρ(1−R)\rho(1-R). The sum is ρ+(1−2ρ)R\rho+(1-2\rho)R, increasing in RR, so the ranking of classifiers is preserved.

Question 2

Under class-conditional noise with ρ+1=0.3\rho_{+1}=0.3 (positives labeled negative) and ρ−1=0.1\rho_{-1}=0.1, where should you threshold the noisy probability η~(x)\tilde\eta(\mathbf x) to recover the clean Bayes classifier?

  1. 0.50.5
  2. 0.60.6
  3. 0.30.3
  4. 0.40.4
Show the answer

D. 0.40.4

η~=0.6 η+0.1\tilde\eta=0.6\,\eta+0.1, so η>1/2\eta>1/2 exactly when η~>0.4=(1−ρ+1+ρ−1)/2\tilde\eta>0.4=(1-\rho_{+1}+\rho_{-1})/2. Positives are often mislabeled, so a noisy probability of 0.450.45 already means a clean probability of about 0.580.58.

Question 3

Test labels are flipped at random with probability 10%. Model A is 5 points more accurate than model B on clean labels. What gap will you measure on the noisy test set?

  1. 5 points
  2. 4.5 points
  3. 4 points
  4. No gap: noise hides all differences
Show the answer

C. 4 points

Measured accuracy is 1−ρ−(1−2ρ)R1-\rho-(1-2\rho)R, so differences in clean error are multiplied by 1−2ρ=0.81-2\rho=0.8: 5×0.8=45\times0.8=4 points. Random test noise compresses gaps without reversing them.

Question 4

When does the Dawid–Skene model improve most over majority vote?

  1. When annotators differ in reliability or make systematic confusions, which it estimates and weights accordingly
  2. When every annotator has the same accuracy and makes independent, symmetric errors
  3. When each item receives only one label
  4. When the annotators' errors are perfectly correlated
Show the answer

A. When annotators differ in reliability or make systematic confusions, which it estimates and weights accordingly

Dawid–Skene learns a confusion matrix per annotator, so reliable annotators get more weight and systematic confusions (always calling class 2 class 3, say) can be undone. With identical, symmetric, independent annotators it reduces to essentially majority vote.

Further reading

  • D. Angluin & P. Laird, "Learning from noisy examples," Machine Learning 2(4), 343–370 (1988).
  • N. Natarajan, I. S. Dhillon, P. Ravikumar & A. Tewari, "Learning with noisy labels," Advances in Neural Information Processing Systems 26 (2013).
  • C. G. Northcutt, L. Jiang & I. L. Chuang, "Confident learning: estimating uncertainty in dataset labels," Journal of Artificial Intelligence Research 70, 1373–1411 (2021).
  • C. G. Northcutt, A. Athalye & J. Mueller, "Pervasive label errors in test sets destabilize machine learning benchmarks," NeurIPS Datasets and Benchmarks Track (2021).
  • A. P. Dawid & A. M. Skene, "Maximum likelihood estimation of observer error-rates using the EM algorithm," Applied Statistics 28(1), 20–28 (1979).