Learning Scripts as Hidden Markov Models

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

TL;DR

This paper introduces the first formal framework for learning narrative "scripts"—stereotypical sequences of events—using Hidden Markov Models (HMMs). By adapting Left-to-Right HMMs to handle unindicated missing events via state-dependent null transitions, the proposed SEM-HMM algorithm successfully learns common-sense event flows from text and outperforms standard baselines at predicting missing narrative steps.

What Problem Does This Paper Address?

When humans read a story, we rely heavily on common-sense knowledge to fill in unwritten gaps. For example, if a narrative says "John walked to the door. He greeted the visitor," we automatically infer that he opened the door in between. In NLP, these stereotypical event sequences are known as scripts.

While scripts are incredibly useful for tasks like resolving ambiguous references and answering comprehension questions, automatically learning them from natural language is challenging. Real-world narratives frequently omit mundane details, and texts rarely provide explicit markers indicating that an event was skipped.

Previous approaches to script learning relied on rigid graph-based clustering or lacked the temporal reasoning required to model order under uncertainty. This paper addresses this gap by framing script learning as a structural and parameter learning problem within a probabilistic framework.

Figure 1: A portion of a learned “Answer the Doorbell” script

Methods

The authors represent scripts using a special class of Left-to-Right HMMs, where hidden states correspond to abstract event types (e.g., "open door") and observations correspond to natural language sentences.

To handle the messy reality of omitted narrative steps, the authors introduce two key algorithmic innovations:

  1. State-Dependent Missingness ($\lambda$-transitions): The model includes a special null observation symbol ($\lambda$). States can transition without emitting a visible observation, effectively allowing the model to skip steps without needing to introduce complex, explicit "insertion" or "deletion" states.
  2. Two-Dimensional Forward-Backward Algorithm: Because $\lambda$-transitions mean that state transitions do not align 1:1 with visible observations, standard EM parameter estimation fails. The authors explicitly maintain two indices—time step $t$ and observation index $i$—to correctly calculate the forward ($\alpha$) and backward ($\beta$) probabilities.

For Structure Learning (SEM-HMM), the algorithm starts with a fully enumerated Prefix Tree Acceptor of the data. It then uses a greedy hill-climbing search to iteratively merge states and delete edges. To make this computationally tractable, they adopt a "locality of change" assumption, approximating the impact of structural changes on expected counts locally rather than re-running EM at every single search step.

Datasets

The framework was evaluated on the Open Minds Indoor Common Sense (OMICS) corpus.

  • Content: The corpus contains 9,044 short, temporally ordered narratives across 175 common household tasks.
  • Evaluation Subset: The authors used 84 domains that contained at least 50 narratives and 3 event types.
  • Setup: 40% of the narratives were withheld for testing, and exactly one randomly chosen event was deleted from each test sequence to evaluate the model's "gap-filling" accuracy.

Key Insights and Ideas

  • The "Locality of Change" Efficiency: Re-estimating HMM parameters after every single proposed state merge or edge deletion is incredibly expensive. Assuming that structural changes only impact local trajectories allows the algorithm to quickly evaluate thousands of structural variations.
  • Semantic Constraints as Priors: Purely statistical structure learning can easily over-generalize, creating physically impossible scripts. To counter this, the authors automatically learn pairwise constraints from the training data (e.g., "Event X never follows Event Y") and penalize models that violate these rules within the Bayesian scoring prior.

Key Results

The evaluation task required the models to predict a single missing event from a partial test sequence. As shown in the results table, the full SEM-HMM model achieved the highest accuracy, significantly outperforming all baselines.

Table 1: The average accuracy on the OMICS domains
  • Superiority over Baselines: At a batch size of $r=10$, SEM-HMM achieved 46.0% accuracy, compared to a simple frequency baseline (27.3%) and a standard temporal conditional baseline (36.2%).
  • The Value of EM: Comparing SEM-HMM to standard Bayesian Model Merging (BMM) highlights the necessity of EM; without EM parameter estimation, BMM's performance actually degraded as batch sizes grew.
  • Approximation Speedup: The approximate version of the algorithm (SEM-HMM Approx.) maintained highly competitive accuracy (44.3%) while cutting the computation time in half.

Limitations and Future Work

While a major step forward for formal script modeling, the authors note a few simplifying assumptions:

  • Simplified Text Input: The event extraction step assumes sentences follow a strict, simple verb-object structure.
  • Pre-ordered Narratives: The model assumes that the input text describes events in strict chronological order, ignoring the fact that real-world literature often uses flashbacks or non-linear timelines.

Future directions include scaling the model to handle complex, un-ordered texts like newspaper articles, enriching the hidden states to capture complex object relationships, and directly integrating these learned HMM scripts into broader text-understanding pipelines.

Summary updated

Abstract

Scripts have been proposed to model the stereotypical event sequences found in narratives. They can be applied to make a variety of inferences including filling gaps in the narratives and resolving ambiguous references. This paper proposes the first formal framework for scripts based on Hidden Markov Models (HMMs). Our framework supports robust inference and learning algorithms, which are lacking in previous clustering models. We develop an algorithm for structure and parameter learning based on Expectation Maximization and evaluate it on a number of natural datasets. The results show that our algorithm is superior to several informed baselines for predicting missing events in partial observation sequences.
BibTeX
@inproceedings{orr2014learning,
  author = {J. Walker Orr and Prasad Tadepalli and Janardhan Rao Doppa and Xiaoli 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