Skip to content

Diogo TravassosData leadership · Analytics · Decision-making

Synthetic dataPublic data

AI answers over company data

Part 3 of 3 in What an AI needs from company data

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.

Key figures
Bank tables, gain per model+11 to +31 pointsfull documentation against names only; pooled 80% to 99% correct, +19 (interval +8 to +31)Trip sample, gain per model+6 to +36 pointsmetric layer against SQL; pooled 80% to 96%, +16 (interval +11 to +24); the top of the range is Claude Haiku 5.5, whose misses with SQL were mostly a question backMulti-step bank tasks solved5.3 → 7.8 of 8the AI ran its own queries, names only then documentation; on the 8 trip tasks the metric layer did worse, 8.0 → 7.3, all of the drop from one modelAnswers left out24 of 2,88023 cut off at the output ceiling and 1 refused by the provider; scored wrong, as planned, the pooled gains are +19 and +17

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.

In plain words

A customer types a question into a company's AI assistant: how much did we spend on cards in US dollars last month? The assistant turns the question into a query on the company's tables and returns a number. The tables rarely say what the business means: which date counts, which values a column can hold, which rows to leave out. A wrong query still returns a clean, plausible number, and a good answer looks exactly like a bad one.

I tested what the assistant needs to know first. Four AI models answered the same 100 questions, three times each, on two datasets. Each time they got either the table and column names alone, or the business definitions as well: written documentation for a set of bank tables, and a metric layer for a public sample of Chicago ride-hail trips. Sixteen more tasks let the model run its own queries and see the results before answering.

The bank tables are synthetic and the trips are public, so no customer data is shared.

On single questions, every model scored higher with the definitions: at least 92% correct with them, 61% to 89% without. For 2 of the 8 model and dataset pairs the interval reaches zero, and on the multi-step trip tasks one model did worse. On the bank tables the weakest model with documentation (97%) beat the strongest without it (89%); on the trip sample the margin is too small to tell at 55 questions. On these questions, the definitions mattered more than the choice of model. How often real questions need them is the part to test on your own data.

Names only
The model sees the table and column names and their types, nothing else.
Allowed values
The names plus the values each text column can hold, for example credit and debit.
Full documentation
What each table and column means, what one row stands for, which date to use, the allowed values and which joins are safe.
SQL on the tables
The model writes the database query itself from the table descriptions.
Metric layer
Also called a semantic layer: one agreed definition per business metric. The model picks a metric, a breakdown and filters, and the layer writes the SQL.
Multi-step task
A question that needs two or three lookups in a row, such as finding the top account and then its cards.
Points (pp)
The gap between two percentages: from 79% to 98% is 19 points.
Interval
How far a difference moves when the questions are resampled. A range that stays above zero means the gain does not hang on a few questions.
Three runs
Each model answered every question three times, because the same model can answer the same question differently.

The evidence: every model did better with definitions

Each point is one model's share of analytical questions answered correctly, averaged over three runs: 36 on the bank tables, 55 on the trip sample. These charts and tables score every answer as planned, so the 24 answers cut off or refused count as wrong. Pooled over the four models, full documentation added 19 points on the bank tables (interval +9 to +31) and the metric layer 17 points on the trip sample (interval +12 to +25); with those answers left out, 19 and 16. Treat the size of each gain with care: the questions were written to need the definitions.

On the bank tables, the list of allowed values closed about half the gap and full documentation the rest: pooled, +9.3 and then +10.2 points.

Share of 36 analytical questions answered correctly, mean over three runs.

Show the data

Bank tables: mean correct analytical answers over three runs

ModelNames onlyPlus allowed valuesFull documentation
Claude Haiku 5.529.3 of 36 (81.5%)34.0 of 36 (94.4%)35.0 of 36 (97.2%)
GPT-4.1 mini28.7 of 36 (79.6%)31.3 of 36 (87.0%)35.3 of 36 (98.1%)
Gemini 3.8 Flash23.7 of 36 (65.7%)27.7 of 36 (76.9%)35.3 of 36 (98.1%)
Claude Sonnet 5.532.0 of 36 (88.9%)34.0 of 36 (94.4%)36.0 of 36 (100.0%)

Bank tables: paired differences in percentage points, with the interval below each figure

ModelAllowed values minus namesDocumentation minus allowed valuesDocumentation minus names
Claude Haiku 5.5+13.0+2.9 to +25.7+2.8−8.3 to +15.8+15.7+3.6 to +30.3
GPT-4.1 mini+7.4−6.7 to +21.2+11.1+1.8 to +24.3+18.5+8.3 to +30.6
Gemini 3.8 Flash+11.1+4.0 to +20.6+21.3+6.5 to +37.6+32.4+15.3 to +50.5
Claude Sonnet 5.5+5.60.0 to +14.7+5.60.0 to +17.1+11.10.0 to +25.0
Four models pooled+9.3+2.1 to +18.2+10.2+2.3 to +22.1+19.4+8.8 to +31.4

Source: this study's stored and scored model answers.

On the trip sample, every model answered more questions through the metric layer; pooled, +17.1 points.

Share of 55 analytical questions answered correctly, mean over three runs.

Show the data

Trip sample: mean correct analytical answers over three runs

ModelSQL on the tablesMetric layer
Claude Haiku 5.533.3 of 55 (60.6%)53.0 of 55 (96.4%)
GPT-4.1 mini47.0 of 55 (85.5%)50.3 of 55 (91.5%)
Gemini 3.8 Flash46.3 of 55 (84.2%)54.0 of 55 (98.2%)
Claude Sonnet 5.547.0 of 55 (85.5%)54.0 of 55 (98.2%)

Trip sample: metric layer minus SQL on the tables, percentage points, with the interval below each figure

ModelMetric layer minus SQL
Claude Haiku 5.5+35.8+26.1 to +52.3
GPT-4.1 mini+6.1−4.8 to +22.5
Gemini 3.8 Flash+13.9+7.1 to +21.2
Claude Sonnet 5.5+12.7+6.5 to +20.7
Four models pooled+17.1+12.3 to +25.0

Source: this study's stored and scored model answers.

Not every single-model difference is clear of zero: for GPT-4.1 mini on the trip sample the interval is −5 to +22 points, and for Claude Sonnet 5.5 on the bank tables it is 0 to +25. In all, 2 of the 8 single-model intervals for these two comparisons reach zero; the pooled ones do not.

Leaving out the 23 answers cut off at the output ceiling and the 1 request the provider refused, instead of scoring them wrong, moves only Gemini 3.8 Flash and GPT-4.1 mini. Gemini's trip gain falls from 14 to 9 points, because all 8 of its cut-off trip answers came with SQL on the tables.

Gain from definitions with the 24 cut-off or refused answers left out, percentage points, with the interval below each figure

ModelBank tables: documentation minus namesTrip sample: metric layer minus SQL
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.10.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

When the AI could look at the data

Each of the 16 multi-step tasks needs two or three lookups in a row: find the top account, then look up its cards; find the busiest day, then the top category that day. The model could run up to four queries and see each result before answering.

On 8 bank tasks, documentation lifted the tasks solved from 5.3 to 7.8 of 8 (pooled, +31.3 points, interval +11.5 to +55.2, about half of it from GPT-4.1 mini); on 8 trip tasks, SQL solved every task in every run and the metric layer 7.3 of 8, all of the drop from one model.

Tasks solved out of 8 per dataset, mean over three runs. A ring around a dot means both contexts scored the same.

Show the data

Multi-step tasks solved, mean of three runs

Model and datasetNames only or SQLDocumentation or metric layerDifference, pp, and interval
Claude Haiku 5.5 (bank)5.3 of 87.3 of 8+25.0−12.5 to +62.5
GPT-4.1 mini (bank)2.7 of 88.0 of 8+66.7+33.3 to +91.7
Gemini 3.8 Flash (bank)7.0 of 87.7 of 8+8.3−12.5 to +37.5
Claude Sonnet 5.5 (bank)6.0 of 88.0 of 8+25.00.0 to +62.5
Claude Haiku 5.5 (trips)8.0 of 85.3 of 8−33.3−62.5 to −8.3
GPT-4.1 mini (trips)8.0 of 88.0 of 80.00.0 to 0.0
Gemini 3.8 Flash (trips)8.0 of 88.0 of 80.00.0 to 0.0
Claude Sonnet 5.5 (trips)8.0 of 88.0 of 80.00.0 to 0.0

Source: this study's multi-step task runs.

What went wrong or was missed

What I would use when

What to give an AI model before it answers from company data

ApproachUse it forWatch out for
Table names onlyA quick internal question where someone who knows the data reads the query.Even the strongest model missed about 1 in 9 bank questions and 1 in 7 trip questions.
Allowed valuesThe cheapest first step: a script can list them. On the bank tables they closed about half the gap.They cannot say which date counts or which rows to leave out. Full documentation added another 10 points.
Full documentationTables the AI queries with SQL, where you own the docs. Every model scored 97% or more on the bank tables.It goes stale when tables change, so it needs an owner and a test that it still matches the tables.
Metric layer (for example dbt's MetricFlow, used here, or LookML)Customer-facing answers and any metric people define differently. Every model scored 92% or more on the trip sample.It answers only what it defines. On the multi-step trip tasks it added nothing, because plain SQL already solved them, and one model did worse through it.
A bigger modelAfter the definitions exist, and tested on your own questions. With definitions every model scored 92% to 100%, too near the ceiling for this test to rank them; the cheapest cost US$0.04 per 100 correct answers against US$0.81 for the dearest.Without definitions the models were up to 25 points apart, while definitions added up to 36 points to a single model.

For a customer-facing assistant I would put a metric layer in front of every metric with an agreed definition, give the model written documentation for everything else, and run the cheapest model that passes a set of questions with known answers. I would not let an assistant answer from table names alone for any number a customer or an executive acts on.

How I would roll this out with a team

What it is worth

Pooled over four models, with the cut-off and refused answers left out, definitions removed about 16 wrong answers per 100 questions on the trip sample and 19 on the bank tables, on questions written to need them. I price the smaller gain, from the trip sample, with declared assumptions:

That is about 32 fewer wrong answers a week, about 420 in a quarter. In this base case, on assumed inputs, the rollout pays for itself within a quarter if one wrong answer costs more than about US$28, roughly 23 minutes of someone's time to notice it and redo the work.

Break-even cost of one wrong answer, US$, with one assumed input moved and the others at the base case

Assumed inputLowerMiddleHigher
Questions a week50: US$114200 (base case): US$281,000: US$6
Share of the measured gain real questions keep25%: US$11450%: US$57100% (base case): US$28
Rollout, engineer-weeks2: US$144 (base case): US$288: US$57

Across all 27 combinations the break-even runs from about US$3 to US$911, so the inputs matter more than the measured gain. Before ranking this ahead of a bigger model, I would measure two of them on real traffic: how many questions arrive, and how many of them need a definition.

Where AI fits

A query that fails is easy to catch. The dangerous AI error is a plausible number with no error attached. My method for any AI answer: ask the AI questions I already know the answers to, compare its answers with mine the way a trial compares a treatment with a control group, and then build what I learn into hard checks and rules the models must follow.

This study is that method end to end, as a self-test. I wrote the 100 questions and their right answers alongside the definitions, and checked each answer against a separate calculation; the names-only arm is the control. The documentation and the metric layer are the rules the models follow. The hard checks are a strict answer format and a sandbox where every query runs without network or credentials on a read-only copy of the data. The provider enforces the format, so "none of the 2,880 new answers was malformed" is true by construction: it shows the setting worked, not anything about the answers. In production the loop keeps turning: every wrong answer found becomes a known answer for the next test.

It pairs with the agent-ready data marts study, which goes deeper on the bank tables alone: the same 40 questions with three models, including Claude Opus 5.5, and why the wrong answers failed, such as guessed category values that do not exist. The trip questions come from the semantic layer study. This study reuses both question sets byte for byte and runs them together, with a fourth model, three runs each and multi-step tasks, so the result does not rest on one dataset or one model. The AI adoption measurement study covers what comes after accuracy: whether people use the assistant and come back to it.

A follow-up round asks what happens when the assistant reads business data through an API connector that pages, rate-limits, times out and fails part-way: AI answers through connectors that fail like real APIs. Another round tests the writing side, where the warehouse pushes fields such as account health back into the CRM that people and assistants read: Warehouse syncs that keep a CRM matching the warehouse. A third breaks the whole loop on purpose, from loading to write-back, and asks which pipeline checks stop it in time: Blocking checks on a warehouse that writes back to its CRM. A fourth asks this page's question of public regulatory documents, with answers keyed from the documents themselves: Questions about public drug labels, with and without the label text. A fifth asks what a model may see, whether access enforced on every path keeps figures in, and whether a cited source or a log shows it when they get out: Who may see what: AI answers under row-level access. A sixth asks what models do when a request can be computed two ways, in paired tests from an independent author: What models do when a request leaves a calculation open; its first step re-reads this study's wrong answers: Which wrong answers match another reading. Another round re-runs this study's recorded SQL on synthetic copies of the trip table, to count the wrong answers a high-scoring copy lets through: How many wrong AI answers a high-scoring synthetic test set waves through.

Method and checks

One test setup, two datasets

Bank tables: four synthetic source tables and two daily marts, 40 questions (36 analytical, 4 that need a clarification), gold answers checked against an independent calculation from the source events, scored exactly in whole cents. Trip sample: 10,000 public Chicago trips from January 2024 with dbt marts and a MetricFlow metric layer, 60 questions (55 analytical, 5 clarification, 20 per tier), gold answers checked against expected rows stored with a small fixture dataset, numbers compared with a tolerance of one millionth.

Both question sets, their gold answers and the prompts are byte-for-byte copies from two earlier studies: the agent-ready data marts study for the bank tables and the semantic layer study for the trip sample. In both, I wrote the questions alongside the definitions they test.

What each arm receives
  • Names only: table and column names and types.
  • Names plus allowed values: the same, plus the distinct values of every text column that is not an identifier.
  • Full documentation: definitions, grain, the posting date rule, allowed values and safe joins.
  • SQL on the tables: the trip schema; the model writes SQL.
  • Metric layer: the metric contract; the model picks metrics, dimensions and filters and MetricFlow writes the SQL.

Every answer runs in a sandbox with no network, no credentials and a read-only copy of the data. The SQL rules are the earlier studies' rules, with EXISTS allowed as a condition, a correction declared in the bank study.

Strict output and how format failures are counted

Each request carries a strict JSON schema with one key, answer, holding one of the shapes the prompt documents. Scoring removes that wrapper and applies each earlier study's rules unchanged. A format failure is an answer that does not parse, does not match the schema, was refused or was cut off at the output ceiling; it counts as wrong. A second scoring, declared before it was run (evals/sensitivity-declaration.json), leaves the cut-off and refused answers out instead; the key figures use it.

Multi-step tasks

16 tasks, 8 per dataset, written and checked before any model saw them: each gold answer comes from SQL in the sandbox and equals a separate plain Python calculation from the source files, and every ranking step has a single winner. The model may run four queries and sees up to 50 result rows each. Final answers are literal rows: text and whole numbers must match exactly, numbers the task asks to round to 2 decimals within 0.005.

Run settings
  • 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.
Written down before the runs

Models, prompts, arms, scoring and analysis were written down before any paid request, and nothing was tuned on test results. One declared change followed, touching no result: Gemini 3.8 Flash ran at its fallback thinking level, low. The two sensitivity analyses came after the runs and were written down before they were run.

Other limits

Clarification is scored by a coarse rubric. Costs are list-price estimates from token counts. The trip schema is public, so the models may have seen it in training; the bank tables are new. A next round would use questions written without sight of the definitions or sampled from real requests, harder items that leave room above the best model, and the cut-off answers re-run with a higher output limit.

More results: question tiers, format failures, clarifications, repeat stability and spend

Trip sample by question tier

The trip sample has 20 questions per tier. In the earlier run, one model wrote its metric requests as free JSON and 7 of its 55 analytical answers carried a malformed filter key, all on tier 1, so the metric layer looked worse on the simplest questions and better on joins. With a strict answer schema, no metric request was malformed.

Once the answer format was enforced, the metric layer stopped losing on simple questions: for the same model, tier 1 went from −30.0 to −1.7 points; across four models it is +12.9.

Metric layer minus SQL on the tables, percentage points (pp). Points left of zero mean SQL on the tables did better.

Show the data

Metric layer minus SQL on the tables, trip sample analytical questions

Question tierEarlier run: SQL and metric layer correctEarlier run, ppStrict output, ppInterval, ppClusters
Tier 1: totals and single filters19 and 13 of 20−30.0+12.9+11.7 to +14.22
Tier 2: by date and by group17 and 19 of 20+10.0+20.4+13.8 to +37.111
Tier 3: joins to area names, harder9 and 14 of 15+33.3+18.3+4.4 to +33.315
All 55 analytical questions45 and 46 of 55+1.8+17.1+12.3 to +25.028

Source: this study's scored runs and the earlier free-format run, trip sample.

Metric layer minus SQL on the tables by model, pp, with the interval below each figure

ModelTier 1Tier 2Tier 3All analytical
Claude Haiku 5.5+26.7+26.7 to +26.7+45.0+25.3 to +90.9+35.6+13.3 to +60.0+35.8+26.1 to +52.3
GPT-4.1 mini−1.7−3.3 to 0.0+6.7−12.1 to +36.4+15.6−17.8 to +46.7+6.1−4.8 to +22.5
Gemini 3.8 Flash+13.3+13.3 to +13.3+15.00.0 to +27.3+13.30.0 to +33.3+13.9+7.1 to +21.2
Claude Sonnet 5.5+13.3+10.0 to +16.7+15.00.0 to +36.4+8.90.0 to +24.4+12.7+6.5 to +20.7

Tier 1 holds only two question templates, so its interval is narrow by construction and says little; read its counts instead. For GPT-4.1 mini the tier 1 difference is −1.7 points with an interval of −3.3 to 0.0, which reaches zero: for that model the strict format closed the gap rather than reversing it.

Format failures

With a strict answer schema, none of the 2,880 new answers was malformed. The remaining failures are 23 Gemini answers cut off at the output ceiling and 1 request the provider refused. The charts and tables count both as wrong, as planned; the key figures and the left-out table leave them out (results/sensitivity.json).

Answers that could not be scored as answers

RunAnswersFormat failuresWhat happened
Earlier run, free JSON (GPT-4.1 mini, one run)24097 malformed metric requests; 1 malformed clarification label; 1 request failed at the provider
Claude Haiku 5.5, strict output7200none
GPT-4.1 mini, strict output72011 request refused by the provider with HTTP 403
Gemini 3.8 Flash, strict output7202323 answers cut off at the 1,024-token output ceiling (thinking tokens count toward it)
Claude Sonnet 5.5, strict output7200none

Clarifications, repeat stability and spend

Nine questions have no single right number (for example a risk threshold nobody defined). They are scored apart from accuracy: the answer counts when the model asks for the missing definition.

Clarification questions answered by asking, mean of three runs

ModelBank: namesBank: valuesBank: documentationTrips: SQLTrips: metric layer
Claude Haiku 5.53.0 of 41.0 of 43.0 of 45.0 of 55.0 of 5
GPT-4.1 mini1.0 of 41.0 of 41.3 of 42.0 of 54.0 of 5
Gemini 3.8 Flash4.0 of 43.7 of 44.0 of 45.0 of 55.0 of 5
Claude Sonnet 5.53.0 of 42.0 of 43.0 of 45.0 of 54.0 of 5

Questions and arms with the same verdict in all three runs

ModelSame every run
Claude Haiku 5.5232 of 240
GPT-4.1 mini225 of 240
Gemini 3.8 Flash221 of 240
Claude Sonnet 5.5238 of 240

Cost at list prices, per model and per 100 correct answers

ModelRequestsSpendCorrect answersSpend per 100 correct
Claude Haiku 5.5976US$0.30683US$0.04
GPT-4.1 mini982US$0.60686US$0.09
Gemini 3.8 Flash1,006US$1.70718US$0.24
Claude Sonnet 5.5990US$6.11750US$0.81
Displayed numbers

Whole percentages and points in the reading text; percentages and percentage points to one decimal in the tables, rounded half away from zero, with a true minus sign. Exact values are in each chart's data table and in the summary file.

Use this at your company

Copy this prompt into your own AI assistant to run the same test on your company's data.

This method comes from Diogo Travassos's study "AI answers over company data" (https://diogotravassos.dev/ai-answers-over-company-data/). If you can open links, read it first: it works the method through end to end, with its checks. The steps below stand on their own if you can't.

Test whether an AI assistant can answer business questions from our data correctly, and what it needs first.

Method:
1. Help me write 30 to 60 questions people really ask about our data, from simple totals to ones that combine filters, dates and groups, plus a few that only make sense after asking what they mean.
2. I will work out each right answer with a separate calculation and keep it from you until scoring.
3. Answer every question three ways: with only table and column names; with names plus the allowed values of each text column; with written definitions (what each metric means, what one row is, which date counts, which joins are safe).
4. Repeat each setup at least three times.

Data you need: the tables behind those questions (for example orders, customers or events), their column names and types, and any metric definitions we already have.

Checks before we trust any answer:
- Run every query on a read-only copy with no network access.
- Use one fixed answer format; anything that does not fit or is cut off counts as wrong.
- Score against my answers exactly, with a stated tolerance for decimals.
- On the unclear questions, a request to clarify counts as right.

Report back: the share correct in each setup and its spread across repeats, the questions every setup missed and why, which wrong answers looked believable, and the limits: how few questions and repeats, and whether the tables are public.

In your report, say which study you followed and link it: https://diogotravassos.dev/ai-answers-over-company-data/

Data notice

Data attribution and required notice

Source: City of Chicago, Transportation Network Providers Trips (2023-2024), dataset n26f-ihde;
and Boundaries Community Areas, dataset igwz-8jzy.
Reuse is subject to the City of Chicago Data Terms of Use:
https://www.chicago.gov/city/en/narr/foia/data_disclaimer.html

This site provides applications using data that has been modified for use from its original source, www.cityofchicago.org, the official website of the City of Chicago. The City of Chicago makes no claims as to the content, accuracy, timeliness, or completeness of any of the data provided at this site. The data provided at this site is subject to change at any time. It is understood that the data provided at this site is being used at one’s own risk.

Area 0 is a derived label for outside-Chicago or unavailable area codes.
No City endorsement is implied.