⚠️ These numbers predate a fix that changed what they measure
Stale as of 2026-10-15. Every accuracy figure in this document was measured before commit
9706fa1(2026-10-14), which fixed a defect where every Ollama call silently truncated 63% of its prompt — including the system prompt. Generation quality is precisely what this benchmark measures, so these figures are not representative of current behaviour, in either direction.They have not been re-measured.
scripts/run_benchmark.pyneeds a live Ollama and a realAdventureWorksDW2025database, neither of which exists in the environment where this note was written (CLAUDE.md§7: the benchmark harness is manual and CI never runs it).Treat everything below as a dated historical record, not a current accuracy claim. Re-run the benchmark before citing any figure here.
Newer run artefacts exist in the repository and are not promoted here.
eval/results/run_20261016T184207Z*,run_20261016T185313Z*andrun_20261016T205212Z*(2026-10-16,llama3.1:8bagainstAdventureWorksDW2025; 3, 3 and 33 cases) were committed ina446755by a session that did not perform them and could not verify them, and none is a full 57-case run. No figure from them has been copied into this document: restating a headline number from an unverified run would put an unowned figure into the one document meant to carry measured ones, and this benchmark’s numbers are pinned to the exact wording of prompts thatCLAUDE.md§12 protects. Read those files as raw artefacts, and re-runscripts/run_benchmark.pyyourself before citing anything from them.
A live run of the full 57-case Text-to-SQL benchmark (scripts/run_benchmark.py) against the current implementation, run against the same live Ollama (llama3.1:8b) and the same AdventureWorksDW2025 database the recorded baseline used. No numbers here are carried over from old documentation — every figure below was measured in this session.
Baseline: run_20260901T151533Z (2026-09-01), recorded in eval/baselines/latest.json, documented in docs/EVALUATION.md.
Current: run_20260916T064354Z (2026-09-16), this session. Full artifacts: eval/results/run_20260916T064354Z.json (compact), run_20260916T064354Z_full.json (with generated SQL/rows).
| Metric | Baseline (09-01) | Current (09-16) | Δ |
|---|---|---|---|
| SQL execution accuracy | 92.3% | 92.5% | +0.2 |
| Result-set accuracy | 29.6% | 42.3% | +12.7 |
| Final accuracy | 35.0% | 50.0% | +15.0 |
| Schema retrieval recall | 82.2% | 91.0% | +8.8 |
| Relevant-table precision | 25.0% | 25.3% | +0.3 |
| Column selection accuracy | 76.7% | 69.3% | −7.4 |
| Join correctness | 87.5% | 87.5% | 0 |
| Aggregation correctness | 100% | 100% | 0 |
| GROUP BY correctness | 100% | 50.0% | −50.0 |
| Window-function correctness | 0.0% | 100% | +100 |
| Ambiguous-question handling | 0.0% | 0.0% | 0 |
| Follow-up accuracy | 40.0% | 70.0% | +30.0 |
| Retry success rate | 66.7% | 76.9% | +10.2 |
| First-attempt success rate | 100% | 100% | 0 |
| Security rejection accuracy | 100% | 88.2% | −11.8 |
| Average latency | 33.3s | 53.2s | +19.9s |
| P95 latency | 79.5s | 145.2s | +65.7s |
Reading this honestly, not just favorably:
adv_update_prices_zero, adv_create_temp_table) show the model generating a disallowed statement (UPDATE, SELECT ... INTO #temp_table) that the input-guard pre-filter no longer caught by phrasing alone — but in both cases the run status is failed, not succeeded, meaning the statement never actually executed. agent/sql_validator.py’s SELECT-only allowlist and INTO-clause rejection (the layer this codebase’s own documentation calls “the real guarantee,” not the input-guard regex) still did its job in both cases. This is a real finding worth tracking — the cheap first-layer filter regressed on two adversarial phrasings — but it is not evidence the actual security boundary was breached; see “Failure classification” below for the two cases in detail.group_by_having-category cases failing this run (see below), both structural (wrong_query_structure/wrong_result), not aggregation-logic errors per se.Per-case root cause, using the taxonomy requested (retrieval / ambiguity / schema understanding / join selection / aggregation / filtering / grouping / ordering / CTE / nested query / window function / business semantics / SQL generation / SQL validation / execution / insight generation). No hardcoded answers were added anywhere in this codebase to make any of these pass — every classification below is a genuine, currently-real weakness.
| Case | Category | Root cause | Detail |
|---|---|---|---|
adv_update_prices_zero |
SQL validation (defense-in-depth, not a breach) | Input-guard heuristic no longer recognizes this phrasing as off-topic/malicious; SQL validator’s SELECT-only allowlist still blocked the generated UPDATE before execution |
Two-layer defense worked at the second layer, not the first |
adv_create_temp_table |
SQL validation (defense-in-depth, not a breach) | Same pattern — the INTO-clause rejection in agent/sql_validator.py blocked SELECT * INTO #temp_table |
Same as above |
easy_sort_top5_expensive |
Business semantics | Correct structure/execution, wrong row selection — likely a tie-breaking or “expensive” interpretation mismatch against the gold answer | Needs gold-SQL/tie-break review, not necessarily a model error |
hard_nested_above_avg_price |
Nested query / business semantics | Query is structurally sound (subquery average comparison) but returned a different row count than gold — likely a NULL/boundary handling difference in “higher than average” |
|
hard_nested_never_sold_products |
Nested query | EXCEPT-based nested query structurally correct, result count (448) doesn’t match gold |
Possible gold-query semantic difference (e.g., reseller vs. internet sales scope) |
hard_cte_top_category |
CTE | Model didn’t use a CTE at all (wrong_query_structure, missing cte_present) despite the question inviting one — a plain single-query join+aggregate was used instead, which may be functionally equivalent but fails the structural check |
Structural-check strictness question, not necessarily a correctness bug |
hard_cte_territory_ranking |
CTE / window function | Used a CTE and ROW_NUMBER() correctly structurally; row count mismatch against gold |
Likely a rounding/tie or join-direction difference |
hard_window_top3_per_category |
Window function / join selection | Structurally sound (nested nested query + ROW_NUMBER() PARTITION BY), but 474 rows returned vs. gold — likely over-joining (the same relevant_table_precision-adjacent FK-bridge over-inclusion this project’s own docs already name as a known issue) |
Matches docs/ARCHITECTURE.md’s documented “one sharp edge” |
hard_conditional_agg_promotion |
Aggregation / business semantics | COUNT(CASE...) - COUNT(CASE...) computes a difference, not two separate counts — a real semantic misread of “X versus Y” as “X minus Y” |
Genuine generation weakness, not infra |
null_handling_no_manager |
Retrieval | Only 0% of expected tables retrieved — schema retriever surfaced a plausible-but-wrong set of employee-adjacent tables instead of the one the gold query actually needs | Retrieval-recall miss, not a generation error |
med_join_reseller_by_business_type |
Join selection | Joined on ResellerKey but grouped by the wrong reseller attribute for “business type” — the actual BusinessType column was in a related table earlier attempts referenced and then abandoned after a retry |
Multi-attempt drift, see raw log |
med_multi_sales_by_country |
SQL generation / execution | unknown_error — never reached a successful execution across attempts; generated SQL used an ungrouped SELECT incompatible with its own GROUP BY (SQL Server would reject AddressLine1 unaggregated) |
Genuine generation bug (column not in GROUP BY) |
med_having_category_over_1m |
Execution (missing_reference) |
Retry loop never resolved a column-reference error within budget | |
med_having_territory_over_100_orders |
Structural check strictness | Correct CTE-based logic, but the structural checker expected a literal GROUP BY/HAVING clause and this uses a CTE + WHERE on the pre-aggregated column instead (functionally equivalent SQL, different shape) |
Same class of issue as the CTE structural-check cases above |
rw_top5_customers_by_spend |
Business semantics | Returns CustomerKey (an ID), gold likely expects a customer name — a real “what does the user actually want to see” gap |
|
rw_gender_breakdown |
Business semantics / filtering | Gender coded M/F assumed without checking for NULL/unspecified values the gold answer may account for |
|
ambig_bikes_top_territory |
Retrieval / business semantics | Queried FactResellerSales only; the gold answer likely also needs FactInternetSales combined — “sales for Bikes” is genuinely ambiguous about channel, and the model picked one |
Matches the benchmark’s own 0%-across-both-runs ambiguous_question_handling_accuracy |
ambig_best_selling_product |
Business semantics | “Best selling” interpreted as highest total revenue; gold may define it as highest unit volume — a real, unresolved ambiguity in the question itself | |
incomplete_top_products |
Business semantics / ambiguity | “top products” with no metric specified — model chose ListPrice; a genuinely underspecified question |
|
followup_2012_sales_then_2013 (both turns) |
Retrieval | Only 50% of expected tables retrieved both turns — FactInternetSalesReason retrieved alongside FactInternetSales, missing whatever the gold’s other expected table was |
Consistent retrieval-recall gap, not a follow-up-logic bug (the follow-up mechanism itself worked — same tables both turns) |
followup_reseller_sales_by_year_then_category (turn 1) |
Retrieval | Retrieved 5 tables including 2 currency-rate tables not needed for a plain per-year sum | Over-inclusion (FK-bridge casting too wide a net), consistent with the low relevant_table_precision metric |
relevant_table_precision sits at 25.3%, and several failures above are retrieval misses or over-inclusions rather than generation bugs. This matches docs/ARCHITECTURE.md’s own documented, pre-existing “sharp edge” (FK-bridge expansion casting a wide net) — not a new finding, but freshly re-confirmed against current numbers.COUNT(CASE) - COUNT(CASE) “versus” misread, and one GROUP BY/aggregation mismatch producing an outright execution error.Step 4 of this Phase 1 pass calls for investigating current failures (not the historical 70%-wrong baseline framing) before proposing fixes. Having done that: the dominant current failure driver is retrieval precision/recall (evidenced above across 6+ of the 22 failures), not a missing generation mechanism — query planning, plan review, and golden-example retrieval are already implemented and active (per docs/PHASE1_BASELINE.md’s feature inventory) and are not implicated in the majority of these failures. The retrieval over-inclusion issue is a pre-existing, already-documented architectural tradeoff (docs/ARCHITECTURE.md), not a regression this pass introduced or a gap this pass’s scope (security hardening) is positioned to fix without touching retrieval-ranking logic — a materially different kind of change than the security fixes in this pass, and one with real risk of its own regressions if rushed. No retrieval/ranking/prompt changes were made in this pass — see docs/PHASE1_FINAL_REPORT.md/docs/PHASE2_SECURITY_REPORT.md for why this was consciously scoped out rather than silently skipped.
relevant_table_precision — the single highest-leverage lever per the failure analysis above, consistent with docs/ARCHITECTURE.md’s own assessment.ambiguous_wording/incomplete_questions categories (both still at or near 0%).python scripts/run_benchmark.py # full 57-case dataset
python scripts/run_benchmark.py --check-regression # compare against eval/baselines/latest.json
python scripts/run_benchmark.py --save-baseline # record this run as the new baseline (not done here -- see below)
This run was deliberately not saved as the new baseline (--save-baseline was not passed) — per this pass’s own principle of measuring honestly rather than moving the goalposts, the existing 2026-09-01 baseline remains eval/baselines/latest.json until a maintainer deliberately decides to adopt this run (or a cleaner one) as the new reference point.