Roz Intelligencia
← Research

Project 01 · Data model

Published

How much does each data layer improve an AI analyst?

Question
If an AI analyst can only see certain layers of the data model, how correct and how consistent are its answers?
Result
Across all 25 questions, accuracy rose from 47% on source tables to 76% with metrics and a business glossary (gpt-4.1), and from 77% to 100% with a stronger model. The late gain comes from business rules, not data access.

dbt · Snowflake · MetricFlow · OpenAI

View on GitHub ↗

Why this question

Most analytics teams believe a well-layered dbt project (staging, intermediate, core, marts, then metrics) makes numbers more consistent. The same structure should help an AI analyst that reads the warehouse.

What is usually missing is the size of the effect. How much does each added layer actually buy? Without a number, it is hard to decide whether the next week of modelling is worth it.

The setup

  • Data: one frozen snapshot of a public food-delivery dataset, modelled in dbt.
  • Questions: 25 business questions of the kind analysts get every week: order counts, GMV, cancellation rates, delivery times, segmentation, a decomposition and a correlation. Formula hints were removed, so “what was the cancellation rate?” does not explain how to calculate it.
  • Six arms. Each one keeps the access of the previous arm and adds one thing:
ArmWhat the AI can query
ASource and staging tables
B+ intermediate models (clean joins, business logic)
C+ core facts and dimensions
D+ aggregate marts
E+ 19 MetricFlow semantic metrics
F+ a written business glossary
  • Runs: every question in every arm, three times, per model: 450 attempts each for gpt-4.1 (temperature 0) and gpt-6-luna (high reasoning effort), 900 in total. The AI had no reference answers, read-only access, and a budget of three queries per question.
  • Scoring: a final answer counts only if every requested number, scope and unit matches a frozen reference within a stated tolerance.

Results

All 25 questions (mean correct, 3 runs)

Armgpt-4.1gpt-6-luna
A · source11.7 (47%)19.3 (77%)
B · + intermediate15.7 (63%)21.0 (84%)
C · + core16.3 (65%)21.7 (87%)
D · + marts16.3 (65%)21.7 (87%)
E · + metrics17.3 (69%)22.0 (88%)
F · + glossary19.0 (76%)25.0 (100%)

Three of these 25 questions (Q22 to Q24) depend on business rules that exist nowhere in the data, such as which markets count as “standard”. Only arm F was given those rules, so arms A to E score 0 on them by design. That is why the last step looks so large. Here is the same result split in two, so you can see which part comes from the data layers and which from written-down rules.

22 data questions

Armgpt-4.1gpt-6-luna
A · source11.7 (53%)19.3 (88%)
B · + intermediate15.7 (71%)21.0 (95%)
C · + core16.3 (74%)21.7 (98%)
D · + marts16.3 (74%)21.7 (98%)
E · + metrics17.3 (79%)22.0 (100%)
F · + glossary16.0 (73%)22.0 (100%)
Share of data questions answered correctly, by data access
  • gpt-4.1
  • gpt-6-luna
40% 50% 60% 70% 80% 90% 100% ABCDEF gpt-4.1, A: 53% gpt-4.1, B: 71% gpt-4.1, C: 74% gpt-4.1, D: 74% gpt-4.1, E: 79% gpt-4.1, F: 73% gpt-4.1 gpt-6-luna, A: 88% gpt-6-luna, B: 95% gpt-6-luna, C: 98% gpt-6-luna, D: 98% gpt-6-luna, E: 100% gpt-6-luna, F: 100% gpt-6-luna

22 data questions, mean of 3 runs. A source, B + intermediate, C + core, D + marts, E + metrics, F + glossary. The vertical axis starts at 40%.

What each added layer changed, in percentage points
  • gpt-4.1
  • gpt-6-luna
-10.0 0.0 +10.0 +20.0 B + Intermediate gpt-4.1, B + Intermediate: +18.2 +18.2 gpt-6-luna, B + Intermediate: +7.6 +7.6 C + Core gpt-4.1, C + Core: +3.0 +3.0 gpt-6-luna, C + Core: +3.0 +3.0 D + Marts gpt-4.1, D + Marts: 0.0 0.0 gpt-6-luna, D + Marts: 0.0 0.0 E + Metrics gpt-4.1, E + Metrics: +4.5 +4.5 gpt-6-luna, E + Metrics: +1.5 +1.5 F + Glossary gpt-4.1, F + Glossary: -6.1 -6.1 gpt-6-luna, F + Glossary: 0.0 0.0

Change in accuracy versus the previous arm, on the 22 data questions. The glossary's real effect, 3 of 3 on the business-rule questions, is not in this chart.

3 business-rule questions

Arms A to E: 0 of 3 with both models. Arm F, with the glossary: 3 of 3, in every run.

What it shows

1. The intermediate layer earned the most. With gpt-4.1, going from raw tables to clean intermediate models added four correct answers out of 22, the largest single step. Proper joins, consistent grain and business logic in SQL closed most of the gap on questions that cross entities.

2. Marts added nothing here. Arms C and D are tied. The agent was already joining core models correctly, so pre-aggregated tables were a shortcut it didn’t need.

3. A metrics layer helps, and adds variance. Arm E was the best on data questions with gpt-4.1, but also the least stable (±1.15 versus ±0.58). In one run, two MetricFlow queries failed and the agent had to fall back to SQL. A semantic layer is only as useful as it is dependable.

4. Rules have to be written down. Without the glossary, every arm gave plausible but wrong answers to the three business-rule questions, and gpt-6-luna usually asked for the missing rule instead of guessing. That is not a data-access problem. It is a definition-access problem, which is what a context layer is for. Arm F answered all three, in every run.

5. A stronger model raises the floor, not the order. gpt-6-luna scored higher in every arm, and mostly fixed three precision questions (a percentage change, a share with a three-way denominator, a GMV decomposition) that gpt-4.1 got wrong in every arm. Those were arithmetic failures, not grounding failures. But the layers still mattered: even the stronger model moved from 88% on source tables to 100% with a metrics layer, and its results were far more repeatable (only 6 of 150 arm-question cells varied between runs, most of them in arm A, where two GMV fields made it sometimes ask which one to use).

What each correct answer costs

Accuracy is only half of the decision, so I also measured effort. For each arm I divide everything spent on its attempts (wall-clock time, and token cost at list prices) by the number of correct answers it produced. An arm that is cheap per attempt but often wrong looks expensive here, which is the point.

Average time per correct answer, in seconds
  • gpt-4.1
  • gpt-6-luna
0.0 10.0 20.0 30.0 40.0 50.0 A Source gpt-4.1, A Source: 9.2 9.2 gpt-6-luna, A Source: 14.5 14.5 B + Intermediate gpt-4.1, B + Intermediate: 17.2 17.2 gpt-6-luna, B + Intermediate: 40.9 40.9 C + Core gpt-4.1, C + Core: 6.6 6.6 gpt-6-luna, C + Core: 16.7 16.7 D + Marts gpt-4.1, D + Marts: 6.4 6.4 gpt-6-luna, D + Marts: 15.4 15.4 E + Metrics gpt-4.1, E + Metrics: 19.4 19.4 gpt-6-luna, E + Metrics: 11.2 11.2 F + Glossary gpt-4.1, F + Glossary: 23.0 23.0 gpt-6-luna, F + Glossary: 14.9 14.9

Total attempt time divided by correct answers, 22 data questions, 3 runs. Time includes model latency and the warehouse queries, so it moves with API load.

Average cost per correct answer, in US cents
  • gpt-4.1
  • gpt-6-luna
0.00 1.00 2.00 3.00 4.00 A Source gpt-4.1, A Source: 2.35 2.35 gpt-6-luna, A Source: 0.09 0.09 B + Intermediate gpt-4.1, B + Intermediate: 2.07 2.07 gpt-6-luna, B + Intermediate: 0.10 0.10 C + Core gpt-4.1, C + Core: 2.01 2.01 gpt-6-luna, C + Core: 0.10 0.10 D + Marts gpt-4.1, D + Marts: 2.34 2.34 gpt-6-luna, D + Marts: 0.11 0.11 E + Metrics gpt-4.1, E + Metrics: 2.69 2.69 gpt-6-luna, E + Metrics: 0.11 0.11 F + Glossary gpt-4.1, F + Glossary: 3.40 3.40 gpt-6-luna, F + Glossary: 0.13 0.13

Token cost at list prices (gpt-4.1 $2 in / $8 out per 1M tokens; gpt-6-luna $0.10 in / $0.50 out), uncached input, divided by correct answers.

Layers cost tokens. Every added layer puts more schema in the prompt, so input grows from arm to arm: about 267k tokens for arm A to 689k for arm F with gpt-4.1. The extra cost is small per question, but it is real.

Cheaper does not mean faster. gpt-6-luna is far cheaper per correct answer, but it thinks longer: its median attempt takes about 9 to 26 seconds versus 4 to 10 for gpt-4.1. Intermediate models (arm B) were the slowest for it in all three runs, and I don’t know why.

The cheapest arm per correct answer is not the most accurate one. With gpt-4.1, arm C costs the least per correct answer, while the metrics arm E, the most accurate, costs about a third more.

Limits

  • One dataset, one warehouse, two models. This shows mechanisms, not how a given model will perform on your data.
  • Timing depends on API load when each run happened, and cost uses list prices without caching, so real bills would be lower. Both are for comparing arms, not for budgeting.
  • Three runs per cell is enough to see instability, not to put tight error bars on it.
  • The scoring tolerances were widened after the first run, without changing questions, prompts or saved attempts, and are documented in the design notes. The numbers above use the final rubric.
  • The glossary rules are rules I wrote for this snapshot. They are not Zomato’s real policies.
  • Arm F scored lower than arm E on data questions for gpt-4.1. I read it as noise at this sample size, not as evidence that a glossary hurts, but I can’t rule out an effect.

Read more and reproduce

Everything is in the open repository: the experiment design, the 25 questions, the reference answers, the plain-language write-up, and per-question audits. The detailed run reports are written in Indonesian.