NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Learning Scripts as Hidden Markov Models

John Walker Orr, Prasad Tadepalli, Janardhan Rao Doppa, Xiaoli Z. Fern, Thomas G. Dietterich

Introduction

In artificial intelligence, "scripts" are mental templates for common, stereotypical activities—such as going to a restaurant or answering a doorbell. When humans encounter a narrative like "John went to a restaurant and later paid the bill," we automatically infer the missing steps: he sat down, ordered food, and ate. For machines, however, these "gaps" in natural language present a significant hurdle to understanding.

This paper introduces the first formal probabilistic framework for scripts using Hidden Markov Models (HMMs). The challenge in modeling scripts is twofold: narratives are "noisy," with different people describing the same event using different words, and they are "gappy," as authors rarely describe every mundane step of an action.

Methodology: Scripts as Left-to-Right HMMs

The authors propose representing scripts as Left-to-Right HMMs. In this architecture, hidden states represent abstract event types (e.g., "Open Door"), while observations correspond to the actual natural language sentences used to describe them.

A learned HMM script for answering a door, showing transition probabilities between hidden states and the handling of null observations (λ).

Technical Innovations

To adapt standard HMMs for script learning, the authors implemented several key innovations:

  • Handling Missing Data: Standard HMMs expect an observation for every state transition. The authors modified the Forward-Backward and EM (Expectation-Maximization) algorithms to allow for "null observations" ($\lambda$). This allows the model to account for events that occurred but were not mentioned in the text.
  • Structural EM (SEM-HMM): Rather than pre-defining the HMM structure, the system learns it from data. Starting with a "Prefix Tree Acceptor" of all observed sequences, the algorithm uses a greedy hill-climbing search to merge similar states and delete unnecessary edges, guided by a Bayesian scoring function.
  • Event Extraction: To bridge raw text and HMM states, a clustering algorithm based on WordNet similarity groups semantically related sentences (e.g., "He walked to the entrance" and "John went to the door") into single event types.

Evaluation and Results

The model was evaluated using the Open Minds Indoor Common Sense (OMICS) corpus, which contains over 9,000 narratives across 175 household tasks. The primary test involved removing a single event from a sequence and requiring the model to predict the missing step.

Performance comparison showing SEM-HMM accuracy against various baselines and the effect of batch size on learning.

As shown in the results, the SEM-HMM achieved an average accuracy of 46.0%, significantly outperforming simpler baselines such as "Frequency" (27.3%) and "Conditional" (36.2%). The model's performance improved as the "batch size" (the number of sequences processed before updating the structure) increased, indicating that more data helps the EM algorithm find superior local optima.

Discussion and Future Work

By utilizing HMMs, scripts become generative models capable of providing probabilistic "common sense" inferences. The model uses a Bayesian prior to penalize overly complex structures while rewarding those that follow learned semantic constraints (e.g., ensuring a door is opened before it is closed).

Despite its success, the model currently assumes that narratives follow a linear temporal order, which may not hold in complex fiction or news reports. Future work aims to expand the system to handle non-linear timelines, complex sentence structures involving multiple actors, and more "natural" text sources like newspaper articles.

Summary updated

BibTeX
@inproceedings{orr2014learning,
  author = {John Walker Orr and Prasad Tadepalli and Janardhan Rao Doppa and Xiaoli Z. Fern and Thomas G. Dietterich},
  title = {{Learning Scripts as Hidden Markov Models}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2014},
  doi = {10.1609/aaai.v28i1.8940},
}
Figure