Skip to content

Training, adaptation, compression, and systems techniques · Training, fine-tuning, adaptation, compression, and systems techniques · TRN037 · Training method

Mean Teacher consistency learning

Uses an exponential moving average of student weights to produce stable targets for consistency training.

Partly runs in CodeSplash Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

A CodeSplash method covers part of this entry; some options or variants aren't built yet.

Do it in CodeSplash Run it on your own data, in Python or R.

Availability
Partly runs in CodeSplash
Code example
Component demo, not a trained model
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
Verified in Python and R through decide.offline_rl, decide.rl_dqn, decide.rl_ppo, discover.autoencoder, discover.contrastive, discover.dagmm, discover.deep_svdd, discover.graph_embed, discover.ts_embed, discover.vae, forecast.deepar, forecast.nbeats, forecast.nhits, forecast.patchtst, forecast.rnn, forecast.tcn, forecast.tft, forecast.timegrad, learn.cnn, learn.dann, learn.deep_ensemble, learn.ft_transformer, learn.gnn, learn.neural_cde, learn.set_model, learn.tabm, learn.tabnet, learn.torch_mlp, missing.csdi, simulate.calibrate, synth.flow, synth.flow_matching, synth.tvae. The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Uses an exponential moving average of student weights to produce stable targets for consistency training.

Question / hypotheses

Does this intervention improve the intended quality, adaptation, resource, or reliability objective under a controlled comparison? It defines a method, not an intrinsic null-hypothesis test.

Architecture / computational structure

Student and teacher share a compatible architecture; the teacher is updated by averaging rather than ordinary gradient descent.

Assumptions

Augmentations should preserve the target semantics. Labeled and unlabeled distributions must be sufficiently related; a teacher can reinforce mistakes.

Formula / computational definition

θteacher←αθteacher+(1−α)θstudent,L=Lsup+λLconsistency.\theta_{teacher}\leftarrow\alpha\theta_{teacher}+(1-\alpha)\theta_{student},\quad L=L_{sup}+\lambda L_{consistency}.

Parameters and notation

Learned: student weights. Averaged state: teacher weights. Hyperparameters: EMA alpha, consistency weight/ramp, augmentations, labeled/unlabeled ratio, confidence handling.

Fitting, fine-tuning, and adaptation

Start from a suitable initialization, train the student with supervised and consistency objectives, and update the teacher after optimizer steps. Evaluate the exact model—teacher or student—that will be deployed.

How to use and calibrate

Compare to a supervised-only baseline at the same labeled-data budget. Example: exploit unlabeled audio clips or images during classifier adaptation.

Example application

exploit unlabeled audio clips or images during classifier adaptation.

Interpretation / pitfalls

Watch out

EMA is not independent supervision. Distribution mismatch and bad augmentations can propagate erroneous pseudo-targets; the method is semi-supervised, not fully unsupervised.

Python and R code examples

Scope: numerical mechanism demonstration. Validation: Python executed successfully on the supplied synthetic inputs; R reviewed but not executed (Rscript unavailable).

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 — numerical mechanism demonstration. · needs numpy

import numpy as np
teacher=np.array([1.,2.]); student=np.array([1.2,1.8]); alpha=.99
print(alpha*teacher+(1-alpha)*student)
R

Component demo, not a trained model — numerical mechanism demonstration.

teacher <- c(1,2); student <- c(1.2,1.8); alpha <- .99
print(alpha*teacher+(1-alpha)*student)

Sources

From the CodeSplash reference, entry TRN037.