Skip to content

feat: Bring Your Own Likelihood (BYOL) mode - #41

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/byol-mode
Sep 10, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/byol-mode

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

Adds Bring Your Own Likelihood (BYOL) mode (modes/byol.md): the door for the second published prompt ("Set up PyAutoFit with my existing science project …"). You bring the likelihood; the assistant brings the inference. The mode runs the prompt's own contract one stage per turn:

  1. Overview — read the pointed-at code; restate what it scores, its calling convention, log-likelihood vs chi-squared (and whether the noise constant is included), free parameters vs fixed configuration, data and selection cuts; ask the user to correct it.
  2. Model — af.Model mirroring the free arguments, priors chosen with the user, model.info.
  3. Wrap and validate — the Analysis wrapper importing their code unchanged; af_wrap_likelihood's three checks (finite, equals their function, bad instance scores worse); the data-inspection gate on their real data.
  4. Search — recommendation with the reason; cost per call sets the runtime estimate; the JAX triage question once.
  5. Go-ahead checkpoint — a four-row table, then stop; nothing runs until they say go.
  6. Run, then results on disk — output-folder tour while it runs; parameter table, plots, aggregator reload; residuals as the check because real data has no truth.

The ask-anything / teacher-mode footer sits on every stage, as in start here. AGENTS.md registers the mode and puts its trigger beside start here at the front of the selection chain (BYOL wins when both fire and code is pointed at). README.md gives the BYOL material its own Bring Your Own Likelihood (BYOL) sub-heading at the end of "Your own project" (P2 points at it), says the prompt launches BYOL mode with the BYOB nod, and names BYOL in "Setting up" step 3 and "Getting Started". Prompt text unchanged; byte-identical between README and the mode. Setup docs untouched (they do not carry the BYOL prompt).

Scripts Changed

None committed. The mode's worked example is a real dry run kept in gitignored scripts/scratch/byol_demo/: a stand-in user module (sne_likelihood.py, flat-ΛCDM distance modulus over dataset/sne_cosmology/, 1371 SNe after the user's cuts, returning -0.5·χ² without the noise constant) taken through stages 1–6.

Dry run

Stage Result
3 validate finite log L −295.1774; equals the user's function exactly; bad instance −1726.64 < good; 0.19 ms per call
4 search DynestyStatic(nlive=75) — evidence wanted, plain-numpy likelihood
6 fit 11.4 s, 3686 evaluations: Ωm 0.344 +0.021/−0.019, H0 73.11 +0.27/−0.30 (dataset README validation 0.344 / 73.14); log Z −302.40; aggregator reload returns the same medians

python autoassistant/audit_skill_apis.py --check-version exits 0; all executed scripts pass the per-file audit.

Test Plan

  • Fresh session in this repo: paste the BYOL prompt with a path to a likelihood module; the reply states BYOL mode, gives the stage-1 overview and asks you to correct it — no fit launched
  • Say "go" after stage 5: the fit runs and the output-folder tour follows

Merge order

Library-first gate: PyAutoLabs/PyAutoFit#1604 (docs only: the "(BYOL)" headings and the link sentences) merges first.

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BrGfrSxV9xoqCa4v1p9hix

…ompt gets its door

modes/byol.md catches the published "Set up PyAutoFit with my existing
science project" prompt and runs its own contract one stage per turn:
overview of the project and likelihood function, a model with priors chosen
with the user, the Analysis wrapper validated against their function
unchanged, a search recommendation with the reason, a go-ahead checkpoint
that fits nothing until they say go, then the run with the output-folder
tour and how to inspect and interpret the results. The ask-anything /
teacher-mode footer sits on every stage, as in start here. You bring the
likelihood; the assistant brings the inference.

AGENTS.md registers the mode and its selection rule beside start here.
README.md gives the BYOL material its own "Bring Your Own Likelihood (BYOL)"
sub-heading under Your own project and says the prompt launches BYOL mode;
prompt text unchanged. The mode's worked example quotes a real dry run on
the bundled supernova dataset through a stand-in user likelihood module.

Closes #40

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BrGfrSxV9xoqCa4v1p9hix
@Jammy2211 Jammy2211 added the pending-release Awaiting coordinated PyAuto release label Sep 10, 2026
@Jammy2211
Jammy2211 merged commit a29fdd2 into main Sep 10, 2026
1 check passed
@Jammy2211
Jammy2211 deleted the feature/byol-mode branch September 10, 2026 21:14
@Jammy2211 Jammy2211 removed the pending-release Awaiting coordinated PyAuto release label Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant