cs.CLMar 24, 2026

Failure of contextual invariance in large language models

Authors: Sagar Kumar, Ariel Flint, Luca Maria Aiello, Andrea Baronchelli

Organizations: Network Science Institute, Northeastern University, USA · Center for Health Informatics Program, Boston Children’s Hospital, USA · Dept. of Mathematics, City St George’s, University of London, UK · IT University of Copenhagen, DK

Abstract

Standard evaluation practices assume that large language model (LLM) outputs are stable when prompts are embedded in contextually equivalent discourses. Here, we test this assumption in the setting of gender inference. Using a controlled pronoun selection task, we introduce minimal, theoretically uninformative discourse context and find that this induces large, systematic shifts in model outputs. Correlations with cultural gender stereotypes, present in decontextualized settings, weaken or disappear once context is introduced, while theoretically irrelevant features, such as the gender of a pronoun for an unrelated referent, become the most informative predictors of model behavior. A Contextuality-by-Default analysis reveals that, in 19--52% of cases across models, this dependence persists after accounting for all marginal effects of context on individual outputs and cannot be attributed to simple pronoun repetition. These findings show that LLM outputs violate contextual invariance even under near-identical syntactic formulations, with implications for bias benchmarking and deployment in high-stakes settings.

Figures & tables

Explore similar work

CardsList
  1. Gender bias across LLMs is common and highly heterogeneous

    Sep 29, 2026Edoardo Bolzoni, Valerio CapraroGender Bias in Language ModelsLLM Auditing

  2. Anchoring LLM Gender Bias to Human Baselines: A Cross-Lingual Audit

    May 29, 2026Jiwoo Choi, Seonwoo Ahn, Tongxin Zhang +1Gender Bias in Language ModelsMultilingual Language Model Evaluation