IRCAN: Mitigating Knowledge Conflicts in LLM Generation via Identifying and Reweighting Context-Aware Neurons

Dan Shi, Renren Jin, Tianhao Shen, Weilong Dong, Xinwei Wu, Deyi Xiong

Large Language Models (LLMs) are essentially massive repositories of compressed knowledge. However, a significant challenge arises when that encoded "parametric knowledge" is wrong, outdated, or contradicts newly provided information. Even when correct information is supplied in a prompt—such as in Retrieval-Augmented Generation (RAG)—LLMs often exhibit "stubbornness," ignoring the provided context in favor of the data they memorized during pre-training.

A new framework, IRCAN (Identifying and Reweighting Context-Aware Neurons), offers a surgical, plug-and-play solution to make LLMs more faithful to their context. By identifying and boosting the specific neurons responsible for processing contextual cues, IRCAN significantly reduces knowledge conflicts without requiring expensive retraining.

The Challenge of Knowledge Conflicts

The core issue IRCAN addresses is knowledge conflict. Imagine asking an LLM, "Which country is the most populous?" Even if you provide a context snippet stating that India surpassed China in 2023, a model like LLaMA-2 might still confidently answer "China" because that was the ground truth during its training phase.

Existing solutions to this problem have major drawbacks:

  • Fine-tuning or Model Editing: These methods are computationally expensive, slow, and can lead to "catastrophic forgetting" of other learned capabilities.
  • Prompt Engineering: Often unreliable and highly specific to individual models.
  • Contrastive Decoding (CAD): While effective, CAD operates only at the final output probability (logit) level, ignoring the internal mechanics and routing within the model itself.

The authors hypothesize that specific neurons within the LLM are responsible for "listening" to the context. If we can locate these neurons and amplify their influence, we can resolve the conflict at its source.

The IRCAN Framework

The IRCAN framework operates in three distinct, inference-time phases to steer the model toward context-sensitive outputs.

The IRCAN framework operates in three phases: Context-Aware Attribution, Neuron Identification, and Neuron Reweighting.
  1. Context-Aware Attribution: The researchers use Integrated Gradients (IG) to assign an "attribution score" to neurons in the Feed-Forward Network (FFN) layers. By comparing the model's internal activations when given just a question versus when given the question plus context, they identify which neurons are most sensitive to contextual information.
  2. Neuron Identification: Rather than relying on a single example, the framework analyzes attribution scores across many instances. This reveals a stable set of "context-aware neurons" that consistently fire when the model needs to integrate external information.
  3. Reweighting: Once identified, these specific neurons are strengthened. Their weights are multiplied by an enhancement factor ($\beta$). Because this is a purely offline, inference-time intervention, it requires absolutely no retraining or fine-tuning of the base model.

Experimental Setup and Key Insights

The authors evaluated IRCAN on several challenging benchmarks designed specifically to trigger knowledge conflicts, including MemoTrap (a completion task using proverbs with unexpected "traps"), as well as COSE and E-CARE (multiple-choice tasks where the provided context supports a counter-intuitive answer). They also tested on general ability benchmarks (ARC, MMLU, GSM8K, etc.) to ensure the intervention didn't degrade standard reasoning.

Several fascinating insights emerged from the study:

  • The "Where" Matters: Context-aware neurons are primarily located in the top layers of the model. This aligns with the theory that lower layers handle surface-level features, while higher layers manage complex semantic integration.
  • Surgical Precision: Modifying the model doesn't require sweeping changes. Strengthening just a few dozen neurons (out of billions) is enough to fundamentally shift the model's behavior toward context faithfulness.
  • Complementary Strengths: Because IRCAN works at the internal neuron level and Context-Aware Decoding (CAD) works at the final output level, combining them (IRCAN-CAD) produces the best overall results, tackling the problem from two different angles.

Key Results

The quantitative improvements achieved by IRCAN are striking, particularly on tasks designed to trick the model into relying on its parametric memory.

Performance of IRCAN compared to baselines across the MemoTrap, COSE, and E-CARE datasets.
  • Massive Accuracy Gains: On the MemoTrap dataset, LLaMA-2-7B’s accuracy jumped from 24.52% to 56.08% (a 129% improvement). LLaMA-3-8B saw an even more impressive 136% improvement.
  • State-of-the-Art Performance: When combined with CAD, IRCAN set new state-of-the-art results on multiple-choice conflict tasks, drastically lowering the model's "Stubbornness Rate" (how often it sticks to its internal, wrong answer despite the context).
  • Preserved General Abilities: Crucially, the model’s performance on standard benchmarks like MMLU or GSM8K remained stable. The intervention successfully makes the model more attentive to context without causing a "lobotomy" effect on its general reasoning skills.

Limitations and Future Directions

While IRCAN is a powerful plug-and-play solution, there are areas for future exploration. The current evaluation relied on curated datasets; testing IRCAN in massive, messy RAG pipelines with long-form documents is a logical next step. Additionally, the neuron identification process currently happens offline. Developing a dynamic, "on-the-fly" identification method could make the system even more flexible. Finally, automating the selection of hyperparameters—like the enhancement strength ($\beta$) and the number of neurons—would further streamline the deployment of this technique.

Ultimately, IRCAN represents a significant step toward controllable LLMs, moving the field away from treating these models as black boxes and closer to a future where we can surgically adjust their internal reasoning pathways.

Summary updated

BibTeX
@inproceedings{shi2024ircan,
  author = {Dan Shi and Renren Jin and Tianhao Shen and Weilong Dong and Xinwei Wu and Deyi Xiong},
  title = {{IRCAN: Mitigating Knowledge Conflicts in LLM Generation via Identifying and Reweighting Context-Aware Neurons}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=ZfXRAqbBKX},
}
Figure