{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/din-sql-decomposed-in-context-learning-of-1","title":"DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction","arxiv_id":"2304.11015","date":"2023-04-21","proceeding":"NeurIPS 2023 11","authors":["Mohammadreza Pourreza","Davood Rafiei"],"abstract":"There is currently a significant gap between the performance of fine-tuned models and prompting approaches using Large Language Models (LLMs) on the challenging task of text-to-SQL, as evaluated on datasets such as Spider. To improve the performance of LLMs in the reasoning process, we study how decomposing the task into smaller sub-tasks can be effective. In particular, we show that breaking down the generation problem into sub-problems and feeding the solutions of those sub-problems into LLMs can be an effective approach for significantly improving their performance. Our experiments with three LLMs show that this approach consistently improves their simple few-shot performance by roughly 10%, pushing the accuracy of LLMs towards SOTA or surpassing it. On the holdout test set of Spider, the SOTA, in terms of execution accuracy, was 79.9 and the new SOTA at the time of this writing using our approach is 85.3. Our approach with in-context learning beats many heavily fine-tuned models by at least 5%. Additionally, when evaluated on the BIRD benchmark, our approach achieved an execution accuracy of 55.9%, setting a new SOTA on its holdout test set.","url_abs":"https://arxiv.org/abs/2304.11015v3","url_pdf":"https://arxiv.org/pdf/2304.11015v3.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"din-sql-decomposed-in-context-learning-of-1","repo_url":"https://github.com/mohammadrezapourreza/few-shot-nl2sql-with-prompting","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"none","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"in-context-learning","task_name":"In-Context Learning"},{"task_slug":"text-to-sql","task_name":"Text to SQL"},{"task_slug":"text-to-sql","task_name":"Text-To-SQL"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/text-to-sql-on-bird-big-bench-for-large-scale","task":"Text-To-SQL","dataset":"BIRD (BIg Bench for LaRge-scale Database Grounded Text-to-SQL Evaluation)","model":"DIN-SQL + GPT-4","rank_in_archive_order":30,"of":41,"metrics":{"Execution Accuracy % (Dev)":"50.72","Execution Accuracy % (Test)":"55.90"},"uses_additional_data":false},{"leaderboard":"/sota/text-to-sql-on-spider","task":"Text-To-SQL","dataset":"spider","model":"DIN-SQL + GPT-4","rank_in_archive_order":4,"of":20,"metrics":{"Exact Match Accuracy (Test)":"60","Execution Accuracy (Test)":"85.3"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2304.11015","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2304.11015"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/mohammadrezapourreza/few-shot-nl2sql-with-prompting","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":4},"by_repo_kind":{"official":{"samples":4,"ran":0,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"985f8112fdd9ad45","entry":"extract_label_and_sub_questions","repo":"mohammadrezapourreza/few-shot-nl2sql-with-prompting","repo_kind":"official","path":"DIN-SQL_BIRD.py","file_url":"https://github.com/mohammadrezapourreza/few-shot-nl2sql-with-prompting/blob/HEAD/DIN-SQL_BIRD.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"985f8112fdd9ad45"}},{"code_sha256_prefix":"f0b9561a5270fa02","entry":"extract_schema_links","repo":"mohammadrezapourreza/few-shot-nl2sql-with-prompting","repo_kind":"official","path":"DIN-SQL_BIRD.py","file_url":"https://github.com/mohammadrezapourreza/few-shot-nl2sql-with-prompting/blob/HEAD/DIN-SQL_BIRD.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f0b9561a5270fa02"}},{"code_sha256_prefix":"66f0572c036abde3","entry":"get_accuracy","repo":"mohammadrezapourreza/few-shot-nl2sql-with-prompting","repo_kind":"official","path":"AnalysisResults.py","file_url":"https://github.com/mohammadrezapourreza/few-shot-nl2sql-with-prompting/blob/HEAD/AnalysisResults.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"66f0572c036abde3"}},{"code_sha256_prefix":"954e98b3d0e164c5","entry":"load_results","repo":"mohammadrezapourreza/few-shot-nl2sql-with-prompting","repo_kind":"official","path":"AnalysisResults.py","file_url":"https://github.com/mohammadrezapourreza/few-shot-nl2sql-with-prompting/blob/HEAD/AnalysisResults.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"954e98b3d0e164c5"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}