Introduction
Sampling from a diffusion model is the solution of the probability-flow ODE
where is the network's estimate of the clean sample at noise level , and every call to is a network evaluation. When only a handful of evaluations are allowed per image, a solver that merely integrates the ODE accurately is no longer the right object: the truncation error of a few large steps dominates, and the field has turned to solvers whose components are fitted to the model. Training-free multistep methods reuse past evaluations [1, 2, 3, 4] or combine past and future scores [5]; learned methods fit the step locations [6], the gradient direction or weights [7, 8], updates that leave the span of past evaluations [9], or the network's time conditioning at each step [10].
The learned methods share one choice we question. They fit their parameters to a high-step teacher trajectory, matching the few-step solution to the teacher's endpoint or intermediate states for each initial noise vector. That is a paired, per-sample regression, while the quantity that is scored is a distance between distributions: the Fréchet distance between Gaussian fits to Inception features of generated and real images. A few-step solver cannot reproduce the teacher's map from noise to image exactly, and a regression toward it spends its capacity on per-sample agreement that the metric does not reward. Our question is whether the same solver parameters can be moved toward the teacher's distribution instead, without real data and without spending any evaluation at sampling time.
Method
TAFR has two fitting stages and an acceptance check, all inside the optional fitting phase; the sampler it produces is the plain first-order solver with per-step conditioning.
The solver and its parameters
We sample with one first-order (DDIM) step per evaluation on a fixed grid ,
where is the network with a learned offset added to the time embedding of each of its blocks at step . For the guided latent model each step also carries a learned offset to the unconditional embedding used by classifier-free guidance. The grid is time-uniform with for pixel models, for the unconditional latent model, and the model's own discrete timesteps for the guided model. These are exactly the parameters, grid and update of the MTEO baseline [10]; our contribution is how they are fitted.
def _fd_rollout(z, t, den, names, phis, uncs, idx, guided):
x = z * t[0]
for i, (tc, tn) in enumerate(zip(t[:-1], t[1:])):
kw = {"uncond": uncs[i]} if guided else {"fp32": True}
d = (x - den(x, tc, rows=idx, temb=_mteo_temb(names, phis[i]), **kw)) / tc
x = x + (tn - tc) * d
return xStage 1: a trajectory fit as the anchor
We first fit the offsets stage by stage to a teacher trajectory, following the MTEO recipe and its reference implementation. A fourth-order iPNDM teacher [11] (DPM-Solver++(2M) for the guided model) is run on a grid about twenty levels long that contains the student's levels, on a fixed set of fitting latents. Step 's offset is then fitted, with the earlier offsets frozen, so that one student step from the student's own current state lands on the teacher's state at the next student level:
for i in range(nfe):
t_cur, t_next = t_s[i], t_s[i + 1]
phi = torch.nn.Parameter(torch.zeros(len(names), widths[names[0]], device=dev))
lr = _mteo_geo(c["lr"], c["lr_min"], i, nfe)
eps = _mteo_geo(c["eps"], c["eps_min"], i, max(nfe - 1, 1))
opt = torch.optim.Adam([phi], lr=lr, betas=(0.9, 0.999))
prev, patience, epoch = None, 0, 0
last = i == nfe - 1
while epoch < c["emax"] and (last or patience < 10):
perm = torch.randperm(n_train, generator=gen).to(dev)
tot = 0.0
for j in range(0, n_train, bs):
b = perm[j:j + bs]
opt.zero_grad(set_to_none=True)
for m in range(0, len(b), c["micro"]):
bb = b[m:m + c["micro"]]
xb = x_cur[bb]
d = (xb - den(xb, t_cur, rows=bb, temb=_mteo_temb(names, phi), fp32=True)) / t_cur
x_next = xb + (t_next - t_cur) * d
loss = torch.nn.functional.mse_loss(x_next, teach[bb, i + 1], reduction="sum") / (
len(b) * x_next[0].numel())
loss.backward()
tot += float(loss) * len(b)
opt.step()This stage is not new. We keep it because it finds the basin: in our development runs, the distribution objective of Stage 2 started from zero offsets reached a far worse FID than when it started from this fit (see Section 4).
Stage 2: Fréchet refinement in the teacher's principal subspace
We then refine all offsets jointly, end to end through the whole few-step rollout, the decoder (for latent models) and the Inception network, against the teacher's terminal distribution. The teacher endpoints of fitting latents ( for pixel models, for latent models) give Inception features . We take the top right singular vectors of the centred , project onto them, and store the teacher's mean and covariance of the projected features (split into blocks of as many components as the micro-batch has samples when the micro-batch is smaller than 64, so that each block's covariance stays estimable). The loss is the Fréchet distance of the student's projected features from that Gaussian,
computed with a symmetric eigendecomposition for both square roots, and with the same ridge , , added to both covariances. The ridge and the eigenvalue floor of keep the gradient of the matrix square root finite when a micro-batch covariance is rank-deficient.
def _fd_sqrt(x):
v, u = torch.linalg.eigh(x)
return (u * v.clamp_min(1e-8).sqrt()) @ u.T
def _fd_one(x, mean_t, cov_t):
mean_x = x.mean(0)
xc = x - mean_x
cov_x = xc.T @ xc / (len(x) - 1)
ridge = 1e-3 * cov_t.diagonal().mean().clamp_min(1e-6)
eye = torch.eye(cov_x.shape[0], device=x.device, dtype=x.dtype)
cov_x = cov_x + ridge * eye
cov_t = cov_t + ridge * eye
root = _fd_sqrt(cov_x)
mid = root @ cov_t @ root
ev = torch.linalg.eigvalsh(mid).clamp_min(1e-8)
return ((mean_x - mean_t).square().sum() + cov_x.diagonal().sum()
+ cov_t.diagonal().sum() - 2 * ev.sqrt().sum())Each optimisation step draws a micro-batch of the same fitting latents, rolls the student out, and takes an Adam step (learning rate , gradient norm clipped to 1) on the Fréchet loss averaged over blocks (and scaled by ). The latents are shared with the teacher set, but the loss never pairs a student sample with its teacher endpoint; it compares only the two feature distributions. The number of steps is for a work constant that depends only on the model, so the fitting cost stays roughly constant as the number of steps grows.
rank, block = 64, min(64, micro)
with torch.no_grad():
_, _, vh = torch.linalg.svd(tf - tf.mean(0), full_matrices=False)
v = vh[:rank].T.contiguous()
targets = []
for j in range(0, rank, block):
y = tf @ v[:, j:j + block]
my = y.mean(0)
yc = y - my
targets.append((my, yc.T @ yc / (len(y) - 1)))
variables = list(phis.parameters()) + (list(uncs.parameters()) if guided else [])
opt = torch.optim.Adam(variables, lr=1e-3)
gen = torch.Generator(device="cpu").manual_seed(321)
steps = max(100, work // nfe)
for it in range(steps):
idx = torch.randperm(n_train, generator=gen)[:micro].to(dev)
opt.zero_grad(set_to_none=True)
out = _fd_rollout(z[idx], t_s, den, names, phis, uncs, idx, guided)
sf = inception((((info["decode"](out).float() + 1) * 127.5).clamp(0, 255)))
loss = sum(_fd_one(sf @ v[:, j:j + block], my, cy)
for j, (my, cy) in zip(range(0, rank, block), targets)) / (len(targets) * 1000)
loss.backward()
torch.nn.utils.clip_grad_norm_(variables, 1.0)
opt.step()
if it % 100 == 0 or it == steps - 1:
print(f"Frechet solver fit {it}: loss {float(loss):.6g}", flush=True)Nothing here uses real images or the reference statistics: the target is the model's own many-step distribution, so the refinement corrects the few-step solver's departure from what the model would produce with a fine discretisation.
Accept only what the objective confirms
Stage 2 is a stochastic optimisation on small-batch covariance estimates, and on some models and budgets it does not help. We therefore evaluate both the Stage 1 offsets and the refined offsets on the whole fitting set, with the same projected Fréchet distance, and return the refined offsets only if that distance is finite and no larger than the initial one; otherwise the trajectory fit is returned unchanged. The check costs one pass over the fitting set per candidate and adds no parameters.
def validation(candidate):
cphis = [candidate["phi%d" % i] for i in range(nfe)]
cuncs = [candidate["unc%d" % i] for i in range(nfe)] if guided else None
feats = []
with torch.no_grad():
for j in range(0, n_train, micro):
idx = torch.arange(j, min(j + micro, n_train), device=dev)
out = _fd_rollout(z[idx], t_s, den, names, cphis, cuncs, idx, guided)
img = (info["decode"](out).float() + 1) * 127.5
feats.append(inception(img.clamp(0, 255)))
sf = torch.cat(feats).float()
return sum(_fd_one(sf @ v[:, j:j + block], my, cy)
for j, (my, cy) in zip(range(0, rank, block), targets)) / len(targets)
initial_score = float(validation(initial))
refined_score = float(validation(refined))
print(f"Frechet solver selection: initial {initial_score:.6g} refined {refined_score:.6g}", flush=True)
if not math.isfinite(refined_score) or initial_score < refined_score:
return initial
return refinedThe returned dictionary has the same shape as the trajectory fit's, so the parameter budget and the sampling cost are identical to MTEO's. The native flow-model branch is not refined; it returns its trajectory fit, to which we added only a teacher grid for the single-step case, where the inherited code divided by zero.
Results
| Method | ① | ② | ③ | ④ |
|---|---|---|---|---|
| FID ↓ | FID ↓ | FID ↓ | FID ↓ | |
| Kimi K3.1 Pro | 3.901 | 4.584 | 14.23 | 14.82 |
| iPNDM | 45.97 | 55.39 | 17.50 | 16.17 |
| PFDiff | 38.73 | 45.38 | 19.49 | 15.14 |
| LD3 | 38.03 | 42.22 | 16.29 | 14.36 |
| DyWeight | 17.90 | 16.96 | 15.51 | 15.04 |
| AMED | 26.37 | 29.61 | 16.48 | 14.76 |
| SpanLift | 13.18 | 14.25 | 14.77 | 15.03 |
| MTEO | 5.650 | 5.040 | 14.29 | 14.61 |
| DPM-Solver++ | 19.41 | 16.78 | ||
| UniPC-3 | 19.38 | 16.77 | ||
| DEIS-tAB3 | 42.37 | 21.65 | 14.65 |
- ① FFHQ 64×64 · 3 network evaluations
- ② ImageNet 64×64 (class-conditional) · 3 network evaluations
- ③ Text-to-image, Stable Diffusion v1.5 · 512 px · COCO captions · 5 guided evaluations
- ④ Text-to-image, Stable Diffusion v1.5 · 512 px · COCO captions · 8 guided evaluations
On FFHQ64/3NFE and IN64/3NFE TAFR is ahead of every published baseline: an FID of 3.901 on FFHQ64/3NFE against 5.650 for the strongest baseline there, MTEO [10], and 4.584 on IN64/3NFE against 5.040 (MTEO [10]). Since MTEO is also our Stage 1, these two settings are the cleanest measurement of what the Fréchet refinement adds on top of an identical trajectory fit, at identical sampling cost.
On SD1.5/5NFE we reach 14.23 against 14.29 for MTEO, the strongest baseline there; the margin is small enough to be ordinary fit-to-fit variation. On SD1.5/8NFE we reach 14.82, behind MTEO's 14.61 and behind the best baseline, LD3 [6] at 14.36; four published baselines are ahead of us there. On these two settings the method is at best level with its own initialisation. The per-setting means alone do not tell us whether the acceptance check kept or rejected the refinement there.
How we got here
TAFR came out of one hypothesis, tested first in its cheapest forms and then narrowed by ablation. All figures in this section are our own development measurements on a small pixel-space model (CIFAR-10) at our main development budget unless stated otherwise, with a small-sample FID against public reference statistics; they are not the task's evaluation.
- The starting observation. The strongest fitted references all distill toward a fixed high-step trajectory with paired per-image losses. We asked whether optimising the distribution of few-step outputs against teacher samples would do better than forcing each noise vector through an approximate teacher endpoint.
- Post-hoc distribution corrections helped, but too little. A monotone per-coordinate quantile transport from student to teacher outputs, applied after an iPNDM solver, improved our development FID from 52.75 to 45.62: a real gain, but one that preserves each sample's ranks and cannot repair joint structure. A closed-form Gaussian transport in a low-frequency DCT basis still degraded the output after we had fixed two transform bugs, and we dropped it. A reverse-SDE variant of the update stayed near an FID of 460 even after an implementation fix, and we did not pursue stochastic sampling further.
- The right capacity was already in a baseline. In our measurements MTEO's per-step embedding offsets were far stronger than the other fitted methods (8.45 on the development model; DyWeight and SpanLift, measured later, gave 12.55 and 11.34), so we decided to change the objective used to fit those offsets rather than invent a new update.
- A kernel objective was not the right distance. Refining MTEO's offsets with a paired Inception-feature regression gave 8.37; with an unbiased multi-kernel MMD between student and teacher features, 8.17. Applied instead to scalar solver coefficients, MMD was much worse than paired fitting (36.87 against 13.86). We replaced the kernel surrogate with the Gaussian Fréchet distance itself, which is what the metric computes, in the teacher's principal subspace: 7.97 with 32 components and 7.47 with 64 (the latter also with twice the fitting latents and batch).
- More components did not help. 256 components in eight blocks of 32 gave 7.54, so we kept a single 64-component subspace for models whose batch allows it, and smaller blocks only where memory forces small micro-batches.
- Starting from zero offsets failed. The same Fréchet stage from zero offsets reached only 13.67. The trajectory fit is what makes the distribution objective identifiable, which is why TAFR is two-stage.
- Population tricks did not pay. Drawing fresh student latents at every step (7.73) and an EMA of student feature moments that decouples the population size from the gradient batch (8.26) were both worse than reusing the fitting latents (7.47). The EMA idea came from recent work that optimises a Fréchet distance directly as a training loss [12]; for fitting solver offsets, the simpler batch estimator was better. A bounded feature queue and keeping the best intermediate iterate also did not help.
- Other additions were measured and left out. Learning the interior noise levels jointly with the offsets gave 7.53; a final quantile transport after the Fréchet stage, 7.42, too small a gain for its extra parameters; a 64-step teacher, 7.40 here but no better on a second model; a line search between the initial and refined offsets moved FID by about 0.01. A four-times larger fitting set looked better in a first probe, but a complete refit was worse on a larger-sample measurement, so we read the probe as fit-to-fit variance and kept 1,024 fitting latents.
- The acceptance check came from a regression. At sixteen evaluations the unguarded refinement was worse than MTEO (7.03 against 6.82), and its full-fitting-set Fréchet distance to the teacher was also worse (0.546 against 0.268), so the teacher distance predicted the failure. With the check, the sixteen-evaluation fit returned MTEO's offsets byte for byte, while at our main development budget it kept the refinement (teacher distance 2.12 to 1.17). Across a sweep of budgets on the development model the check kept the refinement up to nine evaluations and rejected it at the largest budgets we tried. On two of our other development models, one of them the guided latent model under its full recipe, it also rejected the refinement at our main development budget, and returned the trajectory fit unchanged.
- The gain held up where we could check it. On a larger-sample development FID the development model improved from 3.77 with MTEO to 2.76 with TAFR at our main development budget, and by a similar margin on a disjoint range of noise draws; with a single evaluation, the small-sample FID dropped from 47.29 to 15.96. On the development model the accepted refinements move the offsets by about 5% relative to the trajectory fit (about 25% on the unconditional latent model), which is why we describe the method as anchored.
One memory fix also shaped the code: the micro-batch for the guided model is capped at 8 and the product of micro-batch and step count is bounded, because the end-to-end backward pass keeps every step's activations.
Limitations
- The gain is concentrated on two settings. TAFR is clearly ahead on FFHQ64/3NFE and IN64/3NFE. On SD1.5/5NFE it is level with MTEO, and on SD1.5/8NFE it is behind MTEO and three other published baselines. Whatever the reason there, a refinement that the acceptance check let through, or an ordinary difference between two trajectory fits, the method does not improve on its own initialisation on half of the settings.
- It is a refinement of an existing method. The parameterisation, the grid, the update and the first fitting stage are MTEO's, taken from its reference implementation. What is new is the objective of the second stage and the acceptance check. TAFR does not change how many steps are taken, where the network is queried, or whether an update leaves the span of past evaluations.
- The acceptance check is only as good as its proxy. It compares a projected Fréchet distance to the model's own many-step samples, on the same latents the refinement was trained on. It protects against a refinement that fits the teacher worse; it cannot detect a refinement that fits the teacher better and the real data worse, and it is not a held-out test.
- Results vary between fits. Our development runs showed differences of up to about a quarter of an FID point between repeated fits of the same configuration, comparable to the margins on SD1.5/5NFE and SD1.5/8NFE.
- The target is the teacher, not the data. The refinement can at best bring the few-step distribution to the many-step teacher's; any error the teacher itself has is inherited.
- Fitting is expensive. Stage 2 back-propagates through the full rollout, the decoder and the Inception network, so its memory grows with the number of steps; we bound the micro-batch to stay within memory, and the guided latent model needs many guided evaluations just to build the teacher statistics.
- The flow branch is not refined. The native flow model's path returns its trajectory fit without refinement, so TAFR has not been shown to help that model class.
References
- Luping Liu, Yi Ren, Zhijie Lin et al. (2022). Pseudo Numerical Methods for Diffusion Models on Manifolds. ICLR.
- Cheng Lu, Yuhao Zhou, Fan Bao et al. (2025). DPM-Solver++: Fast Solver for Guided Sampling of Diffusion Probabilistic Models. Machine Intelligence Research.
- Wenliang Zhao, Lujia Bai, Yongming Rao et al. (2023). UniPC: A Unified Predictor-Corrector Framework for Fast Sampling of Diffusion Models. NeurIPS.
- Kaiwen Zheng, Cheng Lu, Jianfei Chen et al. (2023). DPM-Solver-v3: Improved Diffusion ODE Solver with Empirical Model Statistics. NeurIPS.
- Guangyi Wang, Yuren Cai, Lijiang Li et al. (2025). PFDiff: Training-Free Acceleration of Diffusion Models Combining Past and Future Scores. ICLR.
- Vinh Tong, Trung-Dung Hoang, Anji Liu et al. (2025). Learning to Discretize Denoising Diffusion ODEs. ICLR.
- Zhenyu Zhou, Defang Chen, Can Wang et al. (2024). Fast ODE-based Sampling for Diffusion Models in Around 5 Steps. CVPR.
- Tong Zhao, Mingkun Lei, Liangyu Yuan et al. (2026). DyWeight: Dynamic Gradient Weighting for Few-Step Diffusion Sampling.
- Sihyeon Kim, Seunghun Lee, Vikas Singh et al. (2026). Learning to Solve Generative ODEs Beyond the Linear Span.
- Yuren Cai, Guangyi Wang, Zongqing Li et al. (2026). Three Creates All: You Only Sample 3 Steps.
- Qinsheng Zhang, Yongxin Chen (2023). Fast Sampling of Diffusion Models with Exponential Integrator. ICLR.
- Jiawei Yang, Zhengyang Geng, Xuan Ju et al. (2026). Representation Fréchet Loss for Visual Generation.