Retrieval · evaluation · measured November 2026
Seventeen findings from grounding an LLM tutor in about 56,000 real curriculum documents and measuring what happened. The adversarial case was the smaller problem. The scoring rubric was a bigger one than either.
This is a write-up of work done for one specific product, with the product and the organisation taken out. What is left is the part I would want to read before starting something similar: a corpus with material the end user must not see, a filter that has to hold, a prompt that has to be tuned against two opposing failure modes at once, and a measurement rig honest enough to tell you when you have made things worse.
Every figure below came out of a harness that cost about five dollars to run. That last fact is doing more work than any of the others.
An LLM tutor for school students, grounded in the lesson material its class is actually working from. The corpus is a multi-state K–12 curriculum: lesson plans, slide decks with speaker notes, worksheets, readings, assessments and teacher editions.
Two things make the retrieval problem tractable and are worth stating before the findings, because several of them depend on it. First, scope is known rather than inferred: the roster says which state, grade, subject and unit a student is in, so retrieval runs inside a few hundred candidate passages instead of across a quarter of a million. Second, the corpus contains material the student must not be shown: answer keys, scoring guides and unreleased assessment items.
The stack, for calibration: Postgres with pgvector, a 0.6B embedding
model on a local GPU, a hosted reranking API, and a mid-sized open-weights model as the
tutor. Questions were written by one model family, answered by a second, and scored by a
third.
The disclosure test was built to measure resistance to manipulation. Each of 279 answer-bearing teacher passages became two student messages: one trying to extract the answer across six tactics, one from a genuinely confused student asking about the same content.
| Student turn | Tutor gave the lesson's answer | Refused entirely | Helpfulness (0–2) | n |
|---|---|---|---|---|
| Trying to extract it | 4.1% (2–8%) | 41% | 1.85 | 172 |
| Genuinely confused | 9.4% (6–14%) | 21% | 1.90 | 233 |
A child who is stuck has the answer read out to them more than twice as often as one trying to trick the tutor into it. Of the six extraction tactics, only I already did it, I just want to check produced leakage worth counting.
The mechanism is ordinary and that is the point. The tutor is not being outwitted. It is reading a teacher's edition that says Students should say: X and relaying X, because relaying it looks like helping. Controlling for whether retrieval actually put the answer-bearing passage into the prompt separates cause from coincidence: 9.4% against 2.2% on honest turns, 4.1% against 0% on extraction attempts. The material causes it, not the student.
A red-team exercise alone would have found the 4.1% and missed the 9.4%. If your system holds privileged context, the sincere question is the one to measure.
A tutor that refuses everything never leaks and is worthless. Measuring extraction alone rewards exactly that failure, so every adversarial turn in the set has a sincere twin asking about the same passage, and helpfulness is scored on both.
This is what made the eventual prompt fix legible. Leakage fell and helpfulness went up (1.90 to 1.97) with refusals falling to zero, which is a different result from leakage falling because the model got more guarded. Without the twin there is no way to tell those apart, and the guarded version scores better.
Three prompt wordings were tested over the same 558 turns with retrieval frozen, so the prompt was the only variable.
| Added to the system prompt | Honest student gets the answer | Extractor gets it | Source fidelity (0–2) |
|---|---|---|---|
| Nothing (baseline) | 9.4% (6–14%) | 4.1% | 1.45 |
| "This is the teacher's copy; do not relay it" | 2.6% (1–6%) | 2.9% | 1.34 |
| That, plus a carve-out for the task statement | 3.9% (2–7%) | 2.9% | 1.42 |
| "Teach the concept freely; the answer is not yours to give" | 5.6% (3–9%) | 4.7% | — |
Telling the model what the material is beat telling it what students might try. Naming the passages as the teacher's copy cut leakage to honestly confused students from 9.4% to 2.6%, paired across the same 233 turns at p = 0.0001. The wording framed around resisting manipulation landed in between and moved little.
That ordering makes sense in hindsight. The failure in finding 1 is not an attack, so an instruction about attacks does not describe the situation the model is actually in. An instruction about the provenance of its context does.
Corrected mid-flight
Scoring the disclosure runs exposed a flaw in the measure before it exposed anything about the tutor. About a third of what had been counted as leakage was the tutor explaining a general definition that the teacher's edition happens to print as the expected response: net force is the sum of the forces; the problem is what the character wants but cannot have.
A tutor that explains one of those to a confused child is teaching. Counting it as disclosure sets up a prompt tuned to make the model less willing to explain things, which is the opposite of what anyone wanted. The corrected definition counts only the lesson's own answer to the work in front of the student.
Worth doing before any tuning: read a sample of the events your metric fires on and check they are the thing you named it after. A third of ours were not.
The leakage fix was not free, and the bill arrived where nothing was watching for it. The first wording cost 0.10 of source fidelity (1.45 to 1.34) and two points of curriculum detail. The disclosure harness reported the change as pure gain, because fidelity is not something it measures.
One sentence carving the lesson's task statement, its scenario and its givens explicitly out of the restriction recovered fidelity to 1.42 and detail to 55%, slightly above baseline, while keeping most of the leakage reduction. The likely mechanism is over-generalisation: told not to restate what the teacher's edition says students should say, the model also stopped restating the problem.
The durable rule is procedural. Run both scorers after any prompt change — one for the capability, one for the safety property. They catch different failures, and an improvement in one can quietly damage the other.
These four cost the most to learn and transfer the most readily. Nothing here is specific to education, retrieval or tutoring.
Retracted a published number
An earlier version of this write-up reported that the carve-out in finding 5 left eight points unrecovered on the tutor's ability to state the lesson's own task, and that closing the gap was one more wording iteration's work. That was wrong. The eight points were an artifact of how the judge was called.
The scorer asked whether the reply stated the lesson's task in the same call as an element checklist, a fidelity grade and a contradiction flag, with the checklist printed directly above the question. The criterion absorbed its neighbours. The judge's own written reasons give it away:
One reply opened by laying out the task and all five of its options more fully than the baseline reply that passed. It was scored as not stating the problem, with the reason given as "mixes correct curriculum terms with contradictory statements."
Another stated an assignment with all seven of its requirements and failed for "misses key paragraph structure details." Both are penalties borrowed from criteria that have their own columns.
Re-scored one question per call, with the other criteria explicitly ruled out, across all 638 replies: 77% for the baseline prompt against 75% for the recommended wording. Paired on the same replies, the carve-out fixed 21 and broke 24. p = 0.77. There was no regression to close.
The cost of this mistake was not the compute. It was a day spent planning to fix a tutor that was working.
The honest version of finding 6 is not that 75% is true and 77% was a lie. The sharper rubric was written after forming the hypothesis, and the two judges agree on only 75% of the cases where the two prompt variants produced no difference. That disagreement rate is the floor. A metric with a floor that high cannot carry an eight-point conclusion in either direction.
Establishing it costs one extra run on cases where you expect no effect, and it tells you which of your columns are allowed to have opinions. It is cheaper than the alternative, which is believing one of them.
The first attempt at the disclosure test used 70 passages. It put the entire effect on extraction turns, found nothing on honest ones, and reported p = 0.06 on six events. The larger run reversed both conclusions cleanly.
Rare-event metrics need a sample sized for the events, not for the inputs. At a 4% base rate, a few hundred turns is a handful of events and almost any story fits them. The rebuilt set used 279 passages, deliberately disjoint from the original 70, so no wording was scored against the material it was written against.
The per-tactic breakdown from finding 1 is in the data and is not reportable. Two runs disagreed sharply about which extraction tactic worked best — one tactic scored 25% in the first run and 8% in the second — because at 11 or 12 items per tactic, two replies moving is 17 points. The pooled rate is the result. The ranking would need roughly 40 items per tactic.
Breakdowns are the most requested and least defensible part of any evaluation. Decide what the sample supports before someone asks for the slice, because by then there is a chart and the chart is persuasive.
About 8% of the corpus must never reach a student: answer keys, scoring guides and assessment items. The question was whether to ship retrieval to the product team as a library or run it as a service they call.
A service, and the filter decided it. As a library, the allowed-tier list becomes the caller's configuration, which means a deploy on the caller's side can widen it. As a service, the tier never appears in the request at all, so a model cannot ask for more than it is allowed and a caller cannot be configured into it. That is the difference between we exclude answer keys and we can demonstrate answer keys are unreachable, and only the second one survives being asked by a school board.
Two lesser reasons pointed the same way. Query vectors must come from the same embedding model with the same instruction prefix as the indexed passages; as a library that is a version string and a prompt the caller has to keep in step with a database they cannot see, and when they drift nothing raises an error — retrieval just quietly gets worse. And one machine holding the reranking vendor's credential is better than every caller holding it.
The prompt went the other way, into the product. It is the product's behaviour, it changes with the product's tone, and it should never need a cross-repository release to edit a sentence.
The cheap plan was to detect answer keys by filename and opening text. It was measured before being abandoned. Across the 50,475 documents whose path and first page carry no answer-key signal at all, 4.36% — 2,201 documents — are answer keys or assessment items.
They are files named like Story 1a Solutions.docx, Bike Ride KEY.pdf and Culminating Task Rubric.docx: every one of them obvious to a person and invisible to the rule that was going to protect students from them.
Classifying all ~56,000 documents with a small model instead cost $2.89 and 83 minutes, which is less than writing the regexes would have cost in salary. The transferable part is not "use a model" — it is that the miss rate of a heuristic filter is a number you can measure in an afternoon, and a filter protecting people deserves that afternoon.
| Tier | Share of corpus | Tutor may quote |
|---|---|---|
| Teacher guidance lesson plans, teacher editions | 69.8% | Yes |
| Student-safe worksheets, readings, slides | 22.4% | Yes |
| Answers only keys, scoring guides | 4.9% | No |
| Assessment item quiz, test, interim content | 2.8% | No |
The tier question is deliberately not teacher or student. Teacher lesson plans turned out to be the best material a tutor can have, because that is where the explanations live, and they are 70% of the corpus. The question is narrower: does this document hand over the answers to the work the student is doing?
A document with no tier is unreachable, rather than permitted for lack of a flag. This sounds like a formality until the next ingestion runs: 4,732 documents currently sit unreachable because classification never covered them, and the correct number of answer keys that have slipped through as a result is zero.
The implementation detail that matters is where the condition lives. An allow-list
comparison (tier = ANY(allowed)) excludes nulls on its own. A deny-list
(tier NOT IN (...)) does not, because in SQL a null is not not
anything. One of those two spellings serves your unclassified documents to children.
The retrieval question is never asked as "what in the corpus is relevant to this question?" It is asked as "within this state, grade, subject and unit, in material this student may see, what is relevant?" — a few hundred candidates rather than 348,000.
Scope comes from the roster, so it cannot be hallucinated, and a bad similarity score cannot drag the tutor into another grade's material. The practical payoff is that the system works acceptably with no reranker at all, because the filter has already done most of the ranking. If you have authoritative metadata, spending it on a hard filter buys more than spending it on a scoring feature.
Grounding also turned out to be faster than not grounding: 3.8 seconds against 4.5. Given the material, the model spends fewer tokens reasoning its way toward a guess. And retrieval accuracy converts into task accuracy fairly directly — on questions where the source document reached the prompt the tutor produced 51% of the expected elements, against 38% where it did not.
A reranker re-sorts candidate passages before the top few go to the model. Three ways of doing it were measured on the same questions.
| Reranking | Found the right source | Throughput | GPU | Cost / 1,000 turns |
|---|---|---|---|---|
| None — embedding order | 81% | 45/sec | no | — |
| General chat model, listwise | 87% | 19/sec | no | $0.45 |
| Local 0.6B→4B cross-encoder cascade | 93% | 0.6/sec | yes | — |
| Purpose-built reranking API | 93% | 30/sec, scales | no | $0.17 |
The hosted reranker matched the local cascade's accuracy exactly at fifty times the throughput, with no hardware, and at roughly a third the price of using a general chat model for the same job while being better at it. Re-measured on its own after deployment: source-document recall 81% to 93%, paired on the same questions it fixed 15 and broke 2, exact McNemar p = 0.0023. Misses fall from about one in five to about one in fourteen.
A hosted reranker's ceiling also belongs to the provider and rises with concurrency, where a single card's falls. Two smaller serving notes from the same benchmark:
How much of each candidate passage the reranker sees mattered more than which reranker it was.
| Characters per candidate | Purpose-built reranker | General chat model |
|---|---|---|
| 420 | 83% | 77% worse than no reranker |
| 900 | 91% | — |
| 1,800 | 93% plateau | — |
At 420 characters the general chat model scored below doing no reranking at all. Anyone implementing reranking from a one-line summary will pick a short truncation to save tokens, measure it once, and conclude that reranking does not work. It is the single setting most worth getting right, and it is the one almost never mentioned.
One number moves the wrong way with better retrieval, consistently: answer leakage rose from 2–3% to 6%. That is the mechanism working, not a defect. Better retrieval surfaces more of the teacher material that contains the expected response, so there is more to let slip — the same finding as part one, arriving from the other direction, with the same fix.
Measured and rejected
The service first answered in about 530 ms, and 1.6 s when the unit filter found too little and widened its scope. Profiling put almost all of it in one place, and not the place it looked like: the embedding model cost 26 ms and the vector search 7 ms, while the keyword half of the hybrid search cost 350–480 ms. The query planner was ignoring the full-text index and recomputing a text-search vector for every one of the roughly 1,800 in-scope passages, on every single turn.
The obvious fix is to force the index to drive the query. Measured, it took a specific question from 378 ms to 10 ms — and a one-word question from 553 ms to 14.5 seconds, because one common word like help or students matches 205,437 of the 348,031 passages. A student typing one word is not a hypothetical. That fix trades a predictable half-second for an occasional fifteen-second stall, and it would have shipped on the strength of the first measurement.
What shipped instead was to stop recomputing the vector and store it as a generated column, self-maintaining because the corpus is re-ingested about once a year by someone who should not have to remember a trigger. Two and a half minutes of migration and 618 MB of disk:
| Retrieval path | Before | After |
|---|---|---|
| Normal, filtered to the unit | 530 ms | 59 ms |
| Widened to the whole grade and subject | ~1.6 s | 172 ms |
| One common word | 670 ms | 58 ms |
Returned passages are byte-identical before and after, which is the check that makes the earlier accuracy figures still describe the running system. The general lesson is narrow and keeps being true: benchmark the obvious fix on the input you would least like it to meet, not on the one that motivated it.
The reranking vendor bills postpaid and metered, with no spend cap, no budget alert and no prepaid option. A retry loop is all it takes for "it should only cost a few dollars" to stop being true, and the card was not the project's own.
So the ceiling lives in the service: a monthly limit, metered from the token counts the API itself reports, persisted across restarts. When it is reached, retrieval falls back to embedding order and says so in the response — the same honest-degrade path it takes when a rerank call fails or times out.
Saying so matters more than the fallback. Silent degradation during someone else's A/B test turns two comparable arms into two different systems, and nothing in the output would show it. Any downstream harness can now assert on that field.
For scale: metered at 9,132 tokens a call, reranking costs about $0.000183 a turn — 16¢ per student per year, or $1,645 a year for 10,000 students at roughly 900 turns each. The ceiling exists for the runaway case, not the expected one.
Stated plainly, because a findings list invites more confidence than the work supports.
The full evaluation — writing 131 questions from known passages, retrieving for all of them, 393 tutor replies and 393 judgements — cost 47 cents and about twenty minutes. The disclosure phase, 2,232 replies across four prompts, came to about four dollars. Re-scoring every reply one criterion at a time cost nine cents.
That is the finding underneath all the others. At a dollar a comparison, re-running is cheaper than arguing, and two of the results above only exist because re-running was too cheap not to: the safety edit that quietly cost fidelity, and the rubric that invented a regression. Both would have shipped on the strength of a careful read.
The harness itself is not public, because the material that makes the test meaningful is real curriculum and the expected student responses printed in teacher editions. The design is the reproducible part: write questions from passages whose answers you already know, freeze retrieval so the prompt is the only variable, pair every adversarial input with a sincere one, and score each criterion in its own call.