# AI answers over company data

One test setup, two datasets, four models: what an AI model needs before it answers business questions from data correctly.
Synthetic bank tables and a public Chicago trip sample, so no customer data is shared.

## Answer

On questions written alongside the definitions, four AI models each scored 92% to 100% with those definitions, near the ceiling, and 61% to 89% from table names alone.

Every model scored higher with the definitions: 11 to 31 points more on the bank tables and 6 to 36 on the trip sample, per model. With them, all four sat too near the top for this test to rank them. When the AI could run its own queries first, documentation still helped on 8 bank tasks, but on 8 trip tasks the metric layer did slightly worse than plain SQL.

Main limitation: The questions and their right answers were written alongside the definitions, to probe the rules those definitions state, for two earlier studies; this study reuses them byte for byte, on one synthetic and one public dataset. The gaps show what definitions are worth on questions that need them; how often real questions need them is untested.

## Results

| Comparison (four models pooled, three runs each) | Difference, pp | Interval, pp |
|---|---:|---:|
| Trip sample: metric layer minus SQL on the tables, all 55 analytical | +17.1 | +12.3 to +25.0 |
| Trip sample, tier 1 (totals and single filters) | +12.9 | +11.7 to +14.2 |
| Trip sample, tier 2 (by date and by group) | +20.4 | +13.8 to +37.1 |
| Trip sample, tier 3 (joins to area names) | +18.3 | +4.4 to +33.3 |
| Bank tables: allowed values minus names only | +9.3 | +2.1 to +18.2 |
| Bank tables: full documentation minus allowed values | +10.2 | +2.3 to +22.1 |
| Bank tables: full documentation minus names only | +19.4 | +8.8 to +31.4 |
| Multi-step bank tasks: documentation minus names only | +31.3 | +11.5 to +55.2 |
| Multi-step trip tasks: metric layer minus SQL | −8.3 | −15.6 to −2.1 |

2 of the 8 single-model intervals for the two main comparisons reach zero; per-model tables are on the page and in results/summary.json. Tier 1 holds two question templates, so its interval is narrow by construction.

Format: with a strict schema, which the provider enforces, 0 of 2,880 new answers were malformed; 23 Gemini answers were cut off at the output ceiling and 1 request was refused by the provider. The table above counts those as wrong, as planned. The earlier free-JSON run had 7 malformed metric requests out of 55.

With the 24 cut-off or refused answers left out (declared in evals/sensitivity-declaration.json, results in results/sensitivity.json):

| Gain from definitions, per model and pooled | Bank: documentation minus names, pp | Trips: metric layer minus SQL, pp |
|---|---:|---:|
| Claude Haiku 5.5 | +15.7 (+3.6 to +30.3) | +35.8 (+26.1 to +52.3) |
| GPT-4.1 mini | +17.6 (+7.4 to +30.2) | +6.1 (−4.8 to +22.5) |
| Gemini 3.8 Flash | +31.5 (+14.9 to +49.0) | +9.3 (+3.7 to +15.6) |
| Claude Sonnet 5.5 | +11.1 (0.0 to +25.0) | +12.7 (+6.5 to +20.7) |
| Four models pooled | +19.0 (+8.3 to +31.1) | +16.2 (+11.4 to +24.3) |

The bank questions are the same 40 as the agent-ready data marts study (https://diogotravassos.dev/agent-ready-data-marts/), which looks deeper at the bank tables alone, and the trip questions the same 60 as the semantic layer study (https://diogotravassos.dev/semantic-layer-evaluation/). Both sets were written alongside the definitions they test and are reused byte for byte.

## Method and checks

- Models: Claude Haiku 5.5 and Claude Sonnet 5.5 (thinking off, effort medium), GPT-4.1 mini (temperature 0 and a fixed seed) and Gemini 3.8 Flash (thinking level low, the declared fallback, because the provider rejected the minimal level). All with a 1,024-token output ceiling and a strict JSON schema.
- Three repeats per model with identical requests. Claude 5.5 and Gemini 3.8 take no temperature or seed here, so repeats measure run-to-run variation.
- Earlier runs reused unchanged: GPT-4.1 mini with free-form JSON on both datasets, plus its allowed values arm and a strict-schema rerun of the metric layer arm, all rescored by this code; they reproduce the published scores of the two source studies.
- Intervals: paired percentile bootstrap with 10,000 replicates, resampling whole clusters: question templates on the trip sample, the CAD and USD twins of each question on the bank tables. Per question, the score is the mean over the three runs; pooled figures average each question's difference over the four models first.
- Frozen inputs: the two earlier studies' question sets, gold answers, prompts, data and documentation, copied byte for byte (datasets/SOURCES.json).
- Written down before any paid request; one declared change followed, touching no result (the fallback thinking level for Gemini 3.8 Flash).

## Reproduce without credentials

Prerequisites: Linux or WSL with Bubblewrap user namespaces (bwrap), Python 3.12.3 and uv. All packages are pinned in requirements.lock.

```sh
uv venv --python python3.12 .venv
uv pip sync --python .venv/bin/python requirements.lock
make all
```

make all builds both databases (dbt build with 15 data tests for the trip sample), runs the tests, scores every stored answer offline (the earlier runs and the new ones), re-runs every multi-step query, writes results/ and renders this README and index.html. No request leaves the machine.

The design files and declared change records of the connectors, drug labels, permissions and silent choices paired tests rounds, and the drug labels round's sampling script, are not in the download. Four number checks read them and need the full project: python -B -m connectors.numbers, druglabels.numbers, permissions.numbers and silent.paired.numbers. So do the tests that run those checks or compare those files with their hashes, in tests/test_connectors_results.py, tests/test_labels.py, tests/test_permissions.py and tests/test_silent_paired.py, and with them the test, connectors and permissions steps of make all.

## Files

- results/summary.json: every figure on the page scored as planned. results/outcomes.csv: every scored answer. results/multistep-outcomes.csv: every task run. results/calls.csv: every request and its cost.
- results/sensitivity.json: the declared sensitivity analyses (evals/sensitivity-declaration.json): every figure with the cut-off and refused answers left out, and the break-even sweep. make sensitivity rebuilds it.
- cache/: the model responses of the new runs. prior/: the earlier runs, with their stored responses unchanged.
- evals/multistep/tasks.json: the multi-step tasks with gold rows.
- datasets/: frozen data, question sets and documentation of the two earlier studies.
- The page styling is viz-design-system release 2.3.0, copied unedited into vendor/viz-design-system/ and pinned by hash in vendor/viz-design-system-adoption.json.

## Data notice

The bank tables are fictional. For the Chicago data read NOTICE.txt for the required City disclaimer and attribution.

Contact: hello@diogotravassos.dev, https://www.linkedin.com/in/diogo-travassos/

Some files are packed in ai-answers-over-company-data-data-1.zip and its sibling parts; unzip them here to restore the full export, which the manifest lists file by file.
