Fix float32 MLE optimization with autograd gradients#66
Open
AparajeetS wants to merge 1 commit into
Open
Conversation
AparajeetS
force-pushed
the
codex/fix-mle-float32-gradient
branch
from
July 18, 2026 09:54
9f670f7 to
b6c42fb
Compare
AparajeetS
marked this pull request as ready for review
July 18, 2026 09:55
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.
Fixes #61.
What changed
scipy.optimize.minimizeTemperatureScalingandLogisticCalibrationwith both float32 and float64 inputsRoot cause
The MLE callback converted SciPy's float64 parameter vector to the prepared input
tensor's dtype. With float32 inputs, SciPy's default finite-difference perturbation near
one was rounded away by that conversion. The loss at
w=1andw=1+1e-8becameidentical, so SciPy reported a zero gradient after two evaluations and returned the
identity initialization with a successful status.
On a deterministic five-class overconfidence problem, the old float32 behavior kept the
weight at
1.0and NLL at1.8382. The autograd path fits a weight of0.3286andreduces NLL to
1.3154, matching the float64 control (0.3285,1.3154).Validation
python -m unittest tests.test_mle_precision -vpython -m compileall -q netcal testsgit diff --checkThe full executable diagnosis and recorded results are available in
Phason Evidence Audit PEA-005.