Semi-supervised Diffusion Model

Machine Learning
Introduced by
Multiple groups (Ho et al., Song et al., and successors)
Year
2020–2022
Type
Generative model with semi-supervised guidance
Family
Deep learning / NLP / CV

What does it do?

A semi-supervised diffusion model is one way of applying the denoising diffusion probabilistic framework to training sets in which only some samples carry class labels.

The diffusion backbone is trained on all samples, while an auxiliary classifier trained on the labeled subset can steer sampling toward a requested class. The approach targets conditional generation in settings where labels are scarce and unlabeled data is plentiful.

The intuition behind the method

Diffusion models learn to reverse a gradual noising process, which implicitly requires modelling the whole data distribution. In the semi-supervised variant, unlabeled examples contribute to that learned distribution through the diffusion objective, while labeled examples train a classifier whose gradient is used during sampling to push the reverse process toward a chosen class. A useful analogy is a detailed map of the terrain drawn from unlabeled data, with a few signposts supplied by labels, so the model can head toward a requested destination without needing a signpost at every step.

History

Sohl-Dickstein et al. (2015) introduced diffusion probabilistic models within a nonequilibrium thermodynamics framework for deep unsupervised learning. Ho et al. (2020) presented the denoising diffusion probabilistic model (DDPM) formulation that the semi-supervised variant builds on. Semi-supervised extensions were developed on top of these foundations in the years that followed.

When to use it

Choose a semi-supervised diffusion model when you need class-conditional generation, the labeled set is small, and a much larger set of unlabeled examples from the same domain is available. Medical imaging, remote sensing and low-resource text are candidate domains for this kind of setting. It also suits projects that want one generative model that produces class-conditional samples and also yields a classifier that works on noisy inputs. Do not use it when all training data is labeled, because a fully supervised conditional model or classifier is then simpler. It is a poor fit when sampling cost matters, since generation needs many sequential denoising steps, and when the dataset is small in both its labeled and unlabeled parts, where VAEs or standard semi-supervised classifiers are more practical.

Limitations and considerations

  • Sampling is slow: each sample requires many sequential reverse steps, and each step evaluates the denoising network and the classifier gradient.
  • Training is computationally heavy, and large image or audio models require substantial GPU resources.
  • The guidance strength s is a sensitive setting: larger values favour class adherence at the cost of diversity, while smaller values weaken conditioning.
  • The classifier term is applied at every noise level. At high noise, the noisy input carries little class information, so classifier errors at those levels feed directly into the sampling path.
  • Theoretical understanding of how the unlabeled ELBO term and the classifier guidance term interact is limited, so their balance is usually determined empirically.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • The diffusion objective is applied to all training samples, so unlabeled data shapes the generative model; only the classifier term depends on labels.
  • The guidance strength s is set at sampling time, so the trade-off between class adherence and diversity can be adjusted without retraining the backbone.
  • Guidance can be added to a pre-trained unconditional diffusion model, because the backbone is unconditional and only the classifier gradient term is new.
  • The auxiliary classifier, trained on noisy inputs, can in principle be reused as a discriminative model or feature extractor, as described under applications.

Applications

  • Medical image synthesis where annotated scans are scarce but unannotated images are available.
  • Data augmentation for low-resource classification, generating class-conditional training examples.
  • Remote sensing and satellite imagery with limited ground-truth labels.
  • Text-conditioned image generation where paired text-image datasets are costly to build.
  • Semi-supervised representation learning, using the noisy-input classifier as a feature extractor for downstream tasks.

How it works

How it works

1

During training, each input is progressively corrupted by Gaussian noise over T discrete time steps according to a fixed variance schedule beta_t. This forward process is tractable in closed form, allowing any noise level to be sampled directly without iterating through all intermediate steps.

Formula
q(x_t | x_{t-1}) = \mathcal{N}(x_t; \sqrt{1-\beta_t}\,x_{t-1},\, \beta_t I)
2

The training set is split into a labeled subset and an unlabeled subset. The diffusion backbone is optimized on all data using the standard evidence lower bound (ELBO), so unlabeled examples contribute to the generative model. The labeled portion additionally supervises an auxiliary classifier that predicts class labels from noisy inputs at various noise levels. How the two training terms are weighted against each other depends on the implementation.

3

At inference time the reverse denoising process is conditioned on a target class label y. The posterior over cleaner inputs is approximated by combining the unconditional denoising network with the auxiliary classifier, so the model can sample from a class-conditional distribution even though only part of the training data was labeled.

Formula
p_\theta(x_{t-1}|x_t, y) \propto p_\theta(x_{t-1}|x_t)\, p_\phi(y|x_t)
4

Classifier guidance shifts each denoising step by the gradient of the log class probability with respect to the noisy input, scaled by a guidance strength s. A larger s pushes samples more strongly toward the target class, usually at the cost of diversity, while a smaller s weakens class adherence. This gradient term is the link between the unlabeled generative model and labeled conditional generation. The noise-dependent factor applied to this gradient varies between parameterizations, so the convention used by a given implementation should be checked before values of s are compared across codebases.

Formula
\tilde{\epsilon}_\theta(x_t, t, y) = \epsilon_\theta(x_t, t) - s\,\nabla_{x_t}\log p_\phi(y|x_t)
5

Starting from pure noise x_T, the model applies T reverse steps. Each step uses the guided mean estimate plus scaled Gaussian noise, producing a clean sample that reflects both the overall data distribution learned from all examples and the class constraint imposed by the label.

Formula
x_{t-1} = \mu_\theta(x_t, t, y) + \sigma_t z,\; z \sim \mathcal{N}(0,I)

Common pitfalls

  • Using a classifier trained only on clean data for guidance. Its predictions on noisy intermediate inputs are unreliable, which degrades sample quality at intermediate noise levels.
  • Setting the guidance strength too high to maximize class fidelity, which often reduces sample diversity. Check coverage and recall to detect this.
  • Training only on the labeled subset and dropping the unlabeled ELBO term, which removes the main source of the semi-supervised benefit.
  • Reporting only FID. FID does not measure class fidelity, so also report classifier accuracy on generated samples, and coverage or recall to detect mode dropping.
  • Assuming that a pre-trained unconditional checkpoint and a separately trained classifier combine optimally. Class adherence and sample quality of the combined sampler should be checked directly.

Frequently asked questions

How much labeled data is typically needed?

No general minimum applies across domains. Requirements depend on the dataset, the number of classes, and how representative the unlabeled set is. The main concern is very few labels on complex data, where the auxiliary classifier has little to learn from and conditional quality may suffer; in that regime, compare against simpler baselines.

Is classifier-free guidance an alternative to classifier guidance?

Yes. Classifier-free guidance trains the diffusion network to be conditionally aware by randomly dropping labels during training, so no separate auxiliary classifier is needed at sampling time. Because it relies on labels during training, it is less naturally semi-supervised than explicit classifier guidance.

Can this approach be applied to text or audio, not just images?

Diffusion-style models have been applied to text and audio, often in a latent space. The guidance principle can then be applied there, with the classifier operating on noisy latent vectors rather than pixels. Practical behaviour depends on the chosen latent space.

How do I evaluate generation quality in a semi-supervised setting?

Use Frechet Inception Distance (FID) or a domain-specific equivalent for distributional quality, Inception Score (IS) for sharpness and diversity, and the accuracy of a separately trained classifier on generated samples to assess class fidelity. Also report coverage and recall to detect mode dropping.

What is the practical compute cost compared to a GAN or VAE?

Inference is slower than single-pass generators such as GANs or VAEs, because each sample requires many sequential network evaluations. Accelerated samplers such as DDIM or DPM-Solver reduce the number of steps, with a quality trade-off that depends on the setting.

How should the guidance strength s be chosen?

Sweep s on a held-out labeled split. At each value, measure class accuracy with a separately trained classifier and measure FID or recall. Select the s that meets the required class fidelity while keeping acceptable diversity. The best value depends on the dataset and the sampler, so it should not be reused unchecked across tasks.

Related methods

Sources

  1. Sohl-Dickstein, J., Weiss, E., Maheswaranathan, N., & Ganguli, S. (2015). Deep Unsupervised Learning using Nonequilibrium Thermodynamics. Proceedings of the 32nd International Conference on Machine Learning (ICML), 2256–2265.

    Open publication reference
  2. Ho, J., Jain, A., & Abbeel, P. (2020). Denoising Diffusion Probabilistic Models. Advances in Neural Information Processing Systems (NeurIPS), 33, 6840–6851.

    Open publication reference