In this lesson, you put questions a model wrote beside the messages hikers really sent, then built the start of an eval set from a sample of last season’s log.
Key Points
- Generated questions don’t look like real ones. Asked for ten questions hikers might send, the model (five recorded runs on 1 December 2026) returned ten complete, polite English questions about huts this trail doesn’t have, and ten of ten ended with a question mark. Your run will word them differently.
- Real messages are messier. Real hikers type fragments on a phone, switch languages, ask two things at once, and ask for things the assistant doesn’t do. A prompt for messier questions only gives you the mess you thought of: the log shows what hikers really send, and how often.
- Start from the log. The starting project’s
data/questions.jsonlholds three hundred of last season’s messages, each with its month, its language, and its safety:"emergency","hazard"(a wrong answer could hurt someone), or"none". The log’s personal data was stripped before you got it, and the starting project’s README says how. - Sample across the season. The log is in date order, so keeping every sixth message spreads the sample over the whole season: fifty of three hundred.
- Count every slice. Counting the sample by month, language, and safety, next to the whole log’s counts, shows the thin slices. A slice is thin when it has too few cases to tell you anything, whatever its share of the log: one Italian case of nine, one French of twelve, and one of thirteen emergencies.
- Fill thin slices from the log first. Adding every emergency, French, or Italian message the sample didn’t include gives seventy-nine cases, written to
evals/cases.jsonl, one case per line. The script writes over that file, so move your twelve invented cases toevals/invented-cases.jsonlfirst. - Read results per slice. The set over-represents the thin slices on purpose, so one overall pass rate doesn’t describe real traffic.
- Generate only for a slice the log can’t fill. Nine Italian cases are still few, and the log has no more. That’s when you generate cases, each marked synthetic and read by a person before it goes in.
- Scale: three hundred messages is a small log. Real traffic gives thousands, and the same counts work there.
Final Code
First, move the twelve invented cases out of the way, since the script writes over evals/cases.jsonl:
$ mv evals/cases.jsonl evals/invented-cases.jsonl
Then evals/sample.js samples the log, counts every slice, and fills the thin ones:
evals/sample.js
import { readFileSync, writeFileSync } from "node:fs";
const log = readFileSync("data/questions.jsonl", "utf8")
.trim().split("\n").map((line) => JSON.parse(line));
const sample = log.filter((q, i) => i % 6 === 5);
function countBy(questions, field) {
const counts = {};
for (const q of questions) {
counts[q[field]] = (counts[q[field]] ?? 0) + 1;
}
return counts;
}
function report(cases) {
console.log(cases.length, "of", log.length, "questions");
for (const field of ["month", "lang", "safety"]) {
const inLog = countBy(log, field);
const inCases = countBy(cases, field);
for (const value in inLog) {
console.log(` ${field} ${value}: ${inCases[value] ?? 0} of ${inLog[value]}`);
}
}
}
const thin = (q) => q.safety === "emergency" || q.lang === "fr" || q.lang === "it";
const cases = [...sample, ...log.filter((q) => thin(q) && !sample.includes(q))];
report(cases);
writeFileSync("evals/cases.jsonl", cases.map((q) => JSON.stringify(q)).join("\n") + "\n");
Run node evals/sample.js on the starting project’s log, and it prints:
79 of 300 questions
month june: 10 of 40
month july: 28 of 100
month august: 28 of 110
month september: 13 of 50
lang en: 47 of 231
lang de: 11 of 48
lang fr: 12 of 12
lang it: 9 of 9
safety emergency: 13 of 13
safety hazard: 23 of 124
safety none: 43 of 163
Your seventy-nine cases have nothing to check answers against yet, so npm run evals can’t grade them. In the next lesson, Label Cases and Hold Some Out, you’ll write down what a good answer to each must have, and set some aside.