In this seminal 1985 paper, Fernando C. N. Pereira addresses a critical bottleneck in computational linguistics: the computational expense of "unification." Unification is the process of combining complex linguistic information during parsing, and at the time, it was a major performance drain. By introducing a "structure-sharing" representation inspired by automated theorem proving, Pereira demonstrated how to reduce parsing times by up to 60% without the massive memory overhead associated with traditional data-copying methods.
The Unification Bottleneck
By the mid-1980s, natural language processing (NLP) was shifting toward unification-based formalisms such as PATR-II and Lexical-Functional Grammar (LFG). Unlike simple context-free grammars that use atomic labels (like NP or VP), these formalisms utilize complex "phrase types" represented as Directed Acyclic Graphs (DAGs) of features and values.
The primary challenge was that whenever a grammar rule was applied, the system had to create new phrase types by refining and merging existing ones. A "naive" implementation would physically copy the old DAGs to modify them. As grammars became more sophisticated, this constant copying became a massive drain on both CPU cycles and memory. Pereira sought a way to represent these updates "virtually," allowing original data structures to be reused across different branches of the search space.
The Molecule Representation
Pereira’s solution centers on the concept of a molecule. Borrowing from the Boyer-Moore theorem prover and early Prolog implementations, a molecule represents a phrase type as a pair: a pointer to the original, immutable DAG (the skeleton) and a table of updates (the environment).
In this framework, updates include "reroutings" (replacing a node) and "bindings" (adding a new arc). The unification algorithm is redefined to operate on these molecules, traversing the skeleton and checking the environment for any virtual modifications before deciding how to merge two structures. This avoids the need to create physical copies of the entire graph for every rule application.
Efficient Environment Management via Virtual-Copy Arrays
To manage these environments efficiently, Pereira utilized a data structure developed by David H. D. Warren: the virtual-copy array. This is essentially a persistent $2^k$-ary tree that allows for $O(\log n)$ access and updates.
Crucially, when a virtual-copy array is updated, it returns a new version of the array that shares most of its structure with the old one, rather than destroying the original. This allows the parser to explore multiple ambiguous interpretations of a sentence simultaneously without them interfering with each other’s data. Pereira framed this memory organization as the "hardware" layer of the system, providing the necessary efficiency for the higher-level DAG data structures.
Key Results and Impact
Pereira’s structure-sharing method provided several significant advantages over the status quo:
- Significant Speedups: Preliminary tests using a left-corner parsing algorithm showed that structure sharing made parsing 40% to 60% faster than traditional structure-copying approaches.
- Improved Complexity: The cost of looking up a node update was reduced from $O(d)$ (where $d$ is the derivation length) in the original Boyer-Moore scheme to $O(\log d)$ using virtual-copy arrays.
- Generality: The method proved applicable to a wide range of formalisms, including Definite-Clause Grammars (DCGs) and Functional Unification Grammar.
While the paper acknowledged some limitations—such as the "renaming problem" in rare edge cases and the inherent overhead of tree-based lookups compared to raw arrays—the work laid the groundwork for modern functional programming techniques in high-performance compilers and state management within NLP systems.
Summary updated