Grounding at the Leaves: Reusable Concept Views for Text-to-SQL Under Vocabulary Mismatch

When people ask a database a question, they use their own words ("worst-performing managers", "churned customers"), and the database uses its own ("emp_rank_q", "status_cd = 7"). Most current systems try to bridge this gap and compose the query in one step. A large language model reads the whole question and the whole schema, then emits SQL. When it fails, it usually fails because it picked the wrong columns or values. Schema-linking errors account for 29% to 49% of Text-to-SQL failures (A Survey on Employing Large Language Models for Text-to-SQL Tasks), and even a tree-structured decomposition method attributes 70% of its remaining errors to inconsistent schema naming (Semantic Decomposition of Question and SQL for Text-to-SQL Parsing).

We propose to separate these two jobs. The question is first broken into a tree of logical operations (join, filter, aggregate, negate, union) that stays entirely in the user's own words. Only the leaves of that tree, each a single user concept such as "manager" or "worst-performing", are then mapped onto the schema. Each leaf mapping is restricted to a conjunctive query: a plain select-project-join query with no negation, union, or aggregation. We call such a leaf mapping a concept view. Two benefits follow from the restriction. Candidate views can be compared by checking whether one query's answers always contain the other's, which is decidable for conjunctive queries, and they can also be executed against the data. Because the same concepts recur across many questions on the same database, verified views are cached and reused, so the system gradually builds a small learned ontology per database.

Core Claim

The claim is that vocabulary mismatch in database question answering is mostly a local, leaf-level problem that recurs across questions. Handling it locally, with a restricted query language at the leaves and full expressivity only at internal nodes, should beat whole-question schema linking. The advantage should be largest when no external hint text is available.

This borrows the architecture of ontology-based data access, where a user-facing vocabulary is linked to stored tables through mappings. The difference is that here a language model proposes the mappings, and execution plus containment checks verify them. Nobody writes them by hand.

The restriction of leaves to conjunctive queries is the key design choice, and it comes from the expressivity literature. Completeness of Queries over Incomplete Databases shows that reasoning about whether an answer is complete reduces cleanly to query containment for conjunctive queries, and that the guarantees are lost once negation or union enter. We therefore keep negation, disjunction and aggregation strictly above the leaves. There they operate on already-grounded sets and are never themselves the object of vocabulary mapping. The same literature constrains the design in a second way. Disjunctive or covering constraints can make rewritings explode to double-exponential size and push evaluation to coNP (A data complexity and rewritability tetrachotomy of ontology-mediated queries with a covering axiom). We therefore do not attempt ontology-level disjunctive reasoning at all. A leaf is one conjunctive view, and alternatives are resolved by evidence rather than carried as logical disjunction.

Relation to Prior Work

Two lines of work each supply half the idea.

The decomposition line breaks questions into structured plans but grounds them in schema vocabulary from the start. Semantic Decomposition of Question and SQL for Text-to-SQL Parsing builds trees of physical operators (Scan, Filter, Join, Aggregate), so its leaves are already table names and messy schemas break it. Beyond Chains decomposes knowledge-base questions into chain or parallel triples over Freebase, where relation names are comparatively clean. MAC-SQL and DEA-SQL split generation into pipeline stages, but they decompose the workflow, not the question's logical structure. None of these keeps the tree in user vocabulary, and none makes grounding a separate, checkable, reusable step.

The schema-linking line attacks the gap directly but for the whole question at once. RSL-SQL combines forward selection with backward parsing of a draft query and self-correction. SQL-to-Schema extracts a concise schema from a draft and regenerates. Both fail when the draft is structurally wrong, because the structure and the grounding are produced together.

The retrieval literature motivates two further constraints.

  • No rewriting of the question. ECLASS-Augmented Semantic Product Search finds that rewriting the question text with a language model to match catalog terminology hurt retrieval, because the rewriter dropped constraints. The same paper finds that a hierarchical taxonomy was what bridged technical jargon. Accordingly, our system never rewrites the question. It enforces a span-coverage check: every content span of the question must be assigned to a leaf or an operator.
  • Cheap reranker feedback. RaFe shows that cheap reranker signals can stand in for expensive language-model judgments. This supports scoring candidate views with lightweight execution-based signals rather than repeated model calls.

Research Program

The system has three components.

  1. Decomposer. It maps a question to a logical tree over user-vocabulary predicates, with verbatim question spans at the leaves. Internal nodes come from a fixed operator set: join on a shared variable, filter, aggregate, top-k, difference for negation, union, and a bounded recursive-closure operator for hierarchy questions.
  2. Leaf grounder. For each leaf, it proposes a handful of candidate conjunctive views over the schema. The candidates are informed by column names, sampled values and column descriptions. It then prunes them in three ways:
  3. it tests pairwise containment to collapse equivalent candidates and detect strictly more general ones;
  4. it executes each candidate and discards those with empty or degenerate results;
  5. it scores the survivors by how well their returned values match the span.
  6. View cache. It stores accepted views per database, keyed by normalized concept phrase. A cached view is only reused when containment and value checks re-confirm it on the new question's context.

The final SQL is obtained by substituting each leaf's view into the tree and compiling the tree to common table expressions.

The analysis side asks where errors live. For a sample of failures on BIRD and Spider-Realistic, we will annotate whether each error is structural (a wrong tree) or grounding (a wrong view at a leaf). If the core claim is right, the proposed system should shift the error mass from grounding to structure relative to RSL-SQL, and cache hits should grow with the number of questions seen per database.

Baselines

Naive reference points. The first is a single-prompt model given the full schema. MAC-SQL reports vanilla GPT-4 at 46.35% execution accuracy on the BIRD development set. Can LLM Already Serve as A Database Interface? reports GPT-4 at 54.89% with BIRD's external-knowledge hints and 34.88% without them. That twenty-point gap measures how much vocabulary bridging the hints are doing, and it is the headroom this proposal targets. We rerun the single-prompt baseline with our own backbone in both settings.

Strongest existing method. This is RSL-SQL, which reports 67.21% execution accuracy on the BIRD development set with GPT-4o (RSL-SQL) and 87.9% on Spider. It is the right competitor because it is the most developed whole-question schema linker in the file, and our claim is precisely that leaf-level linking beats whole-question linking.

For a fair comparison, we run RSL-SQL's released pipeline and our system on the same backbone model, with the same schema access (names, descriptions, sampled values). We match the budget of model calls and tokens per question, so that the extra steps of decomposition do not buy an unfair search advantage. No reported result was found on Lacuna for RSL-SQL without BIRD hints, so we produce that number ourselves.

Beating RSL-SQL means two things. In the no-hint BIRD setting, we need a gain larger than three times the seed-to-seed standard deviation. In the hint setting, we need at least parity. On Spider-Realistic, the strongest reported figure is DEA-SQL at 81.5% (DEA-SQL), and we rerun it under the same budget.

Decomposition over schema vocabulary. A QPL-style tree whose leaves are grounded as they are generated, rather than kept in user vocabulary, isolates the core ingredient. Semantic Decomposition reports 83.8% on the Spider development set for its fine-tuned model, and we reimplement this in prompting form with our backbone.

Component ablations. Three further ablations each remove one component:

  • containment and execution pruning, so the model picks the view directly;
  • the cache;
  • the span-coverage check.

Why not just…?

Why not just give the model the external hints, as BIRD does? Hints are written by annotators per question and are not available in deployment. The drop from 54.89% to 34.88% without them (Can LLM Already Serve as A Database Interface?) shows that current systems depend on them heavily. Our cache is an attempt to produce hint-like knowledge automatically. We report both settings. We would treat a result where our system helps only when hints are absent as consistent with the claim, not as a failure.

Why not just use a stronger whole-question linker such as RSL-SQL with a bigger model? This is the real threat. Stronger models may already ground concepts implicitly. The same-backbone comparison and the error-attribution study settle it. If RSL-SQL's residual errors are mostly structural rather than grounding errors, leaf-level grounding has little to fix, and we would report that the gap is not where the survey figures suggest.

Why not just retrieve relevant columns with a dense retriever over column descriptions? Retrieval of this kind can surface the right columns. It cannot express concepts that require a join or a value condition, such as "worst-performing" as a rank over a computed metric. The ECLASS results show that pure text retrieval is weak on jargon: BM25 reaches 31.4% Hit_Rate@5 on expert queries, against 94.3% with taxonomy augmentation. We include dense column retrieval as the candidate generator inside our grounder and also as a standalone linker feeding single-prompt generation, which measures directly what the tree and the view checks add.

Why not just rewrite the question into schema terms first? The ECLASS study found that such rewriting degraded retrieval by dropping constraints. We run a rewrite-then-generate baseline under the same budget and measure constraint loss with the same span-coverage check, applied post hoc.

Proposed Experiments

Benchmarks. - The main evaluation is BIRD (development set), run with and without hints, reporting execution accuracy and Valid Efficiency Score. The efficiency score matters here, since compiled trees of common table expressions could be slower than human SQL, which BIRD reports runs over 75% faster than naive parser output. - Spider-Realistic tests paraphrased column mentions. - Dr.Spider tests schema and question perturbations. No reported result was found on Lacuna for any system there, so all its numbers come from our reruns. - Spider (development set) serves as a clean-schema control, where we expect little gain. - Spider 2.0, where the best systems reach about 31% according to the survey, is a stretch test of whether per-database caching scales to enterprise schemas.

Decisive checks. - Where the gain comes from. The ablation that keeps the tree but grounds in schema vocabulary should lose most of the gain on no-hint BIRD. If it does not, the tree alone, not leaf-level grounding, is doing the work. - Error mass. Annotated failures should show fewer grounding errors than RSL-SQL at equal token budget. - Cache reuse. Accuracy on later questions within a database should rise as the cache fills. We test this with a shuffled-order control, and with a strict condition in which the cache is populated only from the system's own unverified outputs, never gold SQL. - Value of the restricted leaf language. Allowing leaves to contain negation or aggregation should increase grounding errors, because containment checks no longer apply. That would confirm that the restriction earns its place, rather than serving as a formal decoration.