Contrastive Learning for Knowledge-Based Question Generation in Large Language Models

Zhenhong Zhang, Jiajing Chen, Weiyan Shi, Lingjie Yi, Chihang Wang, Qian YuarXiv 2024 · DOI

Introduction

Large Language Models (LLMs) have demonstrated remarkable capabilities in general text generation. However, their performance often falters in "knowledge-intensive" tasks that require strict adherence to specific, factual information. In these scenarios, models frequently encounter "knowledge gaps" or produce "hallucinations"—factually incorrect but plausible-sounding statements. This paper introduces a novel framework for Knowledge-Based Question Generation (KBQG) that utilizes contrastive learning and Chain-of-Thought (CoT) prompting to mitigate these issues, ultimately producing high-quality, diverse, and factually grounded datasets.

The Challenge of Knowledge-Intensive Tasks

Traditional methods for creating training data for question-answering (QA) systems rely heavily on manual annotation. This process is inherently slow, expensive, and difficult to scale. While LLMs offer an automated alternative, their raw outputs are often noisy. The authors identify two primary hurdles: the inability of models to follow complex domain-specific logic and the tendency to invent facts when the internal knowledge base is insufficient.

Proposed Methodology: A Multi-Stage Pipeline

The researchers developed a sophisticated pipeline designed to move beyond simple zero-shot or few-shot prompting. The core of their approach is Contrastive Prompting, which provides the model with both "positive" (high-quality) and "negative" (hallucinated or poorly phrased) examples.

The proposed multi-stage pipeline for knowledge-based question generation, featuring contrastive prompting and automated scoring.

The workflow consists of several key components:

  1. Multi-Model Knowledge Mining: An ensemble of models (e.g., Llama3, PaLM, Gopher) generates candidate questions in parallel to ensure linguistic diversity.
  2. Contrastive Context: Prompts are enriched with task instructions and a curated set of contrastive examples to guide the model away from common errors.
  3. Chain-of-Thought (CoT) Scoring: A separate model, GLM-3-Turbo, acts as an independent judge. It follows a reasoning chain to score candidates on a scale of 1 to 5. High-scoring questions enter the positive pool, while low-scoring ones serve as negative examples for future iterations.
  4. Model Fine-Tuning: The resulting high-quality dataset is used to augment a base model (MBART), enhancing its performance on downstream tasks.

Experimental Setup

The framework was evaluated using the TriviaQA benchmark, a dataset comprising real-world question-answer pairs from diverse sources like books and Wikipedia. The researchers used a random 25% subset of the data for their enhancement experiments, focusing on both the Web and Wikipedia versions of the dataset.

Key Results and Insights

The study yielded several critical insights into the behavior of LLMs in KBQG tasks:

  • The Superiority of Examples: Providing contrastive examples proved significantly more effective than complex instructions alone. When using both contrastive instructions and examples, the accuracy of generated questions reached 98.8%, a massive leap from the 47.87% achieved with instructions only.
  • The Utility of Negative Samples: Explicitly showing the model what constitutes a "bad" question helps it learn the boundaries of logical form and factual consistency.
  • Performance Gains: The data-augmented model, MBART-Aug, outperformed several strong baselines, including GPT-3.5.
Performance comparison of various models on the knowledge-based task, showing the superiority of the proposed MBART-Aug approach.

As shown in the results, the proposed MBART-Aug achieved an accuracy of 74.61%, surpassing the standard MBART-base (72.31%) and significantly outperforming GPT-3.5 (67.12%).

Conclusion

By integrating contrastive learning with automated multi-model judging, this research provides a scalable path toward high-quality synthetic data generation for knowledge-intensive fields. While the current approach involves significant computational overhead due to the use of multiple large models, it demonstrates that "teaching by example"—including negative examples—is a powerful strategy for reducing hallucinations in LLMs. Future work will likely focus on distilling these capabilities into smaller, more efficient models and applying the framework to specialized domains like medicine and law.

Summary updated

BibTeX
@misc{zhang2024contrastive,
  author = {Zhenhong Zhang and Jiajing Chen and Weiyan Shi and Lingjie Yi and Chihang Wang and Qian Yu},
  title = {{Contrastive Learning for Knowledge-Based Question Generation in Large Language Models}},
  year = {2024},
  eprint = {2409.13994},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.13994},
}
Figure