Genie: a generator of natural language semantic parsers for virtual assistant commands

Giovanni Campagna, Silei Xu, Mehrad Moradshahi, Richard Socher, Monica S. Lam

Introduction

Building virtual assistants that understand complex, multi-step commands is a significant challenge. Traditional methods require manual annotation of thousands of sentences for every new feature, creating a massive data bottleneck. In their PLDI '19 paper, researchers from Stanford and Salesforce introduce Genie, a toolkit designed to automate this process.

Overview of the Genie system: translating user input into ThingTalk code for execution across various services.

Genie combines formal programming principles with a data synthesis pipeline, allowing developers to build sophisticated semantic parsers with a fraction of the manual effort.

The Problem: The Data Bottleneck and Compositionality

Most commercial virtual assistants rely on "intent classification" and "slot filling." While effective for simple requests like "What's the weather?", these systems fail on compound commands such as "If it rains tomorrow, message my boss on Slack."

The core challenges identified are:

  1. The Data Bottleneck: Manual labeling is prohibitively expensive and slow.
  2. Compositionality: Teaching models to combine disparate services (e.g., Weather + Slack) without explicit training examples is difficult.
  3. Free-form Text: Identifying unquoted parameters (e.g., a photo caption) within a sentence remains a struggle for traditional systems.

Methodology: The Genie Synthesis Pipeline

Genie shifts the paradigm by treating assistant capabilities as a formal programming language called ThingTalk. This Virtual Assistant Programming Language (VAPL) is strongly typed and canonical, ensuring a unique code representation for any specific command, which simplifies the learning process for neural networks.

The heart of Genie is its automated data synthesis pipeline:

The Genie data synthesis pipeline, which generates training data from formal definitions and templates.

The pipeline consists of several key stages:

  • Primitive and Construct Templates: Developers provide basic descriptions of functions and general rules for combining them.
  • Randomized Synthesis: Genie uses these templates to generate millions of grammatically correct, albeit "clunky," sentences paired with their corresponding code.
  • Crowdsourced Paraphrasing: A subset of synthesized sentences is rewritten by human workers into natural English.
  • Data Augmentation: Natural sentences are augmented by swapping entities (names, dates, etc.) from a database of 7.8 million entities to prevent overfitting.

The resulting data trains a Multi-Task Question Answering Network (MQAN), supplemented by a pre-trained ThingTalk Language Model to help the decoder understand code structure.

Key Insights and Results

The researchers found that training on a mix of "clunky" synthesized data and natural paraphrases was crucial. The synthesized data teaches the model underlying logic and compositionality, while paraphrases teach natural language nuances. Canonicalization of the code improved accuracy by 5-8%.

Genie demonstrated strong performance across several benchmarks:

  • Realistic Input: Achieved 62% accuracy on "Cheatsheet" data and 63% on IFTTT data, significantly outperforming previous state-of-the-art models.
  • Generalization: Reached 87% accuracy on paraphrased commands for "untrained programs" (combinations of functions not seen during training).
  • Domain Specificity: Improved performance by 19% to 31% over traditional baselines in domains like Spotify.

Limitations and Future Work

Despite its success, Genie's accuracy drops to 30% when encountering entirely new function combinations in the wild. Additionally, non-compositional vocabulary (e.g., "retweet") remains a challenge. Future work aims to use Genie to launch beta versions of assistants to collect real-world data and address linguistic ambiguity through clarifying questions.

Summary updated

BibTeX
@inproceedings{campagna2019genie,
  author = {Giovanni Campagna and Silei Xu and Mehrad Moradshahi and Richard Socher and Monica S. Lam},
  title = {{Genie: a generator of natural language semantic parsers for virtual assistant commands}},
  booktitle = {PLDI},
  year = {2019},
  doi = {10.1145/3314221.3314594},
}
Figure