KODE: Mining Implicit Domain Knowledge from Historical Experience for Text-to-SQL

Qingshuo Lyu, Jiangyi Yin, Zhao Li, Meijie Du, Zhuojun Jiang, Qingyun Liu


Abstract
Text-to-SQL systems built on large language models still struggle in real deployment, where users underspecify queries while databases enforce rigid schemas. The gap is rarely lexical; it lies in implicit knowledge—hidden joins, derived formulas, and domain-specific filters—that natural language (NL) omits but SQL must encode. We observe that this knowledge is not missing: every historical (NL, SQL) pair already records it, with NL stating the goal and SQL stating the steps. Treating the two as dual views of one program, we propose KODE-SQL, a framework with three agents: KODE-Miner aligns NL and SQL in a shared graph space and distills the unmatched regions into reusable templates; KODE-Solver retrieves these templates to generate schema-grounded SQL under a rule-then-retrieval policy; KODE-Critic verifies each candidate on the same graph and feeds successful cases back to the knowledge base. KODE-SQL improves execution accuracy by up to 11.1 points on the knowledge-heavy ScienceBenchmark, remains competitive on BIRD and Spider, and yields consistent gains (+4–7 points) when plugged into existing solvers—validating both its standalone strength and its portability as a knowledge module.
Anthology ID:
2026.findings-emnlp.2032
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2026
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
Findings
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
43245–43266
Language:
URL:
https://aclanthology.org/2026.findings-emnlp.2032/
DOI:
Bibkey:
Cite (ACL):
Qingshuo Lyu, Jiangyi Yin, Zhao Li, Meijie Du, Zhuojun Jiang, and Qingyun Liu. 2026. KODE: Mining Implicit Domain Knowledge from Historical Experience for Text-to-SQL. In Findings of the Association for Computational Linguistics: EMNLP 2026, pages 43245–43266, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
KODE: Mining Implicit Domain Knowledge from Historical Experience for Text-to-SQL (Lyu et al., Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-emnlp.2032.pdf