NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

CoCoA: Confidence- and Context-Aware Adaptive Decoding for Resolving Knowledge Conflicts in Large Language Models

Anant Khandelwal, Manish Gupta, Puneet Agrawal

TL;DR

Large language models (LLMs) struggle to reconcile conflicting information between their internal knowledge and external context. This paper introduces CoCoA, a novel decoding strategy that dynamically balances these sources using confidence-aware signals, leading to more faithful and accurate text generation across various tasks. CoCoA significantly outperforms existing methods, especially in challenging scenarios with conflicting information.

What Problem Does This Paper Address?

LLMs are trained on vast amounts of data, giving them a rich internal knowledge base. However, this knowledge is static and can become outdated or incomplete. To address this, LLMs are often augmented with external context (like retrieved documents) at inference time. This creates a potential for "knowledge conflicts" where the external context contradicts the LLM's internal knowledge. Standard decoding methods often fail to resolve these conflicts, leading to inaccurate or hallucinated outputs. Existing contrastive decoding methods, while helpful, can be too rigid, either over-correcting in low-conflict situations or under-correcting in subtle ones. The authors aim to develop a more adaptive and nuanced approach to conflict resolution during the decoding process.

Methods

The core of CoCoA is a token-level decoding algorithm that dynamically adjusts how much it trusts the external context versus the LLM's internal knowledge at each step. This is achieved through several novel components:

  • Tail-Sensitive Conflict Detection: Instead of relying solely on Jensen-Shannon Divergence (JSD) like previous methods, CoCoA uses Rényi divergence. This allows for tunable sensitivity to discrepancies in the tails of probability distributions, making it better at detecting subtle conflicts.
  • Contextual Confidence Estimation: CoCoA combines two signals to gauge the confidence of the context:
  • Entropy Gap: Measures how much the context narrows down the probability distribution of the next token. A large gap suggests the context is providing a strong, confident cue.
  • Contextual Peakedness: Assesses the sharpness of the context's probability distribution. A high peakedness (large margin between the top two token probabilities) indicates high certainty in the context's preferred token.
  • Adaptive Gating Mechanism: A conflict score is computed using Rényi divergence and the entropy gap. This score, along with contextual peakedness, is used to determine an adaptive blending weight ($\lambda_t$). This weight dynamically controls how much the LLM relies on the context versus its prior knowledge at each decoding step. The final output distribution is generated using power interpolation.

Datasets

The paper evaluates CoCoA on a diverse set of benchmarks across several NLP tasks:

  • Question Answering (QA): Natural Questions (NQ), NQ-SWAP (a conflict variant of NQ), TriviaQA, PopQA, HotpotQA, and TabMWP (tabular QA).
  • Summarization: CNN/DailyMail (CNN-DM), XSum, and TofuEval (focusing on factual consistency).
  • Long-Form Question Answering (LFQA): CLAPNQ, ExpertQA, HAGRID, ELI5-WebGPT, and QuoteSum.

The authors use gold contexts provided by these datasets and follow established evaluation protocols from prior work (e.g., AdaCAD).

Key Insights and Ideas

  • Beyond JSD: The move from JSD to Rényi divergence is crucial for detecting subtle conflicts, especially when distributions are peaked or heavy-tailed, which is common in autoregressive decoding.
  • Confidence Matters: Simply detecting divergence isn't enough; understanding how confident the context is (via entropy gap and peakedness) is key to adaptive decision-making. A moderate divergence might be ignored if the context is uncertain, but amplified if the context is highly confident.
  • Dynamic Blending is Essential: A static approach to conflict resolution (like a fixed contrastive parameter) is insufficient. CoCoA's adaptive gating mechanism, which evolves at each token, allows for nuanced responses that are faithful to context without sacrificing fluency.
  • Generalization Across Conflict Levels: CoCoA performs exceptionally well not only in high-conflict scenarios but also maintains strong performance in low-conflict settings, unlike some prior methods that degrade when context and prior agree.

Key Results

  • State-of-the-Art Performance: CoCoA consistently outperforms strong baselines like ADACAD and greedy decoding across QA, summarization, and LFQA tasks.
  • Significant Gains: On QA tasks, CoCoA achieves up to 9.2 points higher accuracy on average compared to ADACAD. For summarization and LFQA, it improves factuality by up to 2.5 points on average.
  • Robustness to Conflict: On the NQ-SWAP dataset (high conflict), CoCoA surpasses ADACAD by 18.0 points. It also shows a much smaller performance drop on low-conflict NQ-SYNTH compared to greedy decoding, indicating better generalization.
  • Improved Faithfulness: CoCoA demonstrates superior performance in factual consistency metrics (e.g., AlignScore, FaithScore) across summarization and LFQA tasks, indicating it generates more grounded and accurate responses.
  • Modest Latency Increase: Despite incorporating more complex signals, CoCoA's decoding latency is only slightly higher than baselines, making it practical for real-world applications.

Limitations and Future Work

  • Black-Box API Limitation: CoCoA requires access to token-level probability distributions (logits). This poses a challenge for using it with black-box APIs (like GPT-4) that only expose sampled text. Future work could explore approximating these distributions.
  • Language and Model Scope: The current study is limited to English benchmarks and a few open-source models. Extending CoCoA to other languages, specialized domains, and larger, more diverse LLMs is a promising direction.
  • Ethical Considerations: While CoCoA itself doesn't introduce direct ethical concerns, future work should examine how its stronger reliance on external knowledge might inadvertently amplify biases or harmful content present in the context.

Summary updated

BibTeX
@inproceedings{khandelwal2025cocoa,
  author = {Anant Khandelwal and Manish Gupta and Puneet Agrawal},
  title = {{CoCoA: Confidence- and Context-Aware Adaptive Decoding for Resolving Knowledge Conflicts in Large Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2025},
}
Figure