KnowTuning: Knowledge-aware Fine-tuning for Large Language Models

Yougang Lyu, Lingyong Yan, Shuaiqiang Wang, Haibo Shi, Dawei Yin, Pengjie Ren, Zhumin Chen, Maarten de Rijke, Zhaochun Ren

Abstract

Large Language Models (LLMs) frequently encounter challenges in knowledge-intensive tasks, often producing non-factual, incomplete, or illogical responses. We present KnowTuning, a novel two-stage fine-tuning framework designed to instill "knowledge awareness" in LLMs. By explicitly training models to identify difficult information and distinguish between high-quality and flawed responses, KnowTuning significantly reduces hallucinations and improves the structural integrity of generated text.

Introduction

While Supervised Fine-Tuning (SFT) has been the standard for adapting LLMs to specific tasks, it primarily encourages models to mimic the stylistic patterns of the training data. This often results in models that "talk the talk" without a genuine understanding of the factual boundaries of their knowledge. Consequently, when faced with complex queries, models may generate hallucinations—plausible-sounding but incorrect information—or provide answers that lack logical flow and completeness.

KnowTuning addresses this by shifting the focus from mere imitation to knowledge awareness. It posits that a model should recognize which facts are difficult to generate and understand the qualitative difference between a reliable answer and one that is incomplete, non-factual, or illogical.

Methods: The KnowTuning Pipeline

KnowTuning operates through a two-stage process: Fine-grained Knowledge Augmentation and Coarse-grained Knowledge Comparison.

1. Fine-grained Knowledge Augmentation

The first stage identifies "knowledge gaps" within the model. Training answers are decomposed into atomic knowledge units—short, independent facts. The model's perplexity (PPL) is then calculated for each unit. High perplexity serves as a diagnostic signal, indicating facts the model struggles to generate. A teacher model (e.g., GPT-3.5) then rewrites questions and answers to emphasize these difficult facts, forcing the model to concentrate its learning on its weakest areas.

2. Coarse-grained Knowledge Comparison

The second stage teaches the model to differentiate between reliable and unreliable outputs. Researchers generate "disturbed" versions of high-quality answers by creating:

  • Incomplete answers: Deleting key facts.
  • Non-factual answers: Altering facts to be incorrect.
  • Illogical answers: Shuffling the sequence of facts.

Using Direct Preference Optimization (DPO), the model is trained on pairs of reliable vs. unreliable answers. This process explicitly teaches the model the structural and factual markers of a high-quality response.

The KnowTuning pipeline: Fine-grained Knowledge Augmentation and Coarse-grained Knowledge Comparison.

Experimental Results

The effectiveness of KnowTuning was evaluated using Llama2-7B and 13B backbones across four diverse benchmarks: Dolly (general QA), MedQuAD (medical), NQ (search queries), and ELI5 (complex explanations).

Performance Metrics

KnowTuning consistently outperformed standard SFT and other state-of-the-art methods like RLAIF and FactTune. As shown in the table below, KnowTuning achieved superior METEOR and BERTScore results across all tested datasets. For instance, on the Dolly dataset with a 7B model, KnowTuning reached a METEOR score of 19.56, a substantial improvement over the 14.01 achieved by SFT.

Performance comparison of KnowTuning against baselines across multiple benchmarks.

Qualitative Improvements

Beyond automated metrics, KnowTuning demonstrated a higher density of correct facts. In medical QA (MedQuAD), it maintained a factual accuracy rate of 94.85%. Human evaluations further confirmed that KnowTuning produces answers that are significantly more complete and logically sound than those from competing methods.

Conclusion and Future Work

KnowTuning represents a significant step toward more reliable LLMs by integrating knowledge awareness into the fine-tuning process. By focusing on perplexity-based augmentation and preference-based comparison, the method effectively mitigates common failure modes like hallucinations and logical incoherence. Future research may explore integrating these knowledge-aware objectives directly into the pre-training phase or expanding the approach to specialized domains like legal or mathematical reasoning.

Summary updated

BibTeX
@inproceedings{lyu2024knowtuning,
  author = {Yougang Lyu and Lingyong Yan and Shuaiqiang Wang and Haibo Shi and Dawei Yin and Pengjie Ren and Zhumin Chen and Maarten de Rijke and Zhaochun Ren},
  title = {{KnowTuning: Knowledge-aware Fine-tuning for Large Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-main.805},
}
Figure