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.
You build: improve.py: proposes one prompt change, scores it, and prints ACCEPT or REJECT with the numbers.
- Python 3.11 or newer and uv
- An OpenRouter key (free models are enough)
- Lab 40 done (the judge)
-
01Split 60 graded examples into 40 to learn from and 20 held back
wc -l dev.jsonl heldout.jsonlYou pass when: 40 and 20 lines, with no example in both.
-
02Score 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.
uv run --with openai improve.py --baselineYou pass when: Three scores and their spread. Any gain smaller than that spread is noise.
-
03Show the improver the failures from the 40 and ask for one prompt change
uv run --with openai improve.py --proposeYou pass when: A changed prompt saved as a candidate, with one sentence on what it changes.
-
04Score the candidate on the held-back 20 and decide
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.
The check runs on the computer, not on your word: a step passes when its command exits with 0 there.
Computers are not set up on this site yet. Run each command on your own machine and compare with "You pass when".
Commands run in labs/45-self-improve and may take up to 60 seconds each. Every command starts a new shell: put keys and settings in a .env file there, it is loaded each time.