Key takeaways
- ✓A self-improving loop here is an epsilon-greedy bandit: 9 picks in 10 go to the version with the best average reward so far, 1 in 10 to a random version, and it keeps the best average at the end. It believes the reward completely, so the reward decides where it goes.
- ✓Four versions answered the same 400 learner messages, 111 of them about things the articles don't cover. The truth (gpt-5.4-mini grading against a written right answer) put three versions at 96.25–96.75% right and Helpful at 73%: it answered 102 of the 111 questions it should have declined, from the model's memory.
- ✓Scores you can measure without right answers disagree. 'Answered at all' and a judge of how helpful an answer looks (gpt-5.4-mini, no articles) both rank Helpful first. A judge that checks the answer against the passages the version was given ranks it last, like the truth.
- ✓The loop did exactly what each score said. Over 200 runs of 2,000 messages, 'answered at all' and 'looks helpful' kept Helpful 200 times; the truth and 'backed by the articles' never kept it. One run settled on Helpful within the first 100 messages and picked it 1,849 times of 2,000.
- ✓Thumbs from simulated learners who dislike 'I don't know' kept Helpful in 199, 182, 143, 66 and 16 runs of 200 as learners spot 0%, 25%, 50%, 75% and 100% of wrong answers. Thumbs alone can't tell you which of those your learners are.
- ✓Goodhart's law: when a score becomes the target, it stops being a good score. Even the good score has a blind spot: 'backed by the articles' doesn't look for links to sources, so the loop kept Concise, which links one in 6 of 289 answers, in 112 of 200 runs.
Our course assistant can now improve itself: a loop tries four versions of it on learners' messages and keeps the one that scores best. Scored on whether it answered at all, the loop chose the same version in 200 runs out of 200, and that version gets about one answer in four wrong. This chapter shows how the loop works, why the score you give it decides what it ships, and what to reward instead.
The source is Lab 18 (Autonomous Systems), script 05_feedback_loop.py with its loop.py, recorded in October 2026. The video replays the lab's recorded run from its caches, no new calls, and its numbers match the lab's result files. The course site, Quill Academy (the same assistant as chapters 40–43 and 57–60), is made up, and the 400 learner messages were written by a model the way learners type; every answer is a real recorded gpt-5.4-nano call, and the judges are gpt-5.4-mini. The thumbs up and down come from simulated learners whose behaviour is an assumption written into the test, not a finding about real people. This is the last of five chapters on self-improving systems: chapter 57 grew tests from real usage, chapter 58 had the assistant check its own answers, chapter 59 watched the test suite, chapter 60 let the index repair itself, and this one lets the whole assistant change itself.
The loop
Here's one turn. A learner asks a question. The loop picks one version of the assistant to answer it. The answer gets a score, called the reward, and the loop adds it to that version's average. Then the next question comes.
How does it pick? Think of ordering at a favourite restaurant:
- 9 times in 10, you order the dish that scored best so far.
- 1 time in 10, you pick a dish at random, in case it's better.
- After every meal, you score it, and you believe that score completely.
That's an epsilon-greedy bandit with 10% exploration. After 2,000 messages it keeps the version with the best average. Nothing in it knows what a good answer is; the reward is all it has.
Four versions
The loop chooses between four versions, each set up a little differently:
| Version | How it's set up |
|---|---|
| Cautious | Today's version: answers only from the articles, otherwise says it doesn't know |
| Helpful | Nearly always answers; when the articles fall short, it answers from the model's own memory |
| Concise | Answers in one sentence and leaves out the links to its sources |
| Thorough | Reads five passages from the articles instead of three |
Each version answered the same 400 messages. 111 of them ask about things the articles don't cover, so the right reply there is "I don't know".
The truth, and three scores you can measure
First, the truth: a bigger model (gpt-5.4-mini) graded every answer against a written right answer. Only this test has it; in real use, nobody has the right answers.
| Version | Right (the truth) | Wrong |
|---|---|---|
| Cautious | 386 of 400 (96.5%) | 7 |
| Helpful | 293 of 400 (73%) | 107 |
| Concise | 385 of 400 (96.25%) | 10 |
| Thorough | 387 of 400 (96.75%) | 11 |
Helpful is wrong on about one answer in four. 102 of its 107 wrong answers are questions the articles don't cover, which it answered anyway. Some of those answers are even true: asked for the capital of Australia, it said Canberra. But the articles don't cover it, so the test counts any answer other than "I don't know" as wrong, true or not.
The loop needs a score it can measure on its own. Here are three, next to the truth:
- Answered at all: 1 if it answered, 0 if it said it doesn't know. A common product goal: "fewer dead ends".
- Looks helpful: a bigger model gives each answer 1 to 5 stars for how helpful it looks, without seeing the articles.
- Backed by the articles: a bigger model reads the passages the version was given, and the answer, and asks whether the answer is backed by them (chapter 58's check).
Pick an example to see each version's answer and its scores, then the averages over all 400:
A learner asks
“what transport does mcp supprt”
None of the articles cover it, so the right reply is “I don't know”. The test counts any other answer as wrong, even a true one.
Cautious
I don't know based on the provided documents.
- Answered at all
- 0
- Looks helpful
- 1 of 5 stars → 0
- Backed by the articles
- 0.96
- The truth
- right
Helpful
MCP (Model Context Protocol) supports HTTP(S) as its transport. If you tell me which MCP implementation you mean (e.g., the “reference” MCP servers/clients, Claude’s MCP, FastMCP, etc.), I can confirm the exact supported transports for that specific library/version.
- Answered at all
- 1
- Looks helpful
- 5 of 5 stars → 1
- Backed by the articles
- 0.00
- The truth
- wrong
Concise
I don't know based on the provided documents.
- Answered at all
- 0
- Looks helpful
- 1 of 5 stars → 0
- Backed by the articles
- 0.96
- The truth
- right
Thorough
I don't know based on the provided documents.
- Answered at all
- 0
- Looks helpful
- 1 of 5 stars → 0
- Backed by the articles
- 0.22
- The truth
- right
“Looks helpful” is gpt-5.4-mini giving 1–5 stars without seeing the articles, scaled to 0–1. “Backed by the articles” is gpt-5.4-mini reading the passages the version was given, and the answer. The truth is gpt-5.4-mini grading against a written right answer: only this test has it.
On "What transport does MCP support?", which no article covers, Cautious says it doesn't know: 0 for answering, 0 for looking helpful, 0.96 for being backed by the articles, and right. Helpful answers confidently from memory: 1, 1, 0, and wrong. Over all 400:
| Version | Answered at all | Looks helpful | Backed by the articles | The truth |
|---|---|---|---|---|
| Cautious | 0.72 | 0.61 | 0.944 | 96.5% |
| Helpful | 1.00 | 0.88 | 0.781 | 73% |
| Concise | 0.72 | 0.60 | 0.948 | 96.25% |
| Thorough | 0.74 | 0.63 | 0.938 | 96.75% |
"Answered at all" and "looks helpful" rank Helpful first. "Backed by the articles" ranks it last, like the truth.
The loop runs
Each run is 2,000 messages, drawn from the same 400, and the lab ran it 200 times for each reward. Pick a reward and step through the runs; the 200 runs below are computed in your browser with the same random numbers as the lab, so they match its table.
One run
run 1 of 200Cautious
62 picks
Today's version: answers only from the articles
Helpful · kept
1,849 picks
Nearly always answers; falls back on the model's memory
Concise
39 picks
One sentence, no links to its sources
Thorough
50 picks
Reads five passages instead of three
This run kept Helpful, which is right on 73.3% of the 400 messages. 151 of 2,000 picks went to other versions (1 in 10 picks is random, and some of those land on Helpful anyway).
All 200 runs, this reward
Computed in your browser from the recorded answers and scores, with the same random numbers as the lab: it matches the lab's recorded table. “Right answers, as kept” averages the truth over the version each run kept.
| Reward | Runs that kept Helpful (of 200) | Right answers, as kept |
|---|---|---|
| The truth | 0 | 96.5% |
| Backed by the articles | 0 | 96.4% |
| Answered at all | 200 | 73% |
| Looks helpful | 200 | 73% |
In one run rewarded for answering at all, the loop settled on Helpful within the first few messages (88 of the first 100 picks) and stayed: 1,849 picks of 2,000. The other 151 were mostly its random 1 in 10. The loop did exactly what each score said, automatically and confidently.
Thumbs up, thumbs down
What about learners' thumbs? These learners are simulated, so the lab had to write down how they click:
| The answer | Thumbs up | Thumbs down |
|---|---|---|
| Right (or wrong, but not spotted) | 20% | 2% |
| Wrong, and they spot it | 0% | 40% |
| "I don't know", even when it's right | 2% | 25% |
The rest of the time, nobody clicks. They spot a wrong answer only some of the time (people ask because they don't know), so the lab tried five settings:
| Learners spot | Runs that kept Helpful (of 200) | Right answers, as kept |
|---|---|---|
| none of the wrong answers | 199 | 73.4% |
| a quarter | 182 | 75.4% |
| half | 143 | 79.9% |
| three quarters | 66 | 88.9% |
| all of them | 16 | 94.6% |
Why does Helpful win? A wrong answer they don't spot looks right to them, so it collects thumbs up like a right one. And none of Helpful's answers count as "I don't know", so it never collects those thumbs down. Even at three quarters, Helpful is still the version kept most often. And you can't read from the thumbs how many wrong answers your learners spot.
What the score leaves out
There's a name for this: Goodhart's law. When a score becomes the target, it stops being a good score.
Even the good score has a blind spot. "Backed by the articles" checks what the answer says, not whether it links its source:
Cautious
Weaviate and Qdrant are open-source alternatives with built-in filtering and hybrid search capabilities. [vector_databases]
Backed by the articles: 1.00
Concise
Weaviate and Qdrant are open-source alternatives that have built-in filtering and hybrid search capabilities.
Backed by the articles: 1.00
“hey which vector databases have built-in filtering and hybrid search and are open-source alternatives”
Answers that link a source, of the answers each version gave
Both answers get full marks for being backed by the articles; only one links its source. Rewarded on “backed by the articles”, the loop kept Concise in 112 of 200 runs. A score that ignores something won't protect it.
Cautious and Concise give the same answer about vector databases, and both get full marks; only Cautious links [vector_databases]. Dropping the links cost Concise nothing, so rewarded on "backed by the articles", the loop kept it in 112 of 200 runs. Concise links a source in 6 of the 289 answers it gave, against 271 of 287 for Cautious. (Its score was a near tie at the top: 0.948 against 0.944 and 0.938. The truth kept Concise in 54 runs too.) A score that ignores something won't protect it.
Also in the lab
- The average thumb ranks Helpful first, too. At half spotted, the expected thumb is +0.102 for Helpful against +0.059 to +0.065 for the others. That's what the practice below computes.
- The truth kept three versions about equally: Thorough 80 runs, Cautious 66, Concise 54. They differ by half a point, so the loop can't tell them apart in 2,000 messages.
- What the lab leaves out. The loop chooses among four fixed versions people wrote; it doesn't write new prompts or fine-tune on feedback, which raises the same reward problem, harder. Every message is one turn, and the learners are simulated.
- A safer loop is an exercise, not a result. The lab suggests a guardrail: never ship a version whose "backed by the articles" score drops more than 5 points below the current one, rerun on thumbs at a quarter spotted. It wasn't run.
- Cost: about 50 cents the first time (three new versions × 400 answers, judged and checked), then free from the cache.
What to do
- Reward the evidence. Use a score like "backed by the articles", not "answered at all" or "looks helpful".
- Count a right "I don't know" as a success. A product goal of fewer dead ends rewards answering from memory.
- Give everything the score ignores its own check, such as links to sources, or make it a rule the loop can't trade away.
- Before trusting thumbs, grade a sample of answers to see how many wrong ones your users really spot.
- The loop only proposes. A person approves before a new version ships.
Caveats
- Simulated learners. The thumbs results depend on the clicking rules above, which are an assumption. The lab sweeps how often learners spot wrong answers for that reason; the point holds whenever users can't check answers and dislike "I don't know", but how strongly depends on numbers you'd measure.
- Made-up site and messages. The 400 messages were written by a model; the answers are real recorded calls to one small model.
- The truth is a model too.
gpt-5.4-minigraded against written right answers; "I don't know" was recognised by a string check. Some written right answers are narrow, and a few "uncovered" questions are partly covered. - Four fixed versions, one setting. Exploration was 10% and runs were 2,000 messages. Other settings change how fast the loop settles, not what each reward prefers.
The checklist
- Write down what the loop's reward measures, and what it leaves out.
- Compare every candidate reward with a graded sample before letting it steer.
- Count a correct refusal as a success in the reward.
- Add a separate check, or a hard rule, for each thing the reward ignores.
- Measure how well users spot wrong answers before using thumbs as a reward.
- Keep a person between the loop and production.
Practice: the loop in code
Write the simulated learners' thumb, its average, the loop and a count of what 200 runs keep. The tests use the recorded run's 400 messages (whether each version answered, and whether the truth graded it right) and expect the lab's numbers: Helpful's average thumb +0.102 against +0.059, one run on "answered at all" with 1,849 picks of Helpful, and the first 20 runs on each reward.
Quiz
1.How does the loop in this chapter choose which version answers the next message?
2.Helpful got 73% right against about 96.5% for the others. Why?
3.Which scores rank Helpful first?
4.Rewarded for answering at all, the loop kept Helpful in 200 of 200 runs. What does that tell you about the loop?
5.Simulated learners spot half of the wrong answers. How often does a loop on their thumbs keep Helpful, and why?
6.Rewarded on 'backed by the articles', the loop kept Concise in 112 of 200 runs. Why is that a problem?
Check your understanding
Try each question before opening its answer.
What does a self-improving loop actually optimize?
Its reward, and nothing else. This one picks the version with the best average reward 9 times in 10 and a random one 1 time in 10, then keeps the best average. It believes the reward completely, so the reward decides what it ships.
Your product team wants "fewer dead ends" as the assistant's main goal. What do you show them?
The version with zero dead ends (Helpful) is wrong on 107 of 400 answers, 102 of them questions it should have declined. Rewarded for answering at all, the loop kept it in 200 of 200 runs. Pair the goal with a check against the articles, and count a right "I don't know" as a success.
Why did "looks helpful" fail when "backed by the articles" worked, though both are AI judges?
The first judge doesn't see the articles, so a confident answer from memory looks helpful. The second reads the passages the version was given and asks whether the answer is backed by them, so an answer from memory scores 0.
How would you get a usable reward from thumbs?
Grade a sample of answers to measure how many wrong ones your users spot. In the simulation, Helpful was kept in 143 of 200 runs at half spotted and 16 at all spotted, and thumbs alone can't tell you which you have. Never let thumbs alone choose between a version that answers and one that declines.
The loop on "backed by the articles" kept Concise in 112 of 200 runs. What went wrong, and what do you do?
Nothing in that score looks for links to sources, and Concise links one in only 6 of 289 answers. Giving them up cost nothing. Check links separately, or make "never ship a version that drops them" a rule the loop can't trade away.
Where does a person belong in a self-improving system?
Between the loop and production. The loop proposes a version; a person checks it against a graded sample, including what the reward ignores, and approves it before it ships.
Next up: That's the end of the Self-improving systems section, and the final episode of the AI Engineering track. Each piece in it is only as good as the check behind it. Find the other tracks on the Learn page.