Copyright © 2026 Authors retain the copyright of this article. This article is an open access article distributed under the Creative Commons Attribution License which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
@article{209580,
author = {SR Shyamm and Jithesh Gopalan Srinivasan},
title = {Execution-Verified Natural Language to PostgreSQL: A Fine-Tuned Small Language Model that Returns the Fastest Query, Equivalent Alternatives and an Explanation},
journal = {International Journal of Innovative Research in Technology},
year = {2026},
volume = {13},
number = {5},
pages = {2295-2305},
issn = {2349-6002},
url = {https://ijirt.org/article?manuscript=209580},
abstract = {A generated SQL query can be valid and still be wrong, slow, or correct only by coincidence on today’s data. We present a system that translates questions into PostgreSQL and checks every answer by running it. Qwen3.5 models with 4 and 9 billion parameters are fine-tuned with low-rank adaptation on 95,661 examples from a synthetic multi-dialect corpus and the Spider and BIRD benchmarks, all transpiled to PostgreSQL with sqlglot and verified by execution; prompts include example values and, for BIRD, column descriptions. At inference time, an assistant looks up the values a question mentions in the database, samples nine candidate queries, repairs failing ones, votes on their results, and returns the fastest equivalent query, up to three alternatives of similar speed and an explanation. On 500-question samples, the 9B model reaches 81.6% execution accuracy on synthetic test questions, 79.6% on Spider dev and 55.6% on BIRD dev, 7–10 points above the untuned model.
On BIRD’s official Mini-Dev benchmark in PostgreSQL, scored with its official scripts, the 9B model alone reaches 53.2% and the full assistant 55.6%, against 36.0% for the best published baseline. Listing looked-up values among the example values adds 1.2 points on BIRD dev (p=0.017), whereas naming them in the hint costs 3.0. Returning the fastest equivalent query rarely speeds BIRD answers up (geometric mean 1.05×), as they already talk about a millisecond, and can favour coincidental matches. The 4B model scores 68.6% exact match on the DBGorilla function-calling benchmark. Both models run on an 8 GB laptop GPU.},
keywords = {Text-to-SQL, PostgreSQL, large language models, low-rank adaptation, execution-guided decoding, query optimization, natural language interfaces to databases},
month = {October},
}
Submit your research paper and those of your network (friends, colleagues, or peers) through your IPN account, and receive 800 INR for each paper that gets published.
Join NowNational Conference on Sustainable Engineering and Management - 2024 Last Date: 15th March 2024
Submit inquiry