The Language Model Understood the Prompt was Ambiguous: Probing Syntactic Uncertainty Through Generation

Laura Aina, Tal Linzen

TL;DR

Researchers have developed a novel way to measure "syntactic uncertainty" in language models (LMs) by analyzing the text they generate. By sampling multiple completions for ambiguous prompts, they demonstrate that models like GPT-2 track multiple grammatical interpretations simultaneously and respond dynamically to disambiguating cues, much like human readers do.

What Problem Does This Paper Address?

When we read a sentence like "The audience knew the band...", our brains don't wait for the period to start parsing. We incrementally build a structure. However, at this point, the sentence is temporarily ambiguous: the "band" could be the thing the audience knows (a direct object) or the subject of a new clause ("...the band was going to be late").

In psycholinguistics, this is well-studied in humans, but how do neural language models (LMs) handle it? Previous research mostly used "surprisal"—measuring how much a model is "shocked" by a word that resolves an ambiguity. While useful, surprisal doesn't tell us the degree of uncertainty the model holds before the resolution, nor does it easily show if the model is entertaining multiple interpretations at once. This paper proposes using stochastic generation as a window into the model's internal "probabilistic parser."

Methods

The authors propose a "Probing through Generation" framework:

  1. Prompting: Feed an ambiguous sentence fragment (a "prompt") to an LM (specifically GPT-2 and a Gulordava-style LSTM).
  2. Sampling: Instead of taking the single most likely next word, use stochastic decoding to generate 100 different completions for each prompt.
  3. Syntactic Classification: Use an off-the-shelf dependency parser (AllenNLP) to analyze the generated completions. For example, did the model treat "the band" as a direct object or a subject in its finished sentence?
  4. Uncertainty Estimation: Calculate the proportion of completions that follow each interpretation. If 70 completions use Parse A and 30 use Parse B, the model's "subjective probability" for Parse A is estimated at 0.7.

This approach is unique because it doesn't require the researcher to pre-define "correct" completions; the model reveals its own expectations through its creative output.

Datasets

The study uses curated sentence sets from classic psycholinguistic experiments:

  • NP/S Ambiguity: Materials from Grodner et al. (2003) (e.g., "The employees understood (that) the contract...").
  • NP/Z Ambiguity: Also from Grodner et al. (2003) (e.g., "Even though the band left(,) the party...").
  • Noun/Verb Ambiguity: Materials from Frazier and Rayner (1987) (e.g., "Mary thinks that the pants suit..." where "suit" can be a noun or a verb).

These datasets are designed to trigger "garden-path" effects, where a reader is led toward one interpretation only to find it's wrong later in the sentence.

Key Insights and Ideas

  • Parallel Processing: LMs don't just commit to one path. They maintain a distribution over multiple syntactic analyses. The generation method makes this "hidden" uncertainty visible.
  • Default Biases: Models exhibit strong structural preferences. For instance, they have a massive bias toward Noun Phrase (NP) interpretations over Sentential (S) ones, mirroring the "late closure" or "minimal attachment" strategies often seen in humans.
  • Sensitivity to Cues: Adding a single word (like the complementizer "that") or a comma almost entirely collapses the model's uncertainty, shifting the probability mass to the correct interpretation.
  • Lingering Confusion: In NP/Z cases (e.g., "As the couple danced the tango began..."), GPT-2 sometimes produced ungrammatical "blended" sentences. This suggests that once a model starts down a wrong syntactic path, it struggles to "repair" its internal state, leading to structural errors—a digital version of a human "garden-path" moment.

Key Results

  • NP/S Ambiguity: Without cues, models preferred the NP interpretation (direct object) but still generated S completions (embedded subject) roughly 20-30% of the time.
  • NP/Z Ambiguity: Models showed a near-absolute bias toward the NP interpretation. Without a comma, the probability of the "Zero" (Z) interpretation was nearly 0%.
  • Noun/Verb Ambiguity: This showed the highest variance. The model's preference wasn't just structural; it depended heavily on the specific words used, suggesting the model uses lexical frequency (how often "suit" is a noun vs. a verb) to resolve ambiguity.
  • Validation: The generation-based probabilities correlated strongly with traditional surprisal measures (Spearman’s $\rho$ between -0.70 and -0.81), proving that generation is a valid proxy for the model's internal syntactic state.

Limitations and Future Work

  • Parser Reliability: The method relies on an external syntactic parser to label the completions. If the parser makes a mistake, the uncertainty estimate is skewed.
  • Ungrammaticality: The authors noted that models sometimes generate ungrammatical text when confused. Currently, the method discards these or forces them into a category; future work could treat ungrammaticality itself as a signal of high syntactic conflict.
  • Scope: The study focused on three specific English ambiguities. Expanding this to more complex structures (like relative clause attachments) or other languages would test the universality of these findings.

Summary updated

Abstract

Temporary syntactic ambiguities arise when the beginning of a sentence is compatible with multiple syntactic analyses. We inspect to which extent neural language models (LMs) exhibit uncertainty over such analyses when processing temporarily ambiguous inputs, and how that uncertainty is modulated by disambiguating cues. We probe the LM's expectations by generating from it: we use stochastic decoding to derive a set of sentence completions, and estimate the probability that the LM assigns to each interpretation based on the distribution of parses across completions. Unlike scoring-based methods for targeted syntactic evaluation, this technique makes it possible to explore completions that are not hypothesized in advance by the researcher. We apply this method to study the behavior of two LMs (GPT2 and an LSTM) on three types of temporary ambiguity, using materials from human sentence processing experiments. We find that LMs can track multiple analyses simultaneously; the degree of uncertainty varies across constructions and contexts. As a response to disambiguating cues, the LMs often select the correct interpretation, but occasional errors point to potential areas of improvement.
BibTeX
@inproceedings{aina2021language,
  author = {Laura Aina and Tal Linzen},
  title = {{The Language Model Understood the Prompt was Ambiguous: Probing Syntactic Uncertainty Through Generation}},
  booktitle = {BlackboxNLP @ EMNLP},
  year = {2021},
  doi = {10.18653/v1/2021.blackboxnlp-1.4},
}

Loading related content...

Figure