You ask an image model for a lizard in sunglasses, and the picture is flat. You want the version people would pick, without ruining what the model knows. The paper treats this as control, and a 12 million parameter side network wins 69.6% of preference duels against Stable Diffusion v1.4 under PPO.
Slide the control cost τ down. The curve moves toward higher reward, and the drift read-out shows how far it left the pretrained curve. Then we build, piece by piece, why that trade is exact and how to learn it.
You need a rough idea of a probability distribution and what a neural network is. We teach diffusion, control and reward learning from zero.
Based on Diffusion Controller: Framework, Algorithms and Parameterization (arXiv 2603.06981, March 2026) by Tong Yang, Moonkyung Ryu, Chih-Wei Hsu, Guy Tennenholtz, Yuejie Chi, Craig Boutilier and Bo Dai, at Carnegie Mellon, Google Research, Yale and Google DeepMind. Every idea is re-taught here in our own words and devices.
A one-dimensional toy, not an image model: the pretrained distribution is two made-up bumps, the reward is r(x) = x, and the controlled curve is the paper's optimal form, the pretrained density times a weight (exp(r/τ) for KL, a clipped line for α = 2), computed numerically in your browser. Drift is the KL divergence from the pretrained curve, in nats. The paper itself works on Stable Diffusion v1.4 images.
Chapter 0
See why pushing a pretrained image model toward what you want costs quality, and why that trade needs one clear rule
Picture a painter who can draw anything you describe. You type “a lizard wearing sunglasses” and a picture appears. It is fine, but it is flat. You want the kind of picture people pick when they compare two. How do you make the painter do that without ruining what it already knows?
The painter is a diffusion model: a network that makes an image by starting from pure noise and cleaning it up in many small steps (Chapter 1 builds one from zero). It is pretrained, which means it already learned from a huge set of pictures. The paper in this lesson uses Stable Diffusion v1.4 as that painter.
People steer a pretrained painter in three main ways. The first happens while the picture is made. Guidance adds a second prediction at every step and nudges the picture toward the prompt. You change nothing in the model.
The second happens before. You train a small add-on. LoRA adds a few small weight matrices inside the model and trains only those. ControlNet trains a side copy of part of the network that feeds hints into the painter. The painter itself stays put.
The third uses a score. A reward model is a second network that looks at a picture and gives it a number for how much people like it. The paper uses HPS-v2, a model trained on human preference choices. Reinforcement learning fine-tuning (RLFT) changes the painter so its pictures earn higher scores.
Each method works. But the authors say they look like a patchwork. Each one has its own objective and its own tricks, and nothing links them. When something fails, you cannot say why.
All three share one hidden cost. The harder you push, the further the painter moves from what it learned. Far from what it learned, it makes strange pictures. The paper says it plainly: stronger steering needs a bigger departure from the pretrained model, and that can hurt sample quality.
You can feel this in a toy. Each dot below is one possible picture, drawn as a point on a plane. The ring marks the region that holds 95% of what the pretrained model makes. The yellow ramp is a reward that grows to the right. Push the whole cloud to the right and count what stays inside the ring.
Drag the push strength. Dots turn red when they leave the ring, the region the pretrained model finds plausible.
Illustrative toy: 300 seeded points from a two-dimensional bell curve, the ring holds 95% of that curve, and the reward is the x position. A real image has millions of numbers, not two. The straight push is the crudest possible steering; the rest of this lesson finds the best one for a given price.
At push 0 the cloud sits in the ring and the average reward is near zero. Push by 1.5 and the reward rises by 1.5, yet a clear share of dots has left the ring. Push by 3 and most have left. Reward went up and quality went down. Every steering method pays this bill, whether it says so or not.
The paper, Diffusion Controller: Framework, Algorithms and Parameterization, makes the bill explicit. It treats the cleaning-up steps as a process you can control, in the sense of control theory: you choose how each step moves, and you pay a cost for leaving the pretrained choice. Then the best push for any price can be worked out exactly.
Three results follow from that one view. The framework (Chapters 2 and 3) says what the best steered model looks like. The algorithms (Chapters 4 and 5) turn that answer into training rules: a PPO-style rule and a reward-weighted loss. The parameterization (Chapters 6 and 7) says how to build the steered model: keep the pretrained score and add a small correction from a side network.
That last point matters when you cannot open the painter. In the white-box setting you may change the backbone, for example with LoRA. In the gray-box setting the backbone is sealed, and you may only call it and read what it outputs at each step. This is like an API. The paper’s side network works in the gray-box setting, and it still beats LoRA in two of three training recipes (Chapter 9).
Chapter 1
Build a diffusion model from one drop of ink, and learn the two equations the rest of the paper rests on
Drop ink into a glass of water. The ink spreads until the whole glass is one grey cloud. Now play the film backward. The cloud pulls itself back into a single drop. A diffusion model learns to play that film backward, for pictures.
The forward film is easy, because we write it ourselves. We take a clean image and add a little random noise. Then we add a little more, again and again, until only noise is left. The hard part is the reverse film, and that is the part a network learns.
The paper numbers the steps so that time runs the way a reinforcement learning episode runs. The pure noise image is x1 and the clean image is xT. This is the reverse of most diffusion papers, and it is the first thing to hold in mind. A small step goes from a cleaner image xt+1 to a noisier one xt:
Many small steps collapse into one jump. Multiply the α values from step t up to T−1 and call the product ᾱt (read “alpha bar”). Then xt = √ᾱt xT + √(1 − ᾱt) ξ. Try it with two steps of α = 0.8. Then ᾱ = 0.64, so xt = 0.8 xT + 0.6 ξ. The weights 0.8 and 0.6 square to 0.64 and 0.36, which add to 1. The image fades as the noise grows, and the total size never changes.
To run the film backward you need one thing: at each noisy image, which noise was just added? The network εθ(xt, c, t) answers that. Its inputs are the noisy image, the condition c (the text prompt) and the step t. Its output is a tensor with the same shape as the image. We train it with a plain regression: make a noisy image from a real one, and ask the network to guess the noise we used.
loss = ½ ‖ ξ − εθ(√ᾱt xT + √(1−ᾱt) ξ, c, t) ‖2
The paper calls ε the score function. It points along the direction that makes the image look less like noise and more like data. So a good guess of the noise is also a guide toward cleaner images.
Sampling uses that guide one step at a time. Start from pure noise x1. At each step, the model proposes the mean of a bell curve for the next, cleaner image. Then we draw the next image from it:
This is the object the rest of the lesson reshapes. One step of the reverse film is one transition kernel: a rule that takes the current image and gives a bell curve over the next one. Hold on to that phrase. The paper steers a diffusion model by editing these kernels.
Each line is one image, reduced to a single number. The toy data is just two values, +1 and −1. Press Denoise or drag the step.
Illustrative toy with 25 steps and a made-up schedule (β falls from 0.35 to 0.02). With data that is exactly +1 or −1, the best noise guess has a closed form, so this is the real sampler with a perfect network, not a trained one. Images in the paper have 4 × 64 × 64 numbers, not one.
Early in the film the lines tangle in the middle. They are noise, and they have not chosen a side. Late in the film each line has locked onto +1 or −1. The model never decides at one moment. A little of the choice happens at every step. That detail is what makes control possible: every step is a place to push.
For a text prompt, the standard trick is classifier-free guidance. The network is trained with the prompt hidden a small share of the time (the paper uses 10%). At sampling time it runs twice, with and without the prompt, and extrapolates: ε̂ = (1 + λ) ε(x, c, t) − λ ε(x, ∅, t). The paper sets λCFG = 7.5. In code, the whole sampler is short.
def sample(eps, c, beta, abar, lam=7.5):
x = randn(4, 64, 64) # x_1: pure noise
for t in range(1, T): # x_T is the clean image
e = (1 + lam) * eps(x, c, t) - lam * eps(x, None, t) # guidance
mu = (x - beta[t] / sqrt(1 - abar[t]) * e) / sqrt(1 - beta[t])
var = beta[t] * (1 - abar[t + 1]) / (1 - abar[t])
x = mu + sqrt(var) * randn_like(x) # draw x_{t+1}
return x # shape (4, 64, 64)
Stable Diffusion also keeps a text encoder and an image autoencoder (the VAE) around the network. The paper freezes both and trains only the network that makes the noise guess.
Chapter 2
Treat each reverse step as a choice, tilt it toward reward, and pay a price for every tilt
Imagine a hiker crossing a foggy hill. Left alone, the hiker follows a habit: a trail worn by years of walking. At each step the hiker has a spread of places to put a foot, and the habit says which are likely. Now you stand beside the hiker. You can lean on the hiker a little, so likely places shift toward the summit. But the harder you lean, the further the hiker strays from the trail that kept them safe.
The pretrained diffusion model is that hiker. Its habit is the transition kernel from Chapter 1. This chapter sets up the leaning and its price. We build it in four small pieces.
A Markov chain is a process where the next state depends only on the current one. The reverse film is one. The state is the noisy image xt (with the prompt c and the step t riding along). The next state xt+1 is a random draw from the kernel. Nothing earlier matters.
Earlier papers on reinforcement learning for diffusion, such as DDPO and DPOK, call this a standard Markov decision process (MDP): a world where an agent picks actions. They set the action to be the next image xt+1 and the policy to be the kernel. The paper points out the catch. That “action” is the next state itself. The only real freedom is how the kernel is shaped. So why add an action at all?
The paper uses a smaller framework, the linearly-solvable MDP (LS-MDP) of Todorov (2006). It has no actions. The controller changes the kernel directly, and the pretrained kernel p0 is the passive dynamics: what the world does when you do nothing. The control u tilts the passive kernel with an exponential:
The integral on the right is a rule, not a choice. The new kernel must still add up to 1. So you cannot raise every place at once. If you add weight in one place, you take it from another. Any new kernel that gives weight only where the old one did can be written as such a tilt, so this form loses nothing.
A small case shows the shape. Say the next image is one number, the pretrained step is a bell curve with mean μ and variance β̃, and the tilt is a straight line, u(x) = a x. Multiply the bell curve by ea x. You get a bell curve of the same width whose mean moved to μ + aβ̃. A tilt of strength a pushes the mean by aβ̃. Drag it below.
Top: the pretrained step (blue) and the tilted step (warm). Bottom: net value against tilt a. Pick a cost τ, then drag a to the top of the curve.
Illustrative toy with made-up numbers: one step with variance β̃ = 0.5, and a future value that grows one-for-one with the next image, V(x) = x. The mean shift aβ̃ and the KL cost a²β̃/2 are exact for a bell curve tilted by a straight line.
The bottom curve is the whole story of the chapter. A tilt earns reward, because the mean moves toward a bigger future value. A tilt also costs something. The net value rises, peaks, and then falls. Where it peaks depends on the price τ.
The paper writes the price as a divergence: a number that says how far apart two distributions are, zero when they match. The best known one is the KL divergence, DKL(p ‖ q) = ∫ p log(p/q) dx. The paper allows a whole family, the f-divergences, Df(p ‖ q) = ∫ f(p/q) q dx, where f is a convex function with f(1) = 0. Choose f(s) = s log s and you get KL. Each choice of f penalizes drift in its own way.
At the end of the film we score the finished image with the reward r(xT, c). We want the chain of tilts that scores highest, minus the price paid at every step. Write Vu,t for the value we expect from state xt on, if we use control u:
Run the numbers from the toy with τ = 1. The gain is aβ̃ = 0.5a. The price is τ a²β̃/2 = 0.25a². At a = 1 the net is 0.5 − 0.25 = 0.25. At a = 2 the gain is 1.0, the price is 1.0, and the net is 0. The peak sits at a = 1/τ. This is a small preview of the next chapter: the best tilt is the future value divided by τ.
def tilt(p0, u):
"""p0, u: arrays over a grid of next images. Returns the controlled kernel."""
w = p0 * np.exp(u) # tilt the passive kernel
return w / w.sum() # the constraint: it must add up to 1
def kl(p, q):
return np.sum(p * np.log(p / q))
One goal remains. We want the best control u*, and then a diffusion model whose finished images follow it. The paper’s plan has two steps. Chapter 3 finds u*. Chapters 4 and 5 learn an ordinary score ε* whose samples land where u* would put them, using the usual regression of Chapter 1 but with images drawn from the controlled target.
Chapter 3
Work from the finished image back to the first step, and find that the best steered model is the pretrained one times exp(reward/τ)
You plan a road trip by starting at the destination. First you ask which towns are good places to be one hour from the end. Then which towns are good two hours out, because they lead to good places. You never plan from the front, because the front does not know where the road ends.
The best control works the same way. We start from the finished image, where the reward is known, and move backward through the steps. We use the KL price in this chapter, because it gives a clean answer. Chapter 4 returns to other prices.
At the last step the answer is simple. The score of the finished image is r(xT, c). We put it on an exponential scale and call it the goodness Z:
ZT(xT, c) = exp( r(xT, c) / τ )
Why exponential? The price in Chapter 2 is a KL, and KL involves a logarithm. A logarithm turns sums of reward into products of goodness. Dividing by τ sets the exchange rate between reward and drift.
One step earlier, the goodness of a state is the average goodness of where the passive step takes you. Use the pretrained kernel p0, not the controlled one:
This is the paper’s Bellman recursion (Eqs. 54 and 57), simplified. A Bellman recursion defines the value of a state from the value of the states that follow it. The “linearly solvable” in LS-MDP refers to this. The recursion is a plain average, with no maximum inside it. The hard optimization has been solved by the change to Z.
Now the best control follows. The best next-step distribution is the passive one, reweighted by the goodness of each landing place. The division by Zt is exactly the factor that makes it add up to 1, because Zt is the average of Zt+1 under p0:
Compare with Chapter 2. There the best tilt in the toy was a = 1/τ, the future value over τ. Here the tilt is exp(u*) = Zt+1/Zt = exp(V*t+1/τ)/Zt. It is the same rule, now exact for every step. Try it on a tree small enough to compute by hand.
Start at the left. Each choice has two even passive branches. Leaves show a reward. Thick lines are the best controlled probabilities, thin grey lines are the passive 50/50. Drag τ.
Illustrative toy with made-up rewards: leaves A1 = 3, A2 = 0, B1 = 1, B2 = 1, and a passive 50/50 choice at each fork. The goodness values and probabilities are computed exactly with the paper’s recursion (Eqs. 56 to 59).
Slide τ down. At τ = 0.5 almost every run goes to branch A and then to the 3-reward leaf. Slide it up and the controlled probabilities fall back to the passive 50/50, so the average reward falls back to 1.25. Small τ means a cheap price for drift, and the controller drifts a lot.
Chain the steps. Each controlled kernel carries a factor Zt+1/Zt. Multiply them across the film and every Z cancels except the first and last. What is left is the paper’s Eq. 60:
Sum over all the middle images and you get the answer the hero showed: the finished images of the best controlled model follow pu*(xT|c) ∝ p0,T(xT|c) exp(r(xT, c)/τ). The pretrained image distribution is reweighted by exp(reward/τ). That is the entire optimum. It explains KL-regularized reward fine-tuning in one line.
def optimal_kernel(p0, reward, tau):
"""p0[t][s] = dict of next state -> prob. Returns Z and the best kernel."""
Z = {s: np.exp(reward[s] / tau) for s in leaves} # Z_T
for t in reversed(range(T)): # work backward
for s in states[t]:
Z[s] = sum(p * Z[n] for n, p in p0[s].items()) # Z_t = E[Z_{t+1}]
return Z, {s: {n: p * Z[n] / Z[s] for n, p in p0[s].items()} for s in Z if s in p0}
You might think we are done: sample from P*, and the job is done. We are not. Zt(xt) is an average over every possible future of xt, and for images that is far too many to enumerate. The kernel P* has an energy-based form. To sample one step you would run an inner loop that estimates Zt+1 for each candidate. The paper avoids that. It learns a normal diffusion model whose finished images follow pu*, and then samples it the usual cheap way. That is the job of the next two chapters.
One honesty point. For a price other than KL, the best whole-film distribution is not generally the same as what the step-by-step LS-MDP gives. The paper notes that these differ for general f, and it still derives a useful loss in that case (Chapter 4). For KL the two agree exactly.
Chapter 4
Turn the best distribution into a training loss: study the pretrained model’s own pictures, and let the reward decide how much each one counts
A chef wants to cook what the judges love. There is no list of winning dishes to copy. But the chef can cook a hundred dishes, ask the judges to score them, and then study the recipes again. The high scorers get a lot of attention. The low scorers get almost none. After a while the chef’s habits tilt toward what wins.
That is the whole idea of a reward-weighted loss. This chapter shows why the idea is not just a heuristic here. For the paper’s control problem, a particular weight gives exactly the best model of Chapter 3.
Chapter 3 gave a target: finished images xT that follow p*(xT|c). If we had pictures drawn from p*, training would be the plain regression of Chapter 1. Eq. 10 of the paper writes it down: guess the noise that was added to xT ~ p*. But we have no pictures from p*. We only have the pretrained model and a reward model.
Here is the trick. The target is the pretrained distribution times a weight, p*(x) = p0(x) w(x). So the average of anything under p* is the average of w times that thing under p0. A picture from the pretrained model that counts w times is the same as a picture from p* that counts once. This is importance weighting. We can train on pretrained pictures and multiply each one’s loss by its weight.
The paper derives the weight instead of guessing it. Step back from single steps and look at whole films. Let P be any distribution over films and P0 the pretrained one. Ask for the P that maximizes expected final reward minus the price:
Write P = w P0, so w is the weight of each film. The weights must be zero or positive, and they must average to 1 under P0, so that P adds up to 1. The paper adds a multiplier b to enforce that average and sets the slope to zero (the standard calculus rules for optimizing under a constraint, called the KKT conditions). The result:
The max with 0 is the key change. A weight cannot be negative. So images with a reward far below the baseline get weight exactly zero for some divergences. Plug in the KL case, f(s) = s log s. Then (f′)−1(y) = exp(y − 1), so w = exp(r/τ) up to a constant. That is the Chapter 3 answer. For an α-divergence the weight is polynomial: wα = [ 1 + ((α−1)/τ)(r − b) ]+1/(α−1).
Put the weight in front of the regression. This is Theorem 1 of the paper:
Why does a weight not break the regression? The paper uses a lemma: if you weight a score-matching loss by any positive function of the noisy image, the best score is unchanged. The weights change which pictures matter, and the weighted pictures make a new target distribution. The best noise guess for that target is the score of p*. So the weighted loss has p*’s score as its minimizer.
One caution from the paper. For an f other than KL, the whole-film optimum p̃* generally differs from the stepwise LS-MDP optimum. The weighted loss then trains toward p̃*. The authors call it a meaningful surrogate and show it works in experiments.
Eight images have reward scores near 0.3, which is the size of a typical preference score. Choose a weighting rule and slide τ. Watch how much weight lands on the best image.
Bars show each image’s share of the total training weight. Images are sorted by reward, low to high.
Illustrative: eight made-up reward scores (0.262 to 0.318) and a baseline b equal to their mean, 0.290. “Reward itself” is the weight used by earlier reward-weighted methods (Lee et al., Fan et al.). The α rule is the paper’s Eq. 21 with α = 1 + τ, as in its RWL runs. Effective sample size is (∑w)²/∑w².
With the reward itself as the weight, every bar is close to 1/8. Nothing steers. With the exponential or the paper’s polynomial weight at τ = 0.01, one or two images carry most of the weight. The training concentrates on the best pictures. That is control, applied through a loss.
The paper’s own setting is stark. It uses τRWL = 5×10−4 with α = 1 + τ. The exponent 1/(α−1) is then 2,000. The baseline b is the mean reward of the first training batch. A weight that powerful is nearly a hard pick of the best image in each batch. Appendix D reports that a τRWL below 0.0005 broke the weight computation with not-a-number errors. That fits an overflow in a power of 2,000 or more, though the paper does not say so.
def rwl_step(net, prompts, reward_model, tau, b, alpha_m1):
x = sample(net, prompts) # online images from the current model
r = reward_model(x, prompts) # one scalar per image
w = (1 + (alpha_m1 / tau) * (r - b)).clamp(min=0) ** (1 / alpha_m1) # Eq. 21
t = randint(1, T)
xi = randn_like(x)
xt = sqrt(abar[t]) * x + sqrt(1 - abar[t]) * xi
loss = 0.5 * (w * ((xi - net(xt, prompts, t)) ** 2).sum(dim=(1, 2, 3))).mean()
loss.backward(); opt.step()
Chapter 5
Credit each denoising step for how much better than expected it made the final image, minus what the step drifted
A coach watches the film of a lost game. The score only appears at the final whistle. Which of the fifty moves caused the loss? The coach cannot know. But the coach can ask one question about each move: was it better or worse than a typical move from that position? Moves that beat the typical one get more practice. Moves that did not get less.
A diffusion model faces the same problem. Only the finished image gets a score, yet there are many steps to credit. This is the second training route in the paper. Chapter 4 learned from finished images. This route learns from the steps themselves, as policy gradient methods do.
A policy is a rule that chooses what to do next. Here the policy is the Gaussian reverse step of Chapter 1, now with parameters θ: pθ,t(xt+1|xt, c) = N(μθ(xt, c, t), β̃t I). The mean μθ comes from the noise network εθ in the same way as before. So θ lives inside the noise network, and the spread β̃t stays fixed. Training moves the means.
To weigh drift, write ζt+1 = pθ,t(xt+1|xt, c) / p0,t(xt+1|xt, c). This is the density ratio: how much more likely the trained step is than the pretrained step, at the point it actually went. With the reward only at the end, unfolding the value from Chapter 2 gives the paper’s Eq. 15:
For KL this reads simply: the value is the final reward minus τ times the total log ratio of all the steps that remain. Think of the ratio as a meter that counts drift in nats, the unit of information that uses the natural logarithm. One nat is about 1.44 bits.
The advantage of a step answers the coach’s question. It is the value you got after the step, minus the value you expected before it. The paper adds the price of that one step. With KL it is:
Take three steps with τ = 1. Say the log ratios are 0.10, 0.30 and −0.05, the final reward is 1.2, and a value estimate gives V0 = 0.80, V1 = 0.90, V2 = 1.10 (all made up). The advantages are:
| step | V after | − τ log ζ | − V before | advantage |
|---|---|---|---|---|
| 1 | 0.90 | −0.10 | −0.80 | 0.00 |
| 2 | 1.10 | −0.30 | −0.90 | −0.10 |
| 3 | 1.20 | +0.05 | −1.10 | +0.15 |
The three advantages add to 0.05. That equals the whole return, 1.2 − 0.35 = 0.85, minus the starting value 0.80. Step 2 drifted a lot (0.30 nats) and the future did not pay for it, so it earns a negative score. Step 3 moved back toward the pretrained step and gets a bonus. The price is already counted in each advantage.
The paper proves that the gradient of the expected value is the classic policy-gradient formula with this advantage (Proposition 1):
Two known methods drop out as special cases. Set τ = 0 and you get the REINFORCE-style gradient of DDPO. DPOK also uses a KL price, but it counts only the current step’s log ratio at step t. The paper’s Eq. 32 counts the sum of log ratios from step t to the end. The gradients differ in that regularization term.
Raw policy gradient can take a step that is too large and wreck the model. PPO (proximal policy optimization) limits the damage. It looks at the ratio ρ between the new and the old policy at the sampled step, and clips it to the band [1 − δ, 1 + δ]. Eq. 17 of the paper maximizes min( ρ A, clip(ρ, 1−δ, 1+δ) A ). Drag the controls to see where it goes flat.
The warm line is the objective. The shaded band is the clip region. Move the advantage and the ratio.
The curve is the exact formula min(ρA, clip(ρ, 1−δ, 1+δ)A) from the paper’s Eq. 17. The advantage values are illustrative. The paper’s PPO run uses τKL = 1e-4 and does not state δ in the main text, so the slider range is ours.
For a positive advantage, the objective rises with ρ until ρ reaches 1 + δ, then goes flat. The gradient is zero there, so the model gets no reason to move that step further. For a negative advantage the same happens below 1 − δ. PPO keeps each update near the policy that collected the data.
def ppo_loss(net, net_old, net_pre, traj, V, tau, delta):
loss = 0
for t in range(T - 1): # one term per denoising step
logp = log_normal(traj.x[t+1], mu(net, traj, t), var[t])
logp_old = log_normal(traj.x[t+1], mu(net_old, traj, t), var[t])
logp_pre = log_normal(traj.x[t+1], mu(net_pre, traj, t), var[t])
A = V[t+1] - tau * (logp_old - logp_pre) - V[t] # soft advantage, KL case
rho = exp(logp - logp_old)
loss -= torch.min(rho * A, rho.clamp(1 - delta, 1 + delta) * A)
return loss
Chapter 6
Learn what the optimum looks like, so you can build a model that only has to learn the difference
A tailor gets a suit that almost fits. The tailor does not cut new cloth. The tailor adds a tuck at the waist and lets out the sleeve. The tailor can do this because the final suit is the old suit plus two small changes. If the best steered model has the same shape, we should build only the changes.
This chapter shows that it does. It is the bridge from the theory to the network in Chapter 7.
The best step is the pretrained step tilted by Zt+1/Zt. A tilted Gaussian is still close to a Gaussian, with its mean moved. Chapter 2 showed this for a straight-line tilt: the mean moves by aβ̃. The noise guess ε sets that mean, so the best noise guess ε* is the pretrained guess ε0 with a change. The paper asks what shape that change has, under the KL price. It assumes the pretrained network is the exact minimizer of its own loss, and that the finished images have every number between −1 and 1.
The answer is Proposition 2. We state its structure and leave the constants to the paper:
Read it as a recipe. Everything the control needs to add fits in two objects: the gate z* (one scalar between 0 and 1) and the shift h* (one tensor). When the gate is 0, the control is the pretrained guess plus a shift. When the gate grows, the pretrained guess fades. Eqs. 24 to 26 of the paper have the exact constants.
Here is the second finding. The shift h* and the gate z* do not need a free-form network of xt. Both can be written as sums of random Fourier features. These come from a classic idea (Rahimi and Recht, 2007): pick random directions ω, and any smooth function can be built as a sum of cosines and sines along them. The features here are:
Then h* = (1/M) ∑i W*(ωi, c, t) φωi plus an error of size O(1/√M), and the logit of z* (the value before it is squeezed into the 0 to 1 range) has the same form with a vector u* in place of W*. The weights W* and u* depend on the prompt c and the step t, but only through those weights. Try the idea in one dimension. A smooth target function is fit by M random frequencies, with the weights solved exactly.
The warm curve is a smooth target. The teal curve is a sum of cosines and sines at M random frequencies. Add frequencies.
Illustrative toy: a made-up target as a function of the pretrained mean, 24 seeded random frequencies (the first M are used), and weights fit by ridge-regularized least squares on 80 points. The paper fixes M only in theory; its network learns the feature directions instead of sampling them.
With one frequency the fit is a rough wave. With three it already follows the main bump. By twelve it is hard to tell apart from the target. The paper’s result says the same thing in general: a modest number of random features is enough, and the error shrinks like 1/√M.
Look again at where the image goes in. It enters only through μ0. The prompt and the step, (c, t), choose the weights that pick and mix the features. This is the structure of cross-attention, where one stream (the image features) is read by another (the condition) through learned projections. The paper makes the link explicit: it is analogous to cross-attention with μ0 in place of xt. In practice it does not draw random ω at all, because that would make the batch too large. It lets the feature directions be learnable, which cross-attention projections do implicitly.
The design rule that falls out is short. Keep the pretrained score ε0 as the baseline. Give the control a small module with two heads, a gate and a shift. Feed it μ0, which the backbone already computes. Chapter 7 builds exactly that.
def eps_controlled(backbone, side_net, x_t, c, t, lam=1.0):
e0, mu0 = backbone(x_t, c, t) # noise guess and implied reverse mean (exposed outputs)
z, h = side_net(mu0, c, t) # gate z: 1 channel, shift h: 4 channels
s = -z * e0 - a[t] * (z * mu0 + b[t] * (1 - z) * h) # Eq. 28; a[t], b[t] from the schedule
return e0 + lam * s # Eq. 27
Chapter 7
Follow one latent image through the small network that learns the gate and the shift, and see why it can work on a sealed backbone
Picture a sealed engine in a car. You cannot open it. But it has a gauge on the outside that shows what it is doing at every moment. You bolt a small controller next to it. The controller reads the gauge and adds a gentle push to the output. It never touches the engine.
That is the gray-box idea. The backbone stays frozen and hidden. It only has to expose its outputs at each denoising step: the noise guess ε0 and the implied reverse mean μ0. Everything we train sits beside it.
Chapter 6 told us the shape of the best score. The paper turns it into a model with two equations. A side network sθ outputs the gate and the shift, and the controlled score is the pretrained score plus the side network’s correction:
Inside sθ the output is split into the gate zθ and the shift hθ, and combined as in Chapter 6 (Eq. 28 of the paper). It has two parts, a gate part and a shift part, exactly as the optimum predicted.
The side network is a small UNet, a network that shrinks an image to find big-picture features and then expands it again with shortcuts. The paper builds it from standard blocks: two plain residual down blocks, one middle block that cross-attends to the prompt, and two plain residual up blocks. A residual block adds its input back onto its output, which keeps deep stacks easy to train. Table 3 of the paper gives the channels at each stage. The input is a latent of 4 channels on a 64 × 64 grid. Step through it. Then switch to the Naive variant to see what changes.
Boxes are tensors: taller means a finer grid, wider means more channels. Drag the stage. Switch to Naive to see the two differences.
Channels and resolutions are the paper’s Table 3 (block channels 128 and 256, one layer per block, 64 × 64 latent for Stable Diffusion v1.4). The variants differ as in Table 4: the input, the output channels (5 against 4) and how the output is used. Both have 1.2 × 107 trainable parameters (Table 1).
At stage 7 the DiffCon network writes 5 channels: one for the gate, four for the shift. The extra channel is the only change to the output layer. The Naive network writes 4 channels and adds them straight onto ε0. It has the same body and the same parameter count, so any gap in the results (Chapter 9) comes from the form, not the size.
A little arithmetic shows how small the difference is. The input convolution has 3 × 3 filters from 4 channels to 128, so 4 × 128 × 9 = 4,608 weights and 128 biases, 4,736 numbers in all. The output convolution reads 128 channels. If the gate is one extra 3 × 3 output filter, it costs 128 × 9 + 1 = 1,153 numbers. Against 11.8 million parameters in the whole network, that is about 0.01%. The gate is almost free. The paper’s Table 4 says the two variants differ by one output channel, so this is our estimate of the size of that change.
The input is μ0, not xt. The theory says the image enters the optimal correction only through μ0 (Chapter 6). An ablation in the paper (Figure 14) found that feeding μ0 gave better results for the reward-weighted run than feeding xt.
The last layer starts at zero. The paper sets the output layer’s weights to 0. Then sθ = 0, and εθ equals ε0 on the first step of training. The model begins as the pretrained model and moves away only as far as the data pull it. LoRA does the same.
The blocks are cheap. The paper tried four block layouts (Table 11). The one with two plain residual down blocks and two plain residual up blocks, 11.8 million parameters, worked best. Layouts with attention blocks cost 13.4 and 18.5 million and did not win. It also noted that one gate channel and a tensor of shifts keep the correction “small and interpretable”.
λmodel turns the correction up. During training λmodel is 1. At test time the authors tried several values and report the best win rate among them for each checkpoint. That is a tunable dial, and a fair reading of the tables must remember it (Chapter 9).
| Method | What trains | Params | Access |
|---|---|---|---|
| DiffCon | side network sθ | 1.2 × 107 | gray-box |
| DiffCon-Naive | same body, ungated residual | 1.2 × 107 | gray-box |
| LoRA, rank 16 | low-rank adapters inside the backbone | 1.7 × 107 | white-box |
| DiffCon-J | LoRA rank 4 and side network, trained jointly | 1.6 × 107 | white-box |
| DiffCon-S | LoRA rank 4 and side network, trained apart, combined at test time | 1.6 × 107 | white-box |
class SideNet(nn.Module):
def __init__(self):
super().__init__()
self.unet = UNet(in_ch=4, out_ch=5, # 4 latent channels in, 1 gate + 4 shift out
block_out=(128, 256), down=("Down", "Down"), up=("Up", "Up"),
mid="CrossAttn") # the middle block reads the prompt
nn.init.zeros_(self.unet.conv_out.weight) # start as the pretrained model
def forward(self, mu0, c, t): # mu0: (B, 4, 64, 64)
o = self.unet(mu0, t, c) # (B, 5, 64, 64)
return o[:, :1], o[:, 1:] # z: gate channel (B, 1, 64, 64), h: shift (B, 4, 64, 64)
One honest gap. The main text does not say how the side network combines with classifier-free guidance at 7.5. We show the structure and leave that detail to the paper’s code and appendix.
Chapter 8
Follow the data and the loss through supervised tuning, reward-weighted regression and PPO, and see exactly what differs between them
A kitchen has one stove and one set of pans. A cook can learn three ways. Copy a cookbook. Cook, taste and study the best dishes. Or cook, taste and adjust every move with a coach. The pans are the same. What changes is where the food comes from and how the lesson is scored.
The paper tests its side network under three recipes. The network and the sampler are the same each time. Only the data source and the loss change.
SFT is supervised fine-tuning. You have target images. The paper uses the “winner” images and their prompts from the Human Preference Dataset v2 (HPD v2): pairs where people picked one image over another. The loss is the plain noise-guess regression of Chapter 1, with those images as xT. The paper notes this is the same as classifier-free guidance training. It trains with batch size 128 for 1,000 iterations.
RWL is the reward-weighted loss of Chapter 4. There are no target images. The reward model is HPS-v2, a network trained on human preference choices. The weight is the polynomial one of Eq. 21 with τRWL = 5×10−4, α = 1 + τRWL, and a baseline b equal to the mean reward of the first training batch. Every 2 iterations, 64 prompts make 64 images with the current model, and then two gradient steps use that batch. It trains for 2,000 iterations at batch size 64.
PPO is the KL-regularized online PPO of Chapter 5, with the same HPS-v2 reward, τKL = 1×10−4, batch size 64 and 2,400 iterations. The data are online: they come from the current model, not from a fixed set.
All three use Stable Diffusion v1.4 with the text encoder and the image autoencoder frozen. Only the latent noise network is trained. The sampler uses classifier-free guidance at λCFG = 7.5, with the prompt dropped 10% of the time in training, and Adam for the optimizer. DiffCon uses a learning rate of 1e-5 in every recipe. LoRA uses 1e-5 for SFT and 1e-4 for RWL and PPO.
Pick a recipe, then press Run one iteration. The pulse walks the five stages. Boxes that differ from SFT are outlined in warm.
Hyperparameters are from the paper’s Section 5.1: SFT batch 128 for 1,000 iterations; RWL batch 64 for 2,000 iterations, sampling every 2; PPO batch 64 for 2,400 iterations. The five-box layout is our summary of the loop, not a figure from the paper.
Look at the boxes that light up in warm. SFT never calls a reward model and never samples from itself, so it is cheap. RWL and PPO both need fresh images from the current model, and both need the reward. RWL then trains with one weighted regression. PPO needs the whole path of steps stored, a value estimate for the advantage, and the old policy for the ratio.
There is one subtle point in RWL. In Theorem 1 the images xT come from the pretrained model, because the weight turns them into samples of the target. In practice the paper draws images from the current model every 2 iterations, which it calls online sampling. Its Figure 8 compares both settings, which it names teacher sampling and online sampling, and tests its polynomial weight against the DPOK reward weight in each. Online sampling is a practical choice, and the target the loss chases then moves as the model improves. That is one reason the baseline b and the price τ matter so much.
The loop is the same shape in all three. This code is our own condensed summary, using the formulas from the earlier chapters:
def finetune(recipe, net, pre, iters):
for it in range(iters):
if recipe == "sft":
prompts, x = next(hpd_winners) # fixed target images
loss = noise_regression(net, x, prompts) # Eq. 10
elif recipe == "rwl":
if it % 2 == 0: # fresh images every 2 iterations
prompts, x = sample_with(net, 64)
r = hps_v2(x, prompts)
w = (1 + (r - b)).clamp(min=0) ** (1 / tau) # Eq. 21 with alpha = 1 + tau
loss = weighted_noise_regression(net, x, prompts, w) # Eq. 19
else:
traj = sample_trajectories(net, 64) # keep every x_t
loss = ppo_loss(net, net_old, pre, traj, V, tau, delta) # Eq. 17
loss.backward(); opt.step(); opt.zero_grad()
# net is DiffCon: only side-net weights have grads, the backbone is frozen
Because the parameterization only adds a correction to the score, it does not care which loss you use. The paper calls the parameterization orthogonal to the learning algorithm. That is why the same side network can be compared under all three.
The main metric is the win rate: show the same prompt to two models, score both images with HPS-v2, and count how often the tested model scores higher. 0.5 is a tie. The test set is the HPS-v2 prompt set. As a sanity check against reward hacking, the paper also reports CLIP, Clip-Aesthetics and PickScore (Chapter 10). For PPO it adds a human study with more than 50 raters on 50 prompts, four images each.
One protocol detail will matter later. For every checkpoint the authors tried a few values of the test-time guidance λmodel and report the best HPS-v2 win rate among them. For SFT and RWL the DiffCon sweep covers 1/λmodel from 0.1 to 1.0. For PPO it covers 0.7 to 1.0. LoRA has no such dial.
Chapter 9
Read Table 1 row by row, compare methods with the same budget, and see where the gray-box side network wins and where it loses
A race has a time, a rank and a course. The time alone does not tell you much. You need to know what the others ran and on which road. A results table is the same. This chapter reads the paper’s main table slowly, with that in mind.
A win rate of 0.6667 means that in 66.67% of head-to-head comparisons, the tuned model’s image scored higher on HPS-v2 than the pretrained model’s image for the same prompt. A tie is 0.5. Each number comes with a ± spread, which the table reports but the main text does not define in terms of runs, so treat it as a rough error bar.
There are five methods and three recipes. Parameter counts are the number of trainable weights. All use Stable Diffusion v1.4.
Pick a recipe. Bars show the win rate against the pretrained model, with the paper’s spread as a thin line. The dashed line is 0.5, a tie.
All numbers are from the paper’s Table 1 (HPS-v2 win rate against the pretrained model on the HPS-v2 test prompt set, at the end of training, with the spread the table reports). For the side-network methods the paper reports, for each checkpoint, the best win rate over a few test-time λmodel values. Parameters: DiffCon and Naive 1.2 × 107, LoRA 1.7 × 107, DiffCon-J and DiffCon-S 1.6 × 107.
One. The form beats the size. DiffCon and DiffCon-Naive have the same body and the same 12 million parameters. Under SFT DiffCon wins 66.67% and Naive wins 56.55%. Under RWL it is 68.15% against 50.60%. Under PPO it is 69.57% against 52.01%. Naive barely beats a coin flip in two of the three. The gate and shift form, with μ0 as input, is what carries the gain.
Two. Gray-box beats white-box in two recipes. The side network, with no access to backbone weights and 12 million parameters, beats LoRA at 17 million under SFT (66.67% against 57.66%) and under RWL (68.15% against 61.09%). That is 9.0 and 7.1 points ahead, with 29% fewer trainable weights.
Three. PPO is the exception. Under PPO LoRA reaches 90.48% and DiffCon only 69.57%, about 20.9 points behind. The paper says it plainly: for PPO, the white-box methods reach above 0.9. One plausible reading, which the paper does not test, is that a frozen backbone leaves less room to move in this recipe.
Four. Adding the side network to LoRA helps. DiffCon-J and DiffCon-S use a smaller LoRA (rank 4) plus the side network, for 16 million parameters. Under PPO they reach 93.53% and 93.15% against LoRA’s 90.48%. Under SFT both reach 69.64% against 57.66%. Under RWL DiffCon-S is best at 70.91% and DiffCon-J reaches 65.55%.
Here is a back-of-envelope check on the efficiency claim. Take the win rate above a tie, per million trainable parameters. Under SFT, DiffCon gets (0.6667 − 0.5)/12 = 1.4 points per million, and LoRA gets (0.5766 − 0.5)/17 = 0.45. Under PPO, DiffCon gets 1.6 and LoRA gets 2.4. This is our crude arithmetic, not a measure from the paper. It shows why the abstract says “trade-off”: the side network is far ahead per parameter in two recipes and behind in the third. Parameters are also not the same as time or memory, which the tables do not report.
Figure 3 of the paper puts methods against each other directly instead of against the pretrained model. These are read from the bars in that figure, so treat them as approximate:
| Pair | SFT | RWL | PPO | PPO, human raters |
|---|---|---|---|---|
| DiffCon vs DiffCon-Naive | 0.536 | 0.597 | 0.613 | 0.596 |
| DiffCon-J vs LoRA | 0.554 | 0.517 | 0.520 | 0.536 |
| DiffCon-S vs LoRA | 0.568 | 0.507 | 0.527 | 0.520 |
Every value is above 0.5, so every pairing favors the side-network variant. The human study agrees in direction for PPO: raters preferred DiffCon over Naive in about 60% of comparisons. The white-box pairings against LoRA sit between 0.507 and 0.568, close to a coin flip, and the paper reports error bars only for the HPS-v2 numbers.
Three limits shape how to read these numbers. First, RWL and PPO train on HPS-v2, and the win rate is measured with HPS-v2. A tuned model that learned the reward model’s taste will do well here by design. Chapter 10 looks at the other scorers. Second, the test-time λmodel is picked for the best win rate among a handful of values, which favors the side-network methods a little, since LoRA has no such dial. Third, there is one backbone, Stable Diffusion v1.4, and one task, text-to-image. The paper itself lists personalization, safety alignment and transfer as future directions.
def win_rate(tuned, pretrained, prompts, reward):
wins = 0
for c in prompts: # the HPS-v2 test prompt set
a = sample(tuned, c) # image from the tuned model
b = sample(pretrained, c) # image from the pretrained model
wins += float(reward(a, c) > reward(b, c)) # 1 if the tuned image scores higher
return wins / len(prompts) # 0.5 is a tie
Chapter 10
Check whether a higher win rate means better pictures, see which knobs mattered, and list what the paper leaves open
A student who studies for one exam and aces it has not yet shown they learned the subject. You would give a different exam. The win rates in Chapter 9 come from the same scorer that RWL and PPO trained against. So the paper gives other exams too: CLIP, Clip-Aesthetics and PickScore. This chapter reads those, then the knobs the authors turned, then the limits.
CLIP scores how well an image matches its prompt. Clip-Aesthetics scores how pleasing an image looks. PickScore is a second human-preference model, trained on different data than HPS-v2. If tuning only learned the quirks of HPS-v2, these scores would fall while the win rate rises. The pretrained model scores 0.2750 on CLIP, 5.5163 on Clip-Aesthetics and 0.2103 on PickScore. The plot shows each method as a percent change from those values.
Choose a recipe and a scorer. Bars to the right beat the pretrained model on that scorer, bars to the left fall below it.
Values are from the paper’s Tables 8 to 10 (means; the tables also give spreads). The bar is the percent change from the pretrained value, (method − pretrained) / pretrained. The paper reports these scores to show quality is “not compromised”; the percent view is ours.
Try PPO with CLIP. LoRA, DiffCon-J and DiffCon-S all reach 90% or higher win rates, and their CLIP scores fall by about 3.3% to 4.2%. Switch to PickScore and the same three methods rise, from 0.2103 to 0.2125, 0.2133 and 0.2142. So an independent preference model agrees with HPS-v2, while the prompt match slips. DiffCon alone, under PPO, loses 1.4% on CLIP and 3.3% on Clip-Aesthetics (5.3370 against 5.5163), the biggest aesthetics dip of any row. Its PickScore also slips, from 0.2103 to 0.2094. The drops are small, but they are not zero. The honest reading is mixed: the preference scorers agree for the three strongest methods, and the other two scorers give up a little.
You can run this kind of check on any tuned model. First, pick scorers that the training never saw. Second, compute the percent change from the untuned model, as the plot does. Third, compare it with a control, such as DiffCon-Naive here, so you can see whether a drop comes from the method or from tuning in general. Under PPO, Naive moves little on every scorer: CLIP 0.2748, aesthetics 5.5186, PickScore 0.2106. It also barely raises its win rate, 0.5201. A model that does not move much cannot hack much. So the drops in the strong methods are the price of their gains, and the paper’s own claim that quality is not compromised is true only up to those small dips.
The appendix turns one knob at a time. Here is what it found.
| Knob | What the paper found |
|---|---|
| τKL for PPO, values 0, 1e-5, 1e-4, 5e-4, 1e-3 | 1e-4 was best. With the regularizer too small, or zero, the reward does not go up (Figure 10). |
| τRWL, values 0.0005, 0.0025, 0.005 | Smaller was better, but below 0.0005 the weight computation broke with not-a-number errors. 0.0005 was used (Figure 11). |
| Weighting function for RWL | The exponential weight with τRWL = 0.0015 also works: DiffCon beats LoRA again (Figure 12). The paper also compares its polynomial weight with the DPOK reward weight (Figure 8). |
| Learning rate | LoRA likes 1e-4 for RWL and PPO. DiffCon likes 1e-5 (Figure 9). |
| Side-network blocks | Two plain residual down blocks and two up blocks (11.8M parameters) were best. Adding attention blocks cost 13.4M or 18.5M (Table 11, Figure 13). |
| Side-network input | Feeding μ0 beat feeding xt for RWL (Figure 14). |
| Test-time λmodel | Larger values improved generation quality for SFT and RWL (Figures 4 to 7). |
Two of these are worth a second look. The PPO result says the regularizer is not only a safety rope. With no price, the paper’s runs did not gain reward at all, so the KL term shaped learning, not just the result. And the τRWL floor fits a numerical limit more than a theoretical one, as Chapter 4 noted.
Scope. All experiments use one backbone (Stable Diffusion v1.4) and one task (text-to-image preference alignment). The conclusion names personalization, safety alignment and transfer learning as directions still to be tried.
Theory. Proposition 2 assumes the pretrained network exactly minimizes its loss, that finished images have every number in [−1, 1], and that the price is KL. For other f-divergences, the weighted loss is a surrogate for the whole-film optimum, which can differ from the step-by-step one. The paper says so. How much the choice of f matters beyond the exponential and polynomial weights is not studied.
Access. Gray-box still needs the backbone’s per-step outputs. A service that returns only finished images cannot be controlled this way.
Efficiency. The abstract speaks of better quality-efficiency trade-offs. The tables measure efficiency as trainable parameters. They do not report wall-clock time, memory or the cost of calling the backbone at each step. That part is our reading of what is missing, not a claim by the authors.
The PPO gap. In the one recipe where reward rises most, the frozen-backbone method trails LoRA by about 21 points. Whether better side networks, a larger λmodel range or other tricks close that gap is open.
Chapter 11
Test your sense of the numbers, then keep the summary, the table, the core code and the links
Here is the whole paper in one paragraph. Reverse diffusion is a chain of kernels. Steering it means tilting each kernel by exp(u) and paying τ times an f-divergence for the tilt. With a reward only at the end, the best controlled model is the pretrained model times a weight of the final reward: exp(r/τ) for KL. That answer gives two ways to train: a reward-weighted regression on the pretrained model’s images, and a policy gradient with a soft advantage that includes the price, with PPO on top. It also gives the shape of the model: the pretrained score plus a gate and a shift that read the pretrained mean. A small side network with that shape, started at zero, steers a frozen Stable Diffusion v1.4 better than the same network without the shape, and in two of three recipes better than LoRA.
Pick a method and a recipe, set your guess for its win rate against the pretrained model, then reveal the paper’s number.
Choose a recipe and a method. Slide your guess along the line. Press Reveal.
Values are the means in Table 1 of the paper: HPS-v2 win rate against the pretrained model on the HPS-v2 test prompt set.
| What | Value | Source |
|---|---|---|
| DiffCon win rate vs pretrained, SFT / RWL / PPO | 0.6667 / 0.6815 / 0.6957 | Table 1 |
| DiffCon-Naive, same 1.2 × 107 parameters | 0.5655 / 0.5060 / 0.5201 | Table 1 |
| LoRA rank 16, 1.7 × 107 parameters | 0.5766 / 0.6109 / 0.9048 | Table 1 |
| DiffCon-J, LoRA rank 4 plus side net, 1.6 × 107 | 0.6964 / 0.6555 / 0.9353 | Table 1 |
| DiffCon-S, trained apart | 0.6964 / 0.7091 / 0.9315 | Table 1 |
| Side network, best layout, trainable parameters | 11,810,621 (two residual down, two residual up, channels 128 and 256) | Table 11 |
| Training: batch and iterations (SFT / RWL / PPO) | 128 × 1,000 / 64 × 2,000 / 64 × 2,400 | Sec. 5.1 |
| Prices and weights | τRWL = 5e-4, α = 1 + τRWL; τKL = 1e-4 | Sec. 5.1 |
| Sampler and training common settings | λCFG = 7.5, prompt dropout 0.1, Adam, DiffCon learning rate 1e-5 | Sec. 5.1 |
| Human study (PPO) | more than 50 raters, 50 prompts, four images each | App. C |
| Term | Plain meaning |
|---|---|
| Passive dynamics | What the pretrained model does by itself: its reverse kernels p0,t. |
| Control, tilt | The factor exp(u) that reweights a kernel. It must keep the kernel adding up to 1. |
| LS-MDP | A control problem where the controller picks the next-state distribution directly. Solved by a plain average, hence “linearly solvable”. |
| f-divergence | A family of distances between distributions. KL is one member. |
| Goodness Z | exp(V*/τ): how rewarding a state’s future looks, averaged under the pretrained step. |
| Reward-weighted loss | Noise regression on pretrained images, each multiplied by a weight from its reward. |
| Soft advantage | How much better than expected a step was, with its drift price included. |
| Gate, shift | The two outputs of the side network: z fades the pretrained guess, h moves it. |
| Gray-box | The backbone is sealed but exposes its per-step outputs. |
| Win rate | The share of head-to-head prompts where the tuned model’s image scores higher. |
# 1. The best controlled image distribution (KL): p*(x) ~ p0(x) * exp(r(x) / tau)
# 2. Train toward it by weighting the pretrained model's own images (Theorem 1)
def rwl_weight(r, b, tau, alpha_m1):
return (1 + (alpha_m1 / tau) * (r - b)).clamp(min=0) ** (1 / alpha_m1)
# 3. The model form: frozen score + gated, shifted correction from a side network (Eqs. 27, 28)
def eps_theta(backbone, side, x_t, c, t, lam=1.0):
e0, mu0 = backbone(x_t, c, t) # the only things we need from the backbone
z, h = side(mu0, c, t) # the side network reads the pretrained mean
s = -z * e0 - a[t] * (z * mu0 + b[t] * (1 - z) * h)
return e0 + lam * s
# 4. Sample as usual: same reverse step, same guidance, new score
x = randn(4, 64, 64)
for t in range(1, T):
x = reverse_step(x, eps_theta(backbone, side, x, c, t), t)
Earlier reinforcement-learning methods for diffusion, such as DDPO and DPOK, treat the denoising chain as a standard MDP. DDPO is the τ = 0 case of this paper’s policy gradient. DPOK adds a KL price but counts it step by step. DRaFT instead sends gradients through a differentiable reward. DPO-style methods learn from pairs of preferred and rejected images. Tang and Zhou link continuous-time diffusion tuning to entropy and f-divergence control, and the authors build on that line. On the model-form side, LoRA edits the backbone, while ControlNet, T2I-Adapter and IP-Adapter add side modules that act like guidance. The paper’s side network differs in that its form is derived from the control solution and it reads the pretrained mean.
Tong Yang, Moonkyung Ryu, Chih-Wei Hsu, Guy Tennenholtz, Yuejie Chi, Craig Boutilier and Bo Dai. Diffusion Controller: Framework, Algorithms and Parameterization. arXiv:2603.06981, March 2026. arxiv.org/abs/2603.06981. The authors are at Carnegie Mellon, Google Research, Yale and Google DeepMind. Every number in this lesson comes from the paper unless it is labelled illustrative. The toy devices use made-up numbers to show how the mechanisms behave.