Key takeaways
- ✓A test is a question plus the answer you expect. To grow the suite from real usage, compare each message with the existing tests by meaning (embedding similarity, 0 unrelated to 1 the same meaning). Below a line, it's new and an AI writes a test for it. The lab's line, 0.70, was chosen on weeks 1–2 only.
- ✓Where you draw the line is a trade. At 0.70, 78% of repeats were spotted and 93% of new questions were called new; the other 7% got no test. At 0.80, every new question was caught, but only 44% of repeats: 151 more messages went to the writer, most of them copies of existing tests.
- ✓Compare each message with every candidate, not just approved tests. With approved tests only, a question asked again before the weekly review looks new and gets a second test: 264 tests to review in six weeks. Remembering every candidate (approved, waiting or rejected): 162, 39% less, for the same 137 questions covered.
- ✓Count the messages covered, not the tests. Coverage of each week's messages went from 36% in week 1 to 86% in week 2, because popular questions come first. It fell to 65% when two new articles launched in week 4 and was back to 86% a week later, while the suite grew to about 200 tests.
- ✓Write the expected answer from the documents, not by copying production. Copied answers turn the assistant's mistakes into tests: it refused 'what is the fundamental unit of a transformer', though the articles say the attention head, so that test would fail the fix. From the articles 155 of 162 tests were right; copied, 150.
- ✓97% agreement can mean little when almost everything is right. Kappa takes out the agreement you'd get by luck: the reviewer scored 0.28. Reading the 6 tests the key called wrong: 3 were the writer's real mistakes, and the reviewer let 2 of them in. And tests go stale: after one article was revised, 4 of the 5 tests written earlier about the changed parts expected the old answer.
The assistant from the observability chapters (40–43) now writes its own tests: when learners ask something new, an AI drafts a test for it, and another AI reviews it. The reviewer approved 160 of 161 and agreed with the answer key 97% of the time. This chapter asks what that 97% measured, and goes through the decisions on the way: what counts as new, what to compare with, what to count, and who writes the expected answer.
The source is Lab 18 (Autonomous Systems), script 01_test_generator.py, recorded in October 2026; the video uses that run's recorded results, no new calls, and its numbers match the lab README. Quill Academy is a made-up online course site; its assistant answers from seven short articles. Six weeks of traffic, about a thousand messages, were written by a model to sound like learners, with changes planted on purpose: two new articles in week 4 and a revised one on day 28. Every answer is a real recorded model call: gpt-5.4-nano answers, gpt-5.4-mini writes and reviews the tests. This is the first chapter on self-improving systems.
The plan
A test is a question plus the answer we expect. All the tests together are the suite, which runs on every change to catch anything that breaks. The suite starts with 40 tests, taken from the observability lab's questions. Then, for every learner message:
- Is it new? Compare it with the tests by meaning.
- If so, write a test: an AI drafts the question and the expected answer.
- Review it: once a week, a reviewer approves or rejects each new test.
- Approved tests join the suite.
Each step can go wrong in its own way, and the lab replays six weeks to measure each one.
Is it new?
A computer compares meanings by turning text into a list of numbers, an embedding, and measuring how close two of them are: the similarity, 0 for unrelated and 1 for the same meaning. Each message is compared with its closest test. Above the line, it's a repeat; below, it's new.
"hey, what's the difference between HNSW's M and efConstruction parameters" scores 0.96 against an existing test: a repeat. "how do you say good morning in french" scores 0.09: new, and off-topic, which makes a good test of the assistant saying "I don't know".
Of 988 real messages (chatter like "thanks!" left out), 316 ask something a starting test covers and 672 don't. Similarity ranks them well (AUROC 0.952: a random covered message scores higher than a random new one 95% of the time), but no line separates them perfectly:
Each message is compared with the closest test by meaning (similarity: 0 unrelated, 1 the same meaning). Below the line, it counts as new and goes on to the test writer.
95% intervals: repeats (73%–82%), new (91%–95%). This is the line the lab chose, on weeks 1–2 only.
Message
“hey, what's the difference between HNSW's M and efConstruction parameters”
Closest test: What is the difference between HNSW's M and efConstruction parameters?
similarity 0.96 → repeat: skip
Message
“how do you say good morning in french”
Closest test: In transformers, how does multi-head attention help the model?
similarity 0.09 → new: write a test
At 0.70, 7% of new questions get no test. Raise the line and fewer repeats are spotted.
The lab chose 0.70 on weeks 1–2 only. There, 78% of repeats were spotted and 93% of new questions were called new; the other 7% got no test. At 0.80, every new question counts as new, but only 44% of repeats are spotted: 847 messages go to the writer instead of 696. Of the 151 extra, 108 are repeats, each a test the reviewer reads for nothing.
Similarity misses in two directions, which is why no line is perfect. "rag meaning" scores only 0.46 against the test "What is Retrieval-Augmented Generation (RAG)?": the same question in very few words. And "can you explain how the react pattern works" scores 0.80 against "what is the ReAct pattern?": nearly the same words, but one asks how and the other what.
Compare with what?
Next: compare each new message with what? To test just this, the lab pretends the writer and the reviewer are perfect, and reviews at the end of each week.
- Nothing. Every real message becomes a test for a person to review: 988 in six weeks.
- Approved tests only. 264. Why still so many? In week 6, on Monday, a learner asked why full fine-tuning is expensive, and a test was written. It waited for the weekly review. On Wednesday someone asked why full fine-tuning costs so much. That wasn't an approved test yet, so it looked new, and got another test.
- Every candidate. Also compare with every earlier message judged new (a candidate), whether approved, waiting or rejected: 162.
Also compare with every message already judged new: approved, waiting or rejected.
| Week | Tests to review | Suite at week's end | Messages covered |
|---|---|---|---|
| 1 | 58 | 98 | 36% |
| 2 | 28 | 126 | 86% |
| 3 | 13 | 139 | 93% |
| 4 | 31 | 170 | 65% |
| 5 | 21 | 191 | 86% |
| 6 | 11 | 202 | 86% |
Week 1 starts from the 40 starting tests. Week 4: two new articles launched, so coverage dropped. “Every candidate” needs 39% less review than “approved only” for the same 137 questions covered. Comparing with nothing covers 7 more, because it skips nothing; the other two miss the same few that slip under the line.
Remembering every candidate cut review by 39% against "approved only", and covered the same 137 questions. The 7 that "nothing" also covers are the new questions that slip under the line in both: the trade from the previous section. In the lab's first version, the candidate list even changed with the reviewer, because a rejected test came back the next week. Remembering every candidate fixed that too.
Coverage, not size
Is a bigger suite a better one? Look at what the tests cover: the share of each week's messages that a test already covered.
| Week | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| Messages covered | 36% | 86% | 93% | 65% | 86% | 86% |
| Suite size | 98 | 126 | 139 | 170 | 191 | 202 |
Coverage jumped in one week because the popular questions come up in week 1, so they get tests first, and they make up most of the later messages. In week 4, two new articles launched and coverage fell to 65%; a week later it was back. The suite kept growing the whole time. Comparing with nothing grew it to 1,028 tests, 884 of them for questions already covered. Count the messages covered, not the tests.
Who writes the expected answer
Each test needs an expected answer. The easy way is to copy what the assistant answered in production. The catch: a learner asked "what is the fundamental unit of a transformer", and the assistant said it wasn't in the documents. The articles do answer it: the attention head. So the copied test expects a refusal. Fix the assistant, and this test fails the fix.
| Expected answer | Right tests (of 162 real requests) | What the test then checks |
|---|---|---|
| Copied from production | 150 | that the system keeps doing what it did, mistakes included |
| Written from the articles | 155 | that the system says what the articles say |
The writer also filters out messages that aren't worth a test. It dropped all 10 chatter messages among the 172 candidates, and 1 of the 162 real requests.
The reviewer
Back to the reviewer (gpt-5.4-mini) and its 97%. It approved 160 of the 161 tests the writer kept. The answer key (a reference answer for every question, with a model grading each test against it) says 155 are right and 6 wrong.
That's why 97% is weaker than it sounds: almost every test was right, so a lazy reviewer that approves everything would agree 96% of the time. Kappa takes out the agreement you'd get by luck: 1 is perfect, 0 no better than luck. The reviewer got 0.28. Try it:
155 tests are right by the answer key and 6 are wrong. Choose what the reviewer does with each wrong one, and how many right ones it wrongly rejects.
- “i'm working on prompt design for an llm app and need to understand what prompt sensitivity means”
- “how does product quantiztion compress vectors”
- “what's a good way to assess whether a rag response stays faithful to the source docs”
- “how does pq shrink high-dimensional vectors”
- “im building a model eval dashboard and want to know what evaluation results look like in llm evaluation”
- “hey how do i lock down an mcp server”
Kappa compares agreement with what you'd get by luck from how often each side says yes: 1 is perfect, 0 no better than luck. Approving everything agrees 96% of the time and scores 0. The real reviewer: 156 of 161 (97%), kappa 0.28.
The lab then read the 6 tests the key called wrong; the reviewer had let 5 of them in. The key isn't perfect either: models wrote its reference answers, and a model grades against them. Two of its answers were too narrow to grade against, like the single word "Noisy." for "what do evaluation results look like". One test is arguable: the articles partly answer it. Three were the writer's real mistakes, answers the articles don't support: two about product quantization from the writer's own knowledge, and one about locking down an MCP server pieced together from unrelated passages. The reviewer caught one. It let the other two in.
The split into real mistakes, narrow keys and arguable is a reading by hand (the lab's and the video's), not a measured label.
Tests go stale
On day 28, the fine-tuning article was revised: LoRA now goes on all linear layers, and a few hundred examples are enough. Five tests in the final suite had been written before that, about the parts it changed. Graded against the new article, four of them now expect the old answer:
| Test | Written | Still right? |
|---|---|---|
| What three situations make fine-tuning most valuable? | starting test | no: expects "thousands of labeled examples" |
| What does PEFT do instead of updating all model weights? | starting test | no: expects attention layers only |
| How does PEFT with LoRA reduce trainable parameters…? | generated, day 4 | no: attention layers only |
| Why do PEFT LoRA trainable parameters still work well? | generated, day 9 | no: attention layers only |
| What is the difference between PEFT and full fine-tuning? | generated, day 11 | yes |
Two were starting tests; two the system wrote itself. Stale, they fail the correct, updated assistant. A test is a claim about the articles, on the day it was written.
Also in the lab
From the lab's README (its own run, October 2026), beyond the video:
- The writer explained instead of declining. Asked to write "(not in the documents)" when the passages didn't answer, it wrote "The documents do not specify…" paragraphs, which the judge graded as wrong. The fix was a separate
answered: true/falsefield, with code, not the model, writing the decline: right tests went from 86% to 96%. - The writer threw away good tests. Told to drop messages that aren't about the docs, it dropped off-topic and unanswerable requests too, which make good refusal tests. The prompt now drops only greetings, thanks, complaints and keyboard noise: 1 real request dropped instead of 10.
- What it doesn't include. The "person" in the review queue is the answer key, a perfect reviewer; real reviewers are slower and sometimes wrong. Every message is a single turn.
- Cost. Script 01 costs about 60 cents the first time (including the production answers that later scripts reuse), then runs free from the cache.
What to do
- Pick the "is it new?" line on labeled messages, and know both of its mistakes: repeats that become tests, and new questions that get none.
- Compare each message with every candidate, approved, waiting or rejected, not just approved tests.
- Rank the review queue by traffic, and track the share of messages covered, not suite size.
- Write expected answers from the documents, not from production answers.
- Don't trust a reviewer's agreement alone. Check kappa, and read the disagreements by hand.
- Re-check tests when a document changes, starting with the ones about the changed parts.
Caveats
- Made-up site, model-written traffic. The messages were written by a model to sound like learners, with planted changes. Real traffic is messier.
- A perfect writer and reviewer in the memory comparison, so it measures only what each memory sends to review.
- The answer key is models too. Its reference answers were written by models and a model grades against them; 2 of the 6 "wrong" tests were the key's fault.
- Six tests is a small sample. "Caught 1 of 3 real mistakes" comes from reading six tests by hand.
- One line, chosen on two weeks. A different corpus or embedding model needs its own line.
The checklist
- Label a few hundred messages (covered or new) and choose the line on them.
- Store every candidate with its status, and compare new messages with all of them.
- Report weekly coverage of real messages, and the uncovered questions ranked by traffic.
- Generate expected answers from the documents, with code writing any "not in the documents" decline.
- Measure the reviewer with kappa against a labeled sample, and read what it approves.
- Link each test to the documents it came from, and re-check those tests when a document changes.
Practice: the generator's checks in code
Draw the line on the lab's 988 similarities, count how much review each kind of memory costs on a small replay, write Cohen's kappa, and list the tests to re-check after the revision. The tests expect the lab's numbers: 246, 626 and 696 at 0.70; 847 at 0.80; 156 agreements and kappa 0.28; and the five fine-tuning tests written before day 28.
Quiz
1.A message scores 0.09 similarity against its closest test, with the line at 0.70. What happens?
2.You raise the line from 0.70 to 0.80. What changes?
3.The generator compares each message only with approved tests, reviewed weekly. Why does that cost more review?
4.Why measure the share of messages covered rather than the number of tests?
5.Why not copy the assistant's production answer as the expected answer?
6.The reviewer agreed with the answer key 97% of the time. What does kappa 0.28 add?
Check your understanding
Try each question before opening its answer.
How does the system decide whether a learner's message needs a new test, and what can go wrong?
It compares the message with its closest test by meaning (embedding similarity) and calls it new below a line, 0.70 here, chosen on labeled messages from weeks 1–2. Short phrasings of a covered question can score low ("rag meaning", 0.46), so they become duplicate tests; different questions in similar words can score high ("how does ReAct work" vs. "what is ReAct", 0.80), so they get no test.
Why should the generator remember rejected and waiting candidates, not just approved tests?
Otherwise a question asked again before the weekly review looks new and gets another test, and rejected ones come back. Remembering every candidate cut six weeks of review from 264 to 162 (39%) for the same 137 questions covered.
Your suite grew from 40 to 200 tests. Is that good news?
Not by itself. Look at the share of real messages the tests cover: here it went 36% to 86% in a week, then mostly held, with a dip to 65% when new articles launched. Comparing with nothing built 1,028 tests, mostly duplicates. Check also that the tests are right and still right.
Should a generated test's expected answer come from the production answer?
No, or only after a person checks it. Copying turns production mistakes into tests that reward them: a refusal of a question the articles answer became a test that fails the fix. From the articles, 155 of 162 tests were right; copied, 150.
A reviewer agrees with your key 97% of the time. Why might that mean little?
If almost every test is right, approving everything already agrees 96% of the time. Kappa removes that luck: 0.28 here. Reading the six disagreements showed it caught 1 of 3 real writer mistakes.
A document is revised. What happens to its tests, and what do you do?
Tests written before the change still expect the old answer, so they fail the correct, updated system: 4 of the 5 here. Link tests to their source documents, and when one changes, re-check or rewrite its tests.
Next up: Chapter 58 asks whether the assistant can tell which of its own answers are wrong: can a model check its own answers?