Skip to content

Inference programme: no fast default CPU mesh — Rectangular is the default and slow on CPU (new-user hazard) #153

Description

@Jammy2211

Bolt-on to the JAX profiling / inference programme (results/notes/inference/PROGRAMME.md; PyAutoMind epic jax-inference-profiling). Filed 2026-08-21 from the CPU-likelihood speed campaign (#151), at user direction.

Problem

After the 2026-08-20/21 CPU speed round, the Delaunay + Hilbert AdaptImage fiducial is fast on CPU (euclid 4.92 → 1.34 s/eval via PyAutoArray#453 + #455) — but it is the expert configuration. The default mesh a new user gets is RectangularAdaptDensity, whose kernel-CDF transform makes it the slowest thing on a CPU:

  • euclid: transform = 1.66 s = 55% of the eval; hst: 27 s = 89% of a 21.6–30 s eval.
  • The exact windowed numba kernel (PR in flight) buys 3.0–3.4×, but the transform is irreducibly O(N²) erf for exact values — hst stays ~8 s/eval, and the O(N²) scaling gets worse at JWST resolution.
  • A config-gated interpolated-CDF forward (K=8192 knots) was measured at Δlnℒ ≤ +4e-3 absolute / ≤ 2e-3 differential (passes the rtol 1e-6 pins) and reaches ~18–55× on the step — but it is an approximation and a defaults/science decision.
  • On GPU this is a non-issue (full hst eval 57.6 ms on A100) — the hazard is specifically CPU users on the default configuration, i.e. exactly the audience of cpu_fast_modeling.py and every new user without a GPU.

Options (decision needed, then a programme slice)

  1. Make Delaunay first-class: it is now the fast CPU mesh, but requires the adapt-image machinery (Hilbert image mesh from a prior fit) — first-class means either a sensible no-adapt entry path (e.g. Overlay image mesh) or chained-fit defaults that hide the setup from new users.
  2. A simpler/faster Rectangular default: plain uniform Rectangular (no kernel-CDF adaption) as the CPU default, and/or ship the interpolated-CDF mode as the CPU default with the exact transform config-gated instead (inverting the gate).
  3. Something else — e.g. backend-dependent defaults (adaptive Rectangular on JAX/GPU where it is free; a cheaper mesh on use_jax=False), or resolution-dependent guardrails that warn when the O(N²) transform will dominate.

Evidence base

Suggested handling: add a backlog row to PROGRAMME.md and adjudicate the default-mesh decision at the next programme gate — the engineering slices (whichever option wins) are all small once the decision is made.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions