feat: cache solved multiple-image positions for SLaM resume fast-path#619
Merged
Conversation
…ast-path positions_likelihood_from re-runs the point-solver grid search over the maximum log likelihood tracer on every call — on a resumed SLaM pipeline this is the single largest resume cost (autolens_profiling#70: ~70s of a 148s resume, more in production). The solved positions are a pure product of the completed fit, so they are now cached into the upstream result's own files/ folder on first solve (multiple_image_positions[_plane_<z>].json) and loaded on every later call; threshold arithmetic (factor/min/max) stays live so all arguments behave as before. The cache file is appended into the search's .zip so a resumed search's restore() cycle preserves it (helper shared from PyAutoGalaxy). First arrival solves exactly as before; staleness is structurally guarded by search identifiers; pathless results (NullPaths) always solve; the explicit positions= argument bypasses the cache entirely. Validated via autolens_profiling pipeline_resume (with the PyAutoGalaxy adapt-images leg): per-stage inter-stage resume cost 151s/130s/128s -> 0.3s/0.0s/0.1s. Issue: PyAutoGalaxy#502. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 17, 2026
Merged
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
Implements the PyAutoLens leg of the SLaM resume fast-path (PyAutoGalaxy#502, judgment from autolens_profiling#70):
positions_likelihood_fromno longer re-runs the point-solver grid search on every call — the solved multiple-image positions are cached into the upstream result's ownfiles/folder on first solve (multiple_image_positions[_plane_<z>].json) and loaded thereafter via the new privateResult._cached_multiple_image_positions_from.Key mechanics:
factor/minimum_threshold/maximum_threshold/mass_centre_radial_distance_min) stays live, so all arguments behave exactly as before; only the arg-independent point-solve is memoized.positions=argument bypasses the cache entirely;NullPathsresults always solve; staleness structurally guarded by search identifiers..zip(helper shared from PyAutoGalaxy'sadapt_imagesmodule) so the resumerestore()cycle preserves it.Validated with the PyAutoGalaxy leg via the
autolens_profilingpipeline_resumeinstant recipe: per-stage inter-stage resume cost 151s / 130s / 128s → 0.3s / 0.0s / 0.1s.API Changes
None — no public API changes.
positions_likelihood_fromreturns identical objects; later calls load the solved positions from disk. New side effect: a JSON cache file written into a result'sfiles/folder (and its zip) when the result has on-disk output.Details
Added
autolens/analysis/result.py: privateResult._cached_multiple_image_positions_from.Changed Behaviour
positions_likelihood_from: solved positions are cache-aside memoized perplane_redshift.Migration
Test Plan
test_autolens/analysis/test_result.py— new test: second call with a poisoned solver loads the cached positions and reproduces positions + threshold exactly (14/14 in file).test_autolens/suite green in the task worktree.autolens_profilingpipeline_resume(numbers above).Upstream PR
Depends on the PyAutoGalaxy leg (imports
_append_to_search_zip): merge PyAutoGalaxy first — link added after creation.🤖 Generated with Claude Code