Sampler discretization and local error
Separate one-step numerical defects, accumulated trajectory error, model error, and perceptual quality when comparing sampling budgets.
On this page
The question for today
What you’ll understand
- State local and global Euler error under explicit ODE assumptions.
- Compare numerical endpoints on a solvable scalar test.
- Count function evaluations independently from displayed sampler steps and image quality.
A sampling update approximates a continuous or discrete reference process; its error has a defined target. A local one-step defect measured from the exact incoming state is different from the error after many approximate steps. Neither is automatically the same as perceptual quality. Serving decisions need to connect these layers through evidence while preserving the mathematical assumptions of the numerical claim.
Choose the reference equation and computational coordinate
Use an increasing computational coordinate τ and write a deterministic ODE dx/dτ=F(x,τ). Explicit Euler evaluates the field at the current state and advances by a positive step h. If the original sampling equation used decreasing diffusion time t, transform its drift before applying this convention. A numerical fixture with an analytic solution can expose sign, scaling, and endpoint mistakes independently of a neural model. It cannot by itself predict quality on a high-dimensional learned image manifold.
A local defect starts each trial at the exact reference state and asks how one numerical step differs from the exact evolution over that step. Global error instead includes propagation and accumulation of previous mistakes over a fixed horizon. Lipschitz and smoothness assumptions control this propagation; stiffness, endpoint singularities, or a poorly behaved learned field can invalidate a naive comparison. Stochastic strong and weak convergence have separate definitions and orders, so a deterministic Euler order statement must not be transferred unchanged to an SDE sampler.
Keep order claims within their domain
For a sufficiently smooth ODE on a fixed finite interval with suitable Lipschitz bounds, Euler’s one-step state defect is second order in h and its global endpoint error is first order. The constants and stability region still matter. Higher-order diffusion solvers exploit special structure and require their own derivation; the DPM-Solver paper analytically handles a linear component while approximating a neural-network integral. An exact integral representation does not make a finite quadrature of that integral exact for every learned field.
A solver can use several network evaluations per step, reuse previous evaluations, or perform additional corrector calls. Report neural function evaluations, batch size per invocation, guidance branches, and total wall time rather than equating the loop counter with cost. Reducing function evaluations can improve latency but may change discretization error, conditioning adherence, diversity, or artifacts. Distilled or consistency-trained models have a different learned objective and supported sampler contract; they are not evidence that arbitrary pretrained models can lose most evaluations without quality consequences.
Test numerical behavior and generated quality separately
Use a scalar or small-vector reference to verify an implementation’s claimed order and schedule indexing. Then use matched model, prompts, seeds, precision, and output processing to measure task quality and latency. A tighter solver tolerance may increase evaluations without improving a metric dominated by model error. Conversely, a numerically different trajectory can appear preferable under one perceptual metric. Report that empirical observation honestly instead of converting it into a theorem that numerical error and image quality always move together.
The optimization instrument exactly reproduces Euler updates for the test equation x′=−x. Reset, set both η=0.25 and x₀=1, predict x₄=0.31640625 at computational horizon one, then Step four times. Separately Reset, set both η=0.1 and x₀=1, predict x₁₀≈0.34867844 at the same horizon, then Step ten times. Here η plays the Euler step h and each Step advances one iteration, not h units of the UI clock. This fixed quadratic-descent model has no neural score, stochastic diffusion, or image-quality measure.
Work it through
Measure global Euler error on a known solution
For x′=−x, x(0)=1, integrate to computational time one using Euler with four equal steps and with ten equal steps. The analytic endpoint is e⁻¹≈0.36787944.
Four steps use h=0.25 and give (1−0.25)⁴=0.31640625. The absolute endpoint error is approximately 0.05147319.
Ten steps use h=0.1 and give 0.9¹⁰=0.3486784401. The absolute endpoint error is approximately 0.01920100.
The smaller step improves this scalar numerical error under the stated model. The calculation does not compare GPU latency, guided neural evaluations, or generated image quality and cannot establish a universal best sampler budget.
Use an analytic fixture to validate numerical claims, then evaluate generation quality under a separate controlled experiment.
The living notebook
Explore the model
Interactive lab · optimization
Euler step size changes a checkable endpoint error
Reset, set both η=0.25 and x₀=1, predict x₄=0.31640625, then Step four times. Separately Reset, set both η=0.1 and x₀=1, predict x₁₀≈0.34867844, then Step ten times. Interpret η as Euler h for x′=−x over horizon one; the lab is not a neural diffusion sampler or image-quality evaluator.
- Position x0
- 2
- Objective x²/2
- 2
- Iteration behavior
- Stable step
Gradient descent on f(x) = x²/2: xₙ = (1 − η)ⁿx₀. Playback advances two discrete iterations per second. Values outside |x| ≤ 4 are explicitly reported. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forA demonstrated numerical error trend is narrower than a generation-quality or latency guarantee.
Pause & reason
Check your understanding
Your turn
Try it yourself
Euler integrates x′=−x from x₀=1 with h=0.2 for five steps. Compute the endpoint and its approximate absolute error against e⁻¹.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Repeated Euler updates multiply the state by 0.8.
Compare with the solution
The endpoint is 0.8⁵=0.32768 and the absolute error is approximately 0.36787944−0.32768=0.04019944. This deterministic scalar result does not specify the convergence order of an SDE method or the sample quality of a neural denoiser.
Keep the idea
Take it with you
- Define one-step and fixed-horizon error against a specified process.
- Keep order, stability, and parameterization assumptions explicit.
- Measure neural evaluations, wall time, and quality as separate evidence.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.