TypeSQL: Knowledge-Based Type-Aware Neural Text-to-SQL Generation
Summary
TypeSQL addresses text-to-SQL generation on WikiSQL, where a natural-language question and a table schema must be translated into an SQL query, and the test tables are never seen in training. Building on SQLNet, the authors keep the sketch-based slot-filling formulation but reorganise it into three models with shared encoders: one for column-related slots, one for the aggregator, and one for operators and condition values. They also encode all column names jointly with a single BiLSTM. To handle rare entities and numbers that pre-trained embeddings represent poorly, each question token is given a type: a column match, a numeric or date category, or a named-entity class retrieved from Freebase. The type embedding is concatenated with the word embedding. Without database content, TypeSQL raises test execution accuracy from 68.0% to 73.5%, while training in roughly half the time. A content-sensitive variant, TypeSQL+TC, matches question words against table entries and reaches 82.6%. The work shows that lightweight type knowledge and access to database content substantially help semantic parsing over unseen tables.
Key points
- Data: WikiSQL contains 87,673 question–SQL pairs over 26,521 tables, with each table confined to a single train, dev or test split.
- Type labels:
- COLUMN for schema matches, found by searching n-grams of length 2–6.
- INTEGER, FLOAT, DATE and YEAR for numbers and dates.
- PERSON, PLACE, COUNTRY, ORGANIZATION and SPORT, looked up in Freebase.
- Architecture: TypeSQL uses 6 BiLSTMs in total, compared with 12 in SQLNet. Jointly encoding column names alone adds about 1.5% and halves training time.
- Test execution accuracy:
- SQLNet: 68.0%.
- TypeSQL without types: 71.7%.
- TypeSQL: 73.5%.
- TypeSQL+TC: 82.6%, versus 65.1% for the content-sensitive model of Wang et al. (2017a).
- WHERE-clause accuracy rises from 71.9% to 77.8%.
- Resources and limitations: The code is released at github.com/taoyds/typesql. WikiSQL lacks JOIN and GROUP BY, which limits how far the results generalise.
Topics Code & programming languages Semantic parsing & meaning representation
Institutions
Cite
Cite as Tao Yu, Zifan Li, Zilin Zhang, Rui Zhang and Dragomir Radev. 2018. TypeSQL: Knowledge-Based Type-Aware Neural Text-to-SQL Generation. Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers).
@inproceedings{yu2018typesql,
title = {{TypeSQL: Knowledge-Based Type-Aware Neural Text-to-SQL Generation}},
author = {Tao Yu, Zifan Li, Zilin Zhang, Rui Zhang and Dragomir Radev},
booktitle = {Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers)},
year = {2018},
doi = {10.18653/v1/n18-2093},
url = {https://doi.org/10.18653/v1/n18-2093}
}References
- Rakesh Agrawal and Ramakrishnan Srikant. 2003. Searching with numbers. IEEE Trans. Knowl. Data Eng., 15(4):855–870. find
- Miltiadis Allamanis, Daniel Tarlow, Andrew D. Gordon, and Yi Wei. 2015. Bimodal modelling of source code and natural language. In ICML, volume 37 of JMLR Workshop and Conference Proceedings, pages 2123–2132. JMLR.org. find
- Yoav Artzi and Luke Zettlemoyer. 2013. Weakly supervised learning of semantic parsers for mapping instructions to actions. Transactions of the Association forComputational Linguistics. our card
- Laura Banarescu, Claire Bonial, Shu Cai, Madalina Georgescu, Kira Griffitt, Ulf Hermjakob, Kevin Knight, Philipp Koehn, Martha Palmer, and Nathan Schneider. 2013. Abstract meaning representation for sembanking. In Proceedings of the 7th Linguistic Annotation Workshop and Interoperability with Discou… our card
- Jonathan Berant and Percy Liang. 2014. Semantic parsing via paraphrasing. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1415–1425, Baltimore, Maryland. Association for Computational Linguistics. our card
- Dipanjan Das, Nathan Schneider, Desai Chen, and Noah A. Smith. 2010. Probabilistic frame-semantic parsing. In NAACL. our card
This page in Markdown → https://md.research.elamur.ai/free/en/papers/yu-2018-typesql-knowledge-based-type-aware/