A Pilot Study for Chinese SQL Semantic Parsing

Qingkai Min, Yuefeng Shi, Yue Zhang

Presented at EMNLP 2019, this research marks a significant milestone in expanding semantic parsing beyond English-centric benchmarks. The study introduces CSpider, the first large-scale Chinese dataset for complex text-to-SQL tasks, and evaluates the unique challenges posed by the Chinese language in database interfacing.

Introduction

Semantic parsing—the conversion of natural language (NL) into machine-executable code like SQL—is a cornerstone for building intuitive database interfaces. While the Spider benchmark has catalyzed progress for English, other languages have lacked comparable resources. This pilot study addresses this gap by creating CSpider and investigating whether Chinese-specific linguistic features necessitate specialized modeling approaches.

Challenges in Chinese Text-to-SQL

The researchers identify three primary hurdles for Chinese semantic parsing:

  1. Word Segmentation: Unlike English, Chinese lacks explicit word boundaries. Errors in initial segmentation can propagate through the parser, leading to "cascading errors."
  2. Cross-Lingual Schema Mapping: In many professional contexts, database schemas (table and column names) remain in English even when queries are in Chinese. Models must map terms like "城市" to the "City" column.
  3. Linguistic Nuances: Features such as "zero-pronouns"—where subjects or objects are omitted when implied by context—complicate the identification of referenced database components.

Methodology

The study employs a state-of-the-art sequence-to-tree neural parser as a baseline. This architecture uses an LSTM encoder to process the natural language question and a decoder that generates SQL as a top-down syntactic tree, ensuring the output is syntactically valid.

The sequence-to-tree neural parser architecture used as the baseline model.

To optimize for Chinese, the researchers explored several configurations:

  • Encoders: Comparing word-based encoders (using the Jieba segmentor) against character-based encoders.
  • Embeddings: Comparing monolingual embeddings against cross-lingual embeddings (using Tencent's multi-lingual space). Cross-lingual embeddings allow the model to align the semantic space of Chinese queries with English database schemas.

The CSpider Dataset

The core contribution is CSpider, a human-translated version of the Spider dataset.

  • Scale: 9,691 questions across 166 databases.
  • Quality: A rigorous three-step process (translation, cross-checking, and verification) involving NLP researchers ensured high-quality mapping.
  • Realism: Database schemas were kept in English to reflect real-world industry standards in China.
  • Human vs. Machine: A machine-translated (MT) version was also created to benchmark the necessity of human nuance in semantic parsing datasets.

Key Results and Insights

Experimental results demonstrate that Chinese text-to-SQL is achievable with performance levels approaching English systems, provided specific strategies are employed.

Exact match accuracy comparison between English (ENG) and various Chinese model configurations across difficulty levels.

Major Findings:

  • Character-Level Robustness: Character-based models generally outperformed word-based ones. This suggests that character-level processing is more resilient to segmentation errors, especially regarding technical terms or proper names.
  • The Cross-Lingual Bridge: Cross-lingual embeddings proved essential for linking Chinese questions to English table headers, significantly boosting performance on the hardest mapping tasks.
  • Human Translation is Critical: The machine-translated dataset saw a sharp drop in accuracy (from ~12% to ~7%). MT often fails to preserve semantic constraints, such as the distinction between "which" and "how many," which are vital for valid SQL generation.
  • Performance Parity: The best Chinese model (Character-based with Multi-lingual embeddings) achieved 12.1% exact match accuracy, highly comparable to the 14.1% English baseline on the same split.

Conclusion and Future Directions

While this pilot study establishes a strong baseline, several areas for improvement remain. Out-of-vocabulary (OOV) issues continue to plague word-based models, and the current use of static embeddings (Glove/Tencent) could be improved with contextualized models like BERT or ERNIE. Furthermore, explicitly modeling zero-pronoun resolution is a promising avenue for improving the mapping of implicit references to database columns.

The CSpider dataset and associated code are available at https://github.com/taolusi/chisp.

Summary updated

BibTeX
@inproceedings{min2019pilot,
  author = {Qingkai Min and Yuefeng Shi and Yue Zhang},
  title = {{A Pilot Study for Chinese SQL Semantic Parsing}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2019},
  doi = {10.18653/v1/d19-1377},
}
Figure