---
title: "Evaluating the Text-to-SQL Capabilities of Large Language Models"
description: "How Codex translates questions into SQL, why database context changes accuracy, and what few-shot comparisons and error analysis establish."
canonical: "https://research.elamur.ai/free/en/papers/rajkumar-2022-evaluating-text-sql-capabilities-large/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/rajkumar-2022-evaluating-text-sql-capabilities-large/)

[home](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2022](https://md.research.elamur.ai/free/en/papers/2022/) / Evaluating the Text-to-SQL Capabilities of Large Language Models

# Evaluating the Text-to-SQL Capabilities of Large Language Models

Paper · 2022 · Nitarshan Rajkumar, Raymond Li and Dzmitry Bahdanau

**Authors:** Nitarshan Rajkumar, [Li](https://md.research.elamur.ai/free/en/authors/li/), Raymond and [Dzmitry Bahdanau](https://md.research.elamur.ai/free/en/authors/dzmitry-bahdanau/) · **Year:** 2022 · **Venue:** arXiv (Cornell University) · **Licence:** [CC BY 4.0 (arXiv)](https://creativecommons.org/licenses/by/4.0/)

[**52** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W4226053975) · [arXiv (Cornell University)](https://openalex.org/S4306400194) · [licence](https://creativecommons.org/licenses/by/4.0/)

- [PDF](https://arxiv.org/pdf/2204.00498)
- [arXiv 2204.00498](https://arxiv.org/abs/2204.00498)
- [OpenAlex](https://openalex.org/W4226053975)

Citations: OpenAlex, 2026-10-14.

## Deep dive: Evaluating the Text-to-SQL Capabilities of Large Language Models

How Codex translates questions into SQL, why database context changes accuracy, and what few-shot comparisons and error analysis establish. · about 34 minutes to read

**In this deep dive**

1. [Summary](#dd-summary)
2. [Ideas worth borrowing](#dd-ideas-worth-borrowing)
3. [How Mova uses it](#dd-how-mova-uses-it)
4. [The problem and its context](#dd-the-problem-and-its-context)
5. [The method, step by step](#dd-the-method-step-by-step)
6. [Experiments and results](#dd-experiments-and-results)
7. [What the ablations show](#dd-what-the-ablations-show)
8. [Limitations](#dd-limitations)
9. [What came after](#dd-what-came-after)

### Summary

A natural-language question about a database leaves much unsaid. The system answering it must identify the relevant tables, connect their columns, interpret conditions, and decide what information to return. Producing SQL that runs is only part of the task: the query must also express the intended question. This paper investigates whether a general-purpose system trained on code can already perform that translation without additional training on the target task. Its main subject is Codex, evaluated alongside GPT-3 and established text-to-SQL approaches. The central finding is that a carefully constructed prompt makes Codex a strong baseline, while a small collection of worked examples can adapt it effectively to a particular database.

The strongest reported zero-shot configuration uses davinci-codex with table definitions and sample database rows. On the Spider development set, it reaches 67% execution accuracy and 56.5% test-suite accuracy. Execution accuracy checks whether a generated query produces the expected result; test-suite evaluation examines semantic agreement more broadly, allowing queries with different written forms to be compared. The execution result is close to the 68% reported for BRIDGE v2, an earlier specialized system. This comparison establishes that substantial text-to-SQL capability can be accessed through prompting alone. It does not establish that the resulting system is as reliable as a fully supervised approach across every metric or database.

The prompt is a major part of that result. With davinci-codex, supplying only the question yields 8.3% execution accuracy on Spider development data. Adding a schema in the API Docs format raises the score to 56.8%. Representing the schema through valid SQL table declarations, including column types and foreign keys, gives 59.9%. Combining those declarations with database content reaches 67.0%. More content does not consistently improve the result: the combined format performs best with 3 rows, then deteriorates as additional rows are included. The experiments therefore show the importance of both the information supplied and the form in which it is presented.

The paper also examines what automatic failure means. The authors manually inspect 100 sampled predictions that execute successfully but fail test-suite evaluation. Within that sample, 31% are acceptable translations according to the human annotator, in spite of disagreeing with the benchmark’s expected interpretation. Some return a different identifying column, include useful additional columns, or handle ties differently. Other errors are substantive, including inappropriate grouping and shortcuts based on particular database values or background associations. This distinction matters because query correctness depends partly on the question’s meaning and in part on conventions that the question may leave implicit.

Finally, experiments on GeoQuery and Scholar compare two ways of adapting to a database: placing examples in the prompt and updating a previously trained T5-3B system on those same examples. Codex is stronger in the few-shot conditions discussed by the authors, although the zero-shot ordering differs between the datasets. The broader contribution is an evaluation argument as much as a capability result. A credible text-to-SQL assessment needs to consider prompt design, database content, support-example selection, execution-based metrics, and human interpretation together. A single accuracy figure cannot explain which of those factors made a query succeed or fail.

### Ideas worth borrowing

Treat the input representation as an experimental variable. The paper changes how the same kind of database information reaches the system, rather than assuming that a schema is adequately represented whenever its names appear somewhere in a prompt. Comments, executable table declarations, and sample rows offer different evidence. This is useful whenever a system must act on structured material expressed through text. Before attributing a failure entirely to the underlying predictor, test whether its input makes the available structure legible.

Use native task notation. The Create Table format presents a database through SQL declarations, including types and foreign-key relationships. That representation belongs to the same language as the desired output. The comparison suggests a reusable design principle: when asking for a formal artifact, describe relevant constraints in a formalism the system can also use to produce that artifact. The paper does not isolate every benefit of SQL notation, but it demonstrates why representation deserves deliberate comparison.

Give both sides the same support examples. In the domain-adaptation experiments, Codex receives question–query pairs in context, while the T5 baseline trains on those identical pairs. Holding the examples constant makes the adaptation comparison easier to interpret. Otherwise, a result favoring prompting could reflect a more helpful demonstration set rather than a better use of limited supervision. The same principle applies whenever methods consume scarce labeled data through different mechanisms: equalize the evidence before comparing how it is used.

Select examples for structural coverage. The authors group training examples by SQL template and choose support examples from frequent templates. Questions with the same template can vary in wording and literal values while retaining the same query structure. This makes the example budget meaningful at the level of operations and composition, rather than merely counting differently worded questions. The idea can travel to other structured prediction settings where many examples repeat a small collection of underlying patterns.

Separate executable output from intended output. Valid SQL, execution accuracy, and test-suite accuracy answer different questions. A query can run while answering the wrong question, and queries that look different can still express the same operation. Keeping these distinctions visible prevents syntax success from standing in for semantic success. This is especially useful for systems that generate artifacts with an external interpreter, where surface plausibility can be tested separately from behavior.

Audit disagreements before redesigning the system. The manual analysis distinguishes clear semantic mistakes from reasonable interpretations that violate benchmark conventions. Those groups call for different interventions. Incorrect grouping may require better use of keys; choosing a name rather than an identifier may require an explicit output convention. This approach is valuable beyond SQL because benchmark failures often mix genuine inability, incomplete instructions, and multiple defensible interpretations.

Budget context instead of filling it. Sample rows help in the best combined prompt, but adding more eventually hurts. The paper therefore supports measuring the usefulness of context rather than treating available space as a target to exhaust. In another application, the relevant unit might be examples, document passages, or records. The transferable idea is to test whether each expansion of the input improves the task, while accounting for what information that expansion displaces or obscures.

### How Mova uses it

For Mova, a small transparent language system implemented in Rust, the most useful connection is methodological. The paper offers ways to make a language-to-structure task observable: record the database description, record the question, preserve the generated query, and distinguish several kinds of failure. Nothing in the paper establishes a Mova implementation of these procedures. They are concrete directions Mova could adopt when developing or evaluating a database interface.

A first application would be a transparent schema representation. Mova could keep table names, column names, column types, and foreign-key relationships as explicit information that can be inspected. The paper’s prompt comparisons motivate testing how that information affects interpretation. For a small system, the question would be whether explicit relationships help connect a user’s wording to the appropriate database structure. That would need to be demonstrated through Mova’s own experiments; Codex’s scores cannot establish it.

A second application would be separating stages of success. Mova could distinguish an output that cannot be interpreted as SQL from one that executes but expresses the wrong operation. It could also preserve cases in which its interpretation differs from a reference query because an output convention was left unstated. This would support transparency at the level that matters to a user: what the system understood, what operation it attempted, and why the result was accepted or rejected.

The paper’s ambiguity categories suggest particularly useful explanations. If a question refers to a person but does not specify a return column, an interface could make the choice between a name and an identifier visible. If a superlative permits ties, the interface could expose whether it returns a single item or all tied items. These are proposed interface behaviors, not capabilities established for Mova. Their value is that they turn hidden assumptions into choices that can be inspected and tested.

The few-shot setup also offers an experiment Mova could reproduce conceptually without claiming the same learning mechanism. It could organize examples by query structure and evaluate how a small set of representative question–query pairs affects interpretation. Frequent templates would provide a principled starting point for selecting examples. The important distinction is between the selection procedure, which can be reused, and Codex’s ability to learn from a prompt, which does not automatically transfer to a different language system.

A further use would be a compact failure inventory. Mova could maintain separate records for mistaken grouping, unsupported substitutions of literal values, unwanted output columns, and disagreements about ties. Such an inventory would make development more concrete than a single score. It would show whether a change improves structural interpretation, merely adjusts formatting, or aligns the system with a particular dataset’s conventions.

The paper therefore supplies Mova with evaluation questions instead of a ready-made architecture. Which database facts are explicit? Which examples represent distinct query structures? Does a failed test reveal a semantic mistake or an unstated convention? Does extra context help? Those questions fit a transparent system because their answers can be attached to individual decisions. Any claim that Mova already benefits from them would require implementation evidence and evaluation beyond this study.

### The problem and its context

#### From a question to a database operation

Text-to-SQL is a form of [semantic parsing](https://md.research.elamur.ai/free/en/concepts/semantic-parsing/): translating an utterance into a structured representation of its meaning. Here, that representation is a database query. The user asks in natural language, while the database expects an instruction specifying tables, columns, conditions, and operations.

This creates a gap between how a person describes information and how that information is organized. A question may refer to a concept without naming its column. It may require combining tables without mentioning their linking fields. It may express a comparison or superlative without specifying the SQL structure that should implement it. A successful translation must bridge those gaps while respecting the particular database.

The authors describe this as an important practical problem with substantial research attention. Their investigation begins from a common supervised formulation: provide a question, the database schema, and sometimes database contents, then train a system to generate the corresponding query. The schema describes the database’s organization; its contents provide examples of the values stored within that organization.

That distinction is central to the experiments. A schema can identify a column’s name and type, while sample contents can show what its values look like. Foreign-key declarations can identify relationships between tables. These sources of information are related, but they are not interchangeable. The paper tests several ways of making them available.

#### The supervised starting point

The paper places its experiments against a trend toward adapting pretrained language systems to text-to-SQL. In that approach, broad pretraining supplies a starting point, while task-specific training teaches the system to map questions and schemas to queries. The authors note that larger pretrained systems had brought stronger results within this supervised setting.

Their main T5 comparison follows that pattern. T5 is an encoder–decoder system: it reads an input representation and generates an output sequence. The checkpoints used by the comparison methods begin with pretraining on Common Crawl and then undergo [fine-tuning](https://md.research.elamur.ai/free/en/concepts/fine-tuning/) on Spider. The question and schema determine the conditions for the intended SQL output.

The paper identifies the T5 configuration with 3B parameters, combined with PICARD, as the leading Spider approach at the time of the study. PICARD constrains inference through incremental parsing. Its role is relevant because producing a query is not simply a matter of choosing plausible words; the output must satisfy a formal language. The Codex experiments ask how far unconstrained prompting can go without the same task-specific adaptation.

BRIDGE v2 supplies another point of comparison. The paper describes it as a BERT-based sequence-to-sequence approach and uses its published Spider results. The related work [Bridging Textual and Tabular Data](https://md.research.elamur.ai/free/en/papers/lin-2020-bridging-textual-tabular-data-cross/) therefore represents an established specialized solution against which a prompted general-purpose system can be assessed.

Earlier database-query research also appears in the references, including [Learning to Parse Database Queries Using Inductive Logic Programming](https://md.research.elamur.ai/free/en/papers/zelle-1996-learning-parse-database-queries-using/). The current paper does not reconstruct that earlier method. Its immediate comparison concerns pretrained neural systems, prompt design, and adaptation with limited examples.

#### Why evaluate prompting?

The alternative comes from broader developments in [language models](https://md.research.elamur.ai/free/en/concepts/language-model/). The authors point to evidence that scaling pretraining can produce useful abilities without a new training phase for each task. [Language Models are Few-Shot Learners](https://md.research.elamur.ai/free/en/papers/brown-2020-language-models-few-shot-learners/) motivates the possibility of learning a task from examples placed in the input. [Evaluating Large Language Models Trained on Code](https://md.research.elamur.ai/free/en/papers/chen-2021-evaluating-large-language-models-trained/) motivates investigating systems with additional exposure to programming languages.

Codex joins those ideas in a setting where the desired output is executable code. The paper describes GPT-3 as trained on varied internet material and Codex as receiving further training on GitHub code. Both generate text through next-token prediction. SQL generation therefore tests whether a general sequence-generation capability can be directed toward database semantics through the prompt.

The scientific question is narrower than whether these systems can produce convincing SQL. It is whether their outputs are competitive under established evaluation, how much prompt construction matters, and how they adapt when a small amount of domain-specific supervision becomes available. That combination makes the work an empirical capability study instead of a proposal for a new neural architecture.

#### Generalization across databases and within a domain

[Spider](https://md.research.elamur.ai/free/en/papers/yu-2018-spider-large-scale-human-labeled/) supplies the cross-domain setting. Its role is to evaluate translation when questions must be grounded in different database schemas. The prompt has to carry enough information for the system to work with the database at hand.

GeoQuery and Scholar serve a different purpose. The authors repurpose their question-based splits to examine adaptation to a particular domain. The distinction matters: a system can be reasonably strong across unfamiliar schemas yet still fail to follow the conventions of a specific dataset. Conversely, a few examples can provide local guidance without changing the underlying general capabilities.

The paper cites earlier evidence that Spider-trained systems transfer poorly to other single-database tasks without additional adaptation. Its few-shot study asks whether examples in the prompt offer an effective alternative to updating a smaller supervised system. The support examples are therefore not incidental illustrations. They are the limited domain-specific evidence whose usefulness the experiment compares.

### The method, step by step

The study has connected zero-shot and few-shot components. The zero-shot component varies the generator and prompt on Spider. The few-shot component fixes a small set of domain examples and compares using them as prompt context with using them for additional training. A manual audit then examines a selected class of failed predictions.

Evaluating prompted database-query generation The steps in order.

#### Choose the systems being compared

The API evaluation includes GPT-3 variants named ada, babbage, curie, and davinci. The Codex variants are cushman-codex and davinci-codex. Within each family, the paper treats the names as an ascending size ordering.

The exact parameter counts are not established. The appendix discusses estimates for GPT-3 and guesses about Codex, but explicitly cautions against relying on those guesses. This is important for the method: comparisons between named API offerings are directly observed, whereas conclusions about precise parameter scaling would require information the authors do not possess.

The supervised comparisons use T5-based methods and BRIDGE v2. For the few-shot experiment, the authors construct a particular T5-3B baseline that first learns from Spider and then receives further domain-specific training. The reported Spider validation exact-match accuracy of that starting baseline is 71%.

These comparisons bring together systems with different training histories. The aim is practical: compare what prompting can accomplish against established task-trained approaches. The setup does not make the systems identical except for a single training decision.

#### Construct a question-only prompt

The simplest prompt contains the question as a SQL comment and provides no database description. The paper calls this format Question. It tests what can be done without explicit access to the current schema or sample contents.

This condition is useful because a natural-language question alone does not fully specify the available database. Even when a system can imagine a plausible query, the imagined tables or fields may not match the actual schema. Its performance therefore measures a very different information condition from schema-aware prompting.

The Question format also appears in the authors’ discussion of memorization. If success mainly came from retrieving familiar benchmark question–query pairs, an input closely centered on the question might be expected to reveal that behavior. The weak result becomes part of their argument against a simple memorization account, although it cannot settle the issue on its own.

#### Describe the schema in comments

The API Docs format follows a text-to-SQL example associated with the Codex API documentation. It includes the schema inside comments, using a representation that is not standard SQLite syntax.

This gives the system table and column information without asking it to read executable schema declarations. The comparison with Question therefore tests the value of making the database structure available at all. The comparison with Create Table then tests a richer, SQL-native presentation.

The method does not isolate the effects of notation and additional structural detail. Create Table includes types and foreign-key declarations, so a performance change between these formats can reflect both the form of the description and the information it contains.

#### Show sample rows

The Select X format supplies commented results from a query that retrieves rows from each table. Its general SQL form is:

```
SELECT * FROM T LIMIT X
```

SELECT requests data, the asterisk requests all columns, T denotes the table, and X limits the number of rows retrieved. The returned column headers also communicate the schema. The prompt contains the displayed results rather than relying only on table declarations.

This representation combines structural clues with examples of actual values. A column name may be abbreviated or unfamiliar, while its entries can make its role easier to infer. Values may also help connect wording in a question to the form used in the database.

The sample rows are nonetheless only a partial view. They are not an exhaustive statement of the database’s possible values. That matters when interpreting shortcut errors: a system may use a visible value or a familiar association in a way that does not preserve the condition expressed by the question.

#### Supply executable table definitions

The Create Table format uses SQL commands describing the tables. These declarations include column types and foreign-key relationships.

Types constrain how fields can be interpreted. Foreign keys describe links across tables. Together, they provide information relevant to selecting conditions and assembling joins, although the paper does not separately measure the contribution of every declaration.

The format also places input and output within the same formal language. The database is described through SQL, and the system is asked to continue with a SQL query. The resulting improvement is consistent with that representation being helpful, while remaining a comparison of complete prompt formats rather than a tightly isolated test of syntax alone.

#### Combine definitions and contents

Create Table + Select X includes both the schema declarations and sample rows. It is the most informative zero-shot format considered: the system receives an explicit structural description alongside concrete examples of stored values.

This combined input introduces a practical constraint. Davinci-codex supports a 4096-token prompt window, whereas the other API offerings in the study have 2048-token windows. Only davinci-codex can accommodate the combined format with more than 1 row.

The paper also reports a token-processing difference between GPT-3 and Codex. Whitespace is less efficiently represented for the GPT-3 variants in this setup, preventing them from using Create Table + Select X altogether. Consequently, the full experimental grid is limited by context capacity and representation costs.

This means that the strongest result cannot be interpreted solely as a larger system outperforming a smaller one under identical conditions. A longer window allows a different, more informative prompt. The paper treats that access to context as a possible contributor to the peak performance.

#### Select few-shot support examples

For GeoQuery and Scholar, the authors begin with examples grouped by SQL template. A template represents a shared query structure; examples within it may differ in their natural-language wording and literal values.

The templates are ordered by how frequently they occur in the training data. In an n-shot condition, the support set contains a randomly chosen example from each of the n most frequent templates. Here n denotes the number of demonstrations available for adaptation.

This procedure prioritizes frequent structural patterns while avoiding a support set dominated by repeated instances of the same pattern. It does not claim to be the best possible selection method. It defines a reproducible adaptation setting in which the amount and kind of supervision are reasonably clear.

The connection to [Improving Text-to-SQL Evaluation Methodology](https://md.research.elamur.ai/free/en/papers/dollak-2018-improving-text-sql-evaluation-methodology/) is the use of dataset organization around questions and query structures. The current study repurposes those resources for a limited-example comparison rather than treating the full training set as the only meaningful regime.

#### Adapt through context or training

For Codex, the support question–query pairs are appended to the database description. The target question follows them. This is [few-shot learning](https://md.research.elamur.ai/free/en/concepts/few-shot-learning/) through the input: the examples influence the generated answer without a new parameter-update phase for Codex.

For the baseline, the same support pairs become training data. T5-3B starts from its Spider-trained state and is then fine-tuned on GeoQuery or Scholar. Giving both approaches identical support sets helps focus the comparison on how they use the available evidence.

The baseline learning rate is selected in the 20-shot setting. The candidate values are:

```
[0.1, 0.2, 0.5, 1, 2] · 10⁻⁵
```

The brackets contain the candidate coefficients, the centered dot denotes multiplication, and 10⁻⁵ supplies the common scale. The selection uses validation performance after 300 training steps.

The baseline batch size is 1024, which allows all few-shot examples to be included together in a batch. The experiment therefore compares in-context use of demonstrations against a specific, described fine-tuning procedure, instead of an unspecified adaptation baseline.

#### Respect the prompt budget

The maximum support count differs by dataset and API variant. On GeoQuery, davinci-codex can receive as many as 40 examples, while cushman-codex and the GPT-3 variants can receive up to 10.

Scholar’s longer queries and more elaborate schema leave less room. Davinci-codex fits 10 examples and cushman-codex fits 5. The GPT-3 variants cannot accommodate support examples there.

These limits are part of the experimental condition. A support-count comparison cannot be separated from the space needed to describe the database and its queries. The same nominal window size can permit different amounts of useful supervision in different domains.

#### Generate under fixed decoding settings

The authors use greedy decoding, with temperature 0. The appendix specifies a generation allowance of 200 tokens and stop strings that terminate output at selected comment markers, a blank-line boundary, or a semicolon.

These settings keep generation behavior consistent across the reported API experiments. The study does not combine multiple sampled queries, search over alternative candidates, or introduce a learned verifier as part of its main method.

The API versions are also checked for consistency. The authors verify that each named offering is represented by a single served version in their experiments. This does not make an evolving API permanently reproducible, but it avoids mixing multiple versions under the same label within the study.

#### Evaluate behavior and inspect failures

The Spider evaluation tracks executable SQL, execution accuracy, and test-suite accuracy. The few-shot plots report test-suite accuracy for GeoQuery and Scholar.

The manual analysis focuses on davinci-codex with Create Table + Select 3. The authors sample 100 outputs that are executable but rejected by the test-suite evaluator. An annotator then classifies the disagreements.

That sampling decision concentrates the analysis on semantic interpretation after basic executability has been achieved. It cannot describe every kind of system failure, because invalid SQL and automatically accepted predictions lie outside the selected group.

### Experiments and results

#### What the metrics establish

The paper uses several metrics because query generation has several levels of success. Validity, abbreviated VA, is the percentage of outputs that form executable SQLite queries. It is a necessary operational check, but an executable query may retrieve the wrong data.

Execution accuracy, abbreviated EX, compares query behavior with the expected answer. It moves the evaluation beyond whether the output parses or runs. However, agreement on a particular database state is not the same thing as a complete account of query meaning.

Test-suite accuracy, abbreviated TS, is intended to assess semantic agreement between differently expressed queries. The paper emphasizes this metric because Codex has not been trained to reproduce Spider’s particular SQL style. A system should not lose credit merely for expressing an equivalent operation in another form.

The metrics therefore support different conclusions. A strong VA result would show reliable formation of executable queries. A strong EX result would show answer agreement under the execution evaluation. A strong TS result would provide broader evidence about semantic correctness. The paper’s main findings must retain those distinctions.

#### Prompt design on Spider

The clearest numerical progression concerns davinci-codex on the Spider development set. Its question-only input performs poorly. Adding schema information produces a much stronger result; using SQL declarations improves it further; combining declarations with sampled contents gives the strongest execution score reported.

Davinci-codex prompt formats on Spider development execution accuracy Schema descriptions and sample contents substantially strengthen the question-only baseline.

**The numbers**

| System or setting | execution accuracy % |
| --- | --- |
| Question | 8.3 |
| API Docs | 56.8 |
| Create Table | 59.9 |
| Create Table + Select 3 (this paper) | 67.0 |

This progression is evidence about complete prompt configurations. It shows that access to the database description is central to the task and that the richest successful representation combines several kinds of information.

It should not be read as an isolated measurement of foreign keys, column types, SQL syntax, or sample values individually. The formats change bundles of information. The useful practical result is that the tested bundles differ considerably in effectiveness.

The best configuration also reaches 56.5% test-suite accuracy on Spider development data. Reporting that alongside the execution result is important: the headline execution score does not mean that the same proportion of predictions passes the stronger semantic evaluation.

#### Comparison with an established specialized system

The paper compares its best Codex execution result with BRIDGE v2, which reports 68% execution accuracy on Spider. The authors characterize Codex as competitive with that earlier result.

The comparison has a specific significance. Codex reaches its score without additional text-to-SQL training in this evaluation. BRIDGE v2 is an established specialized approach. The result therefore challenges the assumption that a useful baseline must begin with a new task-specific training procedure.

It does not show that prompting dominates supervised methods. The paper also discusses strong T5 systems and constrained inference with PICARD. Its contribution is to establish prompted code-trained generation as a serious baseline that should be measured, rather than to declare the supervised approach obsolete.

The development-set condition is also essential. The authors do not report Spider held-out test performance. Their numerical claim concerns the development evaluation used in the study.

#### Domain adaptation on GeoQuery

The GeoQuery experiments vary the number of support examples and compare test-suite accuracy. Without target-domain examples, both Codex variants already outperform the Spider-trained T5 baseline.

The authors suggest that matching conventions may partly explain this result. In particular, Codex’s treatment of argmax appears closer to GeoQuery’s convention than to Spider’s. This is an interpretation of the observed behavior, not a controlled demonstration that tie handling alone explains the ordering.

With support examples, davinci-codex remains stronger than T5-3B trained on the same limited data in the conditions discussed. Its window permits up to 40 examples on this dataset. GPT-3 davinci performs poorly by comparison.

The full-data T5 reference helps put that finding in context. Training the baseline on all 549 GeoQuery training examples gives 85.7% test-set test-suite accuracy. That result shows that the baseline can be strong when substantial target-domain supervision is available. The few-shot result concerns its use of a small support set, not a general inability to solve GeoQuery.

The paper’s plots show the limited-example comparisons, but the prose does not supply exact scores for every point. The supported conclusion is the reported ordering and adaptation pattern, instead of a reconstructed numerical curve.

#### Domain adaptation on Scholar

Scholar gives a different zero-shot result. Here, the Spider-trained T5 baseline is stronger than Codex before target-domain demonstrations are supplied.

After examples are added, the ordering changes in the conditions highlighted by the authors. Codex exceeds the T5 baseline in the 5-shot and 10-shot settings. This strengthens the adaptation claim because the improvement is not merely preserving an initial zero-shot advantage.

The support budget is smaller than on GeoQuery. Scholar’s schema and queries consume more of the prompt, leaving room for 10 examples in davinci-codex and 5 in cushman-codex. These constraints make the dataset a useful reminder that few-shot capability depends on the practical cost of representing each example.

With the complete Scholar training set of 499 examples, T5 reaches 87.2% test accuracy under the test-suite evaluation described for these experiments. As on GeoQuery, the full-data result establishes a strong supervised reference while addressing a different supervision regime from the limited-example comparison.

#### What the combined results mean

Across the experiments, the most consistent lesson is that adaptation can occur through context without additional task-specific weight updates. The same support examples can be more useful when shown to Codex than when used to further train the chosen T5 baseline.

That conclusion remains tied to the compared systems and training procedures. Their pretraining, size, and code exposure differ. The experiments establish an effective practical strategy, but they do not identify a universal advantage of prompting over fine-tuning.

The contrasting zero-shot results on GeoQuery and Scholar are especially informative. A single domain would make it easier to confuse general capability with compatibility between a system’s default query style and a dataset’s expectations. Considering both domains reveals that initial performance and capacity to adapt are distinct properties.

### What the ablations show

The paper offers controlled comparisons of prompt formats, sample-row counts, API variants, and support-example conditions. It also provides a targeted manual analysis. These investigations help explain the main results, although they do not isolate every causal factor.

#### Schema access changes the task

The comparison between Question and schema-bearing prompts shows that database context is indispensable to the strong Spider result. This is more than a formatting issue. Without a schema, the generator lacks an explicit description of the structure against which its output will run.

The improvement therefore supports a grounding interpretation: much of the useful behavior depends on connecting the question to information supplied about the current database. It weakens an account in which Codex simply produces familiar SQL from the wording of the question alone.

However, the comparison cannot establish whether each successful query reflects a complete internal understanding of the schema. It measures the output behavior produced by adding that information. The distinction matters because a system can exploit useful structural cues while still making mistakes about joins, grouping, or values.

#### Formal schema descriptions help as a bundle

Create Table improves over API Docs in the reported execution comparison. Its input includes valid SQL declarations, types, and foreign keys.

This suggests that the way schema information is organized matters. A native representation can make relationships and constraints available in a form closely related to the output language. But the experiment changes several things together, so it does not assign a separate effect to each.

For an engineer, the appropriate lesson is to test the complete representation rather than claim that one particular declaration explains the improvement. For a researcher, the comparison identifies useful follow-up questions: whether types help independently, whether foreign keys account for join improvements, and whether notation matters when informational content is held constant. The current paper does not answer those questions.

#### Content has a useful range

The row-count analysis shows different behavior for the content-only and combined formats. With Select X, increasing the number of displayed rows changes performance little. With Create Table + Select X, performance peaks at 3 rows and then declines as the input expands.

The result rules out a simple expectation that more database evidence must always help. Sample values can clarify the schema, but a larger presentation can also make the task harder under the tested conditions.

The paper does not establish the mechanism behind the decline. Context length, attention to distracting values, and interactions with the prompt format would require further experiments to separate. What is demonstrated is the practical pattern: the amount of content is a parameter to evaluate, not an automatic source of improvement.

#### Named size and available context interact

Increasing GPT-3 size brings substantial gains in the reported comparisons. The Codex variants show a smaller separation under matched prompt styles.

The authors report that cushman-codex is generally within 1 percentage point of davinci-codex when their prompt formats match. With Create Table, cushman-codex performs 3 percentage points better.

That pattern motivates the suggestion that davinci-codex’s longer input window may contribute more to its best result than a presumed increase in parameter count. Its strongest prompt can include material unavailable to the smaller-window offerings.

This remains a cautious interpretation. The parameter counts are uncertain, and the variants are not controlled copies differing only in context capacity. The experiment shows that peak capability depends on what can fit in the input, while leaving the precise contribution of internal scale unresolved.

#### Some failures concern conventions

The manual sample contains executable predictions that fail test-suite evaluation. The authors divide the observed behaviors into substantive semantic errors and translations the annotator considers acceptable.

Among the substantive errors, shortcuts substitute information from particular values or background associations where the reference uses the question’s literal wording. This can produce a query that happens to fit a familiar case while failing to preserve the actual condition.

Incorrect GROUP BY behavior is another substantive category. Grouping on a name or title rather than a primary key can combine records that should remain separate. The problem concerns identity in the database, not merely a different written form of the query.

The acceptable-disagreement categories concern output columns and superlative interpretation. Codex may choose a name where the dataset expects an identifier, include useful columns beyond the expected projection, or handle tied extrema differently.

These categories explain why the sampled 31% should not simply be added back to benchmark accuracy. The queries remain semantically different from their references, and the human judgment concerns acceptability under the question’s wording. The finding diagnoses ambiguity in the evaluation target; it does not provide a corrected headline score.

#### Demonstrations can communicate local conventions

The appendix includes selected GeoQuery examples comparing zero-shot and 10-shot behavior. The generated queries move closer to the reference style after demonstrations are supplied, including choices about output columns and argmax.

Those examples support a plausible role for few-shot context: it communicates how a dataset expects a reasonable question to be operationalized. Learning from examples can therefore mean acquiring local conventions as well as learning which operations a question requires.

The authors identify the examples as cherry-picked. They illustrate a mechanism consistent with the broader results, but they do not quantify its frequency. The aggregate support-count experiments establish adaptation performance; the selected examples help explain what some of that adaptation looks like.

### Limitations

#### Author-stated limits: development-set evaluation

The authors do not evaluate Spider’s held-out test set. They explain that doing so would require sending the hidden examples through an external API, creating a risk that the evaluation material could later enter training.

This choice protects the intended separation of hidden evaluation data, but it restricts the claim. The Spider scores describe development-set performance. They should not be presented as held-out test results or as evidence that the same ranking would necessarily hold there.

The distinction is especially relevant because the study is about systems whose training data are not fully visible. The decision about which data can be sent to the API is part of the evaluation design, instead of a minor reporting omission.

#### Author-stated uncertainty: possible exposure to Spider

The Spider development material is publicly available on GitHub, making exposure during Codex training possible. The authors offer several arguments against memorization being the main explanation.

They attempt continuation from verbatim fragments of an evaluation file and do not obtain matching file contents. The question-only prompt performs weakly. Stronger results depend on schema information absent from that question–query file. Codex also uses a different query style from the reference, including different aliasing behavior.

The authors further report similar cross-system trends on Spider-Realistic, which removes explicit column-name mentions from questions. They describe that resource as unavailable publicly on GitHub and therefore argue that direct memorization cannot account for the observed behavior there.

These checks are informative, but their evidential strength should be kept clear. Failure to reproduce a file does not prove that training exposure had no effect. Different query style does not prove complete independence from benchmark material. A careful reader can accept that the results are not well explained by simple verbatim retrieval while still treating contamination as unresolved.

The cited discussion of Copilot memorization adds context to the authors’ argument, but it is not a direct audit of the exact training examples behind the evaluated API offerings. The study cannot supply a complete provenance account for them.

#### Author-stated uncertainty: scale and reproducibility

The appendix warns that parameter-count assumptions are guesses. Accordingly, the results support comparisons between named API variants more directly than claims about exact scaling laws.

The authors also note that served API versions can change. They check version consistency within their experiments, which improves interpretability, but a later user of the same service name may receive a different system.

The preliminary GPT-3 fine-tuning experiments have another explicit limitation. They use default settings: 4 epochs, batch size 8, and a learning-rate multiplier of 0.1. The authors do not conduct a hyper-parameter search because of its cost.

Those preliminary results therefore cannot settle the broader question of what carefully optimized task-specific training might achieve. The conclusion itself points towards studying Codex fine-tuning as future work.

#### Setup-derived limit: the comparison is not a matched causal test

A careful reader should distinguish a useful system comparison from an isolated experiment on adaptation mechanisms. Codex and T5-3B differ in pretraining, architecture, code exposure, and scale. The same support examples control an important source of variation, but they do not equalize those backgrounds.

The few-shot results show that the evaluated Codex configuration uses limited domain supervision effectively. They do not establish that in-context adaptation is intrinsically superior to parameter updates under otherwise identical conditions.

The baseline training procedure is also specific. Its learning rate is chosen through the described validation process, and its adaptation follows prior Spider training. Another initialization or optimization procedure would be a different experiment. The paper provides evidence about the chosen baseline instead of exhausting all fine-tuning alternatives.

#### Setup-derived limit: context capacity affects access to information

The strongest prompt is not available to every system under comparison. Input windows and token-processing differences determine whether a combined schema-and-content representation fits.

This is a real deployment constraint and therefore belongs in a practical evaluation. It also complicates explanatory claims. A performance difference may reflect the generator’s capabilities, the amount of database evidence supplied, or both.

The few-shot settings inherit the same issue. GeoQuery permits more support examples than Scholar, and different API offerings fit different support counts. The study therefore measures adaptation under concrete context budgets rather than a uniform supply of unlimited demonstrations.

#### Setup-derived limit: human acceptability is sampled and interpretive

The manual audit covers 100 executable predictions that the test-suite evaluator rejects. It does not include invalid queries, and it does not reassess automatically accepted outputs.

The reported 31% applies to that sampled disagreement group. It is not a proportion of all predictions and cannot be used as a direct adjustment to overall accuracy. The categories were chosen to expose interesting Codex behavior, rather than to establish an exhaustive universal taxonomy.

Acceptability is also judged by an annotator. The paper does not report a multi-annotator agreement study. A different reader might draw the boundary differently for some extra columns or tie-handling choices.

This does not make the analysis unhelpful. It makes its role diagnostic. It reveals that benchmark rejection can combine semantic mistakes with reasonable interpretations, while leaving the prevalence and stability of those interpretations open to broader study.

#### Setup-derived limit: demonstrations and examples have narrow coverage

Support examples are drawn from frequent templates. That is a clear and useful selection rule, but it favors common structures. The results do not establish equally strong adaptation to rare query patterns.

The paper also does not compare that selection strategy with alternative retrieval or coverage procedures. It therefore cannot claim that its support sets are optimal.

Similarly, the selected before-and-after examples in the appendix show possibilities rather than representative frequencies. They make convention learning concrete, but the argument for overall effectiveness must come from the aggregate evaluation.

Finally, successful query generation is not itself a complete database-interface evaluation. The study measures translation quality under benchmark conditions. It does not establish how users resolve ambiguities, how an interface should request clarification, or how generated queries should be managed in a larger application.

### What came after

The later citation trail places the paper within several continuing lines of work: broader text-to-SQL evaluation, methods for organizing in-context generation, verification through execution, and systems built specifically for database queries. A citation establishes a connection in the research literature, but it does not by itself demonstrate that a later method adopted a particular prompt or confirmed the earlier results. The most precise account keeps those levels separate.

#### Broader evaluation of text-to-SQL

[Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation](https://md.research.elamur.ai/free/en/papers/gao-2023-text-sql-empowered-large-language/) continues the benchmark-evaluation direction. Its subject is the same broad question that motivates the Codex study: how to measure text-to-SQL capability when a general language system can be directed through its input. The citation connects it to the earlier empirical baseline. The available bibliographic information does not establish a particular numerical improvement or identify which prompt comparison it inherits.

[Can LLM Already Serve as A Database Interface?](https://md.research.elamur.ai/free/en/papers/li-2023-llm-already-serve-database-interface/) extends the framing toward database interfaces and large-scale database-grounded text-to-SQL. This is a natural continuation of the earlier paper’s practical motivation. A query generator becomes useful only insofar as it connects a request to the structure and contents of an actual database. The later title foregrounds that interface question, while the earlier work provides evidence that schema and content representation are essential parts of answering it.

[A comprehensive evaluation of ChatGPT’s zero-shot Text-to-SQL capability](https://md.research.elamur.ai/free/en/papers/liu-2023-comprehensive-evaluation-chatgpt-s-zero/) carries the zero-shot evaluation question to another named system. Its connection is the evaluation regime: what can be accomplished without target-task examples or an additional task-specific training stage. The citation supports treating the Codex paper as part of the background for that question; it does not establish that the later evaluation reproduces the same dataset conditions or prompt ranking.

[L2CEval](https://md.research.elamur.ai/free/en/papers/ni-2024-l2ceval-evaluating-language-code-generation/) addresses evaluation across language-to-code generation more broadly. SQL is one formal output language within that larger problem. The earlier paper’s distinction between executable output and semantically appropriate output remains relevant to such evaluation, although the citation information alone does not show which particular tests L2CEval uses.

#### Organizing generation and checking it

[DIN-SQL](https://md.research.elamur.ai/free/en/papers/pourreza-2023-din-sql-decomposed-context-learning/) explicitly joins decomposed in-context learning with self-correction for text-to-SQL. Its title identifies a move from showing that demonstrations help towards organizing how those demonstrations guide generation and revision. The earlier paper establishes that examples can improve adaptation and influence conventions. DIN-SQL belongs to the subsequent methodological direction concerned with structuring that process. No specific decomposition steps or performance claims can be inferred from the citation alone.

[LEVER](https://md.research.elamur.ai/free/en/papers/ni-2023-lever-learning-verify-language-code/) centers verification of language-to-code generation using execution. This connects closely to the distinction between generating an artifact and evaluating its behavior. The Codex study uses execution to assess SQL predictions; LEVER’s title places execution within a learned verification approach. The connection is conceptual and bibliographic, without implying that the earlier paper implemented such a verifier.

[Binding Language Models in Symbolic Languages](https://md.research.elamur.ai/free/en/papers/cheng-2022-binding-language-models-symbolic-languages/) belongs to the wider problem of connecting flexible language generation with formal representations. SQL makes that relationship concrete: the input is expressed in ordinary language, while the output must obey a symbolic language and implement the right operation. The citation identifies the earlier evaluation as relevant background, but the title does not specify which of its prompting or error-analysis ideas are reused.

#### Building task-specific systems

[CodeS](https://md.research.elamur.ai/free/en/papers/li-2024-codes-towards-building-open-source/) focuses on building open-source language systems for text-to-SQL. This direction addresses a different part of the problem from evaluating an externally served API. The earlier paper’s uncertainties about parameter counts and changing versions help explain why system availability and inspectability matter to evaluating database-query generation. The citation connection does not establish how CodeS is trained or which results it achieves.

[STaR-SQL](https://md.research.elamur.ai/free/en/papers/he-2025-star-sql-self-taught-reasoner/) presents a self-taught reasoner for text-to-SQL. Its title signals a focus on developing the query-generation process rather than relying solely on an unchanged predictor and a hand-designed prompt. It belongs to a later methodological strand that takes text-to-SQL capability as something to cultivate. The relationship should not be overstated: the citation does not show which error categories or demonstrations from the Codex study directly shape that method.

[SDE-SQL](https://md.research.elamur.ai/free/en/papers/xie-2026-sde-sql-enhancing-text-sql/) names self-driven exploration with SQL probes as its route to improving text-to-SQL generation. The shared concern is how a system gains useful evidence for constructing queries. The earlier study examines externally supplied schemas, rows, and demonstrations; the later title points toward exploration through probes. Specific probe procedures and their effects require evidence from that later work rather than inference from its name.

#### Connections beyond isolated SQL generation

[In-Context Learning for Few-Shot Dialogue State Tracking](https://md.research.elamur.ai/free/en/papers/hu-2022-context-learning-few-shot-dialogue/) connects through limited-example adaptation. Dialogue state tracking is a different structured prediction task, but its title identifies the same broad mechanism of learning from examples placed in context. The citation shows that the Codex study participates in a conversation extending beyond database queries. It does not establish that the same template-selection rule transfers unchanged.

[Natural Language to Code Generation in Interactive Data Science Notebooks](https://md.research.elamur.ai/free/en/papers/yin-2023-natural-language-code-generation-interactive/) places language-to-code generation in an interactive working environment. That setting broadens the practical question from producing a standalone query to generating code amid surrounding activity. The earlier paper’s attention to supplied context is relevant at this level, while the citation information does not identify the notebook work’s exact use of schemas, demonstrations, or execution.

[A Survey on Large Language Models for Code Generation](https://md.research.elamur.ai/free/en/papers/jiang-2024-survey-large-language-models-code/) situates these questions within the wider task of turning natural-language requests into source code. Tools including GitHub Copilot, CodeGeeX, and Amazon CodeWhisperer fall within its scope. Within that broader view, the Codex evaluation supplies a focused case in which code must satisfy both a formal interpreter and a database-specific meaning.

The lasting research question across these connections is how to separate available capability from the conditions that reveal it. This paper demonstrates that schemas, sample contents, and demonstrations materially change observed text-to-SQL performance. It also shows why better scores need careful interpretation: some improvements reflect stronger translation, some reflect adaptation to local conventions, and some depend on the information a context window can hold. Later evaluation and method papers continue along those connected directions, while the original evidence remains strongest where its comparisons are explicit and its claims stay tied to their experimental conditions.

## Cite

Cite as Nitarshan Rajkumar, Raymond Li and Dzmitry Bahdanau. 2022. Evaluating the Text-to-SQL Capabilities of Large Language Models. arXiv (Cornell University).

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.48550/arxiv.2204.00498](https://doi.org/10.48550/arxiv.2204.00498) · [arXiv 2204.00498](https://arxiv.org/abs/2204.00498)

```bibtex
@misc{rajkumar2022evaluating,
  title = {{Evaluating the Text-to-SQL Capabilities of Large Language Models}},
  author = {Nitarshan Rajkumar, Raymond Li and Dzmitry Bahdanau},
  year = {2022},
  doi = {10.48550/arxiv.2204.00498},
  eprint = {2204.00498},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.2204.00498}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
