Are These Modules Worth Their Cost? A Paradigm-Level Accuracy-Cost Analysis of In-context Learning Text-to-SQL
Organizations: Jinan University Guangzhou, China · The Hong Kong Polytechnic University Kowloon, Hong Kong · City University of Macau Taipa, Macau · Jilin University Changchun, 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.
Figures & tables
| Paradigm | 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 | |
| Baselines | ||||||||||||||||||||
| 49.74 | 0.394 | – | 1510 | 51 | 56.32 | 0.547 | – | 1557 | 494 | 59.84 | 1.035 | – | 1642 | 73 | 61.28 | 7.305 | – | 1509 | 66 | |
| 49.67 | 1.972 | – | 7550 | 255 | 56.45 | 2.756 | – | 7787 | 2523 | 60.04 | 5.219 | – | 8222 | 374 | 61.41 | 35.864 | – | 7545 | 301 | |
| 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 | ||||||||||||||||||||
| Backbone | Paradigm | EX | Cost | CPP | IN | OUT |
| Qwen3-235B (Thinking) | 57.82 | 4.55 | – | 1555 | 1134 | |
| 58.02 ( ) | 5.22 | 3.426 | 1529 | 1327 | ||
| 57.30 ( ) | 5.84 | – | 1596 | 1495 | ||
| o3-mini | 54.11 | 5.67 | – | 1509 | 463 | |
| 53.46 ( ) | 5.83 | – | 1546 | 477 | ||
| 53.06 ( ) | 7.08 | – | 1538 | 665 |
| GPT-4o-mini | DeepSeek-V4-Flash | Gemini-2.5-Flash | GPT-5.4 | |||||||||
| Combination | EX | Total Cost | EX | Total Cost | EX | Total Cost | EX | Total Cost | ||||
| 56.84 | 0.612 | 57.82 | 0.743 | 65.12 | 1.971 | 64.60 | 10.310 | |||||
| 55.87 | 1.143 | 55.22 | 1.457 | 63.62 | 3.856 | 64.73 | 24.751 | |||||
| 57.17 | 1.525 | 59.84 | 2.004 | 66.04 | 4.748 | 65.19 | 32.632 | |||||
| 54.50 | 0.685 | 56.39 | 0.793 | 64.34 | 2.217 | 65.32 | 12.190 | |||||
| 55.74 | 0.657 | 57.89 | 0.733 | 63.43 | 1.956 | 65.38 | 12.114 | |||||
| Backbone | Stack | (%) | Cost |
| GPT-4o-mini | 58.02 ( ) | 0.759 | |
| DeepSeek-V4-Flash | 61.15 ( ) | 1.584 | |
| Gemini-2.5-Flash | 67.14 ( ) | 2.916 | |
| GPT-5.4 | 69.43 ( ) | 16.237 |
| (%) | Cost | |||||
| Backbone | T1 | T2 | T3 | T1 | T2 | T3 |
| Llama-3.1-8B-Instruct | 37.61 | 40.22 | 44.07 | 0.05 | 0.06 | 0.09 |
| Qwen3-32B | 50.59 | 52.80 | 55.48 | 0.43 | 0.52 | 0.93 |
| o3-mini | 54.11 | 55.87 | 59.97 | 5.67 | 6.40 | 12.67 |
| Qwen3-235B | 57.82 | 59.06 | 61.80 | 4.55 | 5.76 | 11.36 |
| Claude Sonnet 4.5 | 62.71 | 65.25 | 70.34 | 8.62 | 9.65 | 18.94 |
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| 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 |