AI Glossary / Probabilistic machine learning / Intermediate

Classifier guidance

Definition

Classifier guidance is a technique for steering diffusion-model generation using gradients from a separate classifier. During sampling, the classifier indicates how a noisy intermediate sample could change to increase the predicted probability of a requested class. The diffusion sampler uses that signal to modify its next update, with a scale controlling guidance strength.

What it means

A diffusion model generates data through a sequence of denoising steps. A classifier-guided system adds another source of direction: a model that evaluates the desired class at the current noise level.
The classifier does more than assign a label to a finished image. Its gradient with respect to the intermediate sample helps influence how generation proceeds.
This makes classifier guidance different from generating a large collection and discarding unwanted outputs afterward. It is also different from classifier-free guidance, which combines conditional and unconditional denoising predictions without requiring a separate classifier for that guidance signal.

How it works

Train or obtain a diffusion model and a suitable classifier for its noisy intermediate inputs. In the original approach, the classifier is trained with the relevant noising distribution and receives timestep information.
At a sampling step, compute the gradient of log p(class | noisy sample, timestep) with respect to the sample. This describes a local direction that increases the classifier's log probability for the requested class.
Use the gradient in the sampler's update. In the original Gaussian reverse-step construction, the mean is shifted by guidance scale times the reverse covariance times the classifier gradient. Other samplers express the modification differently, so the update must match the parameterization.
Continue the diffusion process and evaluate the generated results. Guidance can strengthen class consistency while reducing diversity, and the preferred strength depends on the model, sampler, and evaluation objective.

Three practical examples

  • A class-conditional image-generation experiment steers samples toward a selected object category during denoising.
  • A research team varies guidance strength to study the balance between recognizable category features and output variety.
  • An engineer compares guiding an unconditional diffusion model with adding guidance to a model already trained with class conditioning.

Think of it this way

Think of an artist receiving a critic's local suggestions while developing a sketch. The artist supplies the broader ability to make plausible images, while the critic points toward features associated with the requested category.
The analogy is limited: the classifier's mathematical signal is not a reliable human judgment. It can favor shortcuts or exaggerated features, and a stronger signal does not guarantee a better or more varied image.

Worked example

Consider an original two-coordinate example of one Gaussian reverse step. Suppose the diffusion model's proposed mean is mu = (1, −1), its diagonal covariance is Sigma = diag(0.2, 0.5), and the classifier log-probability gradient is g = (0.5, −0.4).
With guidance scale s = 2, the mean shift is s × Sigma × g. Multiplying gives Sigma × g = (0.1, −0.2), so the shift is (0.2, −0.4). The guided mean is therefore (1.2, −1.4).
The next sample is drawn using this shifted mean and the specified reverse covariance in this simplified construction. It need not equal the mean. At scale zero, the shift vanishes; at scale one, the mean would be (1.1, −1.2).
This is an arithmetic illustration of a local update, not a generated image or proof that the class probability rises after every stochastic step. The gradient's usefulness and the quality of the full trajectory depend on the models and sampling procedure.

Illustrative case study

In a fictional project, Harbor Design studies a generator for labeled object illustrations. Increasing classifier guidance makes outputs more obviously associated with the requested category, but reviewers notice increasingly repetitive poses.
The team evaluates several strengths using both category consistency and diversity, retaining the sampler and random-seed settings for comparison. It also checks whether the classifier rewards features that reviewers regard as distortions.
This invented case illustrates a tradeoff. It reports no real benchmark score, production benefit, or universal best guidance value.

Common misconceptions and mistakes

Do not substitute a clean-image classifier without checking whether it can provide useful gradients on the noisy states used during generation.
Do not confuse a classifier gradient with the classifier's scalar confidence score. The gradient concerns changes in the input coordinates.
Do not update classifier weights when the intended operation is to differentiate its output with respect to the current sample.
Do not assume guidance scale is directly comparable across implementations with different conventions.
Finally, do not assume that increasing guidance improves every quality metric monotonically. A metric sensitive to both diversity and fidelity can favor an intermediate setting.

Business use

Classifier guidance helps explain how a generator can be steered by a separately learned assessment signal. For an applied team, its value depends on whether that signal captures the desired properties of the output and works across the sampling noise levels.
Evaluation should include adherence to the requested class, visual artifacts, variety, and computation cost. A classifier can be confident about an image that is unsuitable for the business purpose, so classifier-based metrics should be accompanied by checks aligned with that purpose. Record guidance settings when comparing generated collections.

People also ask

Does the diffusion model have to be unconditional?

No. The original research also applies classifier guidance to an already class-conditional model.

Does the classifier inspect only the final image?

No. In the standard method it supplies gradients during the reverse process on noisy intermediate inputs.

Is classifier guidance the same as training a GAN?

No. It uses a separately trained classifier to modify diffusion sampling; that is different from the adversarial generator - discriminator training objective.

Check your understanding

In the worked example, why is the gradient not simply added directly to the mean?

Answer: The specified Gaussian reverse-step rule uses s × Sigma × g. Both the guidance scale and covariance affect the shift. A direct addition would implement a different update.

Related terms

  • Diffusion model
  • Denoising
  • Conditional generation
  • Classifier-free guidance
  • score function
  • reverse diffusion
  • fidelity–diversity tradeoff

Learn next

compare classifier guidance with classifier-free guidance using their actual update equations. Then vary guidance strength on a fixed evaluation setup and inspect both class adherence and variation across generated outputs.

  • Classifier-free guidance

More in Probabilistic machine learning

  • Chain graphical model - A chain graphical model represents a probability distribution using a graph that can contain both directed and undirected edges, subject to restrictions...
  • Class incremental learning - Class incremental learning is a continual-learning setting in which a model learns additional classes over time while remaining able to distinguish the...
  • Classification with rejection - Classification with rejection allows a classifier to abstain from assigning a class to selected inputs.
  • Cluster assumption - The cluster assumption is a semi-supervised learning assumption that examples within the same meaningful high-density cluster tend to share a class.
  • Collapsed Gibbs sampling - Collapsed Gibbs sampling is a Markov chain Monte Carlo method that integrates some unknown variables out of a probability model, then repeatedly samples the...
  • Common random numbers - Common random numbers is a simulation technique that deliberately shares random inputs between alternatives being compared.

Sources

Primary source: Dhariwal and Nichol, Diffusion Models Beat GANs on Image Synthesis, classifier-guidance section and sampling algorithm: https://papers.neurips.cc/paper/2021/file/49ad23d1ec9fa4bd8d77d02681df5cfa-Paper.pdf Related original comparison: Ho and Salimans, Classifier-Free Diffusion Guidance: https://arxiv.org/pdf/2207.12598 The local calculation and fictional case are original illustrations.

Previous: Classifier-free guidance Next: Classifier head

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer