Repository navigation
findings: correct two disproved claims about the Fitness NaN guard - #106
Merged
Merged
Conversation
…1391) The doc shipped in #105 before the follow-up investigation. Two corrections: 1. "does not protect gradient consumers at all" was overreach -- the trap fires only when the masked branch's DERIVATIVE is non-finite. sqrt/cholesky yes; log(x<0) no (d/dx = 1/x stays finite). 2. the prescribed remedy ("the standard double-where / safe-x pattern") DOES NOT WORK applied to the output. Measured: output-side double-where still grads NaN; only input-side safe-x is finite. By the time Fitness.call sees the log_likelihood the non-finite derivative is already on the tape. So Fitness.call is structurally incapable of fixing this and PyAutoFit#1391 is scoped to pinning the contract, not a code fix. Also corrects the A100 note -- this specific bug reproduces in ~20 lines of CPU JAX. The site-1 localisation is unaffected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Part of PyAutoFit#1391. Upstream PR: PyAutoLabs/PyAutoFit#1392 (must merge first — library-first gate).
Corrects two claims in
searches_minimal/pix_nonfinite_findings.mdthat shipped in #105 and were disproved by the follow-up investigation. main currently carries advice that does not work.What was wrong
The doc's site-2 section (the PyAutoFit
where-guard) was written before the mechanism was tested. Two errors:1. Overreach. It claimed the guard "does not protect gradient consumers at all". The trap actually fires only when the masked branch's derivative is non-finite — not merely its value:
log(x), x<01/x= finite0 * -1 = 0sqrt(x), x<0cholesky(A), non-PD (site 1)2. The prescribed remedy does not work. The doc called for "the standard double-
where(safe-x) pattern". Applied to the output — which is allFitness.callcan do — it fixes nothing. Measured:By the time
Fitness.callreceiveslog_likelihood, the non-finite derivative is already on the autodiff tape. Only refusing to evaluate the offending op at the invalid input works, and that requires knowing which input is invalid — knowable at the NaN's source (site 1, autoarray's Cholesky), not at theFitnessboundary.Consequence:
Fitness.callis structurally incapable of fixing this, so PyAutoFit#1391 is scoped to pinning the contract (docstring + assertion script), not a code fix. Site 1 remains the real fix.Also corrected: the reproduction note. This specific bug needs ~20 lines of CPU JAX, not the A100 — only the site-1 localisation does.
The site-1 localisation is unaffected —
log_det_regularization_matrix_term, the exonerations, and the mechanism all stand.Scripts Changed
searches_minimal/pix_nonfinite_findings.mdDoc only — no code, no scripts, no notebooks.
Gate
PyAutoLens: 1 uncommitted source change(s).