Introduction
In the early 1970s, Artificial Intelligence research was heavily centered on solving problems represented as "goal trees." In these scenarios, a program must navigate a series of decision points where only specific paths lead to a successful solution. Manually programming these nondeterministic algorithms—where the system must explore multiple branches—was notoriously difficult, often resulting in complex, error-prone code filled with nested loops and manual state management.
While contemporary languages like PLANNER and QA4 introduced automatic backtracking to allow programs to "undo" incorrect choices, they were frequently plagued by significant performance overhead. The developers of MLISP2, a dialect of LISP, sought to create a system that was efficient, automatic, and simple enough to feel like writing standard deterministic code.
The State-Saving Philosophy
The researchers identified two primary philosophies for implementing backtracking: the sequential view and the state view. The sequential approach (used in languages like PLANNER) records an "inverse" for every action to undo it step-by-step. In contrast, the state view takes snapshots of the machine's status to restore later.
MLISP2 adopts a highly optimized version of the state view. As shown in the table below, MLISP2 distinguishes itself by automatically restoring both the control and data environments using state-saving techniques, placing it alongside systems like QA4 and POP-2 in terms of capability, but with a focus on LISP-native efficiency.
Technical Innovations
To make state-saving practical, MLISP2 introduced several key technical optimizations:
- Incremental State Saving: Rather than copying the entire memory at every decision point, the system only records the specific changes to the stack and variables that have occurred since the last decision.
- Context Numbers: Each decision point receives a unique integer. When a variable is modified, the system checks if it has already been changed in the current context; if not, the old value is cached before the new one is written. This ensures that "fetching" a value—the most common operation in LISP—remains at full speed.
- The State Stack: A dedicated structure mirrors the standard LISP pushdown stack (P stack). By utilizing high-speed memory-to-memory block transfers (a feature of the PDP-10 architecture), the system can rapidly archive and restore control information.
Evaluation and Impact
MLISP2 was not merely a theoretical exercise; it was battle-tested within the Stanford AI Lab. The system supported major projects including the Logic for Computable Functions (LCF) compiler, the FOL deduction system, and an English-to-French translator.
Performance metrics indicated that the backtracking routines typically accounted for less than 10% of total execution time. Crucially, for standard deterministic code that did not utilize backtracking features, the overhead was virtually insignificant. This efficiency proved that nondeterministic programming could be made practical for complex, real-world AI tasks.
Limitations
Despite its success, the MLISP2 approach had trade-offs. The implementation relied heavily on specific PDP-10 hardware instructions for its speed, making portability a challenge. Additionally, while incremental saving is efficient, extremely deep search trees with frequent data modifications could still lead to high memory consumption on the State Stack. Finally, the authors chose to omit unstructured "fail to a label" jumps (nondeterministic GOTO) to encourage better-structured code, a decision that prioritized safety over absolute programmer flexibility.
Summary updated