Overthinking the Truth: Understanding how Language Models Process False Demonstrations

Danny Halawi, Jean-Stanislas Denain, Jacob Steinhardt

Large Language Models (LLMs) are famous for "in-context learning"—the ability to pick up a new task simply by observing a few examples (demonstrations) provided in a prompt. However, this adaptability is a double-edged sword: if a user provides incorrect, toxic, or biased examples, the model will often faithfully imitate those errors.

This raises a fundamental question about the internal mechanics of "harmful imitation." Does the model actually become convinced by the false context, or does it internally recognize the truth but architecturally prioritize the pattern shown in the prompt? Understanding this distinction is crucial for building models that are robust against misinformation and prompt injection attacks. Recent research reveals that LLMs often "know" the correct answer in their early layers but "overthink" and follow incorrect prompt demonstrations as processing continues into later layers.

Peeking Inside the Black Box

To understand how models process false demonstrations, researchers employed a "bottom-up" mechanistic interpretability approach across 11 different language models (including GPT-J, Pythia, and Llama-2) and 14 text classification datasets. Their methodology relied on three core techniques:

  1. The Logit Lens: This technique allows researchers to "peek" at the model’s internal state at every single layer. By applying the model's final output layer (the unembedding matrix) to the hidden states of intermediate layers, they could observe what the model would predict if it were forced to "exit" early.
  2. Contrastive Analysis: They compared model behavior across two settings: "Correct Demonstrations" (where labels match the truth) and "Permuted Labels" (where labels are systematically swapped, such as labeling all "Positive" reviews as "Negative").
  3. Head Ablation: After identifying specific attention heads responsible for copying false labels, researchers "ablated" them (set their output to zero) to see if it would prevent the model from overthinking.

The "Overthinking" Phenomenon

The logit lens revealed a fascinating internal trajectory. In early layers, the model's internal representation for a prompt with correct demonstrations and one with incorrect demonstrations looks almost identical. However, at a specific "critical layer" (usually around the middle of the model), the paths diverge sharply.

Overview of the overthinking phenomenon: prompt setup, layer-by-layer accuracy divergence, and the success of targeted head ablation.

When given false demonstrations, the model’s accuracy actually decreases as it gets deeper into the network. For instance, a model might internally arrive at the correct answer by layer 16, but "think itself" into the wrong answer by layer 28. This suggests that models often "know" the truth based on their massive pre-training but are architecturally wired to prioritize context-following in their final layers.

The authors localized this behavior to a tiny fraction of the model: specific attention heads in the late layers dubbed False Induction Heads. These heads act as "copy-paste" mechanisms that specifically look for patterns in the prompt's labels and override the model's pre-trained knowledge.

Curing the Overthinking

Understanding this mechanism opens the door to targeted interventions:

  • Early Exiting: For models like GPT-J, simply stopping the computation at a middle layer (e.g., layer 16 out of 28) actually resulted in higher accuracy on misleading prompts than allowing the model to finish its entire computation.
  • Surgical Precision: By ablating just 5 specific attention heads (roughly 1% of the total heads in GPT-J), the researchers reduced the accuracy gap between correct and incorrect prompts by an average of 38.9% across the 14 datasets.
  • No Collateral Damage: Crucially, removing these false induction heads had a negligible effect on the model's performance when it was given correct demonstrations.

Limitations and Future Directions

While these findings provide a powerful new lens for understanding model behavior, the study primarily focused on multiple-choice classification. It remains to be seen if these same false induction heads govern behavior in long-form creative writing or complex reasoning tasks. Furthermore, while ablating heads helped significantly, it didn't completely eliminate the influence of false demonstrations, suggesting other components (like MLPs or other attention heads) also play a role.

Ultimately, this work highlights a fundamental tension in AI training: we want models to follow instructions, but we don't want them to follow bad instructions. By identifying the specific circuits responsible for harmful imitation, this research provides a promising roadmap for guarding the truth at the architectural level.

Summary updated

BibTeX
@inproceedings{halawi2024overthinking,
  author = {Danny Halawi and Jean-Stanislas Denain and Jacob Steinhardt},
  title = {{Overthinking the Truth: Understanding how Language Models Process False Demonstrations}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=Tigr1kMDZy},
}
Figure