Exploring In-Context Learning for Knowledge Grounded Dialog Generation

Qinyu Chen, Wenhao Wu, Sujian Li

Abstract

Knowledge Grounded Dialog (KGD) requires generating conversational responses based on external facts. While Large Language Models (LLMs) are highly fluent, they often suffer from hallucinations, ignoring provided facts in favor of internal training data. This paper introduces IKA (In-context Knowledge grounded dialog Augmenter), a plug-and-play framework that utilizes In-Context Learning (ICL) to guide LLMs toward factual faithfulness. By retrieving diverse, high-quality demonstrations, IKA enables LLMs to outperform specialized fine-tuned models by significant margins, including a 46% improvement in BLEU-4 and a 122% increase in BARTScore.

Introduction

The primary challenge in Knowledge Grounded Dialog is ensuring that the model remains "faithful" to external knowledge sources, such as Wikipedia snippets or knowledge graph triplets. Traditionally, solving this required expensive fine-tuning of smaller models like BART or GPT-2. However, these models often lack the conversational sophistication of modern LLMs. The IKA framework addresses this by providing the model with a few well-chosen examples of how to use knowledge correctly within the prompt, rather than retraining the model itself.

The IKA Framework

The IKA framework consists of three main components designed to optimize the in-context learning process for KGD:

  1. Retrieval Module: IKA searches a reference dataset for previous dialogs semantically similar to the current conversation. It supports sparse (keyword-based), dense (embedding-based), and hybrid retrieval methods.
  2. Diverse Example Retrieval (DER): To prevent the LLM from becoming biased toward a single pattern, the DER algorithm selects examples that are relevant yet distinct from one another. This diversity ensures the model learns a broader range of grounding behaviors.
  3. Prompt Construction: The retrieved examples, dialog history, and target knowledge are formatted into a structured prompt that "teaches" the LLM to ground its response in the provided facts.
Overview of the IKA framework, illustrating the retrieval module, diverse example selection, and prompt construction for LLMs.

Experimental Evaluation

The researchers evaluated IKA using the OpenDialKG and Wizard-of-Wikipedia (WoW) datasets. OpenDialKG provides structured knowledge graph triplets, while WoW tests the framework's ability to handle unstructured textual knowledge.

Key Results

IKA, when paired with GPT-3.5, significantly outperformed RHO, the previous state-of-the-art training-based model. Key improvements included:

  • 46.67% relative improvement in BLEU-4.
  • 30.50% improvement in Entity Coverage F1.
  • 122% increase in BARTScore.

The study also highlighted the importance of the number of examples provided in the prompt. Performance generally improves as the number of in-context examples increases, typically plateauing around 10 examples before gains diminish due to context window limits.

Performance metrics (BLEU-4, ROUGE-L, EC-F1) as a function of the number of in-context examples provided to the model.

Insights and Future Work

A major finding of this research is that LLMs are "hidden" KGD experts. They possess the necessary potential but require specific demonstrations to unlock factual grounding. Furthermore, representing knowledge as structured triplets was found to be more effective than raw text, as it reduces noise for the model.

Despite its success, IKA currently assumes "gold knowledge" is provided. Future work will explore integrating automated knowledge retrieval from massive databases and addressing context window constraints that limit the number of demonstrations.

Summary updated

BibTeX
@inproceedings{chen2023exploring,
  author = {Qinyu Chen and Wenhao Wu and Sujian Li},
  title = {{Exploring In-Context Learning for Knowledge Grounded Dialog Generation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.findings-emnlp.675},
}
Figure