Controllable Context Sensitivity and the Knob Behind It

Julian Minder, Kevin Du, Niklas Stoehr, Giovanni Monea, Chris Wendler, Robert West, Ryan Cotterell

Large Language Models (LLMs) constantly juggle between trusting the context provided in a prompt and relying on their pre-trained prior knowledge. This paper discovers a 1-dimensional "knob" (a linear subspace) within LLMs that controls this exact decision. By mechanically tweaking this knob, researchers can force the model to either strictly follow the context or rely solely on its prior knowledge, even without explicit prompt instructions.

The Knowledge Conflict Problem

In applications like Retrieval-Augmented Generation (RAG) or document analysis, LLMs are fed external context. Sometimes, we want the model to rely heavily on this context (e.g., to avoid hallucinating outdated facts). Other times, we want it to ignore the context and rely on its prior knowledge (e.g., to avoid being tricked by prompt injections or misinformation).

Historically, this tension—known as a knowledge conflict—has been managed through prompt engineering or fine-tuning. However, the exact mechanistic process of how a model decides which source to trust has remained a black box. The authors set out to find the specific neural circuitry that mediates this choice and determine if it can be manually controlled.

Methods: The Controllable Context Sensitivity Task

To find the mechanism behind this behavior, the authors designed a Controllable Context Sensitivity (CCS) task. They feed the model a counterfactual context (e.g., "The capital of France is London") and a query ("What is the capital of France?"), along with an explicit intent instruction ("Listen to the context" vs. "Ignore the context").

Examples of the Controllable Context Sensitivity (CCS) task, showing how models are instructed to either ignore or listen to the provided context.

To isolate the circuitry driving this behavior, they employed tools from mechanistic interpretability:

  1. Activation Patching & Token Identity Patchscope (TIP): They swapped internal model activations between "listen to context" and "ignore context" runs to see which layers caused the model's output to flip.
  2. Novel Search Algorithm: Because searching through every attention head and layer is computationally expensive, they developed a linear-time algorithm to efficiently isolate the specific layers responsible for computing the intent, the prior answer, and the context answer.
  3. Subspace Identification & Steering: Once the critical layers were found, they learned a rank-1 orthogonal projection matrix to identify a 1-dimensional linear subspace that encodes the "intent." They then manually intervened on this subspace (adding or subtracting a vector) to "steer" the model's behavior without changing the prompt.

Datasets

The authors created intent-augmented datasets based on existing knowledge-conflict benchmarks:

  • CCS-BF (BaseFakepedia): Wikipedia facts paired with counterfactual paragraphs (e.g., changing a person's citizenship).
  • CCS-MH (MultiHopFakepedia): Similar to CCS-BF, but requires an extra hop of reasoning to arrive at the answer.
  • CCS-AR (Arithmetic): A synthetic dataset of simple math expressions where sub-expressions are counterfactually reassigned (e.g., context says "5 = 9", query asks for "(5 + 1) / 2").

Key Insights and Ideas

  • The "Knob" is Universal: The authors identified the 1D subspace by analyzing a model fine-tuned on the CCS task. Astonishingly, this exact same subspace acts as a functional knob in the base and non-fine-tuned instruct models of the same family. This suggests the mechanism is a fundamental feature of the LLM's architecture, not just an artifact of fine-tuning.
  • Modular Computation: The model processes knowledge conflicts in distinct, sequential steps. In Llama-3.1 8B, middle layers (e.g., 12–16) compute the intent (whether to trust the context). This intent is written to the residual stream, acting as a switch that triggers later layers (e.g., layer 24) to actually load either the context answer or the prior answer.
  • The Geometry of Performance: There is a massive correlation (~0.9 Pearson) between a model's performance on knowledge conflicts and how far apart the "context" and "prior" representations are in this 1D subspace. Better models naturally push these two states further apart in their latent space.

Key Results

Performance of Zero-Shot (ZS), In-Context Learning (ICL), and Fine-Tuned (FT) models across the three CCS datasets.
  • High Baseline Accuracy: When fine-tuned on the CCS task, Llama-3.1, Mistral-v0.3, and Gemma-2 achieve 85–95% "Pair Accuracy" (meaning they correctly output both the prior and context answers for the same prompt depending on the instruction).
  • Successful Steering: By manually setting the value of the 1D subspace without providing any intent instructions in the prompt, the authors achieved 83% Pair Accuracy on the fine-tuned Llama-3.1 8B.
  • Zero-Shot Latent Capabilities: Steering the subspace on the default (non-fine-tuned) Llama-3.1 instruct model yielded a 73% Pair Accuracy zero-shot, proving the model already possessed this controllable circuitry before any task-specific training.
  • Cross-Model Generalization: The existence of this 1D subspace was confirmed across multiple model families, including Llama-3.1 8B, Mistral-v0.3 7B, and Gemma-2 9B.

Limitations and Future Work

  • Direct Copying vs. Reasoning: The authors note that both fine-tuning and subspace steering are highly effective when the model can directly copy the answer from the context. It struggles more when the context must be used as part of an intermediate reasoning chain (like in the arithmetic dataset).
  • Future Directions:
  • Evaluating if tweaking this context knob negatively impacts other general behaviors, like instruction-following.
  • Developing "adaptive steering," where the model automatically turns its own knob based on the perceived reliability of the retrieved context.
  • Moving beyond binary "context vs. prior" conflicts to tasks that require seamlessly integrating information from both sources.

Summary updated

BibTeX
@inproceedings{minder2025controllable,
  author = {Julian Minder and Kevin Du and Niklas Stoehr and Giovanni Monea and Chris Wendler and Robert West and Ryan Cotterell},
  title = {{Controllable Context Sensitivity and the Knob Behind It}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=Igm9bbkzHC},
}
Figure