Repository navigation
Description
Overview
On the autolens_visualization cluster model (autolens_profiling#439 / PR #440, stress draws 9 and 16, starting scales 1.0, 0.7, 0.5 and 0.3″), PointSolver returns a candidate exactly on an r_core = 0 scaling dPIE member core (e.g. (15.0, 9.0008), (5.5009, −6.4999)). The lens-equation residual there is 0.04″, against a last-step tolerance of about 0.002″. The deflection is discontinuous at a zero-core centre, so triangle containment passes without a true root, and the magnification filter does not catch it. This task adds an opt-in rejection rule (default off) that removes these points without losing true images. Part of epic cluster-pointsolver-speed (ledger).
Plan
- Reproduce in a small unit test (one or two
r_core = 0dPIE members, eager + JIT). If that does not reproduce, extract a minimal case from docs(install): clone workspace at tag matching library version #440's viz draws 9/16. - Diagnose why the magnification filter passes the point (|μ| at 0.0008″ from a zero-core centre should be ≪ 0.1; the Hessian is likely sampled across the discontinuity).
- Compare two rejection rules:
- (A) a source-plane residual cut, |β(θ̂) − β| > k ·
pixel_scale_precision; - (B) a triangle consistency check: the traced final triangle's area vs |det A| × its image-plane area.
- (A) a source-plane residual cut, |β(θ̂) − β| > k ·
- Neither rule may use the linearised |A⁻¹r|: it is huge near a singular core, so it would pass the spurious point.
- Score both rules against existing evidence: the 1c/1d near-cusp candidates (workspace_test
scripts/point_source/solver/image_accuracy_evidence.json) must lose no true image; the docs(install): clone workspace at tag matching library version #440 viz/simpledraws must lose the spurious points with no change to oracle coverage. - Ship the winner as an opt-in solver option, default off, so behaviour is bit-identical. Turning it on by default is a human decision.
- It must work as a static-shape mask under eager/JIT/vmap, leaving gradients and the custom-JVP rule untouched.
Tier: judge — merge mode: human /prm
Detailed implementation plan
Affected Repositories
- PyAutoLens (primary)
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./PyAutoLens | main | clean (behind origin by 1) |
Suggested branch: feature/point-solver-spurious-core
Worktree: ~/Code/PyAutoLabs-wt/point-solver-spurious-core/
Implementation Steps
- Repro tests. Fixture in
test_autolens/point/triangles/test_solver_edge_cases.py: assert the spurious candidate exists with defaults (baseline) and is removed with the option on; run on NumPy and insidejax.jit. - Diagnosis. Measure the residual, |μ| (
_filter_low_magnificationviaLensCalc.magnification_2d_via_hessian_from) and the Hessian at the spurious point, against true images of similar |μ|. - Option. New
AbstractSolver.__init__keyword named after the chosen rule (e.g.residual_threshold), defaultNone:- threaded through
for_grid,for_limits_and_scaleandtree_flatten/tree_unflatten; - applied in
PointSolver._solve_arraybeside_filter_low_magnificationas anxp.where(..., nan)mask, so it becomes theinfsentinel; - in the JVP primal only, leaving the implicit fixed-point rule at the surviving positions unchanged.
- threaded through
- Evidence and threshold. A bounded diagnostic script (outside the library) checks A vs B on the 1c/1d fixtures and the docs(install): clone workspace at tag matching library version #440 viz/
simpledraws and fixes k. Results go in the PR body and an autolens_profiling ledger appendix. - Tests. Defaults bit-identical (existing solver tests); eager/JIT/vmap parity with the option on; gradients finite and unchanged at true images.
- Out of scope:
- starting-grid defaults (decided 2026-10-23: keep 1.0″);
- workspace cluster scripts (validation-check draft);
- the workspace_test CI witness (epic phase 2), filed once the rule is accepted.
Key Files
autolens/point/solver/point_solver.py—_solve_array, where the mask is appliedautolens/point/solver/shape_solver.py—AbstractSolverconstructor, factories, pytreeautolens/point/solver/implicit_diff.py— custom-JVP wrapper (must stay untouched)test_autolens/point/triangles/test_solver_edge_cases.py— new regression tests
Original Prompt
Click to expand starting prompt
@PyAutoLens PointSolver: spurious candidates exactly on r_core = 0 dPIE member cores
Type: feature
Target: autolens
Repos:
- PyAutoLens
- PyAutoArray
Difficulty: small
Autonomy: supervised
Priority: medium
Status: draft
Consequence: judge
Epic: cluster-pointsolver-speed
Related: autolens_profiling#439 (PR docs(install): clone workspace at tag matching library version #440),results/notes/cluster_pointsolver_campaign.md
Filed: 2026-10-23
Why
On autolens_profiling#439's viz-model stress draws 9 and 16, at starting scales 1.0, 0.7, 0.5 and 0.3″, PointSolver returned a candidate exactly at an r_core = 0 scaling dPIE member core (e.g. (15.0, 9.0008)) with a lens-equation residual of 0.04″ against a last-step tolerance of about 0.002″. The deflection is discontinuous at a zero-core dPIE/SIS centre, so the triangle containment test passes without a true root. The independent oracle rejects these; the production solver does not.
Deliverables
- Reproduce on a single SIS-like member with
r_core = 0(unit test fixture, eager + JIT). - Investigate an optional final residual filter (|β(θ) − β| below the precision) or core-aware containment; preserve JIT/vmap/gradient behaviour and the existing eager/JIT parity tests.
- Any default change is a human decision; add the regression to autolens_workspace_test per the epic's CI-witness contract (phase 2) once accepted.
Out of scope
Starting-grid defaults (decided separately); cluster workspace scripts.
Activity
Jammy2211 commentedon Oct 23, 2026
Library PR created
a25ca735a,pending-release): an opt-inresidual_threshold(defaultNone, so behaviour is unchanged). It rejects candidates with |β(θ̂) − β| > k ·pixel_scale_precision; k = 10 is recommended.simple) and 1.075× (1c/1d near-cusp);residual_threshold is not None).feat: PointSolver residual_threshold on by default (10.0)
Jammy2211 commentedon Oct 23, 2026
Human decision 2026-10-23:
residual_thresholdis on by default at 10.0 (commit58f561c04on #800;Nonedisables it).test_static_lattice_jaxnow pinsNone: it counts triangle-step traces, and the filter adds one trace of the padded candidates.Jammy2211 commentedon Oct 23, 2026
Shipped
Merged in #800 (
67e9f1ff3), pending release.PointSolvernow drops candidates whose source-plane residual exceedsresidual_threshold × pixel_scale_precision. The default is 10.0; passNoneto disable it. Pulse ledger: PyAutoPulse#73 (3aeeeae07). Next in the epic: the workspace validation check, then a workspace_test CI witness for the default-on filter.