Abstract
Large Language Models (LLMs) often prioritize their internal parametric knowledge over provided external context, leading to factual hallucinations and unfaithful generations. This paper introduces Multi-Input Contrastive Decoding, a training-free, inference-time strategy that utilizes adversarial "irrelevant" context as a negative signal to sharpen the model's focus on relevant information. Evaluated across multiple open-domain QA benchmarks, the method significantly improves performance and successfully resolves knowledge conflicts, particularly as model scale increases.
Introduction
LLMs rely on two primary knowledge sources: parametric knowledge (information memorized during pre-training) and non-parametric knowledge (information provided in the prompt or context). A persistent challenge is "prior knowledge bias," where models ignore relevant context in favor of internal weights, especially when the context contradicts their training data or contains "long-tail" facts. While Retrieval-Augmented Generation (RAG) provides the necessary snippets, LLMs frequently fail to balance these sources effectively.
Methodology
The authors propose Multi-Input Contrastive Decoding, a method to modify the probability of the next token by contrasting three distinct scenarios during the decoding stage:
- $z_t$ (The Base): Logits generated using only the query (relying on parametric knowledge).
- $z_t^+$ (The Positive): Logits generated using the query combined with relevant context.
- $z_t^-$ (The Negative): Logits generated using the query combined with an irrelevant or adversarial context.
The final output distribution is calculated as: $\text{softmax}(z_t + \alpha(z_t^+ - z_t^-))$.
Key Innovations
- The Negative Signal: By incorporating irrelevant context, the model identifies generic or biased responses that should be suppressed. If a token is highly probable given a random passage, it is likely a hallucination or bias that the contrastive step "subtracts" from the final distribution.
- Dynamic Weighting: Unlike previous methods using a fixed weight ($\alpha$), this approach introduces a dynamic $\alpha$ calculated at every token step. This allows the model to adjust the contrastive effect based on the relative confidence between internal knowledge and the provided context.
- Zero Training: The method is entirely training-free and can be applied to any off-the-shelf LLM at the decoding stage.
Experimental Setup
The method was evaluated across several diverse benchmarks:
- TriviaQA & Natural Questions (NQ): Standard open-domain QA datasets.
- PopQA: An entity-centric dataset focusing on rare, "long-tail" entities where LLMs typically struggle.
- NQ-SUB (Knowledge Conflict): A specialized version of NQ where correct answers in the context were replaced with random entities to test if the model can override its internal memory in favor of the provided (modified) context.
Results and Key Insights
Scaling and Robustness
One of the most significant findings is that the method's effectiveness increases with model size. Larger models possess stronger internal priors, making the contrastive boost more effective at helping them "break free" from their biases. On the NQ-SUB knowledge conflict dataset, Llama-2 70B improved from a near-zero score (0.02%) in closed-book mode to 58.34%, demonstrating a robust ability to prioritize context over internal hallucinations.
Irrelevant Context as a Signal
The research reveals that "irrelevant" context acts as a mirror. By observing model predictions under garbage input, the system better isolates the specific signal provided by the correct input. The authors found that selecting a passage with the highest embedding distance from the relevant context (the "Most Distant" strategy) yielded the best results.
Limitations and Future Work
While effective, the method introduces a 3x computational overhead because it requires three forward passes per token. While parallelization can mitigate this, it remains a challenge for real-time latency. Additionally, while the gains were consistent across Llama, Falcon, OPT, and Flan-T5 families, future research is needed to explore prompt sensitivity and the method's applicability to tasks beyond question answering, such as long-form summarization or toxicity mitigation.
Summary updated