A Sketch-Based System for Semantic Parsing

Zechang Li, Yuxuan Lai, Yuxi Xie, Yansong Feng, Dongyan Zhao

Introduction

Semantic parsing—the process of translating natural language queries into machine-readable logical forms—is a cornerstone of modern question-answering systems. While sequence-to-sequence (seq2seq) models have become the standard approach, they often struggle with complex queries by conflating high-level logical structures with low-level details like specific entities and predicates. This "messy" generation process frequently leads to structural correctness at the expense of factual accuracy, or vice versa.

Researchers from Peking University have addressed these shortcomings by developing a modular, "sketch-based" system. By disentangling the high-level logic from specific data points, their approach achieved a significant 5.65% improvement over previous state-of-the-art models on the most challenging subsets of the NLPCC 2019 evaluation.

Methodology: A Coarse-to-Fine Approach

Instead of generating a query token-by-token, the proposed system employs a three-stage coarse-to-fine pipeline designed to isolate different aspects of the parsing task.

1. Sketch & Label Multi-Task Model

The foundation of the system is a multi-task model built on a fine-tuned BERT architecture. As shown in Figure 1, the model simultaneously performs two critical tasks: Sketch Classification, which identifies the high-level template of the query (e.g., "single-relation" vs. "aggregation"), and Entity Labeling, which uses a Conditional Random Field (CRF) layer to identify entity spans within the natural language question.

The Sketch & Label Multi-Task Model architecture using BERT and CRF.

2. Pattern Pair Matching

To fill the "blanks" in the identified sketch, the system uses a Pattern Pair Matching Network. By replacing specific entities with placeholders (e.g., entity1), the model focuses on the relationship between the phrasing of a question and the required predicates. This abstraction allows the model to generalize across different entities that share similar linguistic contexts.

3. Predicate-Entity Co-occurrence

In scenarios where a formal Knowledge Base (KB) is unavailable during training, the system utilizes a statistical proxy. A dedicated matching network learns which predicates and entities frequently co-occur in the training data, effectively recovering relational information that would typically be provided by a database schema.

Experimental Results

The system was evaluated on the MSParS dataset, consisting of over 81,000 hand-annotated samples. The modular design proved highly effective; the initial sketch and labeling stage achieved an error rate of less than 2% across most categories.

Error rates for different query classes on the development set.

As detailed in Figure 5, the system maintains low error rates for sketch classification ($Err_s$) and entity labeling ($Err_e$) across various query types. While the system performed exceptionally well overall, reaching 84.47% accuracy on the full test set, its most notable success was on the "hard" subset. It achieved 63.08% accuracy on these complex cases, outperforming the top competition entry by a wide margin.

Conclusion and Future Work

The success of this sketch-based system highlights the importance of disentangling logic from data in semantic parsing. By isolating the high-level structure, the model avoids the pitfalls of standard seq2seq generation. Future work will focus on improving performance in "multi-choice" queries—where the model currently struggles with entity ordering—and integrating actual Knowledge Base information to further refine predicate selection.

Summary updated

BibTeX
@inproceedings{li2019sketch,
  author = {Zechang Li and Yuxuan Lai and Yuxi Xie and Yansong Feng and Dongyan Zhao},
  title = {{A Sketch-Based System for Semantic Parsing}},
  booktitle = {NLPCC},
  year = {2019},
  doi = {10.1007/978-3-030-32236-6\_68},
}
Figure