fix: Marquardt-scaled LM damping + zero-fill correction profiles#626
Merged
Conversation
solve_lm_step_from now damps with mu*diag(diag(H)) (clipped) instead of mu*I — scale-invariant damping; visibility-weighted curvatures (~1e11) stalled the interferometer LM under mu*I's 4 usable decades. Both iterative engines build their correction InputPotential with extrapolate=zero (companion PyAutoGalaxy PR) so arc-restricted corrections vanish outside their mesh. Part of #623. 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.
Summary
Two robustness fixes to the potential-correction engines from the interferometer validation campaign (#623):
dense_util.solve_lm_step_from: the damped system is now(H + μ·diag(diag(H)))·δx = −ginstead of(H + μI), making the damping scale-invariant. With visibility-weighted curvatures (H~ 10¹¹) the old μ·I damping had ~4 usable decades before the 10¹⁵ cap and the interferometer LM stalled with "damping exceeded"; with diagonal scaling the damping engages at every scale (the stall is gone). Zero diagonal entries are clipped to 1e-12 of the mean |diag| so they stay damped. Applies to both imaging and interferometer engines (imaging behaviour re-verified by the existing end-to-end tests).InputPotentialwithextrapolate="zero"(new PyAutoGalaxy mode, companion PR), so arc-restricted corrections vanish outside their mesh instead of nearest-smearing spurious deflections across the re-trace grid.API Changes
Behaviour change (internal numerics): the LM damping in
al.pc.dense_util.solve_lm_step_fromis now Marquardt-scaled; identical solutions at convergence, different damping trajectories. No signatures changed.See full details below.
Test Plan
solve_lm_step_fromtest updated to the Marquardt identity; constrained-step and all other kernel tests unchanged.test_autolens/potential_correctionsuite: 51 passed (incl. both end-to-end iterative engines).test_autolenssuite run before commit.Full API Changes (for automation & release notes)
Changed Behaviour
al.pc.dense_util.solve_lm_step_from(H, minus_gradient, mu, ...)— damping term is nowmu * diag(diag(H))(clipped) rather thanmu * I.al.pc.IterFitDpsiSrcImaging/IterFitDpsiSrcInterferometer— correctionInputPotentialbuilt withextrapolate="zero".Migration
Generated by the PyAutoLabs agent workflow.