Building a Semantic Parser Overnight

Yushi Wang, Jonathan Berant, Percy Liang

Abstract

Traditional semantic parsing requires large amounts of domain-specific training data, creating a "cold start" problem for new applications. This paper presents a methodology to build a functional semantic parser in just a few hours. By reversing the data collection process—generating "clunky" canonical sentences from logical forms and using crowdsourcing to paraphrase them—the authors achieve significant accuracy across diverse domains with minimal expert effort.

Introduction

Semantic parsing—the task of mapping natural language queries into executable logical forms—is essential for building natural language interfaces to databases. However, the standard supervised learning approach is bottlenecked by the need for thousands of query-logical form pairs. This creates a catch-22: users won't use a system that doesn't work, but the system needs user queries to learn.

To solve this, the authors propose a "functionality-driven" framework. Instead of waiting for users, developers define what the system can do, and the framework automatically generates the training data needed to support those functions.

The Methodology: A Four-Step Pipeline

The core of the approach is a pipeline that shifts the burden from expert annotation to automated generation and simple human paraphrasing.

The four-step pipeline for building a semantic parser overnight, showing the roles of the builder, the grammar, and the crowd.
  1. Seed Lexicon: A developer spends approximately 30 minutes defining a "seed lexicon." This maps database schema elements (e.g., publicationDate) to simple natural language phrases ("publication date").
  2. Grammar Generation: A domain-general grammar uses these seeds to generate thousands of pairs. Each pair consists of a logical form and a corresponding canonical utterance. These utterances are grammatically awkward but semantically precise, such as "article that has the largest publication date."
  3. Crowdsourced Paraphrasing: Non-expert workers (via Amazon Mechanical Turk) rewrite these clunky canonical utterances into natural, fluid language (e.g., "What is the newest published article?"). This process takes about 5 hours.
  4. Training: The system trains a log-linear model to map the natural paraphrases back to the original logical forms.

Bridging the Gap: Canonical Utterances

The use of canonical utterances is the key technical innovation. It allows non-experts to provide high-quality supervision for complex logic without needing to understand the underlying code.

A derivation tree showing how a logical form (top) is mapped to a canonical utterance (bottom) through intermediate grammar rules.

The framework relies on the concept of Bounded Non-compositionality. While natural language is complex, the "gaps" between a clunky logical representation and a natural sentence are usually small and local. By learning these small mappings, the parser can generalize to complex, unseen queries.

Experimental Results

The methodology was evaluated across seven diverse domains (Calendar, Blocks, Housing, Restaurants, Publications, Social, and Basketball) and a new "Recipes" domain created to test the "overnight" claim.

  • Accuracy: The framework achieved an average accuracy of 59% across the seven initial domains.
  • The Overnight Test: For the "Recipes" domain, the authors successfully built a functional parser with 70.8% accuracy within 24 hours.
  • Generalization: On the classic Geo880 dataset, the parser achieved 56.4% accuracy without any domain-specific training data. While lower than state-of-the-art systems (~90%), it demonstrates the power of zero-effort domain adaptation.

Discussion and Limitations

While highly efficient, the system has limitations. The current grammar struggles with complex linguistic phenomena like nested quantification and anaphora. Additionally, roughly 17% of crowdsourced paraphrases contained errors due to worker misunderstanding or lexical ambiguity in the prompts.

Future work aims to extend the grammar to handle more complex structures and improve the paraphrasing model to better handle "compression," where natural language is significantly more concise than the underlying logical form.

Conclusion

This work demonstrates that building a semantic parser does not require months of data collection. By leveraging a functionality-first design and treating parsing as a paraphrasing problem, developers can deploy natural language interfaces for new domains in a single day.

Summary updated

BibTeX
@inproceedings{wang2015building,
  author = {Yushi Wang and Jonathan Berant and Percy Liang},
  title = {{Building a Semantic Parser Overnight}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2015},
  doi = {10.3115/v1/p15-1129},
}
Figure