reliable · advanced · 60 min
Let it improve itself, and prove it
Have a model propose changes to your prompt from its own failures, and accept a change only when held-back data says it helped.
HANDS-ON LAB · YOU RUN IT ON YOUR MACHINE · 4 STEPS
-
Split 60 graded examples into 40 to learn from and 20 held back
Run this to check
wc -l dev.jsonl heldout.jsonlYou pass when
40 and 20 lines, with no example in both.
Files you write
- dev.jsonl
- heldout.jsonl
-
Score the current prompt on the held-back set three times
The same prompt scores differently on each run. Until you know by how much, you cannot tell an improvement from luck.
Run this to check
uv run --with openai improve.py --baselineYou pass when
Three scores and their spread. Any gain smaller than that spread is noise.
Files you write
- improve.py
-
Show the improver the failures from the 40 and ask for one prompt change
Run this to check
uv run --with openai improve.py --proposeYou pass when
A changed prompt saved as a candidate, with one sentence on what it changes.
Files you write
- prompts/candidate.md
-
Score the candidate on the held-back 20 and decide
Run this to check
uv run --with openai improve.py --decide && grep -c heldout improver.logYou pass when
ACCEPT or REJECT with both scores. The count is 0: the improver never saw the held-back set.
Files you write
- improve.py
- improver.log
No transcript here on purpose. This page does not show terminal output, because model answers differ from run to run. Each step says what a pass looks like; your own terminal is the proof.