Lazy Unification

Kurt GoddenACL 1990

In the late 1980s and early 1990s, unification-based natural language processing (NLP) systems faced a significant performance hurdle. Unification—the process of merging Directed Acyclic Graphs (DAGs) representing grammar rules or lexical entries—is inherently destructive. To preserve original grammar rules for subsequent operations, parsers traditionally employed "Eager Unification," copying entire graphs before any merge attempt.

This 1990 paper by Kurt Godden from General Motors Research Laboratories introduces Lazy Unification (LU), a technique that delays copying until absolutely necessary, dramatically improving efficiency by applying functional programming concepts to graph structures.

The Bottleneck of Eager Unification

The primary issue with eager unification is its extreme inefficiency. In many NLP systems of the era, such as the TASLINK system, the act of copying data structures consumed the vast majority of processing time. Much of this work is wasted because unification frequently fails early in the process, or large portions of the graph remain unmodified. Eagerly copying the entire structure regardless of the outcome creates a massive memory and processing overhead.

Figure 1: Distribution of computation time in the TASLINK system, highlighting copying as the dominant bottleneck.

As shown in Figure 1, copying accounted for approximately 67.77% of total computation time. Godden identifies this "over-copying trap" as the central problem to be solved.

The Lazy Unification Approach

Godden's solution treats copying as an "on-demand" operation. By using a Delay/Force pattern, the system avoids unnecessary work.

Key Mechanisms

  1. Active Nodes (Closures): Instead of copying a node, the system creates an "active node"—a closure that encapsulates the original node and a suspended copy function.
  2. Incremental Copying: When a destructive change is about to occur, the system "forces" the closure. However, it doesn't copy the whole sub-graph; it only copies the root node and turns its children into new active nodes. This "paints" the copy down the graph only as far as necessary.
  3. Copy Environments: To handle "convergent arcs" (where multiple paths point to the same node), the system maintains an association list. This ensures that shared nodes are not duplicated into separate trees, a problem known as node splitting.
Figure 5: An illustration of incremental copying and node management within a DAG under lazy evaluation.

Performance and Results

The evaluation of Lazy Unification within the TASLINK system demonstrated a dramatic shift in the computational profile of the parser:

  • Node Reduction: LU resulted in an 87% reduction in the number of nodes created compared to eager unification.
  • Speedup: Despite the overhead of managing closures, the system achieved a 50% speedup in execution time. In practice, accounting for reduced garbage collection, the system performed at better than twice the original speed.
  • Efficiency Shift: The cost of copying dropped from roughly 68% to just 19% of the total parse time.

Conclusion and Limitations

While highly effective, Lazy Unification is not without costs. The "lazy tax" includes the overhead of constantly checking if a node is "simple" or "active," and searching linear copy environments can become a bottleneck for very large graphs. Furthermore, Godden notes that lazy evaluation is notoriously difficult to debug due to its non-local execution timing. Nevertheless, the approach proved that delaying destructive operations is a powerful strategy for optimizing complex symbolic processing tasks.

Summary updated

BibTeX
@inproceedings{godden1990lazy,
  author = {Kurt Godden},
  title = {{Lazy Unification}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {1990},
  doi = {10.3115/981823.981846},
}
Figure