Towards Robustness of Text-to-SQL Models against Synonym Substitution
Yujian Gan, Xinyun Chen, Qiuping Huang, Matthew Purver, John R. Woodward, Jinxia Xie, Pengsheng Huang
Abstract
Recently, there has been significant progress in studying neural networks to translate text descriptions into SQL queries. Despite achieving good performance on some public benchmarks, existing text-to-SQL models typically rely on the lexical matching between words in natural language (NL) questions and tokens in table schemas, which may render the models vulnerable to attacks that break the schema linking mechanism. In this work, we investigate the robustness of text-to-SQL models to synonym substitution. In particular, we introduce Spider-Syn, a human-curated dataset based on the Spider benchmark for text-to-SQL translation. NL questions in Spider-Syn are modified from Spider, by replacing their schema-related words with manually selected synonyms that reflect real-world question paraphrases. We observe that the accuracy dramatically drops by eliminating such explicit correspondence between NL questions and table schemas, even if the synonyms are not adversarially selected to conduct worst-case adversarial attacks 1 . Finally, we present two categories of approaches to improve the model robustness. The first category of approaches utilizes additional synonym annotations for table schemas by modifying the model input, while the second category is based on adversarial training. We demonstrate that both categories of approaches significantly outperform their counterparts without the defense, and the first category of approaches are more effective. 2 Spider Question:
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
39 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQL cites RAT-SQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL Parsers
- OmniSQL: Synthesizing High-quality Text-to-SQL Data at Scale cites RAT-SQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL Parsers
- OmniSQL: Synthesizing High-quality Text-to-SQL Data at Scale cites RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQL
- OmniSQL: Synthesizing High-quality Text-to-SQL Data at Scale cites ScienceBenchmark: A Complex Real-World Benchmark for Evaluating Natural Language to SQL Systems
- OmniSQL: Synthesizing High-quality Text-to-SQL Data at Scale cites CodeS: Towards Building Open-source Language Models for Text-to-SQL
- StructGPT: A General Framework for Large Language Model to Reason over Structured Data cites RAT-SQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL Parsers
- ScienceBenchmark: A Complex Real-World Benchmark for Evaluating Natural Language to SQL Systems cites RAT-SQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL Parsers
- ScienceBenchmark: A Complex Real-World Benchmark for Evaluating Natural Language to SQL Systems cites RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQL
- CodeS: Towards Building Open-source Language Models for Text-to-SQL cites RAT-SQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL Parsers
- CodeS: Towards Building Open-source Language Models for Text-to-SQL cites RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQL
- CodeS: Towards Building Open-source Language Models for Text-to-SQL cites ScienceBenchmark: A Complex Real-World Benchmark for Evaluating Natural Language to SQL Systems
Cited by top-tier papers39
- RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQLHaoyang Li, Jing Zhang, Cuiping Li, Hong ChenAAAI 2023 · 343 citations
- StructGPT: A General Framework for Large Language Model to Reason over Structured DataJinhao Jiang, Kun Zhou, Zican Dong, Keming Ye et al.EMNLP 2023 · 173 citations
- CodeS: Towards Building Open-source Language Models for Text-to-SQLHaoyang Li, Jing Zhang, Hanbing Liu, Ju Fan et al.SIGMOD 2024 · 124 citations
- OmniSQL: Synthesizing High-quality Text-to-SQL Data at ScaleHaoyang Li, Shang Wu, Xiaokang Zhang, Xinmei Huang et al.VLDB 2025 · 90 citations
- ScienceBenchmark: A Complex Real-World Benchmark for Evaluating Natural Language to SQL SystemsYi Zhang, Jan Deriu, George Katsogiannis-Meimarakis, Catherine Kosten et al.VLDB 2024 · 65 citations
Builds on3
- Is BERT Really Robust? A Strong Baseline for Natural Language Attack on Text Classification and EntailmentDi Jin, Zhijing Jin, Joey Tianyi Zhou, Peter SzolovitsAAAI 2020 · 1,333 citations
- BERT-ATTACK: Adversarial Attack Against BERT Using BERTLinyang Li, Ruotian Ma, Qipeng Guo, Xiangyang Xue et al.EMNLP 2020 · 529 citations
- RAT-SQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL ParsersBailin Wang, Richard Shin, Xiaodong Liu, Oleksandr Polozov et al.ACL 2020 · 39 citations
Related papers
- Dr.Spider: A Diagnostic Evaluation Benchmark towards Text-to-SQL RobustnessShuaichen Chang, Jun Wang, Mingwen Dong, Lin Pan et al.ICLR 2023 · 9 citations
- Importance of Synthesizing High-quality Data for Text-to-SQL ParsingYiqun Hu, Yiyun Zhao, Jiarong Jiang, Wuwei Lan et al.ACL Findings 2023 · 24 citations
- Exploring Schema Generalizability of Text-to-SQLJieyu Li, Lu Chen, Ruisheng Cao, Su Zhu et al.ACL Findings 2023 · 3 citations
- Re-appraising the Schema Linking for Text-to-SQLYujian Gan, Xinyun Chen, Matthew PurverACL Findings 2023 · 4 citations
- SPENCE: A Syntactic Probe for Detecting Contamination in NL2SQL BenchmarksMohammadtaher Safarzadeh, Hitesh Laxmichand Patel, Afshin Oroojlooy, Graham Horwood et al.ACL 2026
