{"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/interleaving-pre-trained-language-models-and","title":"Interleaving Pre-Trained Language Models and Large Language Models for Zero-Shot NL2SQL Generation","arxiv_id":"2306.08891","date":"2023-06-15","proceeding":null,"authors":["Zihui Gu","Ju Fan","Nan Tang","Songyue Zhang","Yuxin Zhang","Zui Chen","Lei Cao","Guoliang Li","Sam Madden","Xiaoyong Du"],"abstract":"Zero-shot NL2SQL is crucial in achieving natural language to SQL that is adaptive to new environments (e.g., new databases, new linguistic phenomena or SQL structures) with zero annotated NL2SQL samples from such environments. Existing approaches either fine-tune pre-trained language models (PLMs) based on annotated data or use prompts to guide fixed large language models (LLMs) such as ChatGPT. PLMs can perform well in schema alignment but struggle to achieve complex reasoning, while LLMs is superior in complex reasoning tasks but cannot achieve precise schema alignment. In this paper, we propose a ZeroNL2SQL framework that combines the complementary advantages of PLMs and LLMs for supporting zero-shot NL2SQL. ZeroNL2SQL first uses PLMs to generate an SQL sketch via schema alignment, then uses LLMs to fill the missing information via complex reasoning. Moreover, in order to better align the generated SQL queries with values in the given database instances, we design a predicate calibration method to guide the LLM in completing the SQL sketches based on the database instances and select the optimal SQL query via an execution-based strategy. Comprehensive experiments show that ZeroNL2SQL can achieve the best zero-shot NL2SQL performance on real-world benchmarks. Specifically, ZeroNL2SQL outperforms the state-of-the-art PLM-based methods by 3.2% to 13% and exceeds LLM-based methods by 10% to 20% on execution accuracy.","url_abs":"https://arxiv.org/abs/2306.08891v1","url_pdf":"https://arxiv.org/pdf/2306.08891v1.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":"interleaving-pre-trained-language-models-and","repo_url":"https://github.com/ruc-datalab/zeronl2sql","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[],"methods":[{"method_slug":"align","method_name":"ALIGN"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2306.08891","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2306.08891"}},"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/ruc-datalab/zeronl2sql","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":7,"unverified":11},"by_repo_kind":{"official":{"samples":18,"ran":7,"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":"64dd3849a251a1bf","entry":"convert_fk_index","repo":"ruc-datalab/zeronl2sql","repo_kind":"official","path":"src/utils/get_tables.py","file_url":"https://github.com/ruc-datalab/zeronl2sql/blob/HEAD/src/utils/get_tables.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"64dd3849a251a1bf"}},{"code_sha256_prefix":"0992d2a47ae733fa","entry":"get_schema","repo":"ruc-datalab/zeronl2sql","repo_kind":"official","path":"get_colval_map.py","file_url":"https://github.com/ruc-datalab/zeronl2sql/blob/HEAD/get_colval_map.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0992d2a47ae733fa"}},{"code_sha256_prefix":"c4dcaf29b663a364","entry":"get_schema_from_json","repo":"ruc-datalab/zeronl2sql","repo_kind":"official","path":"get_colval_map.py","file_url":"https://github.com/ruc-datalab/zeronl2sql/blob/HEAD/get_colval_map.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c4dcaf29b663a364"}},{"code_sha256_prefix":"b724cc2d4066a429","entry":"is_commonword","repo":"ruc-datalab/zeronl2sql","repo_kind":"official","path":"src/utils/bridge_content_encoder.py","file_url":"https://github.com/ruc-datalab/zeronl2sql/blob/HEAD/src/utils/bridge_content_encoder.py","link_basis":"plan_row","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b724cc2d4066a429"}},{"code_sha256_prefix":"f39fdc1ce6cffe08","entry":"is_number","repo":"ruc-datalab/zeronl2sql","repo_kind":"official","path":"src/utils/bridge_content_encoder.py","file_url":"https://github.com/ruc-datalab/zeronl2sql/blob/HEAD/src/utils/bridge_content_encoder.py","link_basis":"plan_row","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f39fdc1ce6cffe08"}},{"code_sha256_prefix":"d56a1f9221823a48","entry":"is_stopword","repo":"ruc-datalab/zeronl2sql","repo_kind":"official","path":"src/utils/bridge_content_encoder.py","file_url":"https://github.com/ruc-datalab/zeronl2sql/blob/HEAD/src/utils/bridge_content_encoder.py","link_basis":"plan_row","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d56a1f9221823a48"}},{"code_sha256_prefix":"448eab4c7249a72c","entry":"normalize","repo":"ruc-datalab/zeronl2sql","repo_kind":"official","path":"src/utils/dataset.py","file_url":"https://github.com/ruc-datalab/zeronl2sql/blob/HEAD/src/utils/dataset.py","link_basis":"plan_row","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"448eab4c7249a72c"}},{"code_sha256_prefix":"427de7d5976d4ed4","entry":"dump_db_json_schema","repo":"ruc-datalab/zeronl2sql","repo_kind":"official","path":"src/utils/get_tables.py","file_url":"https://github.com/ruc-datalab/zeronl2sql/blob/HEAD/src/utils/get_tables.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":"427de7d5976d4ed4"}},{"code_sha256_prefix":"c7c413b7001d6846","entry":"execute","repo":"ruc-datalab/zeronl2sql","repo_kind":"official","path":"LLM_text2sql.py","file_url":"https://github.com/ruc-datalab/zeronl2sql/blob/HEAD/LLM_text2sql.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":"c7c413b7001d6846"}},{"code_sha256_prefix":"776b03fe5995312f","entry":"find_invalid_functions","repo":"ruc-datalab/zeronl2sql","repo_kind":"official","path":"LLM_text2sql.py","file_url":"https://github.com/ruc-datalab/zeronl2sql/blob/HEAD/LLM_text2sql.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":"776b03fe5995312f"}},{"code_sha256_prefix":"227f586d79c9675d","entry":"gelu_new","repo":"ruc-datalab/zeronl2sql","repo_kind":"official","path":"src/utils/aligner.py","file_url":"https://github.com/ruc-datalab/zeronl2sql/blob/HEAD/src/utils/aligner.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":"227f586d79c9675d"}},{"code_sha256_prefix":"f41cf0378a1399d0","entry":"gelu_python","repo":"ruc-datalab/zeronl2sql","repo_kind":"official","path":"src/utils/aligner.py","file_url":"https://github.com/ruc-datalab/zeronl2sql/blob/HEAD/src/utils/aligner.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":"f41cf0378a1399d0"}},{"code_sha256_prefix":"8c9c208c466794b2","entry":"get_structure","repo":"ruc-datalab/zeronl2sql","repo_kind":"official","path":"src/utils/get_data.py","file_url":"https://github.com/ruc-datalab/zeronl2sql/blob/HEAD/src/utils/get_data.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":"8c9c208c466794b2"}},{"code_sha256_prefix":"3aff0fef02654e1a","entry":"linear_act","repo":"ruc-datalab/zeronl2sql","repo_kind":"official","path":"src/utils/aligner.py","file_url":"https://github.com/ruc-datalab/zeronl2sql/blob/HEAD/src/utils/aligner.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":"3aff0fef02654e1a"}},{"code_sha256_prefix":"18ff3872881607ac","entry":"normalize","repo":"ruc-datalab/zeronl2sql","repo_kind":"official","path":"LLM_text2sql.py","file_url":"https://github.com/ruc-datalab/zeronl2sql/blob/HEAD/LLM_text2sql.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":"18ff3872881607ac"}},{"code_sha256_prefix":"8f6f7abc62958716","entry":"prepare_splits","repo":"ruc-datalab/zeronl2sql","repo_kind":"official","path":"src/utils/dataset.py","file_url":"https://github.com/ruc-datalab/zeronl2sql/blob/HEAD/src/utils/dataset.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":"8f6f7abc62958716"}},{"code_sha256_prefix":"8687d376b1d5b594","entry":"serialize_schema","repo":"ruc-datalab/zeronl2sql","repo_kind":"official","path":"src/utils/dataset.py","file_url":"https://github.com/ruc-datalab/zeronl2sql/blob/HEAD/src/utils/dataset.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":"8687d376b1d5b594"}},{"code_sha256_prefix":"2d9b155996a531f8","entry":"tokenize","repo":"ruc-datalab/zeronl2sql","repo_kind":"official","path":"get_colval_map.py","file_url":"https://github.com/ruc-datalab/zeronl2sql/blob/HEAD/get_colval_map.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":"2d9b155996a531f8"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}