Enhancing Contextual Understanding in Large Language Models through Contrastive Decoding

Zheng Zhao,Emilio Monti,Jens Lehmann,Haytham Assem
2024-05-05
Abstract:Large language models (LLMs) tend to inadequately integrate input context during text generation, relying excessively on encoded prior knowledge in model parameters, potentially resulting in generated text with factual inconsistencies or contextually unfaithful content. LLMs utilize two primary knowledge sources: 1) prior (parametric) knowledge from pretraining, and 2) contextual (non-parametric) knowledge from input prompts. The study addresses the open question of how LLMs effectively balance these knowledge sources during the generation process, specifically in the context of open-domain question answering. To address this issue, we introduce a novel approach integrating contrastive decoding with adversarial irrelevant passages as negative samples to enhance robust context grounding during generation. Notably, our method operates at inference time without requiring further training. We conduct comprehensive experiments to demonstrate its applicability and effectiveness, providing empirical evidence showcasing its superiority over existing methodologies. Our code is publicly available at:
Computation and Language,Artificial Intelligence
What problem does this paper attempt to address?
The paper addresses the problem of how to better integrate input context into text generation for large-scale language models, especially for open-domain question answering. Current models may rely too much on pre-trained internal knowledge, resulting in issues of factual inconsistency or lack of context fidelity in the generated content. The paper proposes a contrastive decoding method that combines relevant and irrelevant context to enhance the model's ability to balance different sources of knowledge during the generation process, thereby improving the accuracy and contextuality of the answers. This method demonstrates superiority on multiple datasets without the need for further training.