Skip to content

test mode: size-realistic fake samples — phase 1: design (D1–D4) #1378

Description

@Jammy2211

Overview

Design phase (1 of 4) for extending PYAUTO_TEST_MODE bypass runs to produce size-representative outputs: a sample-count knob so samples.csv matches a production Nautilus SLaM stage (N ~ 10k–100k rows) instead of today's 4 fake samples. This makes cold SLaM runs instant while keeping resume-overhead profiling honest (born from the slam-resume-profiling task, autolens_profiling#70). This phase edits no source — the deliverable is four locked design decisions (D1–D4) posted on this issue, which phase 2 implements verbatim.

Plan

  • Ground the design against the live bypass path: PYAUTO_TEST_MODE levels in autoconf, _fit_bypass_test_mode_build_fake_samples in PyAutoFit.
  • Fix the parity target: measure a production Nautilus SLaM stage's samples.csv (rows, columns, byte size) against today's 4-sample bypass output.
  • Lock and post the four decisions: D1 knob name + accessor placement, D2 vectorized synthesis recipe, D3 downstream contract + the concrete phase-2 test list, D4 representativeness limits (recorded, not solved).
  • Exit: D1–D4 on this issue; phase 2 unblocked with zero open design questions.
Detailed implementation plan

Affected Repositories

  • PyAutoFit (primary — design target; no edits this phase)
  • PyAutoConf (only if D1 places the accessor next to test_mode_level())

Branch Survey

Repository Current Branch Dirty?
./PyAutoFit main clean (claimed by aggregator-sqlite, PR#1376 awaiting merge)
./PyAutoConf main clean

Suggested branch: feature/test-mode-representative-samples (family branch, created in phase 2; phase 1 needs none). Phase 2 is blocked until the aggregator-sqlite PyAutoFit claim frees.

Implementation Steps

  1. Read autoconf/test_mode.py (test_mode_level() accessor pattern) — decide D1: env var PYAUTO_TEST_MODE_SAMPLES (default 4 = today's behaviour, byte-identical when unset); accessor in PyAutoConf next to test_mode_level() vs a local read in PyAutoFit (the latter drops PyAutoConf from phase 2 entirely).
  2. Read autofit/non_linear/search/abstract_search.py_fit_bypass_test_mode, _build_fake_samples (prior-median best + 3 perturbed), save_samples / save_samples_summary — and the samples CSV writer + Samples.summary() quantile/weight machinery. Design D2: vectorized numpy synthesis at N (deterministic seed and where it lives; parameter scatter around the prior median; monotone plausible log-likelihoods; valid normalized weights; exact samples.csv column layout/dtypes so row count and byte size match production).
  3. Measure a production reference from the slam-resume-profiling outputs (autolens_profiling#70): rows, columns, bytes of a real Nautilus SLaM stage samples.csv; same for a bypass-completed stage. Sets the N target range.
  4. Enumerate D3 — everything that must keep working on the synthetic set, with the concrete phase-2 test for each (numpy-only unit tests; no JAX): samples.summary() quantiles, search chaining (result.model / result.instance), aggregator scrape, database load, existing 4-sample multi-batch structural guarantees at large N, default-unset back-compat, and a generation-speed check (N=50k in seconds, vectorized).
  5. Record D4 — known representativeness limits, recorded not solved: single bypass likelihood call leaves no realistically-sized search-internal state; adapt-image FITS values come from the prior-median model (size right, values wrong); test mode auto-skips latents.
  6. Post D1–D4 as issue comments; mark phase 2 unblocked (design-wise).

Key Files

  • PyAutoConf/autoconf/test_mode.pytest_mode_level(); candidate home for the new accessor (D1)
  • PyAutoFit/autofit/non_linear/search/abstract_search.py_fit_bypass_test_mode, _build_fake_samples (D2)
  • PyAutoFit/autofit/non_linear/samples/ — CSV writer, Samples.summary(), weight handling (D2/D3)
  • PyAutoFit/autofit/aggregator/ — scrape path exercised by the D3 contract

Original Prompt

Click to expand starting prompt

Test-mode representative outputs — Phase 1: design

Type: feature
Target: autofit
Repos:

  • PyAutoFit
  • PyAutoConf
    Difficulty: small
    Autonomy: supervised
    Priority: normal
    Status: formalised

Phase 1 of 4 of draft/feature/autofit/test_mode_representative_outputs_size_realistic.md
(the parent umbrella — read it first; its scoping notes were verified against source
2026-07-16). Design only — no source edits; the deliverable is a set of locked
decisions recorded on this phase's GitHub issue, which phase 2 implements verbatim.

Decisions to lock

  • D1 — knob. Confirm PYAUTO_TEST_MODE_SAMPLES=N (env var, default 4 = today's
    behaviour, so nothing changes for existing users/tests) and where it is read:
    accessor next to test_mode_level() in @PyAutoConf autoconf/test_mode.py vs
    reading it locally in @PyAutoFit. Decide whether PyAutoConf is touched at all.
  • D2 — synthesis scheme. Exact vectorized recipe _build_fake_samples uses at
    large N: parameter scatter around the prior median (deterministic seed — where does
    the seed live?), monotone plausible log-likelihoods, valid normalized weights, and
    the samples.csv column layout/dtypes so row count and byte size match a production
    Nautilus SLaM stage (N ~ 10k–100k).
  • D3 — downstream contract. Enumerate what must keep working on the synthetic set
    and how phase 2 tests each: samples.summary() quantiles, search chaining
    (result.model / result.instance), aggregator scrape, database load, and the
    existing 4-sample multi-batch structural guarantees at large N.
  • D4 — representativeness limits. Record (not solve) the known deltas from a
    production resume: single bypass likelihood call leaves no realistically-sized
    search-internal state; adapt-image FITS values come from the prior-median model
    (size right, values wrong); test mode auto-skips latents.

Exit criteria

D1–D4 posted on the issue as locked decisions; phase 2 unblocked with no open design
questions.

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