There’s a Damped Oscillator Hiding Inside DMD
“Guiding forces” and “brakes” in few-step diffusion distillation: the student and the fake chase each other around, and when you simplify the math, it’s literally a damped spring. Comes with three live toys you can play with.
Some intuition-first notes on DMD training dynamics, put together while working on eDMD. Rather than theorems and benchmark tables, I just want to share the physical picture — a damped spring oscillator — that makes the student–fake loop easy to think about, along with three small interactive sandboxes you can play with in the browser.
TL;DR
- In DMD, the student moves along “teacher’s answer − fake’s answer,” while the fake constantly chases the student’s current distribution. Eliminate the fake, and you get a damped harmonic oscillator.
- Spring stiffness comes from the fake tracking the student, damping comes from the fake’s lag, and the fake’s initialization only sets initial velocity — never the final resting point.
- That’s why fixed “engines” like CFG can’t stop on their own and need a tracking “brake.” Crucially, the brake is the fake moving, not the DM loss term by itself.
- Staircase jumps, overshooting and swinging back, and why fres can destabilize training all pop right out of this toy. Still, a toy is a toy — Section 09 lays out where you shouldn’t take it literally.
Contents
- A 30-second DMD refresher
- The force is “constructed”
- Two lines of algebra → a spring
- An engine needs a brake
- The triangle: where the fake starts
- The staircase: strong–weak pairs
- fres: pushing away from a “bad self”
- Going deeper (optional math)
- Where this toy breaks down
- What should the brake actually see?
01A 30-second DMD refresher
DMD (Distribution Matching Distillation) distills a slow multi-step diffusion model into a 1-to-4-step student. There are three players on the board:
Teacher T
The original multi-step diffusion model, frozen throughout. It knows what good images look like.
Student G
The few-step generator we are actually training.
Fake F
Another diffusion model (the critic) continuously trained to fit the student’s current outputs. Usually initialized from the teacher.
Each step, the student generates an image, we add fresh noise to it, and we ask both the teacher and the fake: “what clean image do you think this came from?” The student updates along the difference between their answers:
When CFG is on, the teacher’s answer becomes \(T^w = T_c + (w-1)(T_c - T_u)\). D-DMD splits this difference into two pieces:
Their punchline: CA is the engine, and DM is the regularizer.
What got me obsessing over this was a puzzling pattern in our experiments: our 4-step student didn’t just match the teacher — its preference score beat the teacher at every CFG scale we tried, and kept climbing even after surpassing it. No extra data, no reward model, no discriminator. So where does this “force to keep getting better” come from? Who is pushing, and who is stopping it?
Viewed through a dynamics lens, the whole loop looks uncannily like high-school physics.
02First observation: the force is “constructed”
Start with the simplest case: no CFG (cfg = 1), so the update is just \(T_c - F\).
Notice one easy-to-miss detail: the fake is initialized from the teacher (zero-init LoRA). So at step 0, \(F = T_c\) and the push is literally zero. Nothing is moving the student yet.
Where does the push come from? As the fake trains on the student’s blurry early outputs, it first degrades from “good” (teacher) toward “bad” (student). Only once the fake moves away from the teacher to chase the student does \(T - F\) wake up and start pulling the student toward the teacher.
Splitting the actual force makes this crystal clear. Let \(F_q\) be an idealized fake that tracks the student instantaneously, and \(F_t\) be the actual lagging fake:
At step 0 those two terms cancel out completely. Even better: in a linear-tracking toy, the fake is simply an exponential moving average (EMA) of the student’s past positions. That means the construction residual is “current student − past student” — and at first order, that acts just like momentum.
03Two lines of algebra → a damped spring
Let’s write down the simplest possible toy: every distribution is an isotropic Gaussian with the same variance, so we only track means. Let \(m\) be the student mean, \(f\) be the fake mean, and \(G\) be the teacher’s target mean (just the conditional teacher at cfg = 1, or the guided target with CFG). Then the two DMD updates are exact:
Solve the first equation for \(f = G - \dot m/\eta\), differentiate, and plug into the second:
If ODEs make your eyes glaze over, just picture this: the target \(G\) is the finish line, and the fake is a shadow trailing behind the student. When the shadow lags behind (small \(\kappa\)), the student crosses the finish line while its shadow is still way back — so the “target − shadow” pull hasn’t turned off yet! Momentum carries the student past the line, until the shadow catches up and yanks it back. That back-and-forth is underdamped oscillation.
Every term in the classic damped oscillator maps 1-to-1 onto DMD:
| Spring oscillator | What it is in DMD |
|---|---|
| Equilibrium \(G\) | The teacher’s answer (shifted by CFG when guidance is on) |
| Spring stiffness \(\eta\kappa\) | The “leverage” from fake tracking the student. Freeze the fake, and the spring disappears |
| Damping \(\kappa\) | Fake’s tracking rate. Slow fake = lag = underdamped ringing |
| Damping ratio \(\zeta = \tfrac12\sqrt{\kappa/\eta}\) | How fast the fake moves relative to the student |
| Initial velocity \(\dot m(0) = \eta\,(G - F_0)\) | Where the fake starts. Sets how you launch, never where you land |
So for \(\kappa/\eta \lt 4\) the loop is underdamped (overshoot and ringing); \(\kappa/\eta = 4\) is critical damping; above that it’s overdamped and creeps in slowly. (Careful: \(\kappa/\eta\) is the effective tracking speed ratio, not literally the fake:student step ratio in your training script.)
Easier to feel than to read — try dragging the sliders below:
Click preset ② (κ/η = 4, critical damping) and watch the dashed gray “ideal fake” (an oracle critic always equal to the student). In the original toy, the critically damped lagging fake settles within 1% in 70 steps, while the perfect ideal fake takes 90 steps. Why? Because lag is momentum. Give it too much momentum (preset ④), of course, and you overshoot.
Put another way, the fake isn’t just a passive ruler measuring the student from the outside — its own tracking dynamics literally become part of the student’s optimizer. A little lag gives you momentum for free; too much lag turns it into ringing.
04An engine needs a brake
Now turn on CFG. In this equal-variance toy, the CA term \((w-1)(T_c - T_u)\) is a constant push — same magnitude no matter where the student is. It has no built-in way to know when to stop.
What stops the student is the DM term \(T_c - F\): as CA pushes the student away from the teacher, the fake follows along, so DM grows backward until it exactly balances CA at \(G\). Notice it’s a balance, not both terms vanishing — the engine is still roaring, and the brake is pushing equally hard the other way.
The key line: the brake isn’t the DM term — it’s the fake moving
Look closely at the dashed pink curve in Fig 4: the DM term is still in the loss, we only froze the fake, and the student runs away identically. Behind this is a one-line identity. Because the fake starts at the teacher (\(F_0 = T_c\)):
DM is literally just “how far the fake has moved from initialization.” Freeze the fake and DM is identically zero — “CA + DM” and “CA only” are bit-for-bit identical. So in the classic ablation where “CA alone collapses and adding DM stabilizes it,” everything DM contributes is letting the fake move.
To be fair, D-DMD wasn’t wrong here: their observer experiment explicitly showed that the fake learns the student’s failure modes and DM cancels them out — they just called that a “regularizer.” I find it much clearer to call it what it is in control theory: the sensor in a feedback loop.
A 2-D particle toy makes this jump off the screen — same guiding force, just swapping out the brake:
Put it in control-theory language
Line everything up, and the entire DMD family is a textbook closed-loop controller:
- Setpoint (guiding force): the answer A from a “better model” — a CFG-guided teacher, a strong–weak pair like PAG / autoguidance, or a few steps of teacher integration. A decides where the student lands.
- Sensor (brake): the fake measures where the student currently is. It decides whether the student stops at all, and how accurately.
Once you read it that way, every brake failure maps straight to a standard control-theory bug:
| What went wrong with the brake | Control-theory name | What happens in DMD |
|---|---|---|
| No sensor (frozen fake / CA only) | Open loop | Runs away linearly or collapses onto an extreme mode |
| Lagging sensor (fake too slow) | Underdamped | Overshoots and oscillates |
| Biased sensor (fake fits the wrong distribution) | Steady-state offset | Stops in the wrong place |
| Sensor measures the wrong quantity | Unobserved state | Intermediate steps have force without a brake and drift |
| Fixed-target penalty (e.g., mean/var KL) | Proportional only (no integral) | Stabilizes, but leaves steady-state error — matches D-DMD’s “stable, worse quality” finding |
That’s also why swapping DM for a static regularizer (like pinning mean and variance back to the teacher) stabilizes training at the cost of quality: a static penalty holds you back with a fixed tether and leaves a steady-state bias, whereas a tracking fake acts as a feedback sensor — the error only vanishes once the student’s actual distribution matches the setpoint. Rows 3 and 4 of this table turned out to be the biggest lead of all (what distribution should the fake actually fit?), which we’ll come back to in the last section.
05The triangle: where the fake starts bends the path
Move up to 2-D and a neat geometric picture appears. Three points sit on the plane: the conditional teacher \(p_c\), the unconditional teacher \(p_u\), and the CFG target \(G = p_c + (w-1)(p_c - p_u)\). Drop the untrained student somewhere off to the side, and you get a triangle.
The oscillator equation tells us: where the fake starts only sets the student’s initial velocity \(\eta\,(G - F_0)\). So:
- Fake starts at teacher (standard): initial velocity is pure CA (straight up). Since \(p_c\) isn’t on the student → target line, the student swings sideways along CA first, then curves back;
- Fake starts at target G (anchored): zero initial velocity, then accelerates straight down the line to \(G\);
- Fake starts at student: largest initial kick aimed right at \(G\) — straight path, but maximum momentum and most overshoot.
Play with it for a few seconds and three things stand out:
- All three paths land at the exact same fixed point. Initialization is purely transient; once the fake is fast enough (κ/η ≥ 4), the gap shrinks to a handful of steps.
- “Straighter” doesn’t mean “settles faster.” Under GD, anchoring crosses 1% first by a wide margin — only because it rockets right past the target and swings back! Measured by actually staying within 1%, both take almost the same number of steps (163 vs 173 at κ/η = 1). It’s an easy metric trap: “first time within threshold” rewards overshooting.
- Switch to Adam and the ranking can flip. Because Adam normalizes step sizes by gradient magnitude, launching from zero force no longer slows you down — instead, ramping force up from zero gets amplified.
My first instinct was that the fake should lie on the guided-teacher-to-student line. Turns out that’s sufficient, not necessary: as long as \(\langle G - m,\; G - f\rangle \gt 0\), a small step along \(G - f\) still shrinks the distance to \(G\). Counterexample: \(G=(0,0),\ m=(1,0),\ f=(1,1)\) aren’t collinear, yet a step of 0.1 still cuts the distance from 1 down to ~0.906.
Plot twist: DM first, then CA — should you re-anchor the fake?GD and Adam give opposite answers
Following the triangle intuition, I had what felt like a super clean idea: train DM-only first to build the brake, then when switching CA on, re-anchor the fake at the guided target \(p_w\) so force ramps up smoothly from zero — built-in warmup, way more stable, right?
Under GD, the toy agreed wholeheartedly: max step over the first 30 steps dropped from 3.0 lr to 1.65 lr, and overshoot dropped from 0.29 to 0.16. Then we switched to Adam (\(\beta_1=0, \beta_2=0.95\), what we actually train with) — and the ranking completely flipped! Keeping the old fake gets a one-step 4.47× lr “kick” because Adam’s second moment is still tiny from the quiet DM plateau, then steps shrink as force decays; re-anchoring ramps force up from zero, which Adam amplifies into a larger overshoot (0.14 vs 0.01).
06The staircase: each new strong–weak pair shifts the plateau
Now generalize CFG: any difference between a “stronger” and a “weaker” model call can act as a guiding force. I call these strong–weak pairs, and they split cleanly into two flavors:
| Flavor | Examples | Role in the oscillator |
|---|---|---|
| Tracking: weak side follows student | DM (teacher vs fake), fres (student vs fake) | The brake. Vanishes or balances at the fixed point |
| Fixed: both weights frozen | CFG / CA (cond vs uncond), PAG (normal vs perturbed attention), PT (multi-step vs 1-step) | The engine. Moves the fixed point |
Ideally, a strong–weak score difference corresponds to a “tilted” target density:
It boosts regions the strong model prefers over the weak one. The idea itself isn’t new — it’s right there in Autoguidance. And importantly, it doesn’t conjure knowledge out of thin air, nor does it guarantee those regions match human taste.
What the oscillator predicts is a staircase: DM-only hits a plateau; each time you turn on an informative fixed pair, the fixed point shifts, giving you a fresh step up.
The qualitative pattern carries over well in practice: turning on an informative fixed pair like CFG shifts the plateau and builds a matching brake, while zero-mean random perturbations of the same norm or resetting the fake back to the teacher do not lift the plateau. Of course, not every strong–weak pair guarantees a gain on every model — whether a new pair actually helps depends on its direction, which noise levels it queries, and how the brake interacts with it.
Strip away the notation, and almost every push in distillation comes from a comparison: fixed strong–weak pairs say which way is better, while tracking pairs say when you’ve moved far enough. Without the first, you stay on the old plateau; without the second, it’s hard to land cleanly on a new one.
07fres: what happens if you push away from a “bad self”?
Another natural hunch: if the fake is a “bad version of the student,” shouldn’t the student actively push away from it? Add a term \(\gamma\,(\hat x_0 - F)\) — call it fres (fake residual).
In the Gaussian toy, this term splits cleanly into two halves:
- The mean half is just the construction residual (fake lag) scaled by \(\gamma\), which subtracts damping from the oscillator:
$$\ddot m + (\kappa - \eta\gamma)\,\dot m + \eta\kappa\,(m - G) = 0$$Equilibrium and stiffness don’t budge, while damping drops from \(\kappa\) to \(\kappa - \eta\gamma\). Once \(\gamma \gt \kappa/\eta\), damping goes negative and oscillations blow up. (Scroll back up to the sandbox and try preset ⑥.)
- The spread half pushes each sample away from the student’s center — an entropy bonus that heats the distribution up, shifting the per-\(t\) fixed point to \(q_t \propto p_t^{1/(1+\gamma)}\).
So the hunch “fake is a bad version of the student” is literally right in the Gaussian toy: fake is a lagging, averaged copy of the student, and pushing away from it equals heating + extra momentum.
Because finer spatial frequencies overheat much more aggressively than coarse layout modes, a fixed positive \(\gamma\) can make images look sharper — and bump preference scores — while quietly introducing high-frequency artifacts. The oscillator only tells you the distribution is heating up; whether heated images actually look cleaner is something you still have to inspect by eye.
08Going deeper (for folks who like equations)
Everything so far was a 1-D scalar spring. Real neural networks live in high dimensions where feedback is a matrix. Most of this section is tucked into collapsible blocks — skip straight to §09 if you want — starting with one last interactive toy I really like:
Slow fake + rotated feedback = instability
Consider a 2-D system where at every instant, the fake’s feedback still has a positive inward pull (strength \(h\)), mixed with a bit of rotation (strength \(\omega\)). With an infinitely fast fake, this is stable for any \(\omega\). With a finite tracking rate \(\kappa\), stability holds if and only if:
For example at \(\eta = h = \omega = 1\): \(\kappa = 0.5\) gives max \(\mathrm{Re}(\lambda) = +0.087\) (unstable), while \(\kappa = 2\) gives \(-0.214\) (stable). Here \(\omega\) is just a toy rotation strength — we haven’t measured it in real models.
Restoring stiffness and damping are two separate gateswhy “train the fake faster” isn’t a cure-all
Near an equilibrium, let \(x\) be the student offset and \(z\) be the fake readout offset:
Here \(a\) is the teacher/guidance’s immediate response to moving the student, and \(b\) is the fake loop’s response. Eliminating \(z\) gives
Stable if and only if
If \(b \le a\), training the fake faster will never fix it — the restoring direction itself is wrong. Only when \(b \gt a\) and \(\kappa \le \eta a\) is it purely a tracking-speed problem.
The free-energy view of strong–weak guidanceplus an easy-to-miss catch
Define the free energy
which equals \(\mathrm{KL}(q\Vert\pi_\lambda)\) up to a constant. Under ideal probability flow \(v = s_{\pi_\lambda} - s_q\), it dissipates monotonically:
where \(-s_q\) is the dynamic distribution feedback provided by the fake.
The catch: writing a formal target \(\pi_{\lambda,t}\) at each noise level \(t\) does not mean there exists a single clean distribution whose noisy marginals match all of them. Counterexample (under linear interpolation \(x_t = (1-t)x_0 + t\varepsilon\)): \(p_+ = \mathcal N(0,1)\), \(p_- = \mathcal N(0,4)\), \(\lambda = 1\). Backing out the implied clean variance gives \(+0.549\) at \(t = 0.2\), but \(-1.217\) at \(t = 0.8\) — impossible for any distribution. Multi-noise training is always a compromise; claiming “every pair has a clean fixed point” is too strong.
In neural nets it’s a matrix, not a scalar springfake loss going down ≠ loop stability
Linearizing around equilibrium, student perturbation \(u\) and fake perturbation \(v\) obey
where \(B\) is how fake changes enter the student update (reading), \(C\) is how student changes enter fake training (measuring), and \(H\) is fake’s own regression Hessian. In the special case \(A = 0\) and \(B = C^\top\) (training and reading are transposes), a weighted quadratic energy satisfies \(\dot{\mathcal E} = -v^\top H v \le 0\). In general \(B \ne C^\top\), leaving an indefinite cross term \(v^\top(C - B^\top)u\):
The fake’s own loss steadily dropping does not guarantee the student–fake loop is stable.
That’s the math behind “the restoring force has to act along a direction compatible with what’s being measured.”
Discrete updates add another stability gateJury conditions
Real training steps discretely — update fake first \(f' = (1-k)f + k\,b\,x\), then student \(x' = x + \eta(a x - f')\). Stability requires all three Jury conditions:
On fres, this produces a fun nuance: updating fake first slightly relaxes the damping threshold from the continuous \(\gamma = k/\eta\) to \(\gamma_{\text{crit}} = k/[\eta(1-k)]\) (e.g., 1.0526 vs 1 at \(\eta = k = 0.05\)). At the same time, discrete training introduces the third step-size ceiling — take too big a step and you bounce apart, a failure mode the continuous ODE doesn’t see.
The limit of “keep getting better”repeating the same pair
If stage 2 uses the frozen stage-1 student \(q_0\) as its reference and repeats the same strong–weak pair, the ideal target becomes \(q_0 (p_+/p_-)^\lambda\); repeat \(n\) times and you just get \(q_0 (p_+/p_-)^{n\lambda}\). That only cranks up the same tilt — it doesn’t keep discovering new capabilities forever. Multiple pairs commute in the fully converged ideal limit, yet finite training vector fields generally don’t commute, which is why ordering matters in practice even though theory can’t predict which order looks best.
09Where this toy breaks down
What makes a toy useful is how simple it is; what makes it dangerous is the exact same thing. It’s worth keeping a few sharp boundaries in mind so you don’t over-read the analogy:
- Real fake error isn’t just lag. There is also fitting bias — training on the wrong distribution or underfitting certain frequency bands. Bias shifts the fixed point, and the basic scalar oscillator ignores it completely.
- κ/η is an effective rate, not a hyperparameter. A 5:1 fake:student step ratio is not \(\kappa/\eta = 5\). Use the toy for qualitative regimes and intuition, not exact step counts.
- Anchoring doesn’t guarantee a straight path. Even a constant diagonal preconditioner like \(\mathrm{diag}(4, 0.25)\) bends an anchored trajectory dramatically. Scalar-Adam straight lines do not generalize to per-parameter Adam.
- “No brake ⇒ guaranteed runaway” isn’t a theorem. If conditional and unconditional variances differ, pure CA depends on position and can have a finite attractor (e.g., \(p_c=\mathcal N(1,1),\ p_u=\mathcal N(0,4)\) settles at \(4/3\)). Our linear runaway relied on equal variances.
- Everything here is expectation-level, noiseless, and Gaussian. Per-sample gradient noise, normalization denominators, and shared multi-step parameters all sit outside this toy.
10One last step: what should the brake actually see?
Back in Section 04’s control-theory table, one row turned out to matter even more than lag: sensor bias. In multi-step distillation, only the student’s final step output is delivered at inference time, yet methods like DMD2 or TDM train the fake on pooled predictions or intermediate states — so even when the delivered distribution is already exact, the brake stays nonzero and keeps pushing. If you’re curious how that plays out in full, we follow this thread in eDMD (training the fake exclusively on delivered endpoint outputs).
If you only take away three things
- Separate “underdamped” from “wrong restoring direction.” Speeding up the fake only fixes lag. If lag is the real culprit, a faster fake should mainly shrink oscillation and overshoot.
- Check what the fake models, not just its regression MSE. A low fake loss only tells you it fits whatever distribution you fed it — not that the feedback it returns to the student vanishes at the right endpoint.
- Design the engine and the brake together. Every guiding force needs a compatible brake. What the fake tracks, where it starts, and how fast it moves decide where the student lands and how smoothly it gets there.
A billion-parameter diffusion model is obviously nothing like a 1-D spring. Yet a surprising number of head-scratching training failures come down to tangling those three separate questions: where you’re aiming (the setpoint), what you’re measuring (the sensor), and how fast the loop reacts (damping). A good toy never replaces real experiments — it just gives you cleaner coordinates for asking the right question before burning the next thousand GPU hours.
— End —
Informal notes meant for intuition and discussion. Feel free to reach out: zhaotong68@westlake.edu.cn
References
- Zhao, T., Zeng, X., Han, Y., Wang, R., Lei, M., Yu, G., & Zhang, C. eDMD: Endpoint Distribution Matching for Few-Step Diffusion Distillation. arXiv:2611.17194
- Yin et al. One-step Diffusion with Distribution Matching Distillation (DMD). arXiv:2311.18828
- Yin et al. Improved Distribution Matching Distillation for Fast Image Synthesis (DMD2). arXiv:2405.14867
- Luo et al. Learning Few-Step Diffusion Models by Trajectory Distribution Matching (TDM). arXiv:2503.07340
- Liu et al. Decoupled DMD: CFG Augmentation as the Spear, Distribution Matching as the Shield (D-DMD). arXiv:2511.22677
- Karras et al. Guiding a Diffusion Model with a Bad Version of Itself (Autoguidance). arXiv:2406.02507
- Bradley & Nakkiran. Classifier-Free Guidance is a Predictor-Corrector. arXiv:2408.09000
- Sabour et al. Align Your Flow: Scaling Continuous-Time Flow Map Distillation. arXiv:2506.14603