# Semantic layer evaluation, round 3: questions written blind

Declared before any question was written and before any paid call. The commit that adds this file records when. A
frozen protocol, `evals/blind-protocol.json`, adds the hashes of the questions, the answer keys and the code before
the pilot. Anything decided after the results are seen is labelled as such on the page and in the results file.

## The question

Round 2 measured, per model, how much a semantic layer changes accuracy for agents with tools (SQL only against SQL
plus the layer) on 55 questions I wrote alongside the layer and its metric definitions. A question set written by the
same hand as the thing it tests can flatter it. This round measures whether that gap survives questions written by an
independent author who never saw the layer, the prompts or the earlier questions. It adds no new agent design.

Per model: is the layer minus SQL accuracy gap on the blind questions the same as on the published questions? Where
does it break? Is the scoring itself valid on questions it was not built around?

## The blind questions

- **Author:** independent of the layer. It is given only the warehouse schema, a plain description of the data and a
  business glossary a new analyst would get, plus its instructions. It never sees the semantic layer, the metric definitions, the agent prompts, the
  tools' descriptions beyond the SQL function list, the published questions or any data rows. It is run once, with no
  commands and no files, and its inputs and output are hashed. Its inputs, instructions and run record are kept with the
  study's private files.
- **What it writes:** 40 questions, each with the output columns and row order stated, and separately its own reading
  of each question (how it would compute it, in plain words).
- **Exclusions:** a question is excluded only if no single SELECT within the SQL sandbox's function list can answer it
  on these tables, or it needs data the tables do not hold. Every exclusion is listed with its reason. If fewer than 30
  questions remain, collection does not start and the round is reported as failed.
- **Answer keys:** I write the key SQL for each question from the question text alone, before opening the author's
  readings (they are split into a separate file by a script and their hash is recorded first). The keys are frozen with
  a hash. Then I write a second SQL that follows the author's reading for each question. A question is **agreed** when
  both give the same result under round 1's comparator, and **differs** otherwise. Both keys are kept.
- **Coverage:** for each question I try to express the key answer as a metric query in the layer. A question is
  **covered** when a metric query through round 1's governed path returns the key result, and **not covered**
  otherwise. Decided and frozen before collection. The count of questions the layer cannot express is reported as its
  own number.

## Arms, models and runs (unchanged from round 2)

- **Arms:** SQL only (`run_sql`), and SQL plus the layer (`run_sql` and `query_metrics`). System prompts, tool
  definitions, Codex prompt prefixes, the step limit (10 tool calls; 13 assistant turns; a 600 second wall clock for
  Codex runs), row preview, answer format and decode are taken from round 2's code and asserted byte-identical to the
  round 2 protocol. Only the questions change.
- **Models:** claude-sonnet-5-5 and claude-haiku-5-5 through the model provider's API in round 2's manual tool loop
  (effort medium, 8,000 output tokens, adaptive thinking); gpt-6.1-sol and gpt-6-luna through the Codex CLI on the
  ChatGPT plan from a clean configuration holding only the login file (reasoning effort medium). Reported per model,
  never pooled.
- **Known differences from round 2:** the Codex CLI is version 0.164.0 (round 2: 0.162.1). The Claude runs use a
  different API key from round 2's, because that one has reached its usage limit; same models and settings.
- **Runs:** 3 per question, arm and model, each a fresh conversation, no reuse across runs. Order: run index outer,
  questions in file order, arms alternating first by question.
- **Outcomes:** a cut-off, no final answer or refusal is scored not correct and counted. A provider error gets one
  declared re-run; a run still failing is excluded from accuracy and counted. Every run is kept in `cache-blind/`.

## Scoring

Round 1's per-answer code (`score.prepare`, `evaluator.execute_prepared`) and tolerance (absolute and relative one
millionth, no rounding), unchanged, with round 2's routing (a `{"sql"}` answer on the raw SQL path, a metric query on
the governed path) and round 2's amendment 1 handling of untokenizable SQL. The frozen decode is primary; round 2's
lenient decode is reported as a labelled sensitivity.

## Analysis (per model)

1. **Primary:** layer minus SQL accuracy on the agreed blind questions, with a question-clustered percentile bootstrap
   interval (10,000 replicates, seed 7; all runs of a drawn question kept), next to the published gap from
   `results-run3.json` (unchanged), and the difference between the two gaps with an interval from independent
   resampling of each question set (10,000 replicates, seed 17).
2. **Reading rule (declared now):** a gap is "layer ahead" if its interval lies wholly above zero, "SQL ahead" if
   wholly below, and "no measurable difference" otherwise. For each model the result **held** when the blind gap's
   class equals the published gap's class, and **did not hold** otherwise. The difference between the gaps is
   "smaller on blind questions" or "larger" when its interval excludes zero, otherwise "no measurable change".
3. **Where it breaks:** the same gap on covered and on not-covered blind questions; accuracy per arm on each; the causes
   of misses by answer status.
4. **Questions that differ:** reported separately, scored against my key and against the author's reading, never
   dropped.
5. **All scoreable questions:** the same gap over agreed and differing questions together, scored on my key.
6. **Latency:** median and interquartile range of seconds per run, per arm (Codex runs include the CLI's start-up).
7. **Safety:** per arm, tool calls refused as writes (`Statement denied`, `One SELECT is required`) and as reads
   outside the three declared tables (`Relation denied`, `Namespace denied`), final answers that would do either, and
   Codex commands run outside the two tools. Any such query that executed would be a sandbox failure and stops the
   round.
8. **Step limit, cut-off, no answer, refusal and provider-error counts** by arm.

## Scoring validity (declared now)

- **Re-score:** 100 stored round 2 runs (25 per model, drawn with seed 11) re-scored with the same code; agreement with
  the published per-run verdicts.
- **Hand check:** for each model, 10 runs the scorer marked correct and 10 it marked not correct (all of them if
  fewer), drawn with seed 13 from the final runs on scoreable questions. I read the question, the final answer and its
  result next to the key, and judge whether the answer is right. Agreement is reported per model, and every
  disagreement is listed with its cause.

## Budget and pilot

- Cap US$20 for all paid calls of this round to the Claude models, checked before every run with round 2's reservation
  rule (US$0.40 a Sonnet run, US$0.03 a Haiku run). Spend is recorded from the usage the API returned.
- **Pilot:** questions B01, B09, B17, B25 and B33, 2 arms, 1 run, per model; never scored into the results. Projected
  final cost per Claude model = mean pilot cost per run times its final run count. If spend so far plus both
  projections exceeds the cap, stop and report; the design is not trimmed to fit.
- **Stopping rule:** the full plan is collected whatever the interim results; collection stops early only at the cap
  or on a provider access block, and then reports what was collected.

## Limits known in advance

- The blind set differs from the published set in difficulty and in how much the layer covers, so a different gap can
  come from either. Coverage is reported for that reason.
- One author, one run, 40 questions: a different author would write different questions.

## Outputs

`evals/blind-questions.json` (the questions as written), `evals/blind-keys.json` (key SQL, the author's readings and
their SQL, agreement, coverage), `evals/blind-protocol.json`, `cache-blind/`, `results-blind.json` (from
`score_blind.py`, replayable without credentials), `blind-questions.html` (from `render_blind.py`).
