Resources · Evergreen guide
Text-to-SQL accuracy is a meaning problem. Not a syntax problem.
A generated query can run perfectly and still compute the wrong thing. Text-to-SQL accuracy fails where the business interpretation is chosen silently, executed without a review point, and never recorded as reusable context. This guide explains the failure modes, the evaluation checks that catch them, and the role of a visible plan.
What does text-to-SQL accuracy mean?
Text-to-SQL gives a wrong answer when the generated query implements a business interpretation the asker did not intend, or when an ambiguous question is resolved silently. The query can be valid, fast, and well-formed while the number is wrong for the decision. The fix is not a better model; it is an inspectable representation of the intended analysis between the question and the query.
Written and reviewed by Spotonix · Last reviewed October 8, 2026
Four failure modes behind text-to-SQL inaccuracy.
Each mode removes a different piece of invisible expert work. Together they explain why accuracy scores miss the failure that matters.
A valid query with the wrong meaning
The SQL runs and returns a number, but it computes a definition nobody intended: which measure, which population, which period, which filter. Syntactic correctness says nothing about semantic agreement.
Silent choice of one reading
When a question is ambiguous, a generator picks the most plausible reading without surfacing the choice. The reader has no way to know a decision was made, or that another reading would change the answer.
No review point before execution
In a generate-and-run flow the query executes in the same step that produces it. There is no inspectable representation between the question and the SQL for an accountable person to correct.
Context that is not reusable
A model may use company metadata or a prior query, but unless the interpretation is recorded as reusable context, the next question repeats the same ambiguity instead of compounding what the team already resolved.
Worked example
One valid query can encode four wrong choices.
This example makes the accuracy test concrete. The system is not ready to generate SQL until the material choices are visible.
Question
Which customers grew this quarter?
Unresolved meaning
Customer, growth measure, comparison period, and reporting grain are unspecified.
Reviewable plan
Customer = active account; growth = revenue change; compare Q3 with Q2; grain = account.
Accuracy test
Confirm those choices before generating SQL, then trace the result back to the selected definitions.
Illustrative test fixture
The same three accounts give two valid retention answers.
Synthetic data for checking interpretation; these are not customer results or a Spotonix benchmark. Freeze the three-account starting cohort and compare its revenue at the start and end of one period.
| Account | Start revenue | End revenue |
|---|---|---|
| A | 100 | 100 |
| B | 100 | 170 |
| C | 100 | 0 |
Logo retention: 2 accounts with positive end revenue ÷ 3 starting accounts = 66.7%. Net revenue retention: 270 end revenue ÷ 300 start revenue = 90%. Here an account is counted as retained when its end revenue is positive; your company may use another rule.
A query can return either valid number. Ask which retention measure the business question intends, inspect the cohort and treatment of expansion, then compare with that measure’s expected result. Download the synthetic CSV or read about keeping metric definitions explicit.
Four checks that catch wrong answers.
Use these checks on any text-to-SQL path, including the one you use today. They measure meaning, not syntax.
01
Ask what the question means first
Before any query runs, the intended analysis should be visible: metric, population, comparison period, grain, and filters. If meaning is missing and material, the system should ask which definition applies.
02
Inspect the plan before execution
The selected definitions and the analytical plan appear before SQL executes. A reviewer can correct the course while it is still a plan, not after a number has landed.
03
Trace the answer to its sources
The result should carry its evidence: which definitions were selected, which sources fed them, and where the logic came from. Provenance is what makes a wrong answer findable.
04
Reuse what the team already resolved
Once a definition is clarified and accepted, it becomes company context for the next question. The evaluation should measure whether repeated questions compound rather than re-litigate.
The mechanism, the evidence, and the shared vocabulary.
Review workflow
Validation-loop analytics
Put the correction point before the generated query executes.
Mechanism
Intent Algebra
How selected meaning, scope, filters, and grain become a visible analytical plan.
Vocabulary
The glossary
Analytical plan, clarification, selected definitions, and company context, defined once.
Evidence
Two paths, one rubric
Compare the current path and the visible-plan path on the same questions.
Further reading
Oct 14, 2026
What an AI Analytics Answer Trace Should Contain
A query log is not a complete answer trace. Buyers should ask for the question, interpretation, decisions, bindings, SQL, result, and provenance in one reviewable packet.
Oct 7, 2026
What a Reviewable Analysis Plan Must Show
Before SQL runs, a business reviewer should be able to inspect seven parts of the intended analysis—without reverse-engineering the query.
Sep 23, 2026
When an AI Analyst Should Refuse
An AI analyst should not refuse every ambiguous question. It should stop when an unresolved choice would materially change the metric, population, comparison, or decision.
Test the visible-plan path against your current path.
Bring representative questions, the definitions your team owns, and the systems in scope. We will show the plan and clarifications before anything runs, on the same rubric as your current path.
Book DemoSee how it works