U7.1 ~50 min Oct 2026

Before the image is finished, how do we remind it to draw a corgi?

Run classifier guidance and CFG on the same mixture. Read both complete routes, then compare prerequisites and interpret new scenarios.

Prefer continuous reading? Skill manual Read the note · U7.1 →

What might the image become?
Nori A polar bear in an orca hat

Consider a concrete task. Our model is already trained, and we want a corgi snowboarding in snowy mountains. Even if it accepts text, does supplying those words guarantee the image we want?

Perhaps the dog is snowboarding in the mountains but turns out to be a husky. Perhaps the corgi and mountains are right, but the dog merely stands in the snow. We want to keep the model’s parameters and offer clues while the image is still unfinished.

A person draws an unfinished sketch while a friend offers suggestions. Completed alternatives on the right vary in breed, action, or setting.

The same sketch can develop into different results. For now, we only address “is it a corgi?” Snowy mountains and snowboarding remain separate requirements.

Select the image to enlarge
Lumi: ask a helper that understands drafts
Lumi A winged deer

“If the dog’s legs keep getting longer halfway through drawing, could a friend check how much this image still resembles a corgi?”

Lumi wants a model that recognizes breeds in noisy images. Show it the current image, then find small changes that increase its probability of calling the image a corgi. This is classifier guidance: the classifier provides the judgment, and guidance connects that judgment to generation.

Mugi: could the model answer twice?
Mugi A corgi with a Shiba face

“If the model already reads descriptions, could we ask about the same draft twice? Once say ‘draw a corgi,’ and once leave the breed unspecified. How do the answers differ?”

Mugi wants to compare the same generative model’s predictions with and without a description, then strengthen what the request adds. This is classifier-free guidance (CFG). It needs no separate classifier, but the model must actually have learned both kinds of input.

Nori: check what our tools can answer
Nori A polar bear in an orca hat

“We can describe both ideas. But if the helper has only seen clean photos, can it understand all this noise? If the model always received a description, how will it answer without one?”

Nori wants to check what was learned before generation. At each step, ask: Whose answer do we need now? Has it learned to handle this input? Then examine how Lumi’s and Mugi’s proposals connect to the image in front of us.

What should the helper see now?
Lumi A winged deer
Revisit the partners’ proposals

We want a suggestion at the current step, rather than waiting to select a finished image. What should we give the helper first?

An intermediate adjustment must use the current state. The helper must understand noisy images before its judgment is useful at this step.

A finished photo is useful for final selection, but it does not exist yet. Intermediate guidance must use an input available now.

The fraction of corgis in the dataset does not describe this particular image. The judgment needs to inspect it.

Can we find clues in the draft?
Nori A polar bear in an orca hat

Imagine drawing a few blurry lines. The animal looks vaguely like a dog, but its breed is unclear. A friend suggests, “Would shorter legs make it look more like a corgi?” We can try changing the draft rather than finishing the whole image and starting over.

In diffusion, our actual input is a noisy image xtx_t. The desired “corgi” is the condition cc. Keep U1’s time convention: larger tt means more noise, and sampling moves toward clean images at t=0t=0. The noisy image is formed as

xt=αˉt x0+σtϵ.x_t=\sqrt{\bar\alpha_t}\,x_0+\sigma_t\epsilon.

Here x0x_0 is the original clean photo, αˉt\bar\alpha_t is the retained signal fraction, ϵ∼N(0,I)\epsilon\sim\mathcal N(0,I) is added noise, and σt=1−αˉt\sigma_t=\sqrt{1-\bar\alpha_t} sets its amplitude. We therefore find a judgment model trained at different noise levels and ask it a class question.

Which question is it answering?
Lumi A winged deer

Show the helper xtx_t and ask: “How likely is this noisy image to have come from a corgi photo?” Which quantity answers that question?

The observed image is on the conditioning side; the class we want to infer is on the other side.

Changing the image leaves the dataset’s corgi fraction unchanged. This quantity has not inspected the image.

Which comes first: image or breed?
Nori A polar bear in an orca hat

pt(xt∣c)p_t(x_t\mid c) means “specify corgis, then describe their distribution after adding noise.” By contrast, pt(c∣xt)p_t(c\mid x_t) means “see this image, then infer its class.” We gave the helper an image, so it directly answers the latter.

We want to generate the images described by the former. These quantities are related, but we need to derive that connection rather than swap the notation.

How does judgment connect to generation?
Lumi A winged deer

Imagine selecting the corgi photos in the data, then adding noise with the original forward process. Their noisy density is pt(xt∣c)p_t(x_t\mid c), the distribution we want for this breed.

Yes, it is time for Bayes’ rule again:

pt(xt∣c)=pt(xt) pt(c∣xt)p(c).\begin{gathered} p_t(x_t\mid c)\\ =\frac{p_t(x_t)\,p_t(c\mid x_t)}{p(c)}. \end{gathered}

The base pt(xt)p_t(x_t) includes all kinds of images. Multiplying by the probability of “came from a corgi” gives relatively more weight to images likely to be corgis. The denominator p(c)p(c) restores total mass to 11. The helper’s judgment now connects to the images we want to generate.

How does the starting distribution enter this relationship?

The pt(xt∣c)p_t(x_t\mid c) above is a whole family of noisy distributions: draw clean x0x_0 from the specified breed, then apply the same noising rule. Larger tt usually obscures more of the original image.

If αˉT\bar\alpha_T is very small, conditional xTx_T is also close to a standard Gaussian, so reverse sampling can start from approximate noise. Finite noising need not erase all breed information, however: pT(xT∣c)p_T(x_T\mid c) is not necessarily exactly Gaussian. The score identity, network estimation, starting approximation, and discretized sampler are separate steps.

If only the image changes, what changes with it?
Lumi A winged deer

Fix the noise level, the corgi request, and the original data. Change only the image slightly. Classify the three quantities in Bayes’ rule by their dependence on that image.

Image-dependent · Base density The current image’s base density.
Image-dependent · Class probability The probability of a corgi after seeing the image.
Fixed here · Class fraction The fraction of corgis in the data.

Turn density into a direction for change
Lumi A winged deer

Having a density is not enough; we need a direction in which to change the image. Recall that a score differentiates log density with respect to the image. Taking logs first turns Bayes’ multiplication into addition:

log⁡pt(xt∣c)=log⁡pt(xt)+log⁡pt(c∣xt)−log⁡p(c).\begin{gathered} \log p_t(x_t\mid c)\\ =\log p_t(x_t)\\ +\log p_t(c\mid x_t)\\ -\log p(c). \end{gathered}

Now differentiate with respect to xtx_t. The original-data term gives the base score; the fixed term has zero derivative. Which term contributes the extra direction for corgis? Try writing its gradient.

You can also think first, then read the explanation. Your writing stays on this page and disappears when you reload.

The extra direction from specifying a breed
Lumi A winged deer

Denote the conditional score by st(xt∣c)s_t(x_t\mid c) and the base score by st(xt)s_t(x_t). Termwise differentiation gives

st(xt∣c)=st(xt)+∇xtlog⁡pt(c∣xt).\begin{gathered} s_t(x_t\mid c)\\ =s_t(x_t)\\ +\nabla_{x_t}\log p_t(c\mid x_t). \end{gathered}

The last term points toward the fastest local increase in the log-probability of “came from a corgi” as we change xtx_t. The directions add because Bayes’ product becomes a sum after taking logs.

This is a relationship between exact densities and scores. In practice, networks estimate them for a reverse-time sampler. The score itself is not the distance to move the image. Differentiating away p(c)p(c) also does not mean we have computed its value.

A one-dimensional draft we can actually generate
Nori A polar bear in an orca hat

Reuse U7.0: pbase=12N(−2,0.552)+12N(2,0.552)p_{\mathrm{base}}=\frac12\mathcal N(-2,0.55^2)+\frac12\mathcal N(2,0.55^2), with left/right labels c=0,1c=0,1. Choosing a class stands in for choosing corgis; the horizontal axis is a scalar datum, not a generated dog photograph.

This model has analytic noisy densities, class probabilities, and scores. First run an actual reverse sampler with ideal fixed tools. Each route then fully checks how real networks learn the required answers and how to express the result as noise prediction.

Explore a complete method, then return for the next

Choose the order. Each route includes prediction, actual sampling plots, full derivations, and limitations. Only returning from its final step marks it fully explored. You may return early and resume later.

Ask a noisy classifier for a direction

Run first: which samples does classifier guidance change?
Lumi A winged deer

Use the ideal noisy classifier defined above. Compare the sampled A/B histograms, then inspect the directions and a sampler step at the same x_t.

Predict, then inspect the distribution

With the model fixed, what changes from no guidance to w = 1? Is the classifier gradient itself the sampler update?

A uses w = 0; B uses your chosen w. Both use identical initial noise and random seeds.

The gray curve shows the original mixture. Running adds actual samples; a reference curve does not establish that it was sampled.

Base, reference density, and actual sample histogram Gray dashes: fixed base. Black dots: the named reference density. Gold: actual samples. In A/B mode, blue outlines show observation A. 0.000.420.85 -6-4-20246 x₀density
Fixed baseReference labelled after runningActual samples

The classifier supplies the input derivative of log class probability. The combined score goes into a reverse SDE whose update also includes drift, step size, and random noise. These are analytic functions, not trained networks. At w = 1 the endpoint approximates the conditional distribution, with finite-time and discretization error.

This explains the standard comparison. After changing controls or Python, use the settings and plots you actually ran.

VP: alpha_bar(t) = exp(-8t). Start from the exact base p_1 and use Euler–Maruyama toward t = 0: Δx = (4x + 8s̃)Δt + sqrt(8Δt)ξ. The dotted curve is a conditional reference at w = 1, not an exact endpoint target for w > 1.

Edit Python and run the experiment yourself

Change the parameters or the sampling rule. Python loads when you press Run and executes in your browser. Each run starts fresh; your edits are not saved.

The first opening imports the controls above; reopening preserves your edits. Settings are imported, not accumulated trained parameters or samples, so finite-sample plots need not match exactly.

The code implements this method and plots its distribution with Matplotlib. The first opening imports current controls; every run samples afresh. Change one parameter at the top. The native plot is not a record of edited Python output.

import math
import numpy as np
import matplotlib.pyplot as plt

# 1. SETTINGS -- change one, run again, and explain the plotted evidence.
strength = 1
condition = 1  # 0 = left, 1 = right
noise_time = 0.35
observed_x = 0
steps = 600
rng = np.random.default_rng(42)
sigma = 0.55
grid = np.linspace(-6, 6, 481)
dx = grid[1] - grid[0]

# 2. FIXED MODEL -- analytic functions, no network training in this cell.
def pdf(x, mu=0.0, var=1.0):
    return np.exp(-0.5 * (x-mu)**2 / var) / np.sqrt(2*np.pi*var)
def moments(t):
    a = np.exp(-8*t)
    return np.sqrt(a), a*sigma**2 + 1-a
def sample_base(size, t=0.0):
    signal, var = moments(t)
    mu = np.where(rng.random(size) < 0.5, -2.0, 2.0)
    return signal*mu + np.sqrt(var)*rng.normal(size=size)
def sigmoid(v):
    return np.exp(-np.logaddexp(0, -v))
base = 0.5*pdf(grid, -2, sigma**2)+0.5*pdf(grid, 2, sigma**2)
reference = base.copy()
reference_label = "Conditional reference at w=1"
extra_figure = None

# 3. GENERATION -- reverse VP SDE, Euler-Maruyama; beta = 8.
def base_score(x, t):
    signal, var = moments(t)
    right = sigmoid(4*signal*x/var)
    return (2*signal*(2*right-1)-x)/var
def conditional_score(x, t):
    signal, var = moments(t)
    return ((2 if condition else -2)*signal-x)/var
def classifier_log_gradient(x, t):
    signal, var = moments(t)
    right = sigmoid(4*signal*x/var)
    return 4*signal/var*((1-right) if condition else -right)
def guided(x, t):
    return base_score(x, t)+strength*classifier_log_gradient(x, t)
samples = sample_base(1000, 1.0)
dt = 1/steps
for k in range(steps, 0, -1):
    t = k*dt
    samples += (4*samples+8*guided(samples, t))*dt + np.sqrt(8*dt)*rng.normal(size=samples.size)
reference = pdf(grid, 2 if condition else -2, sigma**2)
reference_label = "Conditional reference at w=1 (not an exact w>1 target)"
print("Fixed analytic scores; finite-time and Euler error remain.")
print("Reverse steps:", steps, "sampler updates:", 1000*steps)
print("Signals per update: base score + classifier input gradient")
print("At x_t, base / conditional / classifier gradient:", base_score(observed_x, noise_time), conditional_score(observed_x, noise_time), classifier_log_gradient(observed_x, noise_time))

# 4. PLOT AND CHECK -- the histogram is from the samples above.
fig, ax = plt.subplots(figsize=(8, 3.6))
ax.plot(grid, base, "--", color="gray", label="Original base")
ax.plot(grid, reference, ":", color="black", label=reference_label)
ax.hist(samples, bins=np.linspace(-6,6,49), weights=np.ones(len(samples))/(len(samples)*0.25), alpha=0.5, label="Actual generated samples")
ax.set(xlabel="clean x0", ylabel="density", xlim=(-6,6))
ax.legend(fontsize=8)
fig.tight_layout()
print("Outputs:", len(samples), "mean:", np.mean(samples), "right share:", np.mean(samples > 0))
print("Outside the plotted window:", np.sum(np.abs(samples)>6))
plt.show()

What do we want to change?
Nori A polar bear in an orca hat

Write the noisy classifier as pϕ(c∣xt,t)p_\phi(c\mid x_t,t), with parameters ϕ\phi; the generative parameters remain θ\theta. We want to keep the helper’s judgment rule and change the image it sees to increase the class log-probability. With respect to what should we differentiate?

An input gradient describes how the judgment varies with the input; it is not a network-parameter update direction.

Updating generative parameters would teach the model this preference again. We want clues for modifying the current image.

If the judgment rule changes, did the image change?
Nori A polar bear in an orca hat

Imagine keeping the image and changing only classifier parameters ϕ\phi. Its judgment might change, but did the dog become a corgi? We want to preserve the judgment rule and change xtx_t instead.

We therefore need ∇xtlog⁡pϕ(c∣xt,t)\nabla_{x_t}\log p_\phi(c\mid x_t,t). Backpropagation can compute input gradients too. Computing a derivative and updating parameters are different operations.

Which helper is prepared for this image?
Lumi A winged deer

Two candidates are available. A learned breeds only from clean photos; B learned the same task at different noise levels. Generation still contains noise. Which has at least the training preparation we need?

Noise level changes what the image reveals. The helper needs to learn class judgments on these inputs.

Accuracy on clean photos does not guarantee understanding of noisy inputs. Check what the helper actually practiced.

They see different inputs. Equal network size or the same name cannot replace training on the relevant inputs.

How should this helper practice?
Lumi A winged deer

“There are many levels of blur along the way. Let us add different amounts of noise to a breed-labeled photo. Even as the dog becomes hard to recognize, we still know its original breed, right?”

Let ϕ\phi denote the helper’s parameters. Draw (x0,c)(x_0,c), a noise level tt, and Gaussian noise ϵ\epsilon, then form xtx_t with the same noising rule. Ask it to assign probability to the correct breed. Its training loss is

Lcls(ϕ)=E(x0,c),t,ϵ[−log⁡pϕ(c∣xt,t)].\begin{aligned} &\mathcal L_{\mathrm{cls}}(\phi)\\ &=\mathbb E_{(x_0,c),t,\epsilon}\big[\\ &-\log p_\phi(c\mid x_t,t)\big]. \end{aligned}

Higher probability for the correct breed means smaller negative log-probability. This is the noisy classifier’s training exercise: directly noise training photos, without waiting for the generative model to draw them. At high noise, the photo may genuinely be unrecognizable, so a reasonable answer may be uncertain.

Training changes ϕ\phi using ∇ϕLcls\nabla_\phi\mathcal L_{\mathrm{cls}}. To help change an image now, fix ϕ\phi and use ∇xtlog⁡pϕ(c∣xt,t)\nabla_{x_t}\log p_\phi(c\mid x_t,t). Both are gradients, but the object to be changed differs.

Put the needed directions together
Lumi A winged deer

Estimate the base score with the trained model, then add the helper’s input gradient:

s~θ(xt,t,c)=sθ(xt,t)+w∇xtlog⁡pϕ(c∣xt,t).\begin{gathered} \widetilde s_\theta(x_t,t,c)\\ =s_\theta(x_t,t)\\ +w\nabla_{x_t}\log p_\phi(c\mid x_t,t). \end{gathered}

Here ww sets the suggestion’s strength. Starting from an unconditional base, w=0w=0 retains the base; if both estimates are exact, w=1w=1 gives the conditional score derived above. In practice, the reverse sampler uses this combined score to determine the next image update. This is Lumi’s classifier-guidance proposal.

What if the generative model already uses a condition?

We started from an unconditional base. Adding classifier guidance to an already conditional score is extra strengthening beyond the original request; an extra coefficient of 00 retains the conditional prediction. The two starting points cannot both call w=1w=1 “no strengthening.” First identify the base answer, then inspect the extra term’s coefficient.

What if the network predicts noise?
Lumi A winged deer

U1’s network usually outputs ϵθ\epsilon_\theta. At a noisy time, with noise amplitude σt=1−αˉt>0\sigma_t=\sqrt{1-\bar\alpha_t}>0, its score representation is

sθ(xt,t)=−ϵθ(xt,t)σt.s_\theta(x_t,t)=-\frac{\epsilon_\theta(x_t,t)}{\sigma_t}.

First consider classifier guidance: add ww times the classifier’s input gradient to an unconditional base score. What happens to the extra term’s sign and scale in noise-prediction form? Multiply the whole score equation by −σt-\sigma_t.

You can also think first, then read the explanation. Your writing stays on this page and disappears when you reload.

First convert the classifier’s direction
Lumi A winged deer

Multiplying the score equation by −σt-\sigma_t gives

ϵ~θ(xt,t,c)=ϵθ(xt,t)−wσt ⁣∇xt ⁣log⁡pϕ(c∣xt,t).\begin{gathered} \widetilde\epsilon_\theta(x_t,t,c)\\ =\epsilon_\theta(x_t,t)\\ -w\sigma_t\!\nabla_{x_t}\!\log p_\phi(c\mid x_t,t). \end{gathered}

Both the minus sign and σt\sigma_t come from the conversion. Here classifier guidance starts from an unconditional base, so w=0w=0 means no guidance. CFG instead starts from a conditional answer and uses w=1w=1 as its baseline.

Does an accurate judgment imply an accurate direction?
Nori A polar bear in an orca hat

We use the gradient of probability as the image changes. Two terrains can have similar heights but different local slopes. Likewise, accurate class probabilities do not automatically imply accurate input gradients.

The generative model in this approach need not accept cc; a separate noisy classifier supplies the request. Now suppose our available tool differs: if the generative model already learned the condition, could its own answers reveal this direction?

What else should we check about the helper?

Classification accuracy checks answers. Guidance also uses local changes around an image, so ask whether tiny input perturbations cause stable judgments. A classifier may change its answer sharply under a small perturbation; clean-image accuracy alone does not establish the quality of intermediate input gradients. This motivates examining the direction, without claiming that stability guarantees successful generation. Kawar, Ganz, and Elad study robust classifiers for guidance.

From the distribution to the complete formula
Nori A polar bear in an orca hat

You generated samples with a fixed model, distinguished input derivatives from parameter updates, and read the noisy-classifier loss, score combination, noise conversion, and limitations. Return to explore the other signal source.

Compare two predictions of the same model

Which two answers should we compare?
Mugi A corgi with a Shiba face

For now, suppose the available model can also answer without a breed specification. Ask about the same xtx_t at the same tt twice, with and without “corgi.” How can we isolate what the request adds?

Bayes gave conditional = base + extra direction. Subtract the base from both sides; no need to repeat the full derivation.

Averaging retains the shared base. We want to isolate the effect of specifying the breed.

Did we count the shared part twice?
Nori A polar bear in an orca hat

We derived conditional score = base score + the condition’s extra direction. Adding the entire conditional score to the base counts that base a second time.

To retain only the condition’s effect, subtract the shared base. We compare two answers for the same image, not two finished images.

Which term did we subtract?
Mugi A corgi with a Shiba face

Rearrange the exact score identity:

∇xtlog⁡pt(c∣xt)=st(xt∣c)−st(xt).\begin{gathered} \nabla_{x_t}\log p_t(c\mid x_t)\\ =s_t(x_t\mid c)-s_t(x_t). \end{gathered}

Subtracting the original direction from the requested direction leaves exactly what the condition adds. Mugi proposes estimating the two terms on the right with the generative model, then subtracting. Use the same image at the same time to compare requests; subtracting two generated images cannot replace this operation.

Run first: how do two predictions change generation?
Mugi A corgi with a Shiba face

Use this toy’s analytic conditional and unconditional scores at the same x_t and t. Then check the training prerequisites for real networks to supply them.

Predict, then inspect the distribution

Ask the same x_t with and without the condition. What changes within the selected mode when w increases from 1?

A retains the conditional prediction (w = 1); B uses your w. The condition, step count, and random seed stay fixed.

The gray curve shows the original mixture. Running adds actual samples; a reference curve does not establish that it was sampled.

Base, reference density, and actual sample histogram Gray dashes: fixed base. Black dots: the named reference density. Gold: actual samples. In A/B mode, blue outlines show observation A. 0.000.420.85 -6-4-20246 x₀density
Fixed baseReference labelled after runningActual samples

CFG changes the combination of two predictions at one input. This toy uses ideal analytic predictions. w = 1 retains the conditional prediction. Larger w changes generation, but the amount of change depends on the data and condition; narrowing is not guaranteed. Ideal classifier guidance and CFG agree with the same w and sampler; real networks have different prerequisites and errors.

This explains the standard comparison. After changing controls or Python, use the settings and plots you actually ran.

The same VP sampler and fixed parameters use s̃ = s_c + (w−1)(s_c−s_empty). Analytic predictions isolate the combination. The following training derivation still checks conditioning dropout; an unprepared network is not assumed to answer empty inputs.

Edit Python and run the experiment yourself

Change the parameters or the sampling rule. Python loads when you press Run and executes in your browser. Each run starts fresh; your edits are not saved.

The first opening imports the controls above; reopening preserves your edits. Settings are imported, not accumulated trained parameters or samples, so finite-sample plots need not match exactly.

The code implements this method and plots its distribution with Matplotlib. The first opening imports current controls; every run samples afresh. Change one parameter at the top. The native plot is not a record of edited Python output.

import math
import numpy as np
import matplotlib.pyplot as plt

# 1. SETTINGS -- change one, run again, and explain the plotted evidence.
strength = 3
condition = 1  # 0 = left, 1 = right
noise_time = 0.35
observed_x = 0
steps = 600
rng = np.random.default_rng(42)
sigma = 0.55
grid = np.linspace(-6, 6, 481)
dx = grid[1] - grid[0]

# 2. FIXED MODEL -- analytic functions, no network training in this cell.
def pdf(x, mu=0.0, var=1.0):
    return np.exp(-0.5 * (x-mu)**2 / var) / np.sqrt(2*np.pi*var)
def moments(t):
    a = np.exp(-8*t)
    return np.sqrt(a), a*sigma**2 + 1-a
def sample_base(size, t=0.0):
    signal, var = moments(t)
    mu = np.where(rng.random(size) < 0.5, -2.0, 2.0)
    return signal*mu + np.sqrt(var)*rng.normal(size=size)
def sigmoid(v):
    return np.exp(-np.logaddexp(0, -v))
base = 0.5*pdf(grid, -2, sigma**2)+0.5*pdf(grid, 2, sigma**2)
reference = base.copy()
reference_label = "Conditional reference at w=1"
extra_figure = None

# 3. GENERATION -- reverse VP SDE, Euler-Maruyama; beta = 8.
def base_score(x, t):
    signal, var = moments(t)
    right = sigmoid(4*signal*x/var)
    return (2*signal*(2*right-1)-x)/var
def conditional_score(x, t):
    signal, var = moments(t)
    return ((2 if condition else -2)*signal-x)/var
def classifier_log_gradient(x, t):
    signal, var = moments(t)
    right = sigmoid(4*signal*x/var)
    return 4*signal/var*((1-right) if condition else -right)
def guided(x, t):
    sc, su = conditional_score(x, t), base_score(x, t)
    return sc+(strength-1)*(sc-su)
samples = sample_base(1000, 1.0)
dt = 1/steps
for k in range(steps, 0, -1):
    t = k*dt
    samples += (4*samples+8*guided(samples, t))*dt + np.sqrt(8*dt)*rng.normal(size=samples.size)
reference = pdf(grid, 2 if condition else -2, sigma**2)
reference_label = "Conditional reference at w=1 (not an exact w>1 target)"
print("Fixed analytic scores; finite-time and Euler error remain.")
print("Reverse steps:", steps, "sampler updates:", 1000*steps)
print("Signals per update: conditional prediction + unconditional prediction")
print("At x_t, base / conditional / classifier gradient:", base_score(observed_x, noise_time), conditional_score(observed_x, noise_time), classifier_log_gradient(observed_x, noise_time))

# 4. PLOT AND CHECK -- the histogram is from the samples above.
fig, ax = plt.subplots(figsize=(8, 3.6))
ax.plot(grid, base, "--", color="gray", label="Original base")
ax.plot(grid, reference, ":", color="black", label=reference_label)
ax.hist(samples, bins=np.linspace(-6,6,49), weights=np.ones(len(samples))/(len(samples)*0.25), alpha=0.5, label="Actual generated samples")
ax.set(xlabel="clean x0", ylabel="density", xlim=(-6,6))
ax.legend(fontsize=8)
fig.tight_layout()
print("Outputs:", len(samples), "mean:", np.mean(samples), "right share:", np.mean(samples > 0))
print("Outside the plotted window:", np.sum(np.abs(samples)>6))
plt.show()

Is the other answer actually prepared?
Mugi A corgi with a Shiba face
The same noisy image is sent to the same model with two inputs: specify a corgi, or leave the breed unspecified. Both answers remain question marks.

The two lines represent two queries to one model, not two models or successive generation steps.

Select the image to enlarge

If every training example supplied a description, suddenly removing it may leave the model unprepared. Which training exercise could give it a chance to answer both kinds of input?

Dropping the condition independently of the data avoids selecting a different data distribution for the no-condition examples.

That removes image information, while the description remains. It does not practice prediction without a description.

Does removing a hint teach an answer?
Mugi A corgi with a Shiba face

Practicing with a hint every time does not guarantee knowing what to do without it. The model learned prediction from xt,t,cx_t,t,c; omitting cc is a different input.

Writing an unconditional score in a formula does not mean the network learned to estimate it. We need that input during model preparation, rather than retraining at every sampling run.

One parameter set, two kinds of practice
Mugi A corgi with a Shiba face

This preparation is conditioning dropout. An empty condition ∅\varnothing means no breed or prompt is specified; it does not mean “no corgis in the image.” Keep the image, noise level, and added noise. The network still predicts that noise, but sometimes cannot read the description.

Write the condition actually shown as c~\widetilde c, either the original cc or the empty condition. The training loss becomes

Ldrop(θ)=E(x0,c),t,ϵ,c~[∥ϵθ(xt,t,c~)−ϵ∥2].\begin{aligned} &\mathcal L_{\mathrm{drop}}(\theta)\\ &=\mathbb E_{(x_0,c),t,\epsilon,\widetilde c} \big[\|\epsilon_\theta(x_t,t,\widetilde c)\\ &\hspace{5em}-\epsilon\|^2\big]. \end{aligned}

The expectation averages over data, times, noise, and the random decision to drop the condition. The target remains ϵ\epsilon. Dropping conditions only for certain breeds would make empty inputs describe selected data. Data-independent dropout instead practices the overall base answer.

After preparation, sampling uses the same θ\theta to obtain sθ(xt,t,c)s_\theta(x_t,t,c) and sθ(xt,t,∅)s_\theta(x_t,t,\varnothing), estimating conditional and unconditional scores. Their difference estimates the request’s extra direction. This requires a model already trained on both inputs; it does not instruct us to retrain an unprepared model now.

Do two queries update the parameters?
Nori A polar bear in an orca hat

The model learned both descriptions and empty conditions during training. We now query both during generation. Can these computations preserve the same θ\theta?

Where does strengthening start?
Mugi A corgi with a Shiba face

The model can already generate from a condition. We are willing to lose some variation to try making breed features clearer, so we add more of the difference between its two answers. Denote strength by ww and start from the conditional prediction:

s~θ(xt,t,c)=sθ(xt,t,c)+(w−1)[sθ(xt,t,c)−sθ(xt,t,∅)].\begin{gathered} \widetilde s_\theta(x_t,t,c)\\ =s_\theta(x_t,t,c)\\ +(w-1)\big[s_\theta(x_t,t,c)\\ -s_\theta(x_t,t,\varnothing)\big]. \end{gathered}

Which ww keeps the original conditional prediction without extra strengthening?

This formula starts from the conditional prediction, and the extra coefficient is w−1. Its baseline is w=1.

At w=0, subtracting the difference from the conditional answer leaves the unconditional answer. Even the original condition’s effect is removed.

At w=2, an extra copy of the difference is added to the conditional answer. That already strengthens guidance.

We can also start from the unspecified answer
Mugi A corgi with a Shiba face

Expanding gives an equivalent expression:

s~θ=sθ∅+w(sθc−sθ∅)=wsθc+(1−w)sθ∅.\begin{aligned} \widetilde s_\theta &=s_\theta^\varnothing+w(s_\theta^c-s_\theta^\varnothing)\\ &=w s_\theta^c+(1-w)s_\theta^\varnothing. \end{aligned}

Here sθcs_\theta^c and sθ∅s_\theta^\varnothing abbreviate answers for the same (xt,t)(x_t,t), making the coefficients easier to inspect. At w=0w=0 the result is unconditional; at w=1w=1 it is conditional; w>1w>1 extrapolates along the difference beyond the original conditional answer.

Which density corresponds to the stronger score?

Fix one tt and assume exact scores. The combination is the log-gradient of these relative weights:

pt(xt) pt(c∣xt)w∝pt(xt)1−wpt(xt∣c)w.\begin{gathered} p_t(x_t)\,p_t(c\mid x_t)^w\\ \propto p_t(x_t)^{1-w}p_t(x_t\mid c)^w. \end{gathered}

Products become sums under log, powers become coefficients, and normalization independent of xtx_t differentiates to zero. If the total mass is finite, these weights can be normalized at this time.

But writing such a density at every time does not establish that all of them arise from one forward process. This fixed-time equality alone cannot show that sampling with the combined scores ends exactly at p0(x0∣c)wp0(x0)1−wp_0(x_0\mid c)^w p_0(x_0)^{1-w}.

Why do some papers use a different baseline number?

Some papers add wpaperw_{\mathrm{paper}} copies of the difference to the conditional answer, writing (1+wpaper)sc−wpapers∅(1+w_{\mathrm{paper}})s^c-w_{\mathrm{paper}}s^\varnothing. Our convention is w=1+wpaperw=1+w_{\mathrm{paper}}. The combination is the same, but the strength is measured from a different baseline. Substitute a number into the actual formula before interpreting it.

What does stronger guidance mean?
Nori A polar bear in an orca hat

Increasing ww above 11 strengthens the condition’s influence. Does this estimate the original conditional score more accurately, or deliberately change sampling’s quality–diversity trade-off?

Convert both predictions to noise prediction
Nori A polar bear in an orca hat

At the same xt,tx_t,t, both predictions use sθ=−ϵθ/σts_\theta=-\epsilon_\theta/\sigma_t, where σt=1−αˉt>0\sigma_t=\sqrt{1-\bar\alpha_t}>0. Multiply the entire CFG identity by −σt-\sigma_t, then check its common factors and coefficients.

Do CFG’s coefficients change sign too?
Mugi A corgi with a Shiba face

For the same xtx_t and tt, both predictions share the score-to-noise conversion factor. What happens to CFG’s combination coefficients in noise-prediction form?

Both scores are multiplied by the same negative noise amplitude. We cannot change only the difference term’s sign.

Changing only the difference’s sign while keeping the other terms does not apply the same conversion to the entire equation.

The common scale cancels. We are changing representations, not redefining the strength convention.

Give the sampler the combined noise prediction
Mugi A corgi with a Shiba face

CFG’s noise combination is therefore still

ϵ~θ(xt,t,c)=ϵθ(xt,t,c)+(w−1)[ϵθ(xt,t,c)−ϵθ(xt,t,∅)].\begin{gathered} \widetilde\epsilon_\theta(x_t,t,c)\\ =\epsilon_\theta(x_t,t,c)\\ +(w-1)\big[\epsilon_\theta(x_t,t,c)\\ -\epsilon_\theta(x_t,t,\varnothing)\big]. \end{gathered}

The original sampler uses this combined prediction to produce the next image at a lower noise level. Classifier parameters ϕ\phi and generative parameters θ\theta can both stay fixed. What changes is the prediction used by this sampler.

What if the unspecified query also contains a description?
Nori A polar bear in an orca hat

“If we do not want blurry photos, could we replace the empty input with ‘blurry,’ then push from ‘a sharp corgi’ away from ‘blurry’?”

This is the idea of a negative prompt. Write the undesired description as c−c_- and abbreviate noise predictions for the same (xt,t)(x_t,t) by ϵθc\epsilon_\theta^c and ϵθc−\epsilon_\theta^{c_-}. A combination is

ϵ~θ=ϵθc−+w(ϵθc−ϵθc−).\widetilde\epsilon_\theta =\epsilon_\theta^{c_-} +w(\epsilon_\theta^c-\epsilon_\theta^{c_-}).

A new sentence tomorrow may combine words already learned, without retraining sentence by sentence. An unseen condition type, however, does not become learned merely because we can write a formula. Classifier guidance can use a separately prepared helper; CFG relies on the generative model’s own conditioning abilities.

This changes the comparison baseline. The model must also understand the input c−c_-. It does not set “the probability of blurry images” to zero, and it no longer directly has the unconditional-base Bayes interpretation.

What if the model learns Flow Matching velocity?

Conditional training can also give a velocity model the input cc. Practice on a known reference path ItI_t, such as It=(1−t)X0+tX1I_t=(1-t)X_0+tX_1 from noise X0X_0 to data X1X_1, with label ∂tIt=X1−X0\partial_t I_t=X_1-X_0. Here t=0→1t=0\to1, unlike diffusion’s denoising toward t=0t=0.

The conditioning-dropout loss is

LdropFM(θ)=E[∥vθ(It,t,c~)−∂tIt∥2].\begin{aligned} &\mathcal L_{\mathrm{drop}}^{\mathrm{FM}}(\theta)\\ &=\mathbb E\big[\|v_\theta(I_t,t,\widetilde c)\\ &\hspace{4em}-\partial_t I_t\|^2\big]. \end{aligned}

The expectation averages over reference endpoints, times, and whether the condition is dropped; the label remains reference velocity. After learning both inputs, we can combine

v~θ(x,t,c)=vθ(x,t,∅)+w[vθ(x,t,c)−vθ(x,t,∅)].\begin{gathered} \widetilde v_\theta(x,t,c)\\ =v_\theta(x,t,\varnothing)\\ +w\big[v_\theta(x,t,c)\\ -v_\theta(x,t,\varnothing)\big]. \end{gathered}

An ODE solver follows this learned field to obtain a generated trajectory. Common Gaussian affine interpolations have a velocity–score conversion connecting to the intuition above. For a general reference path, however, subtracting two velocities alone does not show that the difference is a classifier log-gradient.

Both inputs, the combination, and its limits
Nori A polar bear in an orca hat

You ran CFG and read the conditioning-dropout loss, strength baseline, noise prediction, negative prompts, and Flow Matching correspondence. Producing an image does not make training prerequisites and computation costs identical.

Whom do we need to prepare?
Nori A polar bear in an orca hat
Revisit the partners’ proposals

Lumi proposed classifier guidance and Mugi proposed CFG. Place each action under its partner; read each completed row’s explanation before continuing.

Classifier guidance · Signal Ask another network for class probability, then differentiate with respect to the image.
CFG · Signal Query the same image with and without a condition, then subtract.
Classifier guidance · Preparation The helper learned class judgments at different noise levels.
CFG · Preparation The generative model practiced descriptions and empty conditions.
Classifier guidance · Per-step computation Compute the helper’s prediction and image input gradient.
CFG · Per-step computation Obtain both generative-model predictions.
Classifier guidance · New requests Prepare a noisy classifier for the new request; the base need not read it.
CFG · New requests The request must fall within the generative model’s conditioning abilities.
Classifier guidance · Limitations A separate helper is possible; check noisy judgments, input gradients, and cost.
CFG · Limitations No external classifier, but two prepared answers; high strength may reduce variation.

Which route fits the available tools?
Nori A polar bear in an orca hat

The model learned both text and empty inputs, and this class is within its capabilities. No external classifier is available. What would you try first?

Both required inputs were learned; combine their predictions during sampling.

Empty means unspecified, not forbidden.

Both inputs and this condition type were already learned.

How would you assess a different toolkit?
Nori A polar bear in an orca hat

You have only a clean-photo classifier and a generative model always trained with descriptions. The latter never practiced an empty condition. Which judgment about immediately applying these methods is reasonable?

Clean-photo judgments do not provide reliable noisy-image class probabilities and input gradients.

A conditional answer does not imply a learned no-condition answer. The second prediction needed for subtraction is unprepared.

The first needs a noisy classifier; the second needs a generative model trained on empty conditions. Neither is prepared here.

What does agreement between the plots establish?
Nori A polar bear in an orca hat

In this toy, classifier guidance and CFG with the same c, w, step count, and seed give nearly identical histograms. What explains this?

Bayes equates the ideal signals without removing network prerequisites or the sampler.

Analytic ideal predictions do not replace network training.

w changes the combined score, with finite-step and initialization error remaining.

What if the user provides only a scoring program?
Nori A polar bear in an orca hat

We can now connect a breed request to generation: identify the condition’s extra direction, then estimate it with available tools. We have addressed the corgi class, without guaranteeing the full snowy-mountain and snowboarding request.

The user now says, “These breeds are right, but I prefer certain compositions and lighting.” Their program scores only finished images. We have no noisy classifier for it, and the model has not learned this new preference. Before making high-scoring images more frequent, what should we decide?

Read Bayes’ rule, both guided noise predictions, and preparation details continuously in U7.1 Where Can a Fixed Model Get a Guidance Direction?.