RuleSQLova: Improving Text-to-SQL with Logic Rules
Shoukang Han, Neng Gao, Xiaobo Guo, Yiwei Shan · 2022 International Joint Conference on Neural Networks (IJCNN) · 2022
Text-to-SQL aims to map natural language questions to SQL queries. The sketch-based SQLova model combined with execution-guided (EG) decoding strategy has achieved a super-human performance on the WikiSQL dataset. However, through our fine-grained error analysis, we find that SQLova cannot handle well the aggregation operator selection for nu-meric columns, due to the lack of column type information to distinguish between textual and numeric columns. Besides, most predicted value spans in the WHERE clause have the same meaning with the ground truth, but they do not match exactly, leading to unnecessary errors. Therefore we propose RuleSQLova model, which enhances the SQLova base model with logic rules to deal with these two major weaknesses of SQLova. It first incorporates four logic rules into the model to constrain the aggregation operator prediction for numeric columns, using the general framework of iterative rule knowledge distillation. Then it leverages another logic rule for post-processing before EG decoding to ensure the consistency between predicted value spans and values in the table column. Experimental results indicate that RuleSQLova model offers significant and consistent improvements over SQLova, outperforming competitive sketch-based models on the WikiSQL dataset, and our method also brings improvements to the sketch-based models on the Spider dataset.