Context versus Prior Knowledge in Language Models

Kevin Du, Vésteinn Snæbjarnarson, Niklas Stoehr, Jennifer C. White, Aaron Schein, Ryan Cotterell

Abstract

Large Language Models (LLMs) act as both vast knowledge repositories and flexible in-context learners. However, these roles often conflict when prompt information contradicts internal priors. This paper introduces two information-theoretic metrics—Persuasion Score and Susceptibility Score—to quantify this "tug-of-war." Our analysis reveals that models are significantly more "stubborn" regarding entities encountered frequently during pretraining, while relevant context remains the most effective tool for swaying model output.

Introduction

When a model "knows" from pretraining that the Beatles are a legendary band, but a prompt asserts "The Beatles are the worst," how does it resolve the conflict? Existing research often treats these knowledge conflicts as binary outcomes—did the model follow the context or its prior? This paper argues for a more nuanced approach, seeking to formally measure the strength of a model's dependency on context versus its internal biases for specific entities and query types.

Measuring the Tug-of-War

The authors formalize the interaction between context and prior knowledge using Information Theory, specifically a concept called Half-pointwise Mutual Information (HPMI). They introduce two primary metrics:

  1. Persuasion Score ($\psi$): Measures how much a specific context changes a model's answer distribution for a particular query. It is calculated as the KL-divergence between the model's answer distribution with the context versus without it.
  2. Susceptibility Score ($\chi$): A property of the entity itself, measuring how much its associated answer distribution can be swayed, marginalized over a variety of different contexts.
Framework for calculating Susceptibility ($\chi$) and Persuasion ($\psi$) scores.

To calculate these at scale, the researchers employed a Monte Carlo estimator, sampling from constructed contexts and approximating answer distributions via next-token probabilities across the Pythia model suite (ranging from 70M to 12B parameters).

Experimental Methodology

The study utilized diverse data sources to create a controlled environment:

  • Knowledge Extraction: 122 relations and real-world entities were pulled from the YAGO Knowledge Graph (e.g., "alumniOf", "capital").
  • Familiarity Ground Truth: The researchers analyzed "The Pile" (the deduplicated pretraining corpus) to calculate co-occurrence frequencies of entities and answers.
  • Synthetic Testing: GPT-4 generated "fake" entities to test model behavior in unfamiliar territory, ensuring results weren't solely based on real-world memorization.

Results: Familiarity and Resistance

A primary finding of the study is that familiarity breeds resistance. There is a strong negative correlation (Spearman $\rho = -0.23$) between how often an entity appears in training data and its susceptibility score.

Susceptibility scores vs. memorization ratio for open and closed queries.

As shown in the figure above, as the memorization ratio (a proxy for familiarity) increases, the susceptibility score generally decreases. This effect is particularly visible in open-ended queries, where the median susceptibility drops significantly as entities become more familiar to the model. This suggests that the more a model "knows" an entity, the harder it is to change its mind using in-context information.

The Power of Relevance

Contexts that explicitly mention the queried entity are significantly more persuasive than irrelevant ones. In 95–100% of open queries, relevant contexts were significantly more persuasive. This effect is particularly pronounced in larger models, which are better at integrating relevant context but also show a sharper distinction between how they treat familiar versus unfamiliar entities.

Bias and Social Stance

Susceptibility scores also serve as a tool for bias detection. For instance, masculine names were found to be more susceptible to change when placed in feminine-stereotyped contexts than vice versa, indicating a stronger internal prior for masculine stereotypes. Additionally, "enemy" entity pairs (e.g., David and Goliath) proved less susceptible than "friend" pairs, suggesting more rigid internal representations of conflict.

Conclusion

By quantifying the balance between internal priors and external context, this work provides a framework for understanding LLM behavior in complex information environments. These metrics have significant implications for improving Retrieval-Augmented Generation (RAG), model editing, and ensuring the reliability of few-shot learning by better controlling the influence of context.

Summary updated

BibTeX
@inproceedings{du2024context,
  author = {Kevin Du and Vésteinn Snæbjarnarson and Niklas Stoehr and Jennifer C. White and Aaron Schein and Ryan Cotterell},
  title = {{Context versus Prior Knowledge in Language Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.acl-long.714},
}
Figure