Analysing Neural Language Models: Contextual Decomposition Reveals Default Reasoning in Number and Gender Assignment

Jaap Jumelet, Willem H. Zuidema, Dieuwke Hupkes

Introduction

Modern neural language models demonstrate remarkable proficiency in handling complex grammatical dependencies, such as subject-verb agreement across long distances. However, the internal mechanisms driving these capabilities remain largely opaque. It is unclear whether these models construct internal syntactic representations or rely on sophisticated statistical shortcuts. This research addresses the interpretability of Long Short-Term Memory (LSTM) networks by distinguishing between information from specific focus phrases, surrounding context, and inherent model biases.

Generalised Contextual Decomposition (GCD)

To investigate these internal dynamics, we introduce Generalised Contextual Decomposition (GCD), an advancement over the original Contextual Decomposition (CD) method. GCD partitions the hidden and cell states of an LSTM into two distinct components: $\beta$ (the "inside" contribution from a specific phrase) and $\gamma$ (the "outside" contribution from the remaining context).

Schematic of the GCD framework within an LSTM cell, illustrating the partitioning of states into beta and gamma components across gates.

Unlike its predecessor, GCD allows for flexible hypothesis testing by varying the assignment of interactions—such as gate intercepts or previous hidden states—to the inside or outside bins. To ensure a fair distribution of contributions, the framework employs Shapley values from game theory to allocate input influence across the model's gates.

Experimental Framework

The method was evaluated on two core linguistic phenomena:

  1. Subject-Verb Agreement (Number): Using the NounPP corpus, we tested sentences designed to induce agreement errors (e.g., "The keys on the table are...").
  2. Anaphora Resolution (Gender): Using the WinoBias corpus, we examined both unambiguous gendered terms and stereotypical job titles (e.g., "doctor" vs. "nurse").

The Asymmetry of Logic: Default Reasoning

A primary finding of this study is that LSTMs do not treat grammatical categories symmetrically. Instead, the models exhibit "default reasoning," where singular and masculine forms serve as the baseline "factory settings."

Heatmaps showing the contribution of decomposed tokens to predicted classes. The asymmetry between singular/plural and masculine/feminine predictions highlights the model's reliance on internal defaults.

When predicting a singular verb, the contribution from the actual subject is often minimal because the model is biased toward a singular output by default. Conversely, predicting a plural or feminine form requires a significant "spike" in evidence from the input tokens to override the internal baseline. This suggests that the model assumes a default state until explicit evidence forces a state change.

Structural Bias and Results

The analysis reveals that this bias is structural, residing within the intercepts (bias terms) of the LSTM gates and the final output layer rather than just the word embeddings. For instance, the internal intercept for the pronoun he (7.75) was found to be significantly higher than for she (6.09).

In the WinoBias task, this internal male default exacerbated societal stereotypes. Even when a "nurse" was the clear referent, the model's internal bias made it more difficult for the "female" signal to prevail compared to unambiguous cases. Interestingly, this singular default persisted even when plural verbs were more frequent in the training data, suggesting the bias is a fundamental property of the model's learning strategy rather than a simple reflection of token frequency.

Conclusion

GCD provides a powerful lens into the "black box" of LSTMs, revealing that grammatical processing is governed by evidence-based overrides of hard-coded defaults. These findings suggest that mitigating bias in AI requires looking beyond word embeddings to the internal reasoning pathways and structural intercepts of the architecture. Future work will focus on adapting GCD to the self-attention mechanisms of Transformer-based models.

Summary updated

BibTeX
@inproceedings{jumelet2019analysing,
  author = {Jaap Jumelet and Willem H. Zuidema and Dieuwke Hupkes},
  title = {{Analysing Neural Language Models: Contextual Decomposition Reveals Default Reasoning in Number and Gender Assignment}},
  booktitle = {CoNLL},
  year = {2019},
  url = {https://openreview.net/forum?id=9dqieM-wCkW},
}
Figure