Skip to content

feat: cache solved multiple-image positions for SLaM resume fast-path#619

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/slam-resume-fastpath
Jul 17, 2026
Merged

feat: cache solved multiple-image positions for SLaM resume fast-path#619
Jammy2211 merged 1 commit into
mainfrom
feature/slam-resume-fastpath

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Implements the PyAutoLens leg of the SLaM resume fast-path (PyAutoGalaxy#502, judgment from autolens_profiling#70): positions_likelihood_from no longer re-runs the point-solver grid search on every call — the solved multiple-image positions are cached into the upstream result's own files/ folder on first solve (multiple_image_positions[_plane_<z>].json) and loaded thereafter via the new private Result._cached_multiple_image_positions_from.

Key mechanics:

  • Threshold arithmetic (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.
  • The explicit positions= argument bypasses the cache entirely; NullPaths results always solve; staleness structurally guarded by search identifiers.
  • The cache file is appended into the search's .zip (helper shared from PyAutoGalaxy's adapt_images module) so the resume restore() cycle preserves it.

Validated with the PyAutoGalaxy leg via the autolens_profiling pipeline_resume instant 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_from returns identical objects; later calls load the solved positions from disk. New side effect: a JSON cache file written into a result's files/ folder (and its zip) when the result has on-disk output.

Details

Added

  • autolens/analysis/result.py: private Result._cached_multiple_image_positions_from.

Changed Behaviour

  • positions_likelihood_from: solved positions are cache-aside memoized per plane_redshift.

Migration

  • None required.

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).
  • Full test_autolens/ suite green in the task worktree.
  • End-to-end validation via autolens_profiling pipeline_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

…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>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Jul 17, 2026
@Jammy2211
Jammy2211 merged commit f2f3bb2 into main Jul 17, 2026
3 of 5 checks passed
@Jammy2211
Jammy2211 deleted the feature/slam-resume-fastpath branch July 17, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant