{"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/how-to-prompt-llms-for-text-to-sql-a-study-in","title":"How to Prompt LLMs for Text-to-SQL: A Study in Zero-shot, Single-domain, and Cross-domain Settings","arxiv_id":"2305.11853","date":"2023-05-19","proceeding":null,"authors":["Shuaichen Chang","Eric Fosler-Lussier"],"abstract":"Large language models (LLMs) with in-context learning have demonstrated remarkable capability in the text-to-SQL task. Previous research has prompted LLMs with various demonstration-retrieval strategies and intermediate reasoning steps to enhance the performance of LLMs. However, those works often employ varied strategies when constructing the prompt text for text-to-SQL inputs, such as databases and demonstration examples. This leads to a lack of comparability in both the prompt constructions and their primary contributions. Furthermore, selecting an effective prompt construction has emerged as a persistent problem for future research. To address this limitation, we comprehensively investigate the impact of prompt constructions across various settings and provide insights into prompt constructions for future text-to-SQL studies.","url_abs":"https://arxiv.org/abs/2305.11853v3","url_pdf":"https://arxiv.org/pdf/2305.11853v3.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":"how-to-prompt-llms-for-text-to-sql-a-study-in","repo_url":"https://github.com/shuaichenchang/prompt-text-to-sql","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"in-context-learning","task_name":"In-Context Learning"},{"task_slug":"retrieval","task_name":"Retrieval"},{"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":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2305.11853","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2305.11853"}},"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/shuaichenchang/prompt-text-to-sql","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"unverified":6},"by_repo_kind":{"official":{"samples":6,"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":"513156ef8f40a3ce","entry":"delexical","repo":"shuaichenchang/prompt-text-to-sql","repo_kind":"official","path":"utils.py","file_url":"https://github.com/shuaichenchang/prompt-text-to-sql/blob/HEAD/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"513156ef8f40a3ce"}},{"code_sha256_prefix":"151caf0c62c94dd8","entry":"dispatch_openai_requests","repo":"shuaichenchang/prompt-text-to-sql","repo_kind":"official","path":"sql_generation.py","file_url":"https://github.com/shuaichenchang/prompt-text-to-sql/blob/HEAD/sql_generation.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"151caf0c62c94dd8"}},{"code_sha256_prefix":"7dc320597ca2e8aa","entry":"get_prompt_length","repo":"shuaichenchang/prompt-text-to-sql","repo_kind":"official","path":"database_prompt_construction.py","file_url":"https://github.com/shuaichenchang/prompt-text-to-sql/blob/HEAD/database_prompt_construction.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"7dc320597ca2e8aa"}},{"code_sha256_prefix":"af9bcffd70d6e3be","entry":"is_number","repo":"shuaichenchang/prompt-text-to-sql","repo_kind":"official","path":"database_prompt_construction.py","file_url":"https://github.com/shuaichenchang/prompt-text-to-sql/blob/HEAD/database_prompt_construction.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"af9bcffd70d6e3be"}},{"code_sha256_prefix":"68d3d5cf278d5459","entry":"lexical","repo":"shuaichenchang/prompt-text-to-sql","repo_kind":"official","path":"utils.py","file_url":"https://github.com/shuaichenchang/prompt-text-to-sql/blob/HEAD/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"68d3d5cf278d5459"}},{"code_sha256_prefix":"7ae38ac77c126e53","entry":"normalize_create_table","repo":"shuaichenchang/prompt-text-to-sql","repo_kind":"official","path":"database_prompt_construction.py","file_url":"https://github.com/shuaichenchang/prompt-text-to-sql/blob/HEAD/database_prompt_construction.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"7ae38ac77c126e53"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}