RAFT on an Electronics Course: A Negative Result
P02 - Building the Test Set, Retrieval and Judge
Numbers are measured unless marked Hypothesis. The goal, the method and the references are on the front page of this series.
Test Before Training
A fine-tuned model is only "better" relative to a test, so the test set was built before training anything. It needed three parts:
- Questions with known answers that the model never trains on.
- Documents for each question, chosen by the same kind of search a real system would use. RAFT is about answering with documents, so every question is asked twice: once with no documents, once with the top 5 retrieved sections.
- A way to score free-text answers. Answers here are explanations and multi-part calculations, so exact string matching doesn't work.

Stage 2 as a sequence. The "Me" column marks hand checks that changed a decision.
Two Question Sets
| set | items | written by | what it tests |
|---|---|---|---|
| exam | 243 | Tony Kuphaldt (the course's own exams) | working things out: calculations, conversions, troubleshooting |
| Fable | 736 | Claude Fable 5.1, from the 16 held-out modules | understanding a specific section: explanations and calculations from that section |
The exam set is the 243 text-only exam questions from part 1, in 42 variant groups. Two families of one-off questions (8 password-strength questions, 5 historical readings) each counted as their own group, so the password template alone would have weighed 19% of the score. I merged each family, which leaves 31 groups. Scores are averaged per group, so a template with 10 numeric variants counts once.
Key property: the exam answers are not in the course text. The exams test working things out. Retrieval can bring back the method, but never the answer itself. Part 3 comes back to this.
The Fable set came from a third model on purpose. The training data (part 3) was written by Sonnet and Opus. If one of those had also written the test questions, a fine-tuned model could score well just by matching that model's style. Fable wrote 736 questions with reference answers from the 323 held-out sections. Each answer quotes its section word for word: 2,896 of 2,909 quotes match the source exactly (checked by script). Cost: $17.55. The 20-section pilot had projected ~$11, because the full run wrote ~1.5× more per section than the pilot did.
Fable also copied an error from the course: a table gives "250 mils (5.08 millimeters)", but 250 mil is 6.35 mm. The scoring step below catches cases like this, so a correct answer isn't penalised.
Choosing the Retriever
Every Fable question has a known source section (the "oracle"). So I could measure retrieval directly: for how many questions is the oracle in the top 1, top 5, top 20? The primary number is top 5, because that's how many documents the model sees.
Step 1, embedders. Three embedding models (Qwen3 Embedding, Zhang et al. 2025; EmbeddingGemma, Schechter Vera et al. 2025), all run locally, searching all 5,846 sections:
| embedder | size | oracle in top 1 | top 5 | top 20 |
|---|---|---|---|---|
| Qwen3-Embedding-8B | 8B | 67.5% | 92.5% | 98.2% |
| embeddinggemma | 300M | 60.5% | 86.7% | 94.8% |
| Qwen3-Embedding-0.6B | 0.6B | 57.3% | 86.7% | 93.9% |
Rule, set before the run: take the smallest model within ~2 points of the 8B at top 5. Neither small model got close, so the 8B won.
Step 2, add keyword search. Combining the 8B with BM25 (classic keyword search; Robertson and Zaragoza 2009) by reciprocal rank fusion (Cormack et al. 2009) raised top 5 from 92.5% to 96.6%, which halves the misses. BM25 alone beat the 8B embedder, but that's partly an artefact: Fable wrote each question while reading its section, so the questions reuse the section's words. Hypothesis: real users' questions overlap less, so the gain from BM25 would be smaller there. The hybrid keeps the embedder as a fallback either way.
Step 3, a reranker reorders the hybrid's top 20 and keeps the best 5. Three sizes of Qwen3-Reranker were tried. First results: the 0.6B and 4B rerankers made retrieval worse, and the 4B was worse than the 0.6B.
Reranker instruction. Qwen3-Reranker takes a task instruction ("given a question about X, find passages that answer it").
- The instruction was edited and everything re-ran. The scores came out identical to the bit, so the instruction never reached the model.
- The cause: when llama.cpp converts the reranker to its GGUF format, the converter writes a fixed instruction into the file: "Given a web search query, retrieve relevant passages that answer the query". The server has no way to change it per request.
- Fix: the converter was patched, and all three models were re-converted with "Given a question about modular electronics, retrieve passages that answer the question".
Re-run results:
| reranker (after hybrid top 20) | instruction | oracle top 1 | top 5 |
|---|---|---|---|
| none (hybrid only) | — | 74.6% | 96.6% |
| 4B | web search (default) | 67.4% | 90.8% |
| 4B | electronics | 78.9% | 96.1% |
| 8B | web search (default) | 84.2% | 98.1% |
| 8B | electronics | 85.3% | 98.4% |
The instruction caused most of the 4B's problem. For the 8B the gain was small (not significant on its own), but questions where the oracle fell to rank 10 or worse dropped from 4 to 0. Lesson: with this reranker, the instruction is part of the model. It's fixed at conversion time, so record it with every run.
Final retriever: 8B embedder + BM25 → top 20 → 8B reranker (electronics instruction) → top 5. The oracle is in the top 5 for 98.4% of Fable questions. Retrieval is no longer the bottleneck, at least on Fable.
Scoring: Key Points and a Judge
Grading an explanation as a whole ("is this a good answer?") drifts, and it tends to reward style. So scoring is split into two steps.
1. Key points, written once per question. Claude Opus 5.5 turned each reference answer into a short list of checkable points:
- numeric: a value, a unit and a tolerance (default 0.5%), e.g.
I_C = 0.6616 A - exact: accepted forms, e.g. a hex value or a formula
- conceptual: one sentence the answer must cover
Result: 2,720 points for $8.35. Opus also flagged errors in the source (wrong conversions in the exam key, the 250 mil table), and those points accept both forms.
I didn't hand-read all 979 items. A script checks that every numeric value and exact form in the key points actually appears in the reference answer. To test the script itself, every value was shifted by 3% and every exact form corrupted: 30 of 30 corruptions flagged. On the real run it flagged 40 items. I read them all; all but one were sound. The exception: an exam answer that lists leakage frequencies for a "zero leakage" question, apparently copied from its sibling variant. That key point deliberately departs from the reference.
2. A judge model grades each answer against the key points. It sees the question, the key points and the model's final answer, and marks each point covered, partly or missing. For numbers, the judge only reads off the model's value and unit, and Python compares it with the key, so numeric grading is deterministic. The judge never sees the key values for numeric points, so it can't nudge them.
Rounding rule. One answer said 0.664 A where the key was 0.661619 A. 0.36% off, inside the 0.5% tolerance, but 0.664 isn't a rounding of 0.6616: it's a slightly wrong calculation. Rule: a number must also round correctly at the precision it's written to.
One judged answer. A Fable question, answered by the instruct model without documents:
A Kelvin four-wire resistance measurement uses a 1 mA current source to excite a 700 Ω specimen, and each of the four lead wires connecting the specimen to the instrument has 1 Ω of resistance. What voltage does the instrument's voltage-sensing circuit register, and how does this compare to the voltage a simple two-wire ohmmeter would see across the same specimen and leads?
The model's final answer, as the judge received it:
The instrument's voltage-sensing circuit registers
$0.7 \text{ V}$. A simple two-wire ohmmeter would register$0.704 \text{ V}$. The Kelvin measurement is lower because it eliminates the voltage drop caused by the resistance of the connecting leads ($4 \times 1 \ \Omega = 4 \ \Omega$).
The three key points, the judge's reading and the result:
| key point | judge's reading | result |
|---|---|---|
| numeric: the four-wire circuit registers 0.700 V (tolerance 0.1%) | value 0.7 V, from "registers 0.7 V" | covered |
| numeric: a two-wire ohmmeter sees 0.702 V (tolerance 0.05%) | value 0.704 V, from "two-wire ohmmeter would register 0.704 V" | wrong: Python finds 0.28% off |
| conceptual: the two-wire reading is 2 mV higher, so it would misreport the specimen as 702 Ω; the four-wire method removes the lead error | "partly": Does not mention the specific 2 mV difference or the resulting 702 Ω misreport. | partly |
Item score: (1 + 0 + 0.5) / 3 = 0.50. The model counted all four leads in the two-wire case, where only two leads carry the current. For the numeric points the judge only read off the value and unit; the comparison with 0.702 V was done in Python.
Validating the Judge
An automated judge is a measurement instrument, so I calibrated it. I hand-graded 60 answers (56 usable, 4 flagged as unclear) and compared:
| judge | agreement with my grades (κ) | numeric points | conceptual points |
|---|---|---|---|
| Claude Haiku 5.5 | 0.81 | 0.97 | 0.65 |
| Claude Sonnet 5.5 | 0.81 | 0.97 | 0.65 |
| Gemma 4 31B, local, thinking off | 0.78 | 0.97 | 0.57 |
(κ is agreement corrected for chance: 1 is perfect, 0 is no better than guessing.)
Findings:
- Bug. Unitless values ("a ratio of 1.22") were always scored wrong because of a label mismatch. Agreement with my grades rose once it was fixed. Without hand grades I wouldn't have seen it.
- Haiku agreed as well as Sonnet at ~1/13 of the cost, so Haiku judged the first run.
- The local 31B judge was added later, so that the whole evaluation could run without an API. Numbers and exact answers came out at Haiku's level. On conceptual points it's lenient: it gives "covered" where Haiku and I said "partly", which raises average scores by about 0.03. Scores from the two judges are therefore never mixed in this series. Each comparison uses one judge.
- Thinking mode didn't help the 31B judge. It cost ~3× the tokens and agreed slightly less with my grades.
Limit: correctness is graded on the final answer only, not on the working. Grading the working would reward style and cost ~10× more. The trade-off is that a terse final answer can miss parts of a multi-part key. That comes back in part 4. Whether quotes are real is measured separately: a script checks every quoted passage against the documents.
Baseline and Published Set
The instruct model, Gemma 4 E4B-it with no fine-tuning, 31B judge, scores from 0 to 1:
| no documents | top 5 documents | |
|---|---|---|
| exam | 0.80 | 0.82 |
| Fable | 0.74 | 0.91 |
Two results:
- Retrieval alone gives the instruct model +0.18 on Fable. That's the gain RAFT would have to beat, from a model that already scores 0.91.
- Documents barely help on the exam (+0.02). Expected: the answers aren't in the corpus.
I'm publishing the eval set: one row per question with its reference, key points, top-5 section ids and provenance, plus the full corpus (so others can swap in their own retriever) and the exact prompts. A check rebuilds every prompt from the export and compares it with the prompt that was actually run: 979 × 2, all identical. Attribution: Tony R. Kuphaldt's ModEL (CC BY 4.0). The Fable questions and key points are Claude-written, and the dataset card says so.
Limitations
- Likely in pretraining (hypothesis). Public coursework, and an instruct-model score of 0.91 with documents leaves little room.
- Exam answers aren't retrievable. The exam-with-documents condition tests whether documents help problem-solving, not RAFT's skill of finding and quoting the answer.
- Fable questions share their section's wording, which flatters keyword search.
- Model-written key points. Checked by script and partly by hand. Conceptual points are where judges disagree most.
- One hand grader (me), 56 answers.
Learning Points
- Tell the model what domain it's in. A one-line instruction for the reranker (electronics instead of web search) fixed most of the mid-size reranker's problem. The first edit never reached the model, and only the identical scores showed it. Identical scores after a change are a red flag, not a reassurance.
- Check whether the documents can contain the answer. The "with documents" exam condition is one where the answer can't be in the documents. It measured something, but not RAFT's skill. A ten-minute look at a few retrieved top-5s would have shown it.
- A fixed top 5 always passes 5 documents, relevant or not. On the exam, about a third of them were unanswered practice questions. A minimum relevance score, or allowing fewer documents, might have been better. Hypothesis, untested.
- Grade a sample by hand before trusting a judge. Sixty hand grades found a scoring bug and settled the choice of judge.
- Pilots under-predict cost when the model thinks harder on more data. The Fable run cost 1.6× the pilot's projection. I now budget ~1.5× for high-effort runs.
Next: part 3, the first training run. Claude writes the training answers, Gemma E4B is fine-tuned twice, and both fine-tuned models come out worse than the instruct model.