Introduction: The Tug-of-War in LLM Memory
Large Language Models (LLMs) rely on two primary knowledge sources: parametric knowledge, acquired during pre-training, and contextual knowledge, provided via prompts or retrieval-augmented generation (RAG). A "knowledge conflict" occurs when these sources disagree—for instance, when a model's internal data is outdated compared to a provided document.
As shown in Figure 1, standard greedy decoding often defaults to parametric memory, leading to hallucinations. While Context-Aware Decoding (CAD) attempts to fix this by amplifying the context using a fixed weight ($\alpha$), it often "over-corrects" in low-conflict scenarios, producing degenerate or nonsensical output.
The AdaCAD Method: Dynamic Weighting via JSD
To address the limitations of static weighting, the authors introduce AdaCAD (Adaptive Context-Aware Decoding). This strategy dynamically adjusts the influence of contextual information at every token during the decoding process.
The core of AdaCAD is the use of Jensen-Shannon Divergence (JSD) to measure the conflict between the context-conditioned distribution $p(y|c,x)$ and the internal knowledge distribution $p(y|x)$. Because JSD is bounded between 0 and 1, it serves as a natural, token-level weight ($\alpha_t$):
- High Conflict (High JSD): The model leans heavily on the provided context.
- Low Conflict (Low JSD): The model relies more on its standard predictive power, avoiding unnecessary divergence.
For long-form generation like summarization, the authors also implement a "warmup" lower bound ($\lambda = 0.3$) to ensure context is not ignored during generic sentence starters.
Experimental Evaluation
The researchers evaluated AdaCAD across diverse benchmarks, including standard Question Answering (NQ, TriviaQA, PopQA), tabular reasoning (TabMWP), and summarization (CNN-DM, XSum, TofuEval). They also utilized NQ-SWAP, a dataset designed to trigger high-conflict scenarios by swapping entities.
Key Results
As detailed in Figure 3, AdaCAD consistently outperforms both greedy decoding and static CAD across various model families, including Llama-2, Llama-3, and Mistral-7B.
- Superior Accuracy: AdaCAD achieved an average absolute improvement of 14.21% over static CAD in QA tasks. It also surpassed COIECD, a more complex binary-conflict detection baseline, by 4.82%.
- Factual Consistency: In summarization tasks, AdaCAD improved the AlignScore by 6.19 points over greedy decoding, demonstrating significantly better factual alignment with the source text.
- Robustness to Non-Conflict: Unlike CAD, which saw a 24% performance drop on non-conflicting synthetic data (NQ-SYNTH), AdaCAD remained stable, proving it does not "break" when the context and model agree.
Discussion and Limitations
AdaCAD's strength lies in its granularity; by adjusting at the token level, it can navigate sentences where only specific facts (like dates or names) conflict with internal memory. However, the method requires access to model logits, making it incompatible with black-box APIs. Additionally, calculating two distributions per step effectively doubles the computational cost of the forward pass. Future work may explore these dynamics in multilingual contexts.
Summary updated