A Tabulation-Based Parsing Method that Reduces Copying

Gerald Penn, Cosmin Munteanu

In computational linguistics, parsing complex natural languages using Prolog has long been hindered by the high cost of data management. Researchers Gerald Penn and Cosmin Munteanu from the University of Toronto address this bottleneck by introducing a new bottom-up chart parsing algorithm. Their approach significantly reduces the overhead of copying data structures, making Prolog-based parsers more competitive for large-scale, feature-rich grammars.

The "Copying Tax" in Prolog Parsing

Chart parsing is a standard technique in Natural Language Processing (NLP) that uses memoization to handle linguistic ambiguity. However, implementing this within the Warren Abstract Machine (WAM) architecture of Prolog incurs a hidden "copying tax." When a parser identifies a grammatical constituent (an "edge"), it must be saved to a table. In standard Prolog, this requires a "copy-in" to the dynamic database and a subsequent "copy-out" back onto the heap whenever that edge is needed as a premise for a new rule.

For modern grammars using complex feature structures—attribute-value matrices rather than simple labels—these operations become a massive performance bottleneck. The cost often scales with sentence length, leading to significant slowdowns on long inputs.

Methods: EFD-Closure and Dual-Chart Strategy

The authors propose a two-pronged solution to achieve a constant copying cost:

  1. EFD-closure (Empty-First-Daughter-closure): This pre-processing grammar transformation ensures no rule begins with an "empty category" (epsilon). This guarantee allows the parser to ensure it is always dealing with tangible constituents during matching.
  2. The Dual-Chart Strategy: The algorithm maintains two versions of the chart. An Asserted Copy resides in the standard Prolog dynamic database to protect data during backtracking, while a Term Copy is stored directly on the heap. By matching against the Term Copy, the parser avoids expensive "copy-out" operations.

Because of the EFD-closure, any non-empty edge only needs to be copied exactly twice: once into the asserted database and once into the term copy, regardless of how many times it is accessed.

Evaluation and Key Results

The method was evaluated using several benchmarks, including Context-Free Grammars (CFGs) extracted from the Penn Treebank II (Wall Street Journal), the Alvey Grammar of English, and the MERGE grammar (a modified HPSG English Resource Grammar).

Parsing performance on the Alvey grammar specifically when subsumption testing is required.

As shown in the performance data, the EFD-based parser consistently outperformed standard benchmarks like Carpenter’s algorithm. A significant "aha moment" occurred when simple indexing (hashing by category) was added; the EFD method achieved an average speedup of 2.18x over the non-indexed version. In traditional parsers, the cost of copying an edge often dwarfs the time saved by smart indexing, but the Dual-Chart strategy makes such optimizations viable.

Parsing performance on the Alvey grammar specifically when subsumption testing is required.

For complex grammars like Alvey and MERGE, the EFD method showed clear advantages, particularly during subsumption testing (checking if a new discovery is already covered by a more general existing one). Without EFD, subsumption testing is notoriously slow in Prolog due to redundant copying.

Limitations and Future Work

While the shift to a constant copying cost is a major milestone, it comes with trade-offs. Keeping a full copy of the chart on the heap increases memory pressure, which could lead to cache misses in extremely large parses. Additionally, while EFD-closure is more conservative than other transformations, it still increases the total number of rules in the grammar.

Despite these challenges, the authors suggest this method paves the way for advanced indexing strategies—such as using automata or decision trees—that were previously considered too computationally expensive to implement in Prolog.

Summary updated

BibTeX
@inproceedings{penn2003tabulation,
  author = {Gerald Penn and Cosmin Munteanu},
  title = {{A Tabulation-Based Parsing Method that Reduces Copying}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2003},
  doi = {10.3115/1075096.1075122},
}
Figure