TL;DR
This paper highlights a critical vulnerability in current text-to-SQL models: their over-reliance on exact keyword matching between natural language questions and database schemas. To address this, they introduce "Spider-Syn," a new dataset of paraphrased questions, and propose two defense strategies, demonstrating that augmenting schema information is more effective than adversarial training for improving robustness.
What Problem Does This Paper Address?
Text-to-SQL models aim to translate natural language questions into executable SQL queries. While these models have achieved impressive performance on benchmarks like Spider, their success often hinges on a direct lexical match between words in the question and the table/column names in the database schema. This reliance makes them brittle; if a user uses a synonym or a slightly different phrasing for a schema element, the model can fail spectacularly. This is a significant practical issue, as users rarely know the exact schema names and naturally use synonyms. The paper investigates this "synonym substitution" vulnerability and proposes methods to make text-to-SQL models more robust to such variations.
Methods
The authors introduce two main categories of approaches to improve robustness:
- Multi-Annotation Selection (MAS): This method augments the input to the text-to-SQL model by providing multiple synonymous annotations for each schema item. Instead of just the original schema name, the model can consider a list of synonyms. This is done without requiring any additional training of the model itself. They explore both manual annotation (ManualMAS) and automatically generated synonyms (AutoMAS) based on word embeddings.
- Adversarial Training: This approach involves augmenting the training data with adversarial examples that specifically target synonym substitution. They use a BERT-based attack (BERT-Attack) to generate these examples, aiming to create paraphrased questions that are semantically similar but use synonyms for schema elements.
Datasets
- Spider: The primary benchmark dataset used for training and evaluating baseline models.
- Spider-Syn: A novel, human-curated dataset introduced in this paper. It's derived from the Spider dataset by replacing schema-related words in the natural language questions with manually selected synonyms. The key is that these synonyms do not change the underlying SQL query. Spider-Syn aims to simulate real-world question paraphrasing rather than generating worst-case adversarial attacks.
Key Insights and Ideas
- Lexical Matching is a Double-Edged Sword: While direct lexical matching is effective for current benchmarks, it's the Achilles' heel for real-world robustness. Models are brittle when faced with natural language variations.
- Synonym Substitution is a Realistic Threat: The Spider-Syn dataset demonstrates that even non-adversarial synonym substitutions cause a dramatic drop in performance, highlighting a significant gap between current model capabilities and practical usability.
- Schema Augmentation Outperforms Adversarial Training: The MAS approach, which enriches the model's input with synonym information, proves more effective than adversarial training in improving robustness on Spider-Syn, while also being computationally cheaper as it doesn't require retraining.
- Context Matters for Adversarial Attacks: The paper notes that the effectiveness of adversarial attacks (like ADVGLOVE) can be inconsistent, suggesting that context-aware synonym generation (like BERT-Attack) is more promising.
Key Results
- Existing text-to-SQL models trained on Spider suffer a significant performance drop (around 20-30% accuracy) when evaluated on the Spider-Syn dataset, indicating a lack of robustness to synonym substitution.
- The MAS approach, particularly ManualMAS (using synonyms directly from Spider-Syn), achieved an accuracy of 62.6% on Spider-Syn, significantly outperforming baseline models and even adversarial training methods.
- Adversarial training with BERT-Attack (ADVBERT) improved robustness on Spider-Syn by 10.3% compared to a baseline trained only on Spider.
- MAS approaches also showed improvements on worst-case adversarial attack datasets, with AutoMAS performing well against ADVGLOVE attacks.
Limitations and Future Work
- Spider Test Set Not Public: The paper notes that the Spider test set is not publicly accessible, so their evaluation on Spider-Syn does not include a test set.
- ManualMAS vs. AutoMAS: While ManualMAS achieved the best results on Spider-Syn, it relies on pre-defined synonyms. AutoMAS, which uses automatically generated synonyms, is presented as a more scalable and efficient approach for improving robustness, especially against adversarial attacks.
- Future Work: The authors suggest that MAS can be combined with existing defenses (like adversarial training) and that AutoMAS offers a practical way to enhance text-to-SQL model robustness without extensive retraining. They also highlight the need for models to handle more complex SQL structures and cross-domain generalization, which synonym robustness contributes to.
Summary updated