AVM Description Compilation using Types as Modes

Gerald Penn

Abstract

This paper presents a method for optimizing the enforcement of Typed Feature Structures (TFS) in natural language grammars by treating types as "modes" of instantiation. By tracking the state of knowledge during compilation, the system generates efficient code and templates, resulting in significant performance gains across standard linguistic grammars like the English Resource Grammar (ERG).

Introduction

In computational linguistics, particularly within frameworks like Head-driven Phrase Structure Grammar (HPSG), Typed Feature Structures (TFS) are the primary vehicle for representing complex linguistic information such as agreement, tense, and semantic roles. These structures are governed by type hierarchies that define mandatory features. However, enforcing these constraints during parsing—checking if a data structure matches a description—is a significant computational bottleneck. Traditionally, this is handled via general unification, which often fails to leverage the structural information already provided by a structure's type.

Methodology: Types as Modes

The core innovation presented by Gerald Penn is the treatment of Types as Modes. Borrowing from logic programming, "modes" indicate whether a variable is an input (already instantiated) or an output (to be instantiated). By applying this to TFS, the compiler can track the "input mode" (what is known about the structure) and the "output mode" (the state after enforcement).

The compilation process follows a structured pipeline to transform descriptions into optimized code:

  1. Pre-processing: Descriptions are expanded from macros and segmented into functional blocks to maintain execution order.
  2. Partitioning and Reordering: The compiler prioritizes "fail-fast" operations, such as type mismatch checks, before executing expensive feature path lookups.
  3. Template Generation: Instead of individual instructions, the compiler creates partial Prolog terms (templates). Unifying with these templates at runtime is significantly faster than executing a sequence of discrete instructions.
The three-stage pre-processing of descriptions into functional blocks.

Experimental Evaluation

The proposed compiler was benchmarked against the standard ALE 3.3 compiler using two distinct linguistic grammars:

  • English Resource Grammar (ERG): A large-scale, high-coverage grammar of English, evaluated on a suite of 61 sentences.
  • HPSG Grammar: A literal translation of the Pollard and Sag (1994) grammar, known for being more relational and computationally demanding. This was tested on 274 randomly selected sentences.

Results

The "mode-sensitive" approach yielded substantial performance improvements across both test suites. For the ERG, parsing times were reduced by an average of 41.8%, with every sentence in the suite showing a speedup of at least 36.5%.

Performance comparison on the ERG test suite (61 sentences) showing reduced parsing times with mode-sensitive compilation.

The HPSG grammar showed an average speedup of 28.9%. Notably, for certain complex sentences, the optimization resulted in a staggering 99.6% reduction in parsing time, demonstrating the system's effectiveness in handling "stress test" scenarios.

Conclusion

By viewing types as filters and strategically reordering constraints, the mode-sensitive compiler significantly enhances the efficiency of TFS enforcement. While the current reordering logic is relatively simple, the results suggest that even basic mode tracking can lead to dramatic improvements in parsing speed. Future work will focus on using empirical data to further optimize block ordering and integrating user-provided mode declarations for complex relations.

Summary updated

BibTeX
@inproceedings{penn2003avm,
  author = {Gerald Penn},
  title = {{AVM Description Compilation using Types as Modes}},
  booktitle = {EACL},
  year = {2003},
}
Figure