Out-of-Domain Finetuning to Bootstrap Hallucination Detection

Eugene Yan5 Nov 2023

Problem

Teams that ship LLM summaries need a classifier that flags summaries contradicting their source document. Finetuning one takes a few hundred to a few thousand labeled samples, and labeling them is slow and costly. A model finetuned on a small in-domain set can still be unusable: scores of good and bad summaries overlap, so no threshold works in production.

Example from the article: on news summaries from the Factual Inconsistency Benchmark, a model finetuned for 10 epochs had PR AUC 0.69. At a threshold of 0.8 it found only 2% of inconsistent summaries.

Solution in brief

Treat hallucination detection as natural language inference (NLI): source is the premise, summary is the hypothesis, and the probability of contradiction is the inconsistency score. First finetune the model for 3 epochs on a labeled dataset from another domain (Wikipedia summaries), then on the scarce target data. On news summaries PR AUC rose from 0.69 to 0.85, although the first stage alone barely helped.

Questions this case answers
  • How to build a binary classifier for a text-quality defect when labeled examples from the target domain are scarce but a labeled dataset from a neighbouring domain exists
  • How to check that a scorer separates good and bad outputs well enough to choose a single decision threshold
  • How to train a hallucination detector for summaries when we have only a few hundred labeled samples?
  • How to reuse an open dataset from another domain to get a classifier that works at a production threshold?

Tools and methods

  • NLI as hallucination detection — premise = source document, hypothesis = summary; contradiction means factual inconsistency
  • BART finetuned on MNLI — base model that outputs entailment, neutral and contradiction logits
  • QLoRA — parameter-efficient finetuning, same settings in every stage
  • Pre-finetuning on out-of-domain data — the Unified Summarization Benchmark (USB, Wikipedia) before the Factual Inconsistency Benchmark (FIB, news)
  • ROC AUC, PR AUC and score histograms — check that a threshold is usable
Continue reading — it's free

Google or a one-time email code. No password.