When Only Time Will Tell: Interpreting How Transformers Process Local Ambiguities Through the Lens of Restart-Incrementality

Brielen Madureira, Patrick Kahardipraja, David Schlangen

Abstract

Incremental models that process sentences one token at a time will sometimes encounter points where more than one interpretation is possible. Causal models are forced to output one interpretation and continue, whereas models that can revise may edit their previous output as the ambiguity is resolved. In this work, we look at how restart-incremental Transformers build and update internal states, in an effort to shed light on what processes cause revisions not viable in autoregressive models. We propose an interpretable way to analyse the incremental states, showing that their sequential structure encodes information on the garden path effect and its resolution. Our method brings insights on various bidirectional encoders for contextualised meaning representation and dependency parsing, contributing to show their advantage over causal models when it comes to revisions.

Introduction

In natural language processing, the dominant paradigm involves causal (unidirectional) models that process text strictly from left to right. Once a token is processed, its hidden state remains fixed. However, human language processing is inherently revisable. We often encounter "garden-path" sentences—structures that lead to an initial interpretation that must be corrected as more context arrives.

Consider the sentence: "The professor noticed the grant gained more attention." Initially, "the grant" appears to be the direct object of "noticed." Only upon reaching the verb "gained" does the reader realize "the grant" is the subject of a subordinate clause. While causal models are "stuck" with their initial commitment, bidirectional models like BERT have the potential to revise these internal representations. This paper investigates how bidirectional Transformers update their internal "beliefs" about sentence structure as context unfolds incrementally.

Figure 1: Visualization of the Restart-Incremental (RI) process where the model revises the part-of-speech tag for "can" as more context is provided.

Methodology: Restart-Incrementality and Triangular Structures

To study this phenomenon, the authors employ a Restart-Incremental (RI) paradigm. In this framework, the model processes every prefix of a sentence from scratch (e.g., "The", then "The professor", then "The professor noticed"). This allows researchers to observe how the representation of a specific word changes as the sentence grows.

To manage the resulting data, the authors propose Triangular Structures:

  1. 2D Charts: These track how a specific output (e.g., a POS tag or dependency arc) for a word evolves over successive timesteps.
  2. 3D Prisms: These extend the analysis to high-dimensional hidden states or attention distributions, capturing the evolution of internal features across tokens and time.
Figure 5: Triangular structures used for analysis: (a) 2D chart for discrete labels, (b) 3D prism for hidden states, and (c) 3D prism for attention distributions.

The study evaluates these structures using metrics such as Cosine Distance for hidden states and Jensen-Shannon Divergence (JSD) for attention distributions to quantify the "revision effort" when a disambiguating word appears.

Key Insights and Results

The Garden Path in AI

Bidirectional models are not immune to linguistic traps; they initially mirror the "wrong" human interpretation. When processing an ambiguous prefix, their internal states align with the simpler, incorrect structure until the disambiguating token forces a revision. For Noun-Noun Compounds, the mean cosine distance for the first noun's state jumped to 0.41 when the second noun appeared—significantly higher than the baseline drift of 0.34.

Layer-wise Dynamics

The most significant state revisions occur in the middle-to-upper layers of the Transformer. While lower layers remain relatively stable and focus on local syntax, middle layers appear to be the primary site for semantic re-evaluation and structural revision.

Internal Shifts Predict Edits

There is a remarkably high correlation between internal state shifts and external output changes. For instance, shifts in attention distributions (JSD) were found to be highly predictive of actual dependency arc revisions, with Matthews Correlation Coefficient (MCC) scores reaching up to 0.99 for some models.

Causal Model Brittleness

In contrast to the flexibility of RI-bidirectional models, causal models (like GPT-2) exhibit almost zero state variation for previously processed tokens. Without external mechanisms like beam search, they lack the internal machinery to recover from a garden path once a commitment is made.

Conclusion

While the Restart-Incremental method provides deep interpretability, it is computationally expensive ($O(n^2)$ complexity), making it primarily an analysis tool rather than a production strategy. Future research could extend this work to long-distance ambiguities and non-English languages with different word orders to further explore the temporal dynamics of Transformer representations.

Summary updated

BibTeX
@inproceedings{madureira2024when,
  author = {Brielen Madureira and Patrick Kahardipraja and David Schlangen},
  title = {{When Only Time Will Tell: Interpreting How Transformers Process Local Ambiguities Through the Lens of Restart-Incrementality}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  url = {https://openreview.net/forum?id=yMVP0iA5lh},
}
Figure