Neural Symbolic Machines: Learning Semantic Parsers on Freebase with Weak Supervision

Chen Liang, Jonathan Berant, Quoc V. Le, Kenneth D. Forbus, Ni Lao

Abstract

Semantic parsing translates natural language into formal representations, but faces challenges in compositionality, large search spaces, and weak supervision. We present the Neural Symbolic Machine (NSM), a hybrid framework combining neural sequence models with a symbolic Lisp interpreter. By utilizing a key-variable memory and a novel training approach called IML-REINFORCE, NSM learns to map questions to executable programs using only question-answer pairs. Our model achieves state-of-the-art performance on the WebQuestionsSP dataset, effectively bridging the gap between statistical learning and symbolic reasoning.

Introduction

Translating natural language into executable code—semantic parsing—is essential for complex question-answering over large knowledge bases. Traditional approaches often struggle with three primary hurdles:

  1. Compositionality: Complex queries require multi-step reasoning where intermediate results are stored and reused.
  2. Large Search Spaces: Knowledge bases like Freebase contain millions of entities and tens of thousands of properties, making the search for the correct logical path difficult.
  3. Weak Supervision: Obtaining "gold" programs is expensive; most datasets only provide question-answer pairs, leading to sparse rewards and non-differentiable operations.

The Neural Symbolic Machine Framework

The Neural Symbolic Machine (NSM) addresses these challenges through a Manager-Programmer-Computer (MPC) architecture.

The Programmer (Neural)

The Programmer is a sequence-to-sequence model based on Gated Recurrent Units (GRU). It generates a program in Lisp by predicting a sequence of tokens. A key innovation is the key-variable memory, which allows the model to save intermediate execution results into variables ($v_0, v_1, \dots$) and reference them in subsequent steps. This enables the model to handle complex, compositional questions by manipulating "pointers" to symbolic results rather than high-dimensional vectors.

The Computer (Symbolic)

The Computer is a symbolic Lisp interpreter that executes the Programmer's code against a knowledge base. To manage the massive search space, the Computer provides "Code Assistance": at each decoding step, it prunes the Programmer's options to only those that are syntactically and semantically valid based on the current state of execution.

The NSM architecture featuring the Programmer, Computer, and key-variable memory.

Training with Weak Supervision

Training a non-differentiable system with sparse rewards is difficult. The Manager employs a hybrid strategy called IML-REINFORCE:

  • Iterative Maximum Likelihood (IML): The model uses beam search to find "pseudo-gold" programs that yield the correct answer.
  • REINFORCE: These successful programs bootstrap the reinforcement learning process, stabilizing training and allowing the model to optimize for the expected reward even when the search space is vast.

Experimental Results

We evaluated NSM on WebQuestionsSP, a rigorous dataset based on Freebase. The knowledge base snapshot used contains approximately 23,000 relations and 82 million nodes.

NSM achieved an F1 score of 69.0, surpassing previous state-of-the-art models like STAGG. Notably, NSM does not require heavy feature engineering or domain-specific templates, demonstrating the power of a general-purpose neural-symbolic architecture.

Performance comparison of NSM against the STAGG baseline on WebQuestionsSP.

Conclusion and Future Work

The Neural Symbolic Machine demonstrates that combining the flexibility of neural networks with the precision of symbolic logic is a viable path for large-scale semantic parsing. By pruning search spaces and utilizing key-variable memory, NSM handles complex compositionality under weak supervision. Future work will focus on addressing "spurious" programs—where the model finds the right answer for the wrong reason—and expanding the library of symbolic operations to handle even more diverse natural language queries.

Summary updated

BibTeX
@inproceedings{liang2017neural,
  author = {Chen Liang and Jonathan Berant and Quoc V. Le and Kenneth D. Forbus and Ni Lao},
  title = {{Neural Symbolic Machines: Learning Semantic Parsers on Freebase with Weak Supervision}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2017},
  doi = {10.18653/v1/p17-1003},
}
Figure