Samplers, Inversion and Editing

Dive into Deep Learning · §17.5

Fast Diffusion Samplers, Inversion, and Editing
DDIM family (η) · Heun & multistep ODE solvers · step-grid placement · ODE inversion & slerp · partial-noising edits · inpainting

Why One Trained Network Supports Many Samplers

Motivation

  • Training depends only on single-time marginals p_t(\mathbf{x}_t): The regression loss never depends on the joint transition q(\mathbf{x}_s, \mathbf{x}_t \mid \mathbf{x}_0) between two noise levels s < t.
  • Non-Markovian reverse families (Song, Meng & Ermon, 2020): Any transition from t \to s that preserves the marginal \mathcal{N}(\alpha_s\mathbf{x}_0, \sigma_s^2\mathbf{I}) is consistent with the trained predictor (\hat{\mathbf{x}}_0, \hat{\boldsymbol\epsilon}).
  • Three levers for fast sampling: Stochasticity \eta, higher-order ODE solvers (Heun / multistep), and step-grid placement (\bar\sigma_i).

The DDIM Family: Splitting the Noise Budget

Marginal-Preserving Reverse Steps

\mathbf{x}_s = \alpha_s \hat{\mathbf{x}}_0 + \sqrt{\sigma_s^2 - \tilde\sigma^2}\,\hat{\boldsymbol\epsilon} + \tilde\sigma\,\boldsymbol\xi, \qquad \tilde\sigma = \eta\,\sigma_s\sqrt{1 - \kappa^2}

  • Marginal preservation for all \tilde\sigma \in [0, \sigma_s]: Conditioned on \mathbf{x}_0, the orthogonal kept-noise and fresh-noise terms have variances (\sigma_s^2 - \tilde\sigma^2) + \tilde\sigma^2 = \sigma_s^2.
  • DDIM stochasticity parameter \eta \ge 0: Scales \tilde\sigma relative to the forward-posterior standard deviation using \kappa = \bar\sigma_s/\bar\sigma_t < 1.

Comparing DDIM (η = 0, 1) and the Ancestral Chain

Deterministic ODE vs. Stochastic Chains

Setting \eta = 0, \eta = 1, or using Ho et al.’s ancestral variance defines three distinct reverse processes from the exact same network predictions (\hat{\mathbf{x}}_0, \hat{\boldsymbol\epsilon}):

  • \eta = 0 (Deterministic DDIM = Euler ODE): \tilde\sigma = 0, so \mathbf{x}_s = \alpha_s\hat{\mathbf{x}}_0 + \sigma_s\hat{\boldsymbol\epsilon}, or \bar{\mathbf{x}}_s = \bar{\mathbf{x}}_t + (\bar\sigma_s - \bar\sigma_t)\hat{\boldsymbol\epsilon}—an exact Euler step of d\bar{\mathbf{x}}/d\bar\sigma = \hat{\boldsymbol\epsilon}.
  • \eta = 1 (Posterior-variance DDIM): \tilde\sigma^2 = \sigma_s^2(1 - \kappa^2) is the exact conditional variance of q(\mathbf{x}_s \mid \mathbf{x}_t, \mathbf{x}_0) (exact when data is a single point).
  • Ancestral chain: Uses the larger forward-step variance \sigma_t^2(1 - \kappa^2) = (\sigma_t^2/\sigma_s^2)\tilde\sigma_{\eta=1}^2 (exact for \mathcal{N}(\mathbf{0}, \mathbf{I}) data on VP).

First-Order Stride Error on the 2D Mixture

Exact Predictor Across Step Budgets

Running DDIM (\eta = 0, 1) and the ancestral chain with the exact mixture predictor pred_exact from 20{,}000 starts across N \in \{5, 10, 20, 50, 200, 1000\} steps isolates pure discretization error:

  • O(1/N) first-order convergence: The mean L_2 distance of \eta = 0 samples to the 1,000-step trajectory halves each time N doubles (0.40 at 5 steps \to 0.21 at 10 \to 0.04 at 50).
  • Systematic mode contraction at coarse steps: At N = 10 steps, deterministic DDIM (\eta = 0) contracts within-mode spread to 0.38 (vs. 0.48 for true data) because holding \hat{\boldsymbol\epsilon} constant across a stride over-removes noise.

First-Order Stride Error on the 2D Mixture (cont.)

Exact Predictor Across Step Budgets

   5 steps: distance to 1,000 steps 0.411, spread 0.309 (eta = 1: 0.321, ancestral: 0.386)
  10 steps: distance to 1,000 steps 0.210, spread 0.380 (eta = 1: 0.320, ancestral: 0.528)
  20 steps: distance to 1,000 steps 0.107, spread 0.420 (eta = 1: 0.342, ancestral: 0.520)
  50 steps: distance to 1,000 steps 0.043, spread 0.451 (eta = 1: 0.397, ancestral: 0.502)
 200 steps: distance to 1,000 steps 0.009, spread 0.469 (eta = 1: 0.452, ancestral: 0.480)
1000 steps: distance to 1,000 steps 0.000, spread 0.474 (eta = 1: 0.475, ancestral: 0.479)
  • Why \eta = 1 contracts even more (0.32): Replacing correlated kept noise \hat{\boldsymbol\epsilon} with orthogonal fresh noise \boldsymbol\xi eliminates the positive cross-term with \hat{\mathbf{x}}_0, whereas the ancestral chain over-inflates spread to 0.52.

Second-Order Integration: Heun’s Predictor–Corrector

Cutting Discretization Error from O(h) to O(h²)

\bar{\mathbf{x}}' = \bar{\mathbf{x}}_t + (\bar\sigma_s - \bar\sigma_t)\,\hat{\boldsymbol\epsilon}(\bar{\mathbf{x}}_t, \bar\sigma_t), \qquad \bar{\mathbf{x}}_s = \bar{\mathbf{x}}_t + (\bar\sigma_s - \bar\sigma_t)\,\frac{\hat{\boldsymbol\epsilon}(\bar{\mathbf{x}}_t, \bar\sigma_t) + \hat{\boldsymbol\epsilon}(\bar{\mathbf{x}}', \bar\sigma_s)}{2}

  • Trapezoidal slope averaging: Takes an Euler trial step to \bar{\mathbf{x}}' and averages start and end slopes (2 NFE/step), cutting local error from O(\Delta^2) to O(\Delta^3).
  • Quantitative check on \mathcal{N}(\mathbf{0}, \mathbf{I}) (\bar\sigma: 1 \to 0.5): Exact factor is 0.7906; Euler gives 0.7500 (error -0.0406), whereas Heun gives 0.8000 (4.3\times smaller error +0.0094).

Exponential Integrators and Multistep Solvers

Second-Order Accuracy at One Evaluation per Step

\bar{\mathbf{x}}_s = \bar{\mathbf{x}}_t + \Delta\!\left(\hat{\boldsymbol\epsilon}_t + \frac{\Delta}{2\Delta'}\big(\hat{\boldsymbol\epsilon}_t - \hat{\boldsymbol\epsilon}'\big)\right)

  • Exponential integrator coordinates (\bar{\mathbf{x}} = \mathbf{x}/\alpha_t): Integrates the linear drift analytically, leaving d\bar{\mathbf{x}}/d\bar\sigma = \hat{\boldsymbol\epsilon}(\bar{\mathbf{x}}, \bar\sigma) driven purely by the neural network.
  • 2nd-order Adams–Bashforth (multistep_sample / DPM-Solver++): Reuses the cached slope \hat{\boldsymbol\epsilon}' from the previous step \Delta' to extrapolate linearly to the midpoint at 1 NFE per step.

Step-Grid Placement: Linear vs. VP vs. EDM Grids

Where Should a Solver Spend Its Evaluations?

Karras et al. (2022) decoupled the sampling step grid \{\bar\sigma_0, \ldots, \bar\sigma_N\} from the training schedule, proposing the polynomial EDM grid spaced evenly in \bar\sigma^{1/\rho} (\bar\sigma_{\max} = 80, \bar\sigma_{\min} = 0.002, \rho = 7):

\bar\sigma_i = \Big(\bar\sigma_{\max}^{1/\rho} + \frac{i}{N - 1}\big(\bar\sigma_{\min}^{1/\rho} - \bar\sigma_{\max}^{1/\rho}\big)\Big)^\rho, \qquad i = 0, \ldots, N - 1, \quad \bar\sigma_N = 0

VP          152    58.8    25.1    11.8     6.1    3.41    2.03    1.23    0.72    0.34       0
linear      inf       9       4    2.33     1.5       1   0.667   0.429    0.25   0.111       0
EDM          80    42.4    21.1    9.72    4.07     1.5    0.47   0.117  0.0204   0.002       0
  • Contrast in \bar\sigma = \sigma/\alpha allocation: On a 10-step budget, the VP and EDM grids spend 4 steps at very high noise (\bar\sigma > 4, where images are nearly pure Gaussian noise and trajectories are straight), whereas the linear grid jumps \infty \to 9 \to 4 and places 7 of its 10 steps in the critical structure-forming band \bar\sigma \in [0.11, 4.0].

Deterministic vs. Stochastic Samplers on Garments

Empirical Benchmark Across Step Counts

On our trained class-conditional Fashion-MNIST U-Net, we evaluate 1,000-sample FD across three paired noise draws (mean \pm half-range; real-vs.-real floor is about 0.9, with a half-range of 0.15–0.2):

steps                  10         20         50        100        200       1000
DDIM, eta = 0   5.41±0.32  2.95±0.19  1.76±0.12  1.45±0.11  1.33±0.10  1.32±0.10
DDIM, eta = 1   7.81±0.23  4.90±0.16  3.06±0.09  2.32±0.06  1.98±0.08  1.52±0.05
ancestral      28.66±0.26 19.22±0.63  7.85±0.10  3.45±0.14  1.78±0.13  1.34±0.03
  • Deterministic DDIM (\eta = 0) dominates at every budget \le 200 steps: Scores a third to nearly a half lower FD than \eta = 1 across 10–200 steps, and at 50 steps (\approx 1.7–1.8) already approaches the 1{,}000-step plateau (\approx 1.3).
  • Why the ancestral chain fails at \le 100 steps: Its forward-step variance \sigma_t^2(1 - \kappa^2) injects far too much noise for images on coarse grids, scoring \mathrm{FD} \approx 8–11 at 50 steps (worse than 10-step DDIM at about 5.4) and only tying \eta = 0 at 1{,}000 steps.

Solver Order vs. Step Grid at Equal Evaluations

Benchmarking Euler, Heun, and Multistep Solvers

Comparing Euler, Heun (2 NFE/step), and 2nd-order Adams–Bashforth multistep (1 NFE/step) at equal network function evaluations (NFE) across three grids shows that grid placement and solver order interact strongly:

evaluations                      10         20         50        100
Euler, linear             3.33±0.25  1.99±0.15  1.46±0.11  1.36±0.10
Euler, EDM                6.81±0.38  3.14±0.22  1.86±0.15  1.58±0.14
Euler, EDM, rho = 3       9.74±0.47  4.02±0.25  2.02±0.16  1.62±0.14
Heun, linear              1.60±0.12  1.27±0.07  1.20±0.08  1.25±0.09
Heun, EDM                11.71±0.29  1.69±0.08  1.32±0.10  1.37±0.11
Heun, EDM, rho = 3       84.52±0.45  8.10±0.26  1.47±0.11  1.39±0.11
multistep, linear         2.12±0.17  1.42±0.11  1.29±0.10  1.30±0.10
multistep, EDM            4.50±0.28  1.96±0.16  1.46±0.12  1.41±0.12
multistep, EDM, rho = 3   6.56±0.35  2.37±0.17  1.46±0.12  1.39±0.12

FD Convergence vs. Network Function Evaluations

Reaching the Model’s Asymptotic Plateau

Plotting FD against total network evaluations on log–log axes shows how quickly each solver saturates the model’s asymptotic quality ceiling (\mathrm{FD} \approx 1.15–1.30):

  • 20 evaluations suffice with 2nd-order Heun: On the linear grid, Heun reaches \mathrm{FD} \approx 1.2–1.3 at just 20 evaluations (11 steps)—matching 1{,}000 ancestral steps at 1/50\text{th} the compute.
  • 50 evaluations for multistep, 50 to 100 for Euler: The multistep solver reaches \approx 1.2–1.3 by 50 evaluations on the linear grid; Euler is still at \approx 1.4–1.5 there.
  • Why EDM grids trail at 10–20 NFE here: Spending 40\% of steps at \bar\sigma > 4 starves the middle regime where 28 \times 28 garments form.

Trajectory Error vs. FD Under Guidance (γ = 1, 2)

Comparing Solvers Against a 200-NFE Reference

Does lower FD always mean smaller per-image ODE integration error? We measure per-pixel RMS distance to a 200-NFE Heun reference alongside FD at \gamma = 1 (un-guided conditional) and \gamma = 2 (CFG):

gamma = 1, reference: FD  1.29±0.09; FD and RMS distance to it
evaluations                 10                20                50
  Euler        3.33±0.25 0.108   1.99±0.15 0.063   1.46±0.11 0.030
  Heun         1.60±0.12 0.127   1.27±0.07 0.044   1.20±0.08 0.014
  multistep    2.12±0.17 0.094   1.42±0.11 0.044   1.29±0.10 0.015
gamma = 2, reference: FD  2.29±0.11; FD and RMS distance to it
evaluations                 10                20                50
  Euler        3.88±0.14 0.109   3.07±0.11 0.066   2.57±0.10 0.035
  Heun         3.51±0.15 0.142   2.77±0.10 0.066   2.43±0.10 0.021
  multistep    3.31±0.12 0.099   2.71±0.10 0.051   2.38±0.10 0.021
  • Distributional FD vs. pointwise trajectory accuracy: At 10 NFE (\gamma = 1), Heun has larger pointwise RMS error than Euler (0.12–0.13 vs. about 0.1) yet half the FD (about 1.6 vs. about 3.2): Euler blurs images toward the mean, whereas Heun draws sharp garments that slightly overshoot the exact trajectory.
  • Under guidance (\gamma = 2), multistep wins: Extrapolating (1-\gamma)\mathbf{u}_\varnothing + \gamma\mathbf{u}_c stiffens the ODE; 2nd-order multistep achieves both the lowest RMS trajectory error and reaches the \gamma = 2 FD plateau by 50 evaluations.

Visualizing Sampler Artifacts from Shared Noise

Deterministic Convergence vs. Ancestral Speckle

Generating eight garments from the exact same initial noise \mathbf{z} and class labels across four samplers makes the quantitative table visible at a glance:

  • Row 1 (Ancestral, 50 steps): Excess forward-step variance leaves visible salt-and-pepper speckle across backgrounds and fabrics.
  • Row 2 (DDIM, 10 steps): Smooths away fine prints and collar edges.
  • Rows 3 & 4 (DDIM 50 vs. Heun 20 NFE): Match column-by-column in pose, shading, and sharp details—confirming both converge to the same deterministic ODE map.

Practical Protocol for Selecting a Sampler

How to Tune Sampling for a New Model

Because optimal step counts depend on image resolution, training schedule, and guidance scale \gamma, use a paired doubling protocol whenever deploying a new model:

  1. Fix paired noise seeds and a calibrated metric: Draw a fixed validation noise tensor \mathbf{Z} (n \ge 1{,}000) and measure FD against the real-vs.-real reference floor at the same n.
  2. Start deterministic on the model’s native training grid: Use 2nd-order Heun (for \gamma = 1) or 2nd-order multistep / DPM-Solver++(2M) (for guided generation \gamma > 1) on the training path’s grid.
  3. Double NFE until FD changes by less than run-to-run spread: Once doubling evaluations (10 \to 20 \to 50 \to 100) moves FD by less than the multi-seed range, solver discretization error is negligible—any remaining gap to the real floor is model capacity or training error.

Deterministic ODE Inversion: Image to Latent Code

Running the Probability-Flow ODE Forward

Because the probability-flow ODE is deterministic and reversible, running Euler steps upward from t = 0 to 1 (ddim_invert) encodes any real image \mathbf{x}_0 into a latent noise code \mathbf{z} = \mathbf{x}_1:

\bar{\mathbf{x}}_{t'} = \bar{\mathbf{x}}_t + (\bar\sigma_{t'} - \bar\sigma_t)\,\hat{\boldsymbol\epsilon}(\bar{\mathbf{x}}_t, \bar\sigma_t), \qquad t' > t

 10 steps: squared error per pixel 0.0347, code std 0.69; mixture 0.3097
 20 steps: squared error per pixel 0.0148, code std 0.76; mixture 0.0878
 50 steps: squared error per pixel 0.0039, code std 0.81; mixture 0.0192
100 steps: squared error per pixel 0.0011, code std 0.84; mixture 0.0074
200 steps: squared error per pixel 0.0002, code std 0.86; mixture 0.0023

Analyzing Round-Trip Inversion Error and Code Norm

Why Inverted Codes Are Narrower Than N(0, I)

  • Local slope mismatch: Forward Euler (t \to t') evaluates \hat{\boldsymbol\epsilon} at the lower end t, whereas reverse Euler (t' \to t) evaluates \hat{\boldsymbol\epsilon} at the upper end t'.
  • Discretization error, not field roughness: As step count increases 10 \to 50 \to 200, round-trip MSE drops more than 100\times (\approx 0.035 \to \approx 0.003 \to 0.0002) on our U-Net and on the exact 2D oracle alike.
  • Code norm contraction (std \approx 0.7–0.85 < 1): Forward Euler under-amplifies variance on curved paths.

Spherical Interpolation (Slerp) in Latent Space

Traversing Between Two Real Images

Why can we not interpolate linearly ((1 - u)\mathbf{z}_0 + u\mathbf{z}_1) between two inverted noise codes \mathbf{z}_0, \mathbf{z}_1 \in \mathbb{R}^{784}?

  • The high-dimensional norm-collapse hazard: Two independent Gaussian vectors in d = 784 dimensions are nearly orthogonal (\omega \approx \pi/2) with norm r \approx \sqrt{d}. Their linear midpoint \frac{1}{2}(\mathbf{z}_0 + \mathbf{z}_1) has norm r / \sqrt{2} \approx 0.71\,r—lying completely outside the \mathcal{N}(\mathbf{0}, \mathbf{I}) shell where the denoiser was trained.
  • Spherical linear interpolation (Slerp): Rotates along the great circle of constant radius r connecting \mathbf{z}_0 and \mathbf{z}_1 at angle \cos\omega = \frac{\mathbf{z}_0^\top \mathbf{z}_1}{\|\mathbf{z}_0\|\|\mathbf{z}_1\|}: \mathbf{z}_u = \frac{\sin\big((1 - u)\omega\big)\,\mathbf{z}_0 + \sin(u\omega)\,\mathbf{z}_1}{\sin\omega}, \qquad u \in [0, 1]

Editing by Partial Noising (SDEdit)

Trading Input Fidelity for Sample Realism

Given a coarse user sketch or blurred composite \mathbf{y} (here the 10 blurred class-mean silhouettes, \mathrm{FD} \approx 87), SDEdit (Meng et al., 2022) corrupts \mathbf{y} to an intermediate time t_0 \in (0, 1] and integrates backward from t_0 to 0:

\mathbf{x}_{t_0} = \alpha_{t_0}\mathbf{y} + \sigma_{t_0}\boldsymbol\epsilon \implies \hat{\mathbf{x}}_0

  • Small t_0 = 0.3 (high fidelity, poor realism): Keeps pixel MSE to the input small (\approx 0.02), but noise is too weak to erase unnatural blur (\mathrm{FD} \approx 30).
  • Sweet spot t_0 = 0.7: Noise erases high-frequency blur while \alpha_{0.7} = 0.3 preserves coarse pose and silhouette, synthesizing sharp textures (\mathrm{FD} \approx 4).
  • Full noise t_0 = 1.0: Forgets \mathbf{y} completely (\mathrm{FD} below 2).

Editing by Partial Noising (SDEdit) (cont.)

Trading Input Fidelity for Sample Realism

As t_0 grows, the distance to the input \mathbf{y} rises while FD falls:

t0 = 0.0: squared distance to the input 0.000, FD 87.04
t0 = 0.3: squared distance to the input 0.018, FD 30.71
t0 = 0.5: squared distance to the input 0.045, FD 12.19
t0 = 0.7: squared distance to the input 0.087, FD 4.01
t0 = 1.0: squared distance to the input 0.168, FD 1.88

Zero-Shot Replacement Inpainting

Conditioning on Partial Pixel Observations

Given known pixels \mathbf{y} on a binary mask \mathbf{m} \in \{0, 1\}^{28 \times 28} (here the top half of an image), replacement inpainting (Song et al., 2021) runs standard DDIM steps and overwrites the masked region at every level s with a freshly noised copy of \mathbf{y}:

\mathbf{x}_s \leftarrow \mathbf{m} \odot \big(\alpha_s\mathbf{y} + \sigma_s\boldsymbol\xi\big) + (\mathbf{1} - \mathbf{m}) \odot \mathbf{x}_s

  • Zero retraining required: Diverse lower-half completions emerge from different initial noise draws.
  • Boundary seam limitation: Because the unmasked step and the overwrite happen separately, texture mismatches can appear at the row-14 seam (remedied by RePaint’s back-and-forth resampling steps; Lugmayr et al., 2022).

Concept Check: DDIM, Heun, and Slerp Geometry

Check Your Understanding

Test your understanding of fast diffusion solvers and deterministic inversion:

  1. Noise replacement fraction at \eta = 1: On a 10-step VP grid, the first step drops from \bar\sigma_t = 152 to \bar\sigma_s = 59. Since \mathrm{SNR} = 1/\bar\sigma^2, what fraction f = 1 - \mathrm{SNR}_t/\mathrm{SNR}_s of the noise variance at level s is replaced by fresh noise \boldsymbol\xi when \eta = 1?
  2. Why ancestral sampling speckles at 50 steps: Why does the 50-step ancestral chain produce grainy images (\mathrm{FD} \approx 8–11) while 50-step DDIM (\eta = 0) is crisp (\mathrm{FD} \approx 1.7–1.8), even though both tie at 1{,}000 steps?
  3. When is DDIM round-trip inversion exact? Under an exact velocity oracle, for what data distribution is ddim_sample(ddim_invert(x0)) exact in just 1 step, and why does linear interpolation between two codes \mathbf{z}_0, \mathbf{z}_1 fail?

Answers:

  1. \kappa^2 = \mathrm{SNR}_t / \mathrm{SNR}_s = (\bar\sigma_s / \bar\sigma_t)^2 = (59 / 152)^2 \approx 0.151, so f = 1 - \kappa^2 \approx \mathbf{84.9\%} of the noise variance is replaced by fresh noise.
  2. The ancestral chain injects the forward-step variance \sigma_t^2(1 - \kappa^2) = (\sigma_t^2/\sigma_s^2)\tilde\sigma_{\eta=1}^2. On a 50-step grid at low noise, \sigma_t^2/\sigma_s^2 \gg 1, injecting excessive noise when the garment is already nearly determined; at 1{,}000 steps, \sigma_t^2/\sigma_s^2 \approx 1.
  3. Inversion is exact in 1 step when \hat{\boldsymbol\epsilon} is constant along trajectories (a single data point). For two orthogonal codes of norm r, the linear midpoint \frac{1}{2}(\mathbf{z}_0 + \mathbf{z}_1) shrinks in norm to r/\sqrt{2} \approx 0.71r, falling outside the unit Gaussian shell.

Summary: Fast Samplers, Inversion, and Editing

Key Takeaways

Method / Tool Update Rule in (\bar{\mathbf{x}}, \bar\sigma) = (\mathbf{x}/\alpha, \sigma/\alpha) Order & Cost per Step Key Empirical Result & Role
DDIM (\eta = 0) \bar{\mathbf{x}}_s = \bar{\mathbf{x}}_t + (\bar\sigma_s - \bar\sigma_t)\hat{\boldsymbol\epsilon}_t 1st-order (O(h)), 1 NFE Exact Euler on flow ODE; reaches plateau in 50 NFE
Stochastic DDIM (\eta > 0) \mathbf{x}_s = \alpha_s\hat{\mathbf{x}}_0 + \sqrt{\sigma_s^2 - \tilde\sigma^2}\hat{\boldsymbol\epsilon} + \tilde\sigma\boldsymbol\xi 1st-order SDE, 1 NFE \eta = 1 uses posterior variance; trails \eta = 0 at \le 200 steps
Heun’s Method Average of Euler start & trial slopes 2nd-order (O(h^2)), 2 NFE Reaches asymptotic FD plateau in 20 NFE on linear grid
Multistep (AB2 / DPM++) \bar{\mathbf{x}}_t + \Delta\big(\hat{\boldsymbol\epsilon}_t + \frac{\Delta}{2\Delta'}(\hat{\boldsymbol\epsilon}_t - \hat{\boldsymbol\epsilon}')\big) 2nd-order (O(h^2)), 1 NFE Reuses previous slope; best solver under CFG (\gamma = 2)
DDIM Inversion & Slerp Forward Euler t: 0 \to 1; great-circle arc O(h) round-trip error Encodes real images to noise codes \mathbf{z} while preserving \|\mathbf{z}\|
SDEdit & Inpainting Start at t_0 \in (0, 1) or overwrite mask \mathbf{m} Zero-shot (no retraining) t_0 trades fidelity vs. realism; mask overwrite fills missing regions