Repository navigation
fix(schedulers): promote DEIS polynomial coefficients to float64 to prevent catastrophic cancellation - #15159
Open
MinYeFa wants to merge 1 commit into
Conversation
…revent catastrophic cancellation (huggingface#15090) In DEISMultistepScheduler, evaluating polynomial integral coefficients in float32 leads to catastrophic cancellation when num_inference_steps is large (h << 1). For 500 steps, float32 precision loss exceeds 8%, whereas evaluating the polynomial integrals in float64 maintains numerical stability across all step regimes. This commit converts the intermediate log-rho values and integral evaluations in multistep_deis_second_order_update and multistep_deis_third_order_update to float64 scalars before scaling the model output tensors. Signed-off-by: Min-Ye Fa <347497424+MinYeFa@users.noreply.github.com>
MinYeFa
force-pushed
the
fix/deis-scheduler-float64-coefficients-15090
branch
from
October 31, 2026 22:37
e94fa86 to
86e2f28
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #15090.
In$h = \Delta \log\rho \ll 1$ ).
DEISMultistepScheduler, evaluating polynomial integral coefficients in float32 leads to catastrophic cancellation asnum_inference_stepsincreases (when the step sizeSpecifically, in
multistep_deis_second_order_updateandmultistep_deis_third_order_update:rho_t,rho_s0,rho_s1,rho_s2were calculated via PyTorch float32 division.np.logproduces single-precision NumPy floats.ind_fn, the polynomial integration formulas compute finite differences between adjacent terms whose difference isSolution
rho_t, rho_s0, rho_s1, rho_s2to standard 64-bit Python floats (float(sigma / alpha)).model_output_listtensors (float(...)).test_high_step_coefficient_precisionverifying stable ODE integration across 50 and 100 inference steps for orders 2 and 3.