Abstract
This paper presents the first systematic investigation into compositional generalization within context-dependent Text-to-SQL parsing. While state-of-the-art models perform well on standard benchmarks, they exhibit significant performance degradation when encountering novel combinations of conversational refinements. To address this, the authors introduce new benchmarks, SParC-CG and CoSQL-CG, and propose p-align, a method designed to improve model robustness by explicitly aligning natural language utterances with their corresponding SQL modifications. Experimental results demonstrate that p-align consistently enhances performance across various base models, highlighting the importance of structural alignment in conversational semantic parsing.
Introduction
Text-to-SQL systems are essential for bridging the gap between natural language and structured databases. Modern applications often require context-dependent interactions, where users refine their queries over multiple turns. For instance, a user might start with "List the distinct names of all nurses" and follow up with "Order them in alphabetical order."
The core challenge in these multi-turn dialogues is compositional generalization: the ability of a model to handle novel combinations of previously seen components. While a model might understand "Order by name" and complex "WHERE" clauses separately, it often fails when these "building blocks" are combined in ways not present in the training data. This paper addresses the gap in conversational settings, where the "building blocks" are spread across multiple turns of a dialogue.
Methods
The authors approach the problem through benchmark construction and architectural innovation.
1. Benchmark Construction (SParC-CG and CoSQL-CG)
To evaluate compositional generalization, the researchers developed a pipeline to generate out-of-distribution conversational samples from existing datasets (SParC and CoSQL).
The pipeline consists of four main stages:
- Filtering: Removing context-independent examples to focus on true conversational dependencies.
- Pattern Extraction: Identifying abstract "modification patterns" (e.g., adding a specific clause) from SQL syntax trees.
- Recombination: Combining these patterns with base queries to create novel SQL structures.
- Utterance Generation: Using a fine-tuned T5 model and expert human review to translate these new SQL combinations into natural-sounding dialogue.
2. The p-align Method
Standard models typically concatenate the entire dialogue history into a single input string. The authors argue this "blurring" makes it difficult for the model to map specific refinements to their SQL counterparts. The proposed p-align method extracts specific embeddings for each interaction turn and forces the decoder to align these embeddings with the corresponding SQL segments. This encourages the model to learn precise mappings between conversational "tweaks" and structural SQL changes.
Results and Insights
The study reveals a massive "generalization gap" in current state-of-the-art models. When tested on the new CG benchmarks, performance "craters" compared to standard dev sets. For example, the top-performing LGESQL + STAR model dropped from 66.9% to 25.8% on SParC-CG and from 59.7% to 26.3% on CoSQL-CG.
Key findings include:
- Concatenation Limitations: Simple history concatenation allows models to rely on surface-level patterns rather than structural understanding.
- Alignment Benefits: The p-align method showed consistent improvements, such as a 7.5% absolute gain for a BERT-Base model on SParC-CG.
- Over-optimization: Models often performed better on "Non-CG" parts of the new benchmarks than on original dev sets, suggesting they are over-fitted to specific conversational flows in training data.
Conclusion
This research underscores the fragility of current conversational Text-to-SQL models when faced with novel compositional structures. By introducing rigorous benchmarks and the p-align alignment method, the authors provide both a diagnostic tool and a potential solution for building more robust, context-aware semantic parsers. Future work includes exploring Large Language Models (LLMs) and using the recombination pipeline for data augmentation.
Summary updated