Skip to content

Robustness, label quality, and active data acquisition · Robustness, label quality, and active data acquisition · ROB006 · Training method

Co-teaching

Train two networks that exchange selected low-loss examples, aiming to reduce memorization of corrupted training labels.

Explained here Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

Documented in the Academy only. There's no Set up button.

Availability
Explained here
Code example
Component demo, not a trained model
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
The reference's example ran here in one language.
The reference's record
Python: Ran in the reference's review, on this exact code. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Train two networks that exchange selected low-loss examples, aiming to reduce memorization of corrupted training labels.

Question / hypotheses

Does exchanging likely-clean examples improve generalization under the assumed label-noise process? Low loss is a selection heuristic, not an observed clean-label certificate.

Architecture / computational structure

Two separately initialized networks score the same mini-batch. Each chooses a retained fraction of low-loss cases; the peer network updates on those cases. The retained fraction changes with training stage.

Assumptions

Useful clean patterns must be learned before severe noise memorization. The selection schedule must preserve informative minority and difficult examples. Correlated networks, structured noise, and severe class imbalance can defeat the intended complementarity.

Formula / computational definition

SA=arg⁡min⁡S: ∣S∣=⌊r(t)m⌋∑i∈SℓA(i),θB←θB−η∇θB1∣SA∣∑i∈SAℓB(i),A↔B.S_A=\arg\min_{S:\,|S|=\lfloor r(t)m\rfloor}\sum_{i\in S}\ell_A(i),\quad \theta_B\leftarrow\theta_B-\eta\nabla_{\theta_B}\frac{1}{|S_A|}\sum_{i\in S_A}\ell_B(i),\quad A\leftrightarrow B.

Parameters and notation

Learned: both networks. Hyperparameters: retained fraction r(t), its schedule/noise-rate estimate, optimizer and learning rate, architectures, initialization, batch size, and stopping. Selection indices are transient state. Two models impose additional memory and compute.

Fitting, fine-tuning, and adaptation

Use independent initialization and a warm-up/retention schedule justified on development data. Fine-tuning on a new noisy domain requires reassessing noise and minority retention. Store selected-example histories for audits; avoid automatically treating rejected examples as labeling errors.

How to use and calibrate

Compare against ordinary training and a clean-label subset if available. Plot validation accuracy, selection rate by class, and peer disagreement. Inspect excluded difficult cases with human review; preserve an untouched test annotation process.

Example application

Train an image classifier from weak annotations while tracking whether rare classes are disproportionately discarded.

Interpretation / pitfalls

Watch out

The two networks can reinforce the same bias. An incorrect noise-rate estimate discards useful data or retains too much corruption. A favorable synthetic symmetric-noise result does not establish robustness to real annotator disagreement.

Python and R code examples

Scope: Complete batch selection/exchange calculation on supplied losses; no backpropagation. Python: NumPy; R: base R.

Validation: Python executed successfully on the supplied fixture; R reviewed but not executed.

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — Complete batch selection/exchange calculation on supplied losses; no backpropagation. Python: NumPy; R: base R. · needs numpy

import numpy as np
la=np.array([.1,1.5,.3,.9]); lb=np.array([.8,.2,1.3,.4]); keep=2
sa=np.argsort(la)[:keep]; sb=np.argsort(lb)[:keep]
print("A uses B selection",sb,"loss",la[sb].mean())
print("B uses A selection",sa,"loss",lb[sa].mean())
assert set(sa)=={0,2} and set(sb)=={1,3}
R

Component demo, not a trained model — Complete batch selection/exchange calculation on supplied losses; no backpropagation. Python: NumPy; R: base R.

la <- c(.1,1.5,.3,.9); lb <- c(.8,.2,1.3,.4); keep <- 2
sa <- order(la)[seq_len(keep)]; sb <- order(lb)[seq_len(keep)]
print(list(A_uses_B=sb,A_loss=mean(la[sb]),B_uses_A=sa,B_loss=mean(lb[sa])))
stopifnot(setequal(sa,c(1,3)),setequal(sb,c(2,4)))

Sources

From the CodeSplash reference, entry ROB006.