Learning to Map Sentences to Logical Form: Structured Classification with Probabilistic Categorial Grammars

Luke S. Zettlemoyer, Michael CollinsUAI 2005

Abstract

This paper addresses the problem of mapping natural language sentences to lambda-calculus encodings of their meaning. We describe a learning algorithm that takes as input a training set of sentences labeled with expressions in the lambda calculus. The algorithm induces a grammar for the problem, along with a log-linear model that represents a distribution over syntactic and semantic analyses conditioned on the input sentence. We apply the method to the task of learning natural language interfaces to databases and show that the learned parsers outperform previous methods in two benchmark database domains.

Introduction

Building natural language interfaces for databases requires a robust way to translate human queries into formal logical representations. For instance, a user query like "What states border Texas?" must be mapped to a formal expression such as λx.state(x) ∧ borders(x, texas).

Traditionally, this "semantic parsing" task has been difficult because training data typically consists only of sentence-logic pairs, without the intermediate derivation steps (parse trees) that explain how specific words contribute to the final meaning. Manually annotating these derivations is labor-intensive and expensive. Zettlemoyer and Collins propose a method to automatically induce these grammars and learn the underlying linguistic structures using minimal supervision.

Methodology: Probabilistic Combinatory Categorial Grammars

The core of the proposed approach is the use of Probabilistic Combinatory Categorial Grammars (PCCGs). This framework tightly integrates syntax and semantics by treating words as functions that combine to form larger meanings.

The CCG Framework

In a CCG, each word in the lexicon is associated with a category that defines its syntactic behavior and its semantic contribution in lambda calculus. For example, a transitive verb like "border" is defined as a function that takes two noun phrases to produce a sentence.

A CCG derivation for the query "What states border Texas?" showing the mapping from natural language to lambda calculus.

The Learning Algorithm

The algorithm learns both the lexicon (the dictionary of word-to-logic mappings) and the parameters of a log-linear model that ranks potential parses. It operates in two alternating steps:

  1. Lexical Generation (GENLEX): This component "reverse-engineers" potential lexical entries by looking at a sentence and its target logical form. If the system knows the final logic is borders(utah, idaho), it can hypothesize that "borders" corresponds to the predicate λx.λy.borders(y, x).
  2. Parameter Estimation: Because GENLEX generates many possible (and often incorrect) entries, the system uses a log-linear model to assign weights to them. Using stochastic gradient ascent, the model learns to favor the lexical entries and derivations that most consistently produce the correct logical forms across the training set.

Experiments and Results

The model was evaluated on two benchmark datasets: Geo880 (880 geography queries) and Jobs640 (640 job listing queries). The original Prolog annotations were converted to lambda calculus for this study.

The PCCG approach demonstrated significant improvements over previous state-of-the-art systems, such as COCKTAIL. Notably, the system achieved high precision while starting with virtually no prior linguistic knowledge, learning the meanings of complex terms like "largest" or "run through" entirely from the training data.

Performance comparison of the PCCG method against the COCKTAIL system on the Geo880 and Jobs640 datasets.

Discussion and Conclusion

A key insight of this work is that structure learning—inducing the lexicon itself—is as critical as parameter estimation. By using CCG as a bridge, the authors created a natural mathematical path from syntax to logic. The algorithm also remains efficient by pruning "spurious" lexical entries, keeping only those that contribute to high-scoring parses.

While the system achieves exceptional precision (over 96%), the primary limitation remains recall. Failures often occur with complex linguistic structures, such as non-local dependencies (e.g., "Through which states..."), which the current lexical generation rules cannot yet capture. Future work aims to expand these rules and apply the PCCG framework to even more diverse and complex datasets.

Summary updated

BibTeX
@inproceedings{zettlemoyer2005learning,
  author = {Luke S. Zettlemoyer and Michael Collins},
  title = {{Learning to Map Sentences to Logical Form: Structured Classification with Probabilistic Categorial Grammars}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2005},
  url = {https://openreview.net/forum?id=do9p228wqKS},
}
Figure