Manuscript Offprint
arXiv:2608.28432Are These Modules Worth Their Cost? A Paradigm-Level Accuracy-Cost Analysis of In-context Learning Text-to-SQL
Jiayan Lin
Jinan University
Guangzhou, China
Zheng Yuan
The Hong Kong Polytechnic
University
Kowloon, Hong Kong
Qinggang Zhang
Jilin University
Changchun, China
Yujia Liu
Jinan University
Guangzhou, China
Yilin Xiao
The Hong Kong Polytechnic
University
Kowloon, Hong Kong
Xiao Huang
The Hong Kong Polytechnic
University
Kowloon, Hong Kong
Zijin Hong
The Hong Kong Polytechnic
University
Kowloon, Hong Kong
Hao Chen
City University of Macau
Taipa, Macau
Feiran Huang
Beihang University
Beijing, China
Abstract
Recent advances in in-context learning (ICL) text-to-SQL have substantially improved execution accuracy on public benchmarks by assembling increasingly elaborate pipelines around the base generator, yet existing studies typically report aggregate end-to-end accuracy, without quantifying the marginal accuracy-cost contribution of individual design choices. Consequently, providing a unified, paradigm-level cost-accuracy quantification remains a critical challenge for understanding and configuring modern text-to-SQL. To address this, we instantiate 17 paradigm-level configurations across five recurring modules of the ICL text-to-SQL pipeline under a single controlled implementation, and attribute each paradigm's marginal contribution and incurred cost across all four backbones spanning diverse capability levels and reasoning styles. Our analysis reveals that execution-feedback refinement is the only paradigm whose benefit holds universally at consistently low cost, while most other modules help only under backbone-dependent conditions. Token accounting shows that input demand is more closely tied to pipeline structure, whereas output demand is more sensitive to backbone generation behavior. Cross-module analysis further shows that stacking improves accuracy on most backbones, although how the gains compose varies with backbone capability. We also find that a fixed budget is often better spent engineering a more elaborate pipeline over a mid-tier backbone than upgrading to a frontier model with a lean pipeline. These findings distill into an actionable, cost-aware tiered guideline that transfers to five additional backbones without per-paradigm search.
CCS Concepts
• Information systems → Relational database query languages;
• Computing methodologies → Natural language processing.
1 Introduction
The advent of large language models (LLMs) has driven remarkable progress on text-to-SQL [13], a foundational task that translates natural language questions into executable SQL queries over relational databases. In particular, in-context learning (ICL) approaches [34] have substantially pushed execution accuracy on widely used benchmarks such as BIRD [19] and Spider [41] by assembling increasingly elaborate pipelines around the base generator. ICL is particularly suitable for such analysis because its improvements are largely realized through inference-time pipeline design, allowing the marginal benefit and added cost of individual components to be measured while holding the underlying backbone fixed. A modern ICL text-to-SQL system rarely issues a single prompt: it retrieves in-context demonstrations [29], links the relevant schema [18], samples and selects among multiple candidates [15], and refines the chosen query through execution feedback or multi-agent coordination [33]. Each successive system stacks more such modules atop the last, propelling state-of-the-art accuracy to new heights on public leaderboards. These increasingly modular pipelines still create a growing design space in which accuracy gains may often arise in practice from very different combinations of inference-time components.
However, is the accuracy growth on text-to-SQL leaderboards reliably worth its disproportionately growing cost? Figure 1 illustrates a concerning trend: execution accuracy keeps rising as more modules are stacked, while the cost required to gain each additional point grows disproportionately. Pipeline components, however, are typically reported only through a single end-to-end accuracy number for the system. This aggregate-only reporting practice raises two concerns: 1) The marginal contribution of
All authors contributed equally to this research.
Jiayan Lin, Yujia Liu, Zijin Hong, Zheng Yuan, Yilin Xiao, Hao Chen, Qinggang Zhang, Xiao Huang, and Feiran Huang

What is the grade span offered in the school with the highest longitude?
General ICL Text-to-SQL Pipeline: Pre-Processing → SQL Generation → Post-Processing
Baseline

Pipeline Stack Configuration

Backbone—Pipeline Trade-offs

Figure 1: Overview of a modular ICL Text-to-SQL pipeline and its accuracy-cost trade-offs. Five recurring modules span preprocessing, SQL generation, and post-processing, but their benefits and inference costs vary across backbones, yielding different cost-efficient configurations under fixed budgets.
individual modules is overshadowed by aggregate accuracy, as the same end-to-end number may be reached through entirely different module combinations, leaving unclear which paradigms carry the gain and which are merely along for the ride; 2) Cost is rarely accounted for jointly with accuracy, despite agentic refinement loops and multi-candidate sampling consuming several times, and in some cases an order of magnitude, more tokens and dollars than a single-pass baseline. These concerns make it difficult for practitioners to decide which modules are worth adding for a backbone, and how far the pipeline should go before engineering ceases to pay off. They therefore motivate us to study this recurring class of modular ICL pipelines under controlled settings, where inference-time modules can be varied while holding the backbone fixed to more reliably attribute their marginal accuracy and cost.
Studies have begun to interrogate aspects of text-to-SQL pipelines, such as ablations on schema linking [22] or comparisons among candidate selection strategies [24], while several surveys catalog representative methods and their design choices [17]. However, these efforts either evaluate isolated components within a single system or report each method as a monolith without disentangling its constituent paradigms, leaving open how each module's contribution shifts across backbones of differing capability and reasoning style. In this context, effectively quantifying the marginal accuracy-cost tradeoff of each design paradigm in ICL text-to-SQL pipelines remains a significant challenge. As a solution, this paper conducts a controlled paradigm-level evaluation that decomposes the ICL text-to-SQL pipeline into recurring modules, instantiates each design choice as a paradigm-level configuration under a unified implementation, and isolates its marginal contribution alongside the incurred cost across backbones spanning diverse capability levels and reasoning styles. Unlike accuracy-only evaluations, we jointly examine execution accuracy and inference cost, revealing how each paradigm's value shifts with model capability. Overall, our contributions in this paper are listed as follows:
-
We conduct the first controlled, paradigm-level accuracy-cost evaluation of in-context learning (ICL) text-to-SQL pipelines, instantiating 17 paradigm-level configurations across five recurring modules under a single unified implementation.
-
We reveal that execution-feedback refinement is the only paradigm whose benefit holds universally at consistently low cost, while most other paradigms instead help only under backbone-dependent conditions, exposing the unreliability of aggregate-only accuracy reporting in practice.
-
We further show that a fixed budget is often better spent engineering a more elaborate pipeline over a mid-tier backbone than upgrading to a frontier model with a lean pipeline, and distill these findings into a tiered cost-efficient configuration guideline validated on five additional backbones across capability levels without per-paradigm search.
2 Pipeline Decomposition
We decompose the ICL Text-to-SQL pipeline into three main stages, Pre-Processing, SQL Generation, and Post-Processing, comprising five recurring functional modules: Example Retrieval, Schema Linking, Generation Strategy, Candidate Selection, and Refinement. These yield 17 paradigm-level configurations; Figure 2 summarizes the taxonomy and 24 representative methods. For a question with schema , the five modules are formalized below.
(1) Example Retrieval. Retrieves a demonstration set from using a paradigm-specific representation :
Here, denotes the question in example z. Question Similarity directly uses raw question embeddings [17]; Masked Question Similarity masks schema-specific entities before retrieval [8]; and SQL Skeleton Similarity uses structural SQL query forms [27].
(2) Schema Linking. For each schema element , a paradigm-specific rule determines whether is retained:
Retrieval-Based Linking scores relevant schema elements via dense retrieval [38]; Pseudo-SQL Guided Linking retains elements explicitly referenced by a preliminary SQL draft [29]; Direct LLM Linking uses Single-shot [25] or Two-stage [6] LLM linking; and Agentic Linking uses iterative proposer-verifier exchanges.
(3) Generation Strategy. Generates a pool of N SQL candidates:
Disabled retrieval uses , while disabled linking uses . Direct Generation generates SQL directly [4]; CoT-Enhanced Generation elicits intermediate reasoning [24]; and Decomposition-Based Generation decomposes the question before generating the final SQL [34]. They may also be combined via parallel generators.
Are These Modules Worth Their Cost? A Paradigm-Level Accuracy-Cost Analysis of In-context Learning Text-to-SQL

Figure 2: Taxonomy of ICL Text-to-SQL pipelines, organizing five modules across three pipeline stages into 17 paradigm-level configurations and 24 representative methods, including methods that naturally span multiple paradigms within the pipeline. Repeated method names indicate systems that combine design paradigms across modules or use multiple strategies within the same module, providing a unified view of how modern ICL Text-to-SQL systems assemble pipeline components in practice.
(4) Candidate Selection. Selects one query from according to selection paradigm c:
Execution-Based Voting selects from the largest result-equivalence group [20]; LLM-Based Preference Selection uses an LLM to choose via Scoring and Ranking [9] or Pairwise Comparison [16].
(5) Refinement. Maps the selected SQL to the final prediction under refinement paradigm :
Execution-Feedback Refinement rewrites only after an execution error or empty result [2]; Self-Correction performs prompt-level review without execution [39]; and Agentic Refinement coordinates multiple revision roles using execution feedback [33]. Without refinement, the selected SQL is simply returned unchanged [10, 26].
Our taxonomy covers 24 representative ICL Text-to-SQL methods published between 2023 and 2026 that report on BIRD or Spider and provide sufficient pipeline detail for reliable paradigm-level classification. Methods may span multiple paradigms, especially through parallel generation or combined schema linking signals.
3 Experimental Setup
This section describes the experimental setup for our paradigm-level analysis. We first introduce the datasets and backbone scope, then present the evaluation metrics and statistical testing, and finally detail the controlled implementation of the 17 paradigm configurations to ensure consistent and comparable assessment across paradigms and backbones within our unified framework.
3.1 Dataset and Backbones
Dataset. We conduct the main paradigm-level analysis on the development split of BIRD [19], which contains 1,534 question and SQL pairs over 11 databases. BIRD is widely used in recent ICL Text-to-SQL work and provides evidence annotations that are directly relevant to several paradigms studied in this paper. To examine cross-benchmark generalization, we additionally use Spider [41] (1,034 samples) to evaluate cross-benchmark transfer of the BIRD-derived pipeline configurations under the same protocol in § 5.2.
Backbones. We run the full set of paradigm configurations on four primary backbones spanning different capability levels and reasoning behaviors: GPT-4o-mini, Gemini-2.5-Flash, DeepSeek-V4-Flash (reasoning), and GPT-5.4. To further examine the effect of reasoning behavior on generation strategies, we additionally evaluate Qwen3-235B in thinking mode and o3-mini in § 4.2. Finally, we evaluate the tiered guideline in § 6 on five additional backbones by applying the three prescribed tiers without per-paradigm search.
3.2 Metrics and Statistical Testing
Accuracy metrics. For intuitive comparison, we follow the standard evaluation setting in the text-to-SQL community [41]. Our primary evaluation metric is execution accuracy (EX). Given a
Jiayan Lin, Yujia Liu, Zijin Hong, Zheng Yuan, Yilin Xiao, Hao Chen, Qinggang Zhang, Xiao Huang, and Feiran Huang
set of question and gold-SQL pairs and predicted SQLs :
where denotes the execution operator on the corresponding database. For configurations that sample multiple candidates, let denote the sampled candidates for example . We additionally report oracle candidate recall (OCR):
which upper-bounds the EX achievable by any selection strategy over a fixed candidate pool.
Cost and resource metrics. To compare paradigms along the accuracy–cost tradeoff, for a paradigm instantiated in module , we report cost per EX point (CPP):
where denotes the matched reference for module , using the same sampling budget as ( for Candidate Selection and otherwise). Measured in USD/pp, CPP represents the additional cost to gain one percentage point of EX over the matched reference. CPP is reported only when strictly improves EX at strictly higher cost; paradigms that Pareto-dominate the reference are marked separately. We report all costs in USD and also record mean per-question input (IN) and output (OUT) token counts for comparison to better characterize resource overhead beyond aggregate API cost.
Statistical testing. All EX gains over the matched reference are evaluated using McNemar's test. We report 95% confidence intervals and determine statistical significance at ; detailed numerical intervals are provided in the supplementary material for reference.
3.3 Controlled Implementation
To ensure that quantitative comparisons reflect paradigm-level differences rather than incidental properties of specific systems [13], we re-implement the 17 configurations identified in § 2 as paradigm representatives under a unified controlled framework. Rather than reproducing any particular system, each configuration instantiates the defining mechanism of one paradigm while keeping shared implementation settings fixed within corresponding module across all backbones. Figure 3 summarizes these controlled implementations across all five modules. Detailed implementation settings and fallback behavior are provided in the final supplementary material.
Baseline and single-swap protocol. We define a global baseline for each backbone with no retrieved demonstrations, the full schema, direct generation () with , and neither Candidate Selection nor Refinement. For each target module, we replace only that module with the paradigm under study while keeping other modules at their trivial settings, so that the observed difference can then be attributed directly to the target paradigm. Candidate Selection is the only exception to the reference: because selection requires multiple candidates, we use a matched baseline that returns the first candidate from the same candidate pool, thereby
Controlled Paradigm Implementation
Require: , , optional evidence, backbone, target module , and paradigm setting Ensure: final prediction
1: Keep all non-target modules at their trivial settings. 2: if is EXAMPLE RETRIEVAL then 3: Fix , the training retrieval pool, and the same frozen encoder. 4: 5: else if is SCHEMA LINKING then 6: Fix the full-schema input and always retain primary/foreign keys. 7: 8: else if is GENERATION STRATEGY then 9: Fix one backbone generation call at temperature 0. 10: 11: else if is CANDIDATE SELECTION then 12: Fix the same pool sampled from . 13: Execute all candidates in . 14: 15: else if is REFINEMENT then 16: Fix the same inputs and temperature 0; keep the last valid SQL on failure. 17: 18: end if 19: Run the remaining pipeline stages at their trivial settings. 20: return
Gray italics: shared fixed settings. [ ] denotes a conditional operation.
Figure 3: Controlled implementation of the 17 paradigm configurations. For each target module, shared settings are fixed and all non-target modules remain at their trivial settings, so that only the paradigm-specific mechanism itself varies.
also separating the selector's contribution from the gain due to multi-sample generation. For Generation Strategy, we additionally evaluate sampling to examine effect on candidate-pool quality.
4 Single-Module Analysis
We instantiate each of the 17 paradigm configurations by replacing exactly one module in the global baseline pipeline, holding the remaining four at their trivial settings. This single-swap protocol isolates the marginal contribution of each paradigm. Table 1 reports the accuracy–cost and token statistics across all four backbones, while Figure 4 summarizes the EX results with 95% confidence intervals. We organize the analysis around two questions below:
Q1. Are there paradigms whose marginal benefit is robust across all four backbones, making them safe pipeline defaults?
Q2. For paradigms whose benefit is not universal, does the variation correlate with model capability or reasoning style?
4.1 Universal Paradigms
Across the 17 overall paradigm configurations, (Execution-Feedback Refinement) is the only paradigm whose benefit holds
Are These Modules Worth Their Cost? A Paradigm-Level Accuracy-Cost Analysis of In-context Learning Text-to-SQL
Table 1: Module-level accuracy–cost results on BIRD dev across four LLMs. EX: execution accuracy (%); Cost: total API spend (USD); CPP: incremental USD per EX point over the matched-budget baseline (N=5 for Candidate Selection, N=1 otherwise; § 3.2). IN/OUT: mean per-question tokens (DeepSeek-V4-Flash reasoning tokens count as OUT). Significance uses McNemar’s test (α=0.05; full CIs in the supplement). In CPP, numbers denote significant gains; “○”, nonsignificant gains; “–”, no EX improvement; and “*”, a significant gain at no higher cost. / mark the best/second-best results; OCR@5 is the oracle upper bound for N=5.
| ParadigmBaselines | GPT-4o-mini | DeepSeek-V4-Flash | Gemini-2.5-Flash | GPT-5.4 | |||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| EX↑ | Cost↓ | CPP↓ | IN↓ | OUT↓ | EX↑ | Cost↓ | CPP↓ | IN↓ | OUT↓ | EX↑ | Cost↓ | CPP↓ | IN↓ | OUT↓ | EX↑ | Cost↓ | CPP↓ | IN↓ | OUT↓ | ||
| N=1 | 49.74 | 0.394 | - | 1510 | 51 | 56.32 | 0.547 | - | 1557 | 494 | 59.84 | 1.035 | - | 1642 | 73 | 61.28 | 7.305 | - | 1509 | 66 | |
| N=5 | 49.67 | 1.972 | - | 7550 | 255 | 56.45 | 2.756 | - | 7787 | 2523 | 60.04 | 5.219 | - | 8222 | 374 | 61.41 | 35.864 | - | 7545 | 301 | |
| OCR@5 | 56.91 | 1.972 | - | 7550 | 255 | 60.56 | 2.756 | - | 7787 | 2523 | 64.54 | 5.219 | - | 8222 | 374 | 66.82 | 35.864 | - | 7545 | 301 | |
| Example Retrieval | |||||||||||||||||||||
| 50.07 | 0.462 | ° | 1806 | 50 | 56.06 | 0.613 | - | 1858 | 498 | 60.43 | 1.270 | 0.401 | 1842 | 110 | 62.58 | 8.602 | 0.995 | 1834 | 68 | ||
| 50.65 | 0.525 | 0.144 | 2009 | 68 | 56.84 | 0.717 | 0.326 | 2311 | 512 | 61.28 | 1.632 | 0.417 | 2207 | 161 | 63.69 | 9.613 | 0.957 | 2058 | 75 | ||
| 49.80 | 0.867 | ° | 3357 | 103 | 57.11 | 1.063 | 0.660 | 3708 | 622 | 60.10 | 2.421 | ° | 3358 | 228 | 63.49 | 14.879 | 3.417 | 3325 | 92 | ||
| Schema Linking | |||||||||||||||||||||
| 49.87 | 0.275 | ° | 873 | 81 | 55.93 | 0.360 | - | 964 | 357 | 59.13 | 1.117 | - | 857 | 188 | 60.63 | 5.102 | - | 826 | 84 | ||
| 52.15 | 0.574 | 0.075 | 1844 | 163 | 57.04 | 0.899 | 0.491 | 1871 | 1157 | 61.15 | 1.784 | 0.575 | 1855 | 243 | 62.39 | 10.955 | 3.293 | 1903 | 159 | ||
| 51.11 | 0.544 | 0.109 | 1936 | 107 | 56.19 | 0.782 | - | 1852 | 896 | 60.89 | 1.659 | 0.599 | 1924 | 202 | 60.82 | 9.672 | - | 1944 | 96 | ||
| 51.83 | 0.582 | 0.090 | 1528 | 250 | 55.87 | 0.757 | - | 1634 | 944 | 60.76 | 1.808 | 0.847 | 1577 | 282 | 59.97 | 12.806 | - | 1622 | 286 | ||
| 52.93 | 1.260 | 0.271 | 4478 | 249 | 56.52 | 1.380 | ° | 4520 | 953 | 61.34 | 2.870 | 1.224 | 4524 | 205 | 62.06 | 23.631 | 20.870 | 4568 | 266 | ||
| SQL Generation | |||||||||||||||||||||
| 49.74 | 0.394 | - | 1510 | 51 | 56.32 | 0.547 | - | 1557 | 494 | 59.84 | 1.035 | - | 1642 | 73 | 61.28 | 7.305 | - | 1509 | 66 | ||
| 53.98 | 0.503 | 0.026 | 1534 | 163 | 55.93 | 0.556 | - | 1602 | 493 | 62.71 | 1.522 | 0.170 | 1538 | 212 | 62.84 | 10.000 | 1.723 | 1533 | 179 | ||
| 51.24 | 0.534 | 0.093 | 1574 | 187 | 56.13 | 0.651 | - | 1650 | 689 | 60.76 | 1.925 | 0.976 | 1590 | 311 | 63.10 | 11.476 | 2.285 | 1573 | 237 | ||
| Candidate Selection | |||||||||||||||||||||
| 51.11 | 1.972 | * | 7550 | 255 | 57.30 | 2.756 | * | 7787 | 2523 | 60.89 | 5.219 | * | 8222 | 374 | 62.71 | 35.864 | * | 7545 | 301 | ||
| 50.52 | 2.625 | 0.771 | 9718 | 423 | 59.00 | 3.602 | 0.333 | 10319 | 3227 | 61.60 | 8.045 | 1.806 | 10018 | 896 | 63.82 | 53.348 | 7.249 | 9964 | 658 | ||
| 51.17 | 4.056 | 1.389 | 14962 | 666 | 58.54 | 4.743 | 0.953 | 14962 | 3562 | 61.93 | 10.622 | 2.858 | 14846 | 988 | 63.89 | 75.436 | 15.975 | 14933 | 790 | ||
| Refinement | |||||||||||||||||||||
| 54.63 | 0.471 | 0.016 | 1750 | 74 | 58.15 | 0.620 | 0.040 | 1697 | 596 | 62.32 | 1.099 | 0.026 | 1671 | 86 | 63.30 | 7.905 | 0.297 | 1592 | 78 | ||
| 51.83 | 1.030 | 0.305 | 3509 | 242 | 56.58 | 1.253 | ° | 3638 | 1098 | 60.95 | 3.211 | 1.964 | 3513 | 416 | 62.06 | 21.918 | 18.680 | 3518 | 366 | ||
| 53.26 | 1.365 | 0.276 | 4980 | 238 | 59.97 | 1.878 | 0.365 | 5007 | 1870 | 63.04 | 4.281 | 1.016 | 5116 | 502 | 64.02 | 28.578 | 7.769 | 5251 | 367 | ||
across all four backbones at consistently low cost. It yields gains between +1.83 and +4.89 pp, with CPP below 0.30 USD/pp throughout. The mechanism is: a diagnostic execution is run on the candidate query, and the model is guided to rewrite only when execution errors or returns no rows. The call is therefore failure-gated rather than mandatory, which keeps the average overhead small while preserving the upside on the queries that actually need revision.
The other two refinement paradigms illustrate why 's combination is rare. (Self-Correction) significantly improves EX on three backbones but has no significant effect on the reasoning backbone DeepSeek-V4-Flash (+0.26 pp, n.s.); even where it helps, its CPP is far above 's. (Agentic Refinement) is positive on all four backbones and posts the highest absolute EX in several columns, but at CPP one to two orders of magnitude above . The pattern across the three paradigms is consistent: execution feedback supplies information the model did not have at generation time, while prompt-internal correction adds only what the model could in principle have produced on its own. Among universally helpful paradigms, this information asymmetry, rather than reasoning quality, is thus what separates cheap from expensive in this setting.
4.2 Model-Dependent Paradigms
The remaining four modules deliver gains that depend on the backbone. Rather than treating each module in isolation, we organize the discussion by backbone characteristics, since the modules' contributions move together with model capability across tested backbones.

Figure 4: EX (pp) relative to the matched-budget reference baseline for 17 paradigm configurations on BIRD dev. Shaded bands show CIs for paired differences, and the dashed line marks EX = 0. Statistical significance is assessed using McNemar's test. Full numerical CIs are provided in the supplementary material for every paradigm on each backbone.
Capability gradient: schema linking and example retrieval exhibit opposing trends. On GPT-4o-mini, the weakest backbone in our set, Schema Linking delivers its largest gains across the four backbones: (Agentic Linking) adds +3.19 pp, and , , all clear +1.3 pp. The benefit shrinks sharply on stronger backbones. On GPT-5.4, only and yield positive gains, both at substantially higher CPP than pre-processing paradigms typically incur on cheaper backbones. Schema linking acts as a capability prosthesis: its value falls as the backbone's schema-grounding ability
Jiayan Lin, Yujia Liu, Zijin Hong, Zheng Yuan, Yilin Xiao, Hao Chen, Qinggang Zhang, Xiao Huang, and Feiran Huang
Table 2: Generation strategy results on BIRD dev for two additional reasoning backbones. Qwen3-235B uses thinking mode. Parentheses report EX over (pp). Units: Cost in USD, CPP in USD/pp, and IN/OUT in tokens per question.
| Backbone | Paradigm | EX↑ | Cost↓ | CPP↓ | IN↓ | OUT↓ |
|---|---|---|---|---|---|---|
| Qwen3-235B (Thinking) | 57.82 | 4.55 | - | 1555 | 1134 | |
| 58.02 (+0.20) | 5.22 | 3.426 | 1529 | 1327 | ||
| 57.30 (-0.52) | 5.84 | - | 1596 | 1495 | ||
| o3-mini | 54.11 | 5.67 | - | 1509 | 463 | |
| 53.46 (-0.65) | 5.83 | - | 1546 | 477 | ||
| 53.06 (-1.04) | 7.08 | - | 1538 | 665 |
rises. Recent studies [22, 42] report that sufficiently strong models can generate correct SQL even without explicit schema linking; we extend the observation to a four-backbone, cost-aware setting. Example Retrieval shows the opposite trend, though weakly. (Masked Question Similarity) is the best retrieval paradigm on every non-reasoning backbone, and its gain scales with baseline EX, from +0.91 pp on GPT-4o-mini to +2.41 pp on GPT-5.4. One reading is that stronger non-reasoning backbones extract reusable structure from demonstrations, but DeepSeek-V4-Flash departs from this trend in ways we cannot attribute to capability alone in this case. These trends suggest backbone-dependent preprocessing benefits.
Reasoning split: external reasoning scaffolds help mainly non-reasoning backbones. Among the four primary backbones tested, Generation Strategy varies more than any other module. (CoT-Enhanced Generation) delivers +4.24 pp on GPT-4o-mini at CPP = 0.026 USD/pp, the second-largest single-module gain after . The gain shrinks on Gemini-2.5-Flash and GPT-5.4, and turns negative on DeepSeek-V4-Flash (-0.39 pp), with CPP on reasoning-capable backbones one to two orders of magnitude higher. (Decomposition-Based Generation) follows a similar pattern, with negligible effect on DeepSeek-V4-Flash; the exception is GPT-5.4, where slightly exceeds (+1.83 vs. +1.56 pp) at higher CPP.
Because DeepSeek-V4-Flash is the only reasoning backbone among the primary four models, we further compare all three generation strategies on Qwen3-235B in thinking mode and o3-mini (Table 2). On Qwen3-235B, changes EX by +0.20 pp and by -0.52 pp. On o3-mini, the changes are -0.65 and -1.04 pp, with higher cost in every case. Across the three reasoning backbones tested, external reasoning scaffolds provide no consistent accuracy gain over direct generation, despite higher cost. We nevertheless treat this split as suggestive rather than universal, since reasoning style, capability, and model family remain confounded.
Pool-bound regime: candidate selection saturates regardless of backbone. All three selectors significantly improve EX over the N=5 baseline on every backbone, but we do not test selector against selector; we therefore draw no ranking among , , . More consequently, taking the best selector per backbone, a substantial gap to the oracle ceiling remains everywhere, reaching 5.74 pp on GPT-4o-mini. Candidate selection is recall-bound: once the candidate pool is fixed, further gains must come from improving the pool itself or revising the chosen query post-hoc. The fixed-pool recall ceiling, together with the substantial combined

DeepSeek-V4-Flash
Figure 5: Per-question input (IN) and output (OUT) token consumption across the 17 paradigm configurations for two backbones, GPT-4o-mini and DeepSeek-V4-Flash, on BIRD. Dashed horizontal lines mark the corresponding baseline token levels for direct comparison across configurations. inference cost of multi-candidate generation and selection, motivates the exclusion of Candidate Selection from both the stacking analysis in § 5 and the cost-aware configuration guideline in § 6.
4.3 Token-Level Resource Decomposition
USD cost alone does not reveal where a paradigm's resource overhead comes from. Table 1 reports the complete IN/OUT token accounting across all four backbones, while Figure 5 visualizes two contrasting backbones. The source of token overhead closely follows the paradigm mechanism. Example Retrieval and LLM-based Candidate Selection are primarily input-heavy: substantially expands the prompt context, while reaches about 15K input tokens. In contrast, Generation Strategy mainly shifts resource use toward output consumption through additional reasoning or decomposition. Schema Linking is more heterogeneous: reduces input through schema pruning, whereas incurs substantially larger input context from iterative interaction. Refinement shows a different pattern: remains close to the baseline in both IN and OUT, whereas and incur substantially larger token overhead.
Across backbones, token consumption varies more strongly in OUT than IN. For a given paradigm, IN is stable across the four backbones, while the two-backbone visualization shows a pronounced OUT gap: DeepSeek-V4-Flash consistently produces substantially more OUT than GPT-4o-mini, with its reasoning traces contributing to the OUT total. This pattern suggests that input demand is more closely tied to pipeline structure, whereas output demand is more sensitive to backbone generation behavior, especially reasoning.
4.4 Single-Module Conclusion
The single-module analysis surfaces one safe default and a structured account of when the rest help and where their resource overhead arises. Only qualifies as a universal, low-cost
Are These Modules Worth Their Cost? A Paradigm-Level Accuracy-Cost Analysis of In-context Learning Text-to-SQL
Table 3: Cross-module interactions across four backbones. EX is combined execution accuracy (%), with gray values marking combinations that do not outperform the better of the two individual paradigms. Green and red denote super- and sub-additive interactions. The rows are omitted because they reduce to and have by construction. Cost is reported in USD. All interaction values are measured in percentage points relative to the matched-budget reference baseline for each backbone.
| Combination | GPT-4o-mini | DeepSeek-V4-Flash | Gemini-2.5-Flash | GPT-5.4 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| EX↑ | Total Cost↓ | EX↑ | Total Cost↓ | EX↑ | Total Cost↓ | EX↑ | Total Cost↓ | |||||
| 56.84 | -2.02 | 0.612 | 57.82 | +0.07 | 0.743 | 65.12 | -0.07 | 1.971 | 64.60 | -0.26 | 10.310 | |
| 55.87 | -0.20 | 1.143 | 55.22 | -0.97 | 1.457 | 63.62 | -0.20 | 3.856 | 64.73 | +1.11 | 24.751 | |
| 57.17 | -0.33 | 1.525 | 59.84 | +0.26 | 2.004 | 66.04 | +0.13 | 4.748 | 65.19 | -0.39 | 32.632 | |
| 54.50 | -0.39 | 0.685 | 56.39 | -0.07 | 0.793 | 64.34 | +0.20 | 2.217 | 65.32 | +0.07 | 12.190 | |
| 55.74 | -0.39 | 0.657 | 57.89 | -0.07 | 0.733 | 63.43 | +0.19 | 1.956 | 65.38 | +0.26 | 12.114 | |
| 52.28 | -1.05 | 1.182 | 55.67 | -0.72 | 1.501 | 59.45 | -2.42 | 4.523 | 64.47 | +0.59 | 26.360 | |
| 52.93 | -1.83 | 1.441 | 60.17 | +0.39 | 2.067 | 64.60 | +0.64 | 5.304 | 66.56 | +0.72 | 34.801 | |
default; other modules’ contributions are backbone-dependent. The dependence has structure: input-side scaffolding tracks capability, generation-side scaffolding tracks reasoning style, and post-hoc selection saturates against a pool-bound ceiling. Resource use shows a complementary pattern: IN is more closely tied to pipeline structure, whereas OUT is more sensitive to backbone generation behavior. § 5 next asks whether these effects compose when paradigms are stacked, and how a fixed budget should be allocated across stages.
5 Cross-Module and -Model Tradeoffs
The single-swap protocol discussed in § 4 isolates each paradigm’s marginal contribution, but two research questions remain unsolved:
Q3. When two paradigms are used together, do their gains compose additively, or does their combination yield smaller or larger gains than expected across different backbones?
Q4. Given a fixed budget, is it more cost-efficient to engineer a richer pipeline on a cheaper backbone, or instead to simply upgrade to a stronger backbone running a lean pipeline?
5.1 Module Interactions
We study Q3 through a systematic analysis of module interactions. Since exhaustive coverage is infeasible, we focus on the full Generation × Refinement grid across all backbones. We choose this pair because refinement revises the SQL produced by generation, making their interaction particularly direct. For paradigms and , we quantify their interaction in percentage points as
where positive indicates super-additive gains and negative indicates sub-additive gains, both relative to the baseline pipeline. Table 3 reports the resulting configurations and interaction terms.
Generation × Refinement. Of the 24 nontrivial configurations, 17 achieve higher EX than the better individual paradigm. The pattern is strongest on GPT-5.4, where six combinations improve over both individual paradigms; five of six do so on both GPT-4o-mini and Gemini-2.5-Flash. DeepSeek-V4-Flash is the exception, with only one of six combinations improving over both paradigms. This is consistent with the single-module results in § 4: neither nor outperforms on this reasoning backbone, so the resulting combinations rarely outperform refinement alone.
Table 4: Module-best pipelines on BIRD dev. Parentheses show (pp) over the baseline; API costs are in USD. Stacks follow the cost-aware rule in § 5.2 and favor paradigms with low CPP and broadly positive gains across tested models.
| Backbone | Stack | EX (%)↑ | Cost↓ |
|---|---|---|---|
| GPT-4o-mini | 58.02 (+8.28) | 0.759 | |
| DeepSeek-V4-Flash | 61.15 (+4.82) | 1.584 | |
| Gemini-2.5-Flash | 67.14 (+7.30) | 2.916 | |
| GPT-5.4 | 69.43 (+8.15) | 16.237 |
The interaction terms reveal how these gains compose across backbones. On GPT-4o-mini, stacking usually outperforms the better individual paradigm, but all six interactions are sub-additive. This may reflect the weaker backbone’s limited capacity to exploit generation and refinement jointly, yielding overlapping gains across stages. GPT-5.4 exhibits the opposite pattern: all six combinations outperform both individual paradigms, and four are super-additive.
Generation × Example Retrieval. We further examine whether this backbone-dependent pattern extends to the input side through . The combination outperforms both individual paradigms on the three non-reasoning backbones, but not on DeepSeek-V4-Flash, where does not improve the baseline in isolation. remains small across all four backbones, ranging from -0.39 to +0.20 pp, indicating near-additive composition for this module pairing overall.
Overall pattern. Results from the two module pairings show that interaction effects differ systematically across backbones. Module stacking improves accuracy on most backbones, but how its gains compose varies with backbone capability. Since results from two-paradigm combinations do not determine the performance of complete multi-module stacks, § 5.2 evaluates backbone-specific stacks and reports end-to-end accuracy and cost jointly.
5.2 Stacking vs. Upgrading
Stack construction rule. We exclude Candidate Selection because its gains are bounded by candidate-pool diversity (§ 4.2) and do not justify sampling candidates from a single generator. For each backbone and each remaining module, we select the nontrivial paradigm with the lowest CPP whose EX gain is positive on that
Jiayan Lin, Yujia Liu, Zijin Hong, Zheng Yuan, Yilin Xiao, Hao Chen, Qinggang Zhang, Xiao Huang, and Feiran Huang

Figure 6: Cost-EX tradeoffs on Spider dev. Hollow circles denote baselines, filled stars denote the module-best pipelines selected on BIRD and applied unchanged to Spider. The horizontal axis reports total cost on a logarithmic scale.
backbone and on a majority of backbones, retaining the trivial paradigm if none qualifies. This selects rather than the cheaper on GPT-4o-mini: although gains +0.13 pp on that backbone, its gain is negative on the other three. The resulting stacks in Table 4 largely follow the marginal analysis: all use , while DeepSeek-V4-Flash retains because neither nontrivial generation paradigm improves its EX. The only substantive departure from the marginal-EX ranking occurs in GPT-5.4's generation module, where the rule selects for its lower CPP despite 's slightly higher EX overall.
BIRD tradeoff. Table 4 summarizes the resulting stacks on BIRD. Stacking improves EX on every backbone, but by different margins: GPT-4o-mini, Gemini-2.5-Flash, and GPT-5.4 each gain more than 7 pp, while DeepSeek-V4-Flash gains noticeably less, consistent with its weaker response to pipeline engineering observed in § 4. At moderate budgets, engineering a richer pipeline on a mid-tier backbone outperforms upgrading to a frontier backbone running lean: Gemini-2.5-Flash's stack Pareto-dominates GPT-5.4's lean baseline, achieving substantially higher EX at lower cost. This reframes choice as a backbone-pipeline tradeoff rather than a preference for the strongest model. At the high-budget end, GPT-5.4's stack attains the highest EX, but its 2.29 pp advantage over Gemini-2.5-Flash's stack comes at more than the total cost.
Spider generalization. To test cross-benchmark transfer, we apply the BIRD-derived stacks unchanged to Spider. As shown in Figure 6, all four stacks improve EX over their respective lean baselines, with gains ranging from +3.68 to +6.77 pp. The backbone-pipeline tradeoff persists on Spider: the DeepSeek-V4-Flash and Gemini-2.5-Flash stacks both Pareto-dominate GPT-5.4's lean baseline. The GPT-4o-mini stack nearly matches that baseline (80.17% vs. 80.27%) at 1.879, while the DeepSeek-V4-Flash and Gemini-2.5-Flash stacks surpass it, reaching 82.01% and 84.72% at lower costs of 1.172, respectively. GPT-5.4's stack achieves the highest EX of 87.04%, but its 2.32 pp advantage over Gemini-2.5-Flash's stack requires 5.62× the total cost overall.
5.3 Cross-Module and -Model Conclusion
Cross-module composition is backbone-dependent, and at moderate budgets the cost-efficient frontier runs through stacked mid-tier pipelines rather than lean configurations on frontier backbones. Marginal results remain useful for stack construction, but interactions shape how module gains combine. Applying the BIRD-derived stacks unchanged to Spider shows that the resulting backbone-pipeline tradeoff extends beyond BIRD. Table 4 reports a separate stack for each backbone; § 6 distills these results into a unified guideline and evaluates it on five diverse additional models.
Table 5: Guideline validation on additional backbones. EX (%) and total API cost in USD are measured on BIRD; parenthesized values report EX in percentage points over Tier 1. T1–T3 denote three progressively richer configurations, ranging from the lean baseline to the full cost-aware pipeline.
| Backbone | EX (%) | Cost | ||||
|---|---|---|---|---|---|---|
| T1 | T2 | T3 | T1 | T2 | T3 | |
| Llama-3.1-8B-Instruct | 37.61 | 40.22 (+2.61) | 44.07 (+6.46) | 0.05 | 0.06 | 0.09 |
| Qwen3-32B | 50.59 | 52.80 (+2.21) | 55.48 (+4.89) | 0.43 | 0.52 | 0.93 |
| o3-mini | 54.11 | 55.87 (+1.76) | 59.97 (+5.87) | 5.67 | 6.40 | 12.67 |
| Qwen3-235B | 57.82 | 59.06 (+1.24) | 61.80 (+3.98) | 4.55 | 5.76 | 11.36 |
| Claude Sonnet 4.5 | 62.71 | 65.25 (+2.54) | 70.34 (+7.63) | 8.62 | 9.65 | 18.94 |
6 Cost-Efficient Configuration Guideline
The per-backbone stacks in § 5.2 are backbone-specific selections derived from per-paradigm evaluation and therefore cannot be assumed in advance when configuring a new system. The practical question is instead whether the recurring patterns across these stacks can be compressed into a small set of configurations that requires only coarse knowledge of the backbone, rather than a new paradigm search for every model. This section distills the preceding single-module and stacking results into such a prescriptive guideline, examines the empirical patterns behind its recommendations, and directly evaluates its transfer to five additional validation backbones spanning diverse capability levels and reasoning behaviors.
6.1 From Stacks to a Tiered Guideline
We distill the single-module and stacking results in our study into three clear incremental tiers for practical use. Tier 1 is the bare backbone running a single-pass baseline. Tier 2 adds (Execution-Feedback Refinement), the only paradigm that improves all four primary backbones at consistently low cost. Tier 3 further adds (Masked Question Similarity) and (Pseudo-SQL Guided Linking), together with a backbone-conditional generation strategy: (CoT-Enhanced) for non-reasoning backbones and (trivial) for reasoning-capable ones, following the split identified in § 4.2.
These choices are not obtained by simply taking the highest-accuracy paradigm in each module. They preserve the components that recur across the cost-efficient stacks in § 5.2. All four stacks contain , , and , whereas Generation Strategy is the main component that changes with backbone reasoning behavior: the three non-reasoning stacks use , while DeepSeek-V4-Flash retains . This recurring structure in turn motivates a fixed tier definition with the generation choice conditioned on the backbone. The resulting guideline recommends a tier from the backbone profile and accuracy-cost preference, without requiring per-paradigm search for a new backbone. Figure 7 summarizes the resulting tier construction and backbone-conditioned selection rule.
Are These Modules Worth Their Cost? A Paradigm-Level Accuracy-Cost Analysis of In-context Learning Text-to-SQL
[Tier Construction]
Bare-backbone baseline. Use the single-pass baseline with all modules at their trivial settings.
T1: Bare backbone (N=1).
Universal refinement rule. is the only paradigm that improves all tested backbones at consistently low cost.
T2: T1 + .
Backbone-conditioned stacking rule. persist across backbone stacks, while generation follows the reasoning split:
T3: T2 + .
[Candidate Selection]
Cost-efficient setting. Candidate Selection faces a fixed-pool recall ceiling and sampling overhead, so it is excluded from the cost-efficient tiers.
Accuracy-first option. When cost is secondary, Candidate Selection may be added for further accuracy, subject to the candidate-pool recall ceiling.
[Tier Selection]
Reasoning
T2 is the cost-efficient default; consider T3 when extra accuracy justifies the cost.
Small / mid-tier
non-reasoning
Prefer T3.
Frontier
Use T3 when maximum EX is prioritized; otherwise consider a cheaper backbone with T3.
Figure 7: Evidence-backed cost-efficient configuration guideline distilled from the single-module and stacking analyses. The three tiers progressively incorporate paradigms supported by robust accuracy-cost evidence, while Candidate Selection is treated separately due to its sampling overhead and fixed-pool recall ceiling. The recommended tier further depends on backbone capability and reasoning behavior.
6.2 Patterns Behind the Guideline
Pipeline engineering is most cost-effective on small and mid-tier non-reasoning backbones. The Tier 1 to Tier 3 improvement is largest on the smallest backbone in our study, while a mid-tier non-reasoning backbone at Tier 3 costs a fraction of a frontier backbone at Tier 1 ( ). For example, Gemini-2.5-Flash at Tier 3 reaches higher EX than GPT-5.4 at Tier 1 while costing substantially less in our setting. The guideline therefore favors Tier 3 for these backbones, while using Tier 2 as the cost-efficient default for reasoning backbones and reserving Tier 3 on frontier backbones for accuracy-first settings; tests this pattern on five backbones.
6.3 Validation on Additional Backbones
To test whether the guideline transfers beyond the four primary backbones from which its tier structure was derived, we directly apply the three prescribed tiers to five additional validation backbones spanning different capability levels and reasoning behaviors, without conducting any per-paradigm search or adapting the tier composition to individual models. All five validation backbones consistently improve from Tier 1 to both Tier 2 and Tier 3. As shown in Table 5, Tier 2 gains range from +1.24 to +2.61 pp, while Tier 3 gains range from +3.98 to +7.63 pp. The improvement is observed across capability levels and both non-reasoning and reasoning settings, indicating that the fixed tier compositions continue to transfer beyond the four primary backbones used for stack construction. The corresponding costs also follow the intended tier ordering, with Tier 2 adding limited overhead and Tier 3 trading a larger cost increase for higher EX across five validation backbones.
7 Related Work
Empirical Analysis of Text-to-SQL. Several studies analyze specific components or configurations of Text-to-SQL systems. Li et al. [17] introduce NL2SQL360, a multi-angle evaluation framework that compares NL2SQL methods across data domains, SQL characteristics, and evaluation settings, and further explores the selection of solutions for different application needs. At the component level, Maamari et al. [22] revisit explicit schema linking and show that stronger LLMs can often operate directly over the full schema when it fits within the context window, avoiding errors caused by filtering necessary elements. In contrast, Yuan et al. [42] improve schema linking by formulating the selection of relevant schema elements as a constrained knapsack optimization. For generation, Tai et al. [31] also show that iterative least-to-most prompting can be unnecessary and that overly detailed reasoning may propagate errors.
Recent systems increasingly combine multiple such mechanisms into elaborate inference-time pipelines. CHASE-SQL [24] combines multi-path candidate generation with preference-based pairwise selection; DeepEye-SQL [16] organizes linking, diverse generation, verification, and candidate selection through a workflow; and Agentar-Scale-SQL [34] orchestrates internal reasoning, iterative refinement, and parallel generation and selection for test-time scaling. These systems demonstrate the benefit of increasingly sophisticated pipeline orchestration, but still primarily optimize integrated system designs and evaluate components within their own pipelines. Our study complements these efforts by isolating each module's marginal accuracy-cost contribution under one controlled implementation across multiple backbones; the schema-linking and CoT trends further extend prior observations to this cost-aware setting.
Cost-Aware LLM Systems. Cost-aware LLM deployment has been studied at three complementary layers. At the model-selection layer, FrugalGPT [3], SATER [28], and RouteLLM [23] use routing or cascading to navigate tradeoffs between performance and cost. At the inference-resource layer, LLMLingua [14] and Sketch-of-Thought [1] reduce prompt or reasoning token usage, while recent work studies compute-optimal and budget-aware allocation of test-time reasoning resources [21, 30]. At the workflow layer, CATP LLM [37] explicitly balances task performance against tool-execution cost. Within Text-to-SQL, Dönder et al. [5] propose N-rep, which reduces inference cost through multiple schema representations without CoT or self-consistency. These efforts optimize model choice, inference resources, or workflow execution; we instead directly ask which modules of the Text-to-SQL pipeline justify their added cost.
Jiayan Lin, Yujia Liu, Zijin Hong, Zheng Yuan, Yilin Xiao, Hao Chen, Qinggang Zhang, Xiao Huang, and Feiran Huang
8 Conclusion
We studied the ICL Text-to-SQL pipeline as a modular object in its own right, isolating the marginal contribution and cost of each design paradigm under a unified controlled framework across four backbones. Execution-feedback refinement is the only paradigm that improves all four primary backbones at consistently low cost, making it a safe first addition; most others pay off only under backbone-dependent conditions. Token accounting suggests that input demand is closely tied to pipeline structure, whereas output demand is sensitive to backbone generation behavior. Building on this analysis, we found that a fixed budget is often better spent engineering a richer pipeline over a mid-tier backbone than upgrading to a frontier model with a lean pipeline. The BIRD-derived stacks also transfer to Spider, where all four improve accuracy and the backbone-pipeline tradeoff persists. We distill these observations into a backbone-dependent, tiered guideline that transfers to five additional validation backbones, offering practitioners a more practical, cost-aware starting point for configuring ICL Text-to-SQL systems than aggregate accuracy alone in practical settings.
9 Ethical Considerations
This work evaluates text-to-SQL methods on the publicly available BIRD benchmark [19]. Nevertheless, deployed text-to-SQL systems, especially in real world database applications, can expose sensitive database contents or execute harmful queries when model outputs are incorrect or maliciously prompted. Practical deployments should therefore enforce least-privilege access, use read-only execution whenever possible, validate generated SQL, sandbox query execution, and maintain proper human oversight and audit logs.
References
[1] Simon A. Aytes, Jinheon Baek, and Sung Ju Hwang. 2025. Sketch-of-Thought: Efficient LLM Reasoning with Adaptive Cognitive-Inspired Sketching. In Empirical Methods in Natural Language Processing (EMNLP).
[2] Zhenbiao Cao, Yuanlei Zheng, Zhihao Fan, Xiaojin Zhang, Wei Chen, and Xiang Bai. 2024. RSL-SQL: Robust Schema Linking in Text-to-SQL Generation. arXiv preprint arXiv:2411.00073 (2024).
[3] Lingjiao Chen, Matei Zaharia, and James Zou. 2024. FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance. Transactions on Machine Learning Research (TMLR) (2024).
[4] Minghang Deng, Ashwin Ramachandran, Canwen Xu, Lanxiang Hu, Zhewei Yao, Anupam Datta, and Hao Zhang. 2025. ReFoRCE: A Text-to-SQL Agent with Self-Refinement, Format Restriction, and Column Exploration. In ICLR 2025 Workshop: VerifAI: AI Verification in the Wild.
[5] Yusuf Denizay Dönder, Derek Hommel, Andrea W Wen-Yi, David Mimno, and Unso Eun Seo Jo. 2025. Cheaper, Better, Faster, Stronger: Robust Text-to-SQL without Chain-of-Thought or Fine-Tuning. arXiv preprint arXiv:2505.14174 (2025).
[6] Xuemei Dong, Chao Zhang, Yuhang Ge, Yuren Mao, Yunjun Gao, Lu Chen, Jinshu Lin, and Dongfang Lou. 2023. C3: Zero-shot Text-to-SQL with ChatGPT. arXiv:2307.07306 (2023).
[7] Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Amy Yang, Angela Fan, et al. 2024. The llama 3 herd of models. arXiv preprint arXiv:2407.21783 (2024).
[8] Dawei Gao, Haibin Wang, Yaliang Li, Xiuyu Sun, Yichen Qian, Bolin Ding, and Jingren Zhou. 2024. Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation. In International Conference on Very Large Data Bases (VLDB).
[9] Yingqi Gao, Yifu Liu, Xiaoxia Li, Xiaorong Shi, Yin Zhu, Yiming Wang, Shiqi Li, Wei Li, Yuntao Hong, Zhiling Luo, Jinyang Gao, Liyu Mou, and Yu Li. 2024. Xiyan-sql: A multi-generator ensemble framework for text-to-sql. arXiv preprint arXiv:2411.08599 (2024).
[10] Zijin Hong, Hao Chen, Zheng Yuan, Qinggang Zhang, Luyao Zhuang, Qing Liao, Feiran Huang, Yangqiu Song, and Xiao Huang. 2026. ErrorLLM: Modeling SQL Errors for Text-to-SQL Refinement. In Conference on Knowledge Discovery and Data Mining (KDD).
[11] Zijin Hong, Hao Wu, Su Dong, Junnan Dong, Yilin Xiao, Yujing Zhang, Zhu Wang, Feiran Huang, Linyi Li, Hongxia Yang, and Xiao Huang. 2026. Benchmarking LLMs' mathematical reasoning with unseen random variables questions. In Conference on Artificial Intelligence (AAAI).
[12] Zijin Hong, Zheng Yuan, Hao Chen, Qinggang Zhang, Feiran Huang, and Xiao Huang. 2024. Knowledge-to-SQL: Enhancing SQL Generation with Data Expert LLM. In Findings of Association for Computational Linguistics (ACL).
[13] Zijin Hong, Zheng Yuan, Qinggang Zhang, Hao Chen, Junnan Dong, Feiran Huang, and Xiao Huang. 2025. Next-Generation Database Interfaces: A Survey of LLM-based Text-to-SQL. IEEE Transactions on Knowledge and Data Engineering (TKDE) (2025).
[14] Huiqiang Jiang, Qianhui Wu, Chin-Yew Lin, Yuqing Yang, and Lili Qiu. 2023. LLLingua: Compressing Prompts for Accelerated Inference of Large Language Models. In Empirical Methods in Natural Language Processing (EMNLP).
[15] Dongjun Lee, Choongwon Park, Jaehyuk Kim, and Heesoo Park. 2025. MCS-SQL: Leveraging Multiple Prompts and Multiple-Choice Selection For Text-to-SQL Generation. In International Conference on Computational Linguistics (COLING).
[16] Boyan Li, Chong Chen, Zhujun Xue, Yinan Mei, and Yuyu Luo. 2026. DeepEye-SQL: A software-engineering-inspired text-to-sql framework. In Conference on Management of Data (SIGMOD).
[17] Boyan Li, Yuyu Luo, Chengliang Chai, Guoliang Li, and Nan Tang. 2024. The Dawn of Natural Language to SQL: Are We Fully Ready?. In International Conference on Very Large Data Bases (VLDB).
[18] Boyan Li, Jiayi Zhang, Ju Fan, Yanwei Xu, Chong Chen, Nan Tang, and Yuyu Luo. 2025. Alpha-SQL: Zero-Shot Text-to-SQL using Monte Carlo Tree Search. In International Conference on Machine Learning (ICML).
[19] Jinyang Li, Binyuan Hui, Ge Qu, Jiaxi Yang, Binhua Li, Bowen Li, Bailin Wang, Bowen Qin, Ruiying Geng, Nan Huo, Xuanhe Zhou, Chenhao Ma, Guoliang Li, Kevin Chang, Fei Huang, Reynold Cheng, and Yongbin Li. 2023. Can LLM Already Serve as A Database Interface? A Big Bench for Large-Scale Database Grounded Text-to-SQLs. In Advances in Neural Information Processing Systems (NeurIPS).
[20] Zhishuai Li, Xiang Wang, Jingjing Zhao, Sun Yang, Guoqing Du, Xiaoru Hu, Bin Zhang, Yuxiao Ye, Ziyue Li, Rui Zhao, and Hangyu Mao. 2025. Pet-sql: A prompt-enhanced two-round refinement of text-to-sql with cross-consistency. In International Conference on Database Systems for Advanced Applications (DASFAA).
[21] Junhong Lin, Xinyue Zeng, Jie Zhu, Song Wang, Julian Shun, Jun Wu, and Dawei Zhou. 2026. Plan and Budget: Effective and Efficient Test-Time Scaling on Reasoning Large Language Models. In International Conference on Learning Representations (ICLR).
[22] Karime Maamari, Fadhil Abubaker, Daniel Jaroslawicz, and Amine Mhedhbi. 2024. The Death of Schema Linking? Text-to-SQL in the Age of Well-Reasoned Language Models. In NeurIPS 2024 Third Table Representation Learning Workshop (NeurIPS).
[23] Isaac Ong, Amjad Almahairi, Vincent Wu, Wei-Lin Chiang, Tianhao Wu, Joseph E Gonzalez, M Kadous, and Ion Stoica. 2025. RouteLLM: Learning to Route LLMs from Preference Data. In International Conference on Learning Representations (ICLR).
[24] Mohammadreza Pourreza, Hailong Li, Ruoxi Sun, Yeounoh Chung, Shayan Talaei, Gaurav Tarlok Kakkar, Yu Gan, Amin Saberi, Fatma Ozcan, and Sercan O Arik. 2025. Chase-sql: Multi-path reasoning and preference optimized candidate selection in text-to-sql. In International Conference on Learning Representations (ICLR).
[25] Mohammadreza Pourreza and Davood Rafiei. 2023. Din-sql: Decomposed in-context learning of text-to-sql with self-correction. In Advances in Neural Information Processing Systems (NeurIPS).
[26] Ge Qu, Jinyang Li, Bowen Qin, Xiaolong Li, Nan Huo, Chenhao Ma, and Reynold Cheng. 2025. SHARE: An SLM-based Hierarchical Action CorRection Assistant for Text-to-SQL. In Association for Computational Linguistics (ACL).
[27] Tonghui Ren, Yuankai Fan, Zhenying He, Ren Huang, Jiaqi Dai, Can Huang, Yinan Jing, Kai Zhang, Yifan Yang, and X. Sean Wang. 2024. PURPLE: Making a Large Language Model a Better SQL Writer. In International Conference on Data Engineering (ICDE).
[28] Yuanzhe Shen, Yide Liu, Zisu Huang, Ruicheng Yin, Xiaoqing Zheng, and Xuanjing Huang. 2025. SATER: A Self-Aware and Token-Efficient Approach to Routing and Cascading. In Empirical Methods in Natural Language Processing (EMNLP).
[29] Jie Shi, Bo Xu, Jiaqing Liang, Yanghua Xiao, Jia Chen, Chenhao Xie, Peng Wang, and Wei Wang. 2025. Gen-SQL: Efficient Text-to-SQL By Bridging Natural Language Question And Database Schema With Pseudo-Schema. In International Conference on Computational Linguistics (COLING).
[30] Charlie Snell, Jaehoon Lee, Kelvin Xu, and Aviral Kumar. 2025. Scaling LLM Test-Time Compute Optimally Can be More Effective than Scaling Parameters for Reasoning. In International Conference on Learning Representations (ICLR).
[31] Chang-Yu Tai, Ziru Chen, TIANSHU ZHANG, Xiang Deng, and Huan Sun. 2023. Exploring Chain of Thought Style Prompting for Text-to-SQL. In Empirical Methods in Natural Language Processing (EMNLP).
Are These Modules Worth Their Cost? A Paradigm-Level Accuracy-Cost Analysis of In-context Learning Text-to-SQL
[32] Shayan Talaei, Mohammadreza Pourreza, Yu-Chen Chang, Azalia Mirhoseini, and Amin Saberi. 2024. CHESS: Contextual Harnessing for Efficient SQL Synthesis. arXiv:2405.16755 (2024).
[33] Bing Wang, Changyu Ren, Jian Yang, Xinnian Liang, Jiaqi Bai, LinZheng Chai, Zhao Yan, Qian-Wen Zhang, Di Yin, Xing Sun, and Zhoujun Li. 2025. MAC-SQL: A Multi-Agent Collaborative Framework for Text-to-SQL.. In International Conference on Computational Linguistics (COLING).
[34] Pengfei Wang, Baolin Sun, Xuemei Dong, Yaxun Dai, Hongwei Yuan, Mengdie Chu, Yingqi Gao, Xiang Qi, Peng Zhang, and Ying Yan. 2025. Agentar-Scale-SQL: Advancing Text-to-SQL through Orchestrated Test-Time Scaling. arXiv preprint arXiv:2509.24403 (2025).
[35] Yihan Wang, Peiyu Liu, and Xin Yang. 2025. LinkAlign: Scalable Schema Linking for Real-World Large-Scale Multi-Database Text-to-SQL. In Empirical Methods in Natural Language Processing (EMNLP).
[36] Ziyang Wang, Yuanlei Zheng, Zhenbiao Cao, Xiaojin Zhang, Zhongyu Wei, Pei Fu, Zhenbo Luo, Wei Chen, and Xiang Bai. 2026. AutoLink: Autonomous Schema Exploration and Expansion for Scalable Schema Linking in Text-to-SQL at Scale. In Conference on Artificial Intelligence (AAAI).
[37] Duo Wu, Jinghe Wang, Yuan Meng, Yanning Zhang, Le Sun, and Zhi Wang. 2025. CATP-LLM: Empowering Large Language Models for Cost-Aware Tool Planning. In International Conference on Computer Vision (ICCV).
[38] Xiangjin Xie, Guangwei Xu, Lingyan Zhao, and Ruijie Guo. 2025. OpenSearch-SQL: Enhancing Text-to-SQL with Dynamic Few-shot and Consistency Alignment. In Conference on Management of Data (SIGMOD).
[39] Yuanzhen Xie, Xinzhou Jin, Tao Xie, Mingxiong Lin, Liang Chen, Chenyun Yu, Lei Cheng, Chengxiang Zhuo, Bo Hu, and Zang Li. 2024. Decomposition for Enhancing Attention: Improving LLM-based Text-to-SQL through Workflow Paradigm. In Findings of Association for Computational Linguistics (ACL).
[40] Hongyu Yao, Zijin Hong, Hao Chen, Zhiqing Li, Qijie Shen, Zuobin Ying, Qihua Feng, Huan Gong, and Feiran Huang. 2026. Macro Graph of Experts for Billion-Scale Multi-Task Recommendation. In Conference on Knowledge Discovery and Data Mining (KDD).
[41] Tao Yu, Rui Zhang, Kai Yang, Michihiro Yasunaga, Dongxu Wang, Zifan Li, James Ma, Irene Li, Qingning Yao, Shanelle Roman, Zilin Zhang, and Dragomir Radev. 2018. Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Task. In Empirical Methods in Natural Language Processing (EMNLP).
[42] Zheng Yuan, Hao Chen, Zijin Hong, Qinggang Zhang, Feiran Huang, Qing Li, and Xiao Huang. 2025. Knapsack Optimization-based Schema Linking for LLM-based Text-to-SQL Generation. In International Conference on Data Engineering (ICDE).
Jiayan Lin, Yujia Liu, Zijin Hong, Zheng Yuan, Yilin Xiao, Hao Chen, Qinggang Zhang, Xiao Huang, and Feiran Huang
Table 6: Per-backbone EX (%) on BIRD dev (1,534 examples). EX [95% CI] is the percentage-point gain over the matched-budget baseline ( for Candidate Selection; otherwise), and CPP is incremental USD/pp. “–” denotes undefined CPP, “*” Pareto domination, and the / keys mark the best/second best results.
| ID | GPT-4o-mini | DeepSeek-V4-Flash | Gemini-2.5-Flash | GPT-5.4 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| EX ↑ | ΔEX ↑ | [95% CI] | CPP ↓ | EX ↑ | ΔEX ↑ | [95% CI] | CPP ↓ | EX ↑ | ΔEX ↑ | [95% CI] | CPP ↓ | EX ↑ | ΔEX ↑ | [95% CI] | CPP ↓ | |
| Example Retrieval | ||||||||||||||||
| 50.07 | +0.33 | [-0.01, +0.67] | 0.207 | 56.06 | -0.26 | [-0.57, +0.05] | - | 60.43 | +0.59 | [+0.06, +1.12] | 0.401 | 62.58 | +1.30 | [+0.63, +1.97] | 0.995 | |
| 50.65 | +0.91 | [+0.26, +1.56] | 0.144 | 56.84 | +0.52 | [+0.01, +1.03] | 0.326 | 61.28 | +1.43 | [+0.74, +2.13] | 0.417 | 63.69 | +2.41 | [+1.42, +3.40] | 0.957 | |
| 49.80 | +0.07 | [-0.16, +0.29] | 7.259 | 57.11 | +0.78 | [+0.06, +1.50] | 0.660 | 60.10 | +0.26 | [-0.18, +0.70] | 5.317 | 63.49 | +2.22 | [+1.28, +3.15] | 3.417 | |
| Schema Linking | ||||||||||||||||
| 49.87 | +0.13 | [-0.13, +0.39] | - | 55.93 | -0.39 | [-0.75, -0.03] | - | 59.13 | -0.72 | [-1.27, -0.16] | - | 60.63 | -0.65 | [-1.19, -0.11] | - | |
| 52.15 | +2.41 | [+1.49, +3.33] | 0.075 | 57.04 | +0.72 | [+0.08, +1.36] | 0.491 | 61.15 | +1.30 | [+0.63, +1.98] | 0.575 | 62.39 | +1.11 | [+0.45, +1.77] | 3.293 | |
| 51.11 | +1.37 | [+0.69, +2.05] | 0.109 | 56.19 | -0.13 | [-0.39, +0.13] | - | 60.89 | +1.04 | [+0.42, +1.67] | 0.599 | 60.82 | -0.46 | [-0.95, +0.03] | - | |
| 51.83 | +2.09 | [+1.23, +2.95] | 0.090 | 55.87 | -0.46 | [-0.88, -0.04] | - | 60.76 | +0.91 | [+0.32, +1.51] | 0.847 | 59.97 | -1.30 | [-1.98, -0.63] | - | |
| 52.93 | +3.19 | [+2.11, +4.27] | 0.271 | 56.52 | +0.20 | [-0.09, +0.49] | 4.262 | 61.34 | +1.50 | [+0.79, +2.21] | 1.224 | 62.06 | +0.78 | [+0.21, +1.35] | 20.870 | |
| SQL Generation | ||||||||||||||||
| 49.74 | 0.00 | - | 56.32 | 0.00 | - | 59.84 | 0.00 | - | 61.28 | 0.00 | - | |||||
| 53.98 | +4.24 | [+2.96, +5.52] | 0.026 | 55.93 | -0.39 | [-0.75, -0.03] | - | 62.71 | +2.87 | [+1.80, +3.94] | 0.170 | 62.84 | +1.56 | [+0.80, +2.32] | 1.723 | |
| 51.24 | +1.50 | [+0.77, +2.23] | 0.093 | 56.13 | -0.20 | [-0.49, +0.09] | - | 60.76 | +0.91 | [+0.32, +1.51] | 0.976 | 63.10 | +1.83 | [+1.00, +2.65] | 2.285 | |
| Candidate Selection | ||||||||||||||||
| 51.11 | +1.43 | [+0.74, +2.13] | * | 57.30 | +0.85 | [+0.19, +1.51] | * | 60.89 | +0.85 | [+0.27, +1.43] | * | 62.71 | +1.30 | [+0.63, +1.97] | * | |
| 50.52 | +0.85 | [+0.36, +1.34] | 0.771 | 59.00 | +2.54 | [+1.47, +3.61] | 0.333 | 61.60 | +1.56 | [+0.80, +2.32] | 1.806 | 63.82 | +2.41 | [+1.42, +3.40] | 7.249 | |
| 51.17 | +1.50 | [+0.79, +2.21] | 1.389 | 58.54 | +2.09 | [+1.14, +3.04] | 0.953 | 61.93 | +1.89 | [+1.04, +2.74] | 2.858 | 63.89 | +2.48 | [+1.48, +3.48] | 15.975 | |
| Refinement | ||||||||||||||||
| 54.63 | +4.89 | [+3.53, +6.25] | 0.016 | 58.15 | +1.83 | [+0.99, +2.67] | 0.040 | 62.32 | +2.48 | [+1.48, +3.48] | 0.026 | 63.30 | +2.02 | [+1.15, +2.89] | 0.297 | |
| 51.83 | +2.09 | [+1.23, +2.95] | 0.305 | 56.58 | +0.26 | [-0.05, +0.57] | 2.708 | 60.95 | +1.11 | [+0.45, +1.77] | 1.964 | 62.06 | +0.78 | [+0.21, +1.35] | 18.680 | |
| 53.26 | +3.52 | [+2.38, +4.66] | 0.276 | 59.97 | +3.65 | [+2.47, +4.83] | 0.365 | 63.04 | +3.19 | [+2.08, +4.30] | 1.016 | 64.02 | +2.74 | [+1.68, +3.80] | 7.769 | |
A Full Taxonomy Mapping
Table 7 maps 24 ICL Text-to-SQL methods to paradigms across five pipeline modules. A checkmark indicates documented use of a paradigm, while a dash indicates that such use is not established in the original paper. For Direct LLM Linking and LLM-Based Preference Selection, sub-paradigm distinctions ( vs. and vs. ) are recorded within cells rather than assigned separate columns.
Multi-paradigm cells. A method may instantiate multiple paradigms within one module. This occurs mainly in Generation Strategy, where systems combine direct, CoT-enhanced, and decomposition-based generators, and in Schema Linking, where retrieval-based and LLM-based signals are combined before SQL generation.
Classification protocol. We classify each method according to the primary system reported in the original paper, excluding ablation variants. When the paradigm is not stated explicitly, we infer it from the provided prompts or pseudocode; if neither provides sufficient evidence, the cell is marked as – in the final taxonomy table.
B Paradigm Implementation Details
This section details the controlled implementations of the 17 paradigm-level configurations evaluated in the main paper. We organize them into pre-processing (Example Retrieval and Schema Linking; Figure 8), SQL generation (Generation Strategy; Figure 9), and post-processing (Candidate Selection and Refinement; Figure 10).
Box layout. Each module card specifies its shared inputs, backbone, and fallback behavior; maps paradigms to mechanisms and per-query LLM calls; notes auxiliary calls or behavior and their cost treatment; and identifies the trivial baseline used in the main marginal analysis for controlled comparison across paradigms..
C API Pricing
All USD costs reported in the main paper and this supplement are calculated using the API prices in Table 8, recorded on May 2, 2026. For each benchmark, the total configuration cost is the sum of input-and output-token charges over its full development split.
Table 8: API prices in USD per million tokens, recorded on May 2, 2026. For reasoning backbones, output charges include all billed reasoning tokens used in evaluation.
| Model | Input | Output |
|---|---|---|
| GPT-4o-mini | 0.15 | 0.60 |
| Gemini-2.5-Flash | 0.30 | 2.50 |
| DeepSeek-V4-Flash | 0.14 | 0.28 |
| GPT-5.4 | 2.50 | 15.00 |
| Llama-3.1-8B-Instruct | 0.02 | 0.04 |
| Qwen3-32B | 0.08 | 0.28 |
| o3-mini | 1.10 | 4.40 |
| Qwen3-235B-A22B (Thinking) | 0.23 | 2.30 |
| Claude Sonnet 4.5 | 3.00 | 15.00 |
D Detailed Results with Confidence Intervals
This section supplements the module-level results in Table 2 of the main paper. For every paradigm–backbone pair, Table 6 reports execution accuracy, its change from the matched-budget reference baseline with a corresponding 95% confidence interval, and cost per EX point (CPP). The main-paper table provides the corresponding API costs and mean per-question input/output-token counts.
Confidence intervals. For each paradigm–backbone pair, we compare per-example correctness with a matched-budget reference over the 1,534 BIRD development examples. Two-sided 95% confidence intervals for EX use the normal approximation to the paired difference based on discordant outcome counts, while significance is assessed by a two-sided McNemar's test at . Candidate Selection uses an reference, whereas all other paradigms use , isolating the paradigm effect from additional candidate sampling. We report the intervals directly to preserve effect direction and magnitude rather than only binary significance decisions.
Are These Modules Worth Their Cost? A Paradigm-Level Accuracy-Cost Analysis of In-context Learning Text-to-SQL
| Method | Venue | Example Retrieval | Schema Linking | Generation Strategy | Candidate Selection | Refinement | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Question Similarity | Masked Similarity | SQL Generation Similarity | Retrieval Linking | Pipeline Linking | Direct Linking | Agentic Linking | Direct Generation | Decomposition Generation | Execution Profile Selection | Execution Refinement | Self-Correction | Agentic Refinement | |
| AutoLink | AAAI'26 | - | - | - | - | - | ✓ | ✓ | ✓ | Pairwise | ✓ | - | - |
| DeepEye-SQL | SIGMOD'26 | - | ✓ | - | ✓ | Single-shot | - | ✓ | ✓ | Pairwise | - | - | ✓ |
| MAGIC | AAAI'25 | - | - | - | - | - | - | - | - | - | - | ✓ | - |
| GrammarScale-SQL | arXiv'25 | - | ✓ | - | - | - | ✓ | ✓ | ✓ | Pairwise | ✓ | ✓ | - |
| N-ep | arXiv'25 | - | ✓ | - | - | Single-shot | - | ✓ | - | Pairwise | - | - | - |
| Xian-SQL | arXiv'25 | - | ✓ | - | ✓ | Single-shot | - | ✓ | - | Scoring | ✓ | - | - |
| Gen-SQL | COLING'25 | ✓ | - | - | ✓ | - | - | ✓ | - | - | ✓ | - | - |
| MCS-SQL | COLING'25 | ✓ | ✓ | - | - | Two-stage | - | - | ✓ | Scoring | - | - | - |
| MAC-SQL | COLING'25 | - | - | - | - | Direct Linking | - | ✓ | ✓ | - | - | - | ✓ |
| PET-SQL | DASRA'25 | - | ✓ | - | ✓ | - | - | ✓ | - | - | - | - | - |
| LinkAlign | EMNIP'25 | - | - | - | - | - | ✓ | - | - | - | - | - | - |
| Alpha-SQL | ICML'25 | - | - | - | ✓ | Single-shot | - | - | ✓ | ✓ | ✓ | - | - |
| CHESS-SQL | ICML-W'25 | - | - | - | - | Two-stage | - | - | ✓ | - | Scoring | ✓ | - |
| CHASE-SQL | ICLR'25 | - | - | - | - | Two-stage | - | - | ✓ | ✓ | Pairwise | - | ✓ |
| Referee | ICLR-W'25 | - | - | - | - | Single-shot | - | ✓ | - | ✓ | - | - | ✓ |
| OpenSearch-SQL | SIGMOD'25 | - | ✓ | - | ✓ | Single-shot | - | - | ✓ | ✓ | - | ✓ | - |
| RSI-SQL | arXiv'24 | ✓ | - | - | ✓ | Single-shot | - | ✓ | - | - | Pairwise | ✓ | - |
| DEA-SQL | ACL-F'24 | ✓ | ✓ | - | - | Two-stage | - | ✓ | - | - | - | ✓ | - |
| PURPLE | ICDE'24 | - | - | ✓ | ✓ | Direct Linking | - | ✓ | - | - | - | ✓ | - |
| SuperSQL | VLDB'24 | ✓ | - | ✓ | ✓ | - | - | ✓ | - | ✓ | - | - | - |
| DAIL-SQL | VLDB'24 | ✓ | ✓ | - | - | - | ✓ | - | - | ✓ | - | - | - |
| CS-SQL | arXiv'23 | - | - | - | - | Two-stage | - | ✓ | - | ✓ | - | - | - |
| ACT-SQL | ERMLP'23 | ✓ | - | - | - | Direct Linking | - | - | ✓ | - | - | - | - |
| DN-SQL | NeurIPS'23 | - | - | - | - | Single-shot | - | - | ✓ | - | - | ✓ | - |
Table 7: Taxonomy of representative Text-to-SQL methods.
Jiayan Lin, Yujia Liu, Zijin Hong, Zheng Yuan, Yilin Xiao, Hao Chen, Qinggang Zhang, Xiao Huang, and Feiran Huang
Example Retrieval
Shared setup. All three paradigms retrieve from the BIRD training split using a frozen bge-large-en-v1 .5 encoder, with -normalized embeddings ranked by cosine similarity. Examples drawn from the target database are excluded to prevent leakage, and exact-duplicate questions are removed. The generator receives up to demonstrations, each rendered as the original question, its optional evidence annotation, and the gold SQL; no demonstration schema is included. Embeddings are precomputed once and cached.
| Paradigm | Retrieval signal | Shots |
|---|---|---|
| Question Similarity | Raw question embedding. | 3 |
| Masked Question Similarity | Question with schema-specific entities masked by the backbone before encoding; retrieval returns the original (unmasked) examples. | 3 |
| SQL Skeleton Similarity | Structural skeleton of a preliminary SQL draft, matched against skeletons of training gold SQL. | 3 |
Auxiliary LLM calls. issues one backbone call per query to produce the masked question; issues one call to draft the preliminary SQL from which the skeleton is extracted. requires no auxiliary call. All auxiliary calls use the same backbone as the main generator, at temperature 0; on an empty or malformed response, the paradigm falls back to the unmasked question () or to direct generation (). Skeleton extraction abstracts literals and non-keyword identifiers to placeholder tokens while preserving SQL keywords and operators.
Trivial baseline. Zero-shot generation with no retrieved demonstrations.
Schema Linking
Shared setup. Each paradigm receives the question, the full schema with column descriptions, and the optional evidence annotation, and returns a filtered schema for the generator; primary and foreign keys are always retained after filtering. Paradigms differ in who makes the linking decision. Malformed or empty responses fall back to the full schema, so no paradigm gains accuracy from its failure path. All auxiliary calls use the main backbone, so their cost is attributed to that backbone.
| Paradigm | Mechanism | Calls |
|---|---|---|
| Retrieval-Based | Embeds question keywords against per-column text, boosts columns whose cells match a keyword, and keeps the top-scoring tables and columns. | 1 |
| Pseudo-SQL Guided | Drafts a SQL query over the full schema, then keeps the referenced tables and columns. | 1 |
| Direct LLM, Single-shot | Asks the backbone once to select the needed tables and columns, then validates the names against the schema. | 1 |
| Direct LLM, Two-stage | Selects relevant tables first, then selects columns only within those tables. | 2 |
| Agentic | A proposer selects a schema slice, a verifier judges its sufficiency, and an optional second proposer revises it. | 1–3 |
Auxiliary LLM calls. All linking calls run on the main backbone at temperature 0. uses a frozen bge-large-en-v1 .5 encoder for its keyword-column matching. issues a variable number of calls: a single proposer call when its proposal is empty or unparsable, two calls when the verifier accepts the slice, and a third only when the verifier reports a concrete deficiency.
Trivial baseline. The full schema is passed to the generator unfiltered.
Figure 8: Controlled implementation of pre-processing modules: Example Retrieval and Schema Linking.
Are These Modules Worth Their Cost? A Paradigm-Level Accuracy-Cost Analysis of In-context Learning Text-to-SQL
Generation Strategy
Shared setup. All three paradigms receive the question, the schema (linked or full), and the optional evidence, and run on the main backbone at temperature 0 with a single sampled candidate—one generation call per query. Each parses the final SQL string from its own output and passes only that string downstream; when no SQL can be parsed, the query counts as incorrect.
| Paradigm | Mechanism | Calls |
|---|---|---|
| Direct | The backbone writes a single SQL query directly, returned in a fenced code block. | 1 |
| CoT-Enhanced | The backbone emits a step-by-step reasoning trace and the final SQL in one structured response. | 1 |
| Decomposition-Based | The backbone decomposes the question into sub-questions and sub-queries and returns an assembled final SQL, all in one structured response. | 1 |
Generation behavior. All three paradigms use a single backbone call; they differ only in what that call is asked to emit. In , reasoning and SQL are produced together and is therefore charged as additional output tokens rather than obtained from a separate planning call. In , the number of sub-questions is chosen by the model, and the final SQL is read directly from its output rather than assembled by executing sub-queries; likewise adds no extra call. SQL is parsed from a structured field where available (, ) or from the fenced block (), with a shared fallback that extracts a bare SELECT/WITH statement.
Trivial baseline. Direct generation ().
Figure 9: Controlled implementation of the generation stage: Generation Strategy.
Jiayan Lin, Yujia Liu, Zijin Hong, Zheng Yuan, Yilin Xiao, Hao Chen, Qinggang Zhang, Xiao Huang, and Feiran Huang
Candidate Selection
Shared setup. All selectors operate over the same pool of candidates, sampled from the direct-generation prompt on the main backbone at temperature 0.8—the same pool used by the reference baseline. Each selector returns one of the five candidates and never generates a new query.
| Paradigm | Mechanism | LLM calls |
|---|---|---|
| Execution-Based Voting | Executes all five candidates, groups them by result equivalence, and takes the earliest candidate in the largest group. | 0 |
| Scoring and Ranking | Shows the model all five candidates with their execution outcomes and asks it to pick the best. | 1 |
| Pairwise Comparison | Runs a single-elimination tournament, comparing the running winner against each remaining candidate. |
Selection behavior. All selectors first execute the five candidates and run on the main backbone at temperature 0. They differ in cost: issues no LLM call (execution only), a single call independent of , and calls (four at ), the dominant cost driver among the selectors.
Trivial baseline. Return the first candidate from the same candidate pool.
Refinement
Shared setup. Each paradigm receives the selected SQL, the question, the schema, and the optional evidence, and returns a final SQL that replaces the original for evaluation; if refinement yields no valid SQL, the original (or most recent valid revision) is kept. All refinement calls run on the main backbone at temperature 0.
| Paradigm | Mechanism | LLM calls |
|---|---|---|
| Execution-Feedback | Executes the SQL first, then asks the model to rewrite it only when execution errors or returns no rows. | 0–1 |
| Self-Correction | Asks the model to review the SQL against a generic error checklist, without executing it. | 1 |
| Agentic | A corrector revises the SQL using execution feedback, a verifier reviews the result, and the corrector may revise once more. | 1–3 |
Refinement behavior. The paradigms differ in when they fire, which is what separates their cost. is failure gated: it runs one diagnostic execution and issues a model call only on an error or empty result, so its average call count per query is below one—the reason it adds accuracy at near-zero cost. and instead fire on every query: issues exactly one review call with no execution feedback, while issues two to three calls across its corrector and verifier roles. Each paradigm performs at most one revision round ( at most one additional corrector pass).
Trivial baseline. The selected SQL is returned unchanged, with no refinement call.
Figure 10: Controlled implementation of post-processing modules: Candidate Selection and Refinement.