Quantum-like contextuality in large language models
Contextuality is a distinguishing feature of quantum mechanics, and there is evidence that it is a necessary condition for quantum advantage in the context of magic state distillation. To harness it, researchers have been asking whether similar phenomena arise in other domains. The answer has been affirmative, e.g. in behavioural sciences. However, one has to adopt frameworks that take some degree of signalling into account. Two such frameworks exist: (i) a signalling-corrected sheaf-theoretic model and (ii) the Contextuality-by-Default (CbD) framework. This paper provides the first large-scale experimental evidence for contextuality in the large language model BERT. We constructed a linguistic schema modelled over a contextual quantum scenario, instantiated it in the Simple English Wikipedia, and extracted probability distributions for the instances. This led to the discovery of 77 118 sheaf-contextual and 36 938 948 CbD contextual instances. We prove that these contextual instances arise from semantically similar words by deriving an equation that relates degrees of contextuality to the Euclidean distance of BERT’s embedding vectors. Our linguistic schema is a variant of the coreference resolution challenge. These results suggest that quantum methods may be advantageous in the field of natural language processing.
Authors
- Kin Ian Lo (ORCID: https://orcid.org/0000-0002-1300-396X)
- Shane Mansfield (ORCID: https://orcid.org/0000-0002-2231-2422)
- Mehrnoosh Sadrzadeh (ORCID: https://orcid.org/0000-0002-5863-7835)
Institutions
- Quandela (France) (FR)
- University College London (GB)
Publication Details
- Journal
- Proceedings of the Royal Society A Mathematical Physical and Engineering Sciences
- Published
- 2025-08-01
- DOI
- https://doi.org/10.1098/rspa.2024.0399
- Primary Topic
- Quantum Mechanics and Applications
- Type
- article
- Field-Weighted Citation Impact
- 0.00
Funders
- Royal Academy of Engineering
- Engineering and Physical Sciences Research Council