Skip to main content
QUICK REVIEW

[Paper Review] DoLa: Decoding by Contrasting Layers Improves Factuality in Large Language Models

Yung-Sung Chuang, Yujia Xie|arXiv (Cornell University)|Sep 7, 2023
Topic ModelingComputer Science17 citations
TL;DR

DoLa decodes by contrasting the logits from mature and premature transformer layers, dynamically selecting layers to surface factual knowledge and reduce hallucinations without external retrieval or fine-tuning. It improves truthfulness across multiple tasks while adding minimal latency.

ABSTRACT

Despite their impressive capabilities, large language models (LLMs) are prone to hallucinations, i.e., generating content that deviates from facts seen during pretraining. We propose a simple decoding strategy for reducing hallucinations with pretrained LLMs that does not require conditioning on retrieved external knowledge nor additional fine-tuning. Our approach obtains the next-token distribution by contrasting the differences in logits obtained from projecting the later layers versus earlier layers to the vocabulary space, exploiting the fact that factual knowledge in an LLMs has generally been shown to be localized to particular transformer layers. We find that this Decoding by Contrasting Layers (DoLa) approach is able to better surface factual knowledge and reduce the generation of incorrect facts. DoLa consistently improves the truthfulness across multiple choices tasks and open-ended generation tasks, for example improving the performance of LLaMA family models on TruthfulQA by 12-17% absolute points, demonstrating its potential in making LLMs reliably generate truthful facts.

Motivation & Objective

  • Motivate the challenge of factuality and hallucinations in large language models (LLMs) and seek a decoding-time solution that does not rely on retrieval or fine-tuning.
  • Propose a dynamic, layer-contrast decoding method (DoLa) that amplifies factual knowledge embedded in higher layers while downplaying lower-layer linguistic cues.
  • Show that surface-level factual improvements translate to higher truthfulness across multiple-choice and open-ended tasks in LLaMA-family models, with modest latency impact.

Proposed method

  • Compute next-token distributions from both the final (mature) layer and selected earlier (premature) layers using the model's vocabulary head.
  • Dynamically select the premature layer M by maximizing the Jensen-Shannon Divergence between q_N(·|x_<t) and q_j(·|x_<t) across candidate early layers.
  • Form the DoLa probability via a logit contrast function F(q_N, q_M) that subtracts the premature-layer logits from the mature-layer logits and applies a softmax over a plausibility-filtered vocabulary subset.
  • Apply an adaptive plausibility constraint to ensure high-probability tokens from the mature layer remain eligible, and include a repetition penalty during decoding.
  • Optionally compare against static premature-layer choices (DoLa-static) to illustrate robustness of the dynamic approach.
  • Experimentally validate on TruthfulQA, FACTOR, StrategyQA, GSM8K, and GPT-4 evaluated Vicuna benchmarks across LLaMA-7B, -13B, -33B, and -65B models.

Experimental results

Research questions

  • RQ1Does decoding by contrasting layers reduce hallucinations in LLMs without external knowledge or fine-tuning?
  • RQ2Can dynamic premature-layer selection (via layer-wise distribution distance) robustly improve factuality across multiple tasks and model sizes?
  • RQ3What is the relative performance of DoLa versus Contrastive Decoding (CD) and static layer baselines across factuality, reasoning tasks, and open-ended generation?

Key findings

  • DoLa consistently improves truthfulness across multiple-choice and open-ended tasks for LLaMA models, with notable gains on TruthfulQA and FACTOR.
  • In open-ended TruthfulQA, DoLa improves %Truth×%Info by 12-17% across four LLaMA sizes, approaching ITI performance without supervised labels.
  • Dynamic premature-layer selection (via maximum JSD) selects higher layers for fact-heavy tasks and lower layers for longer sentence completions, yielding robust gains across datasets.
  • DoLa achieves modest decoding latency increases (about 1.01x to 1.08x) and generalizes to models outside the LLaMA family (e.g., MPT-7B) with some exceptions.
  • On reasoning tasks (StrategyQA, GSM8K), DoLa improves or maintains performance, while CD can sometimes harm reasoning in certain setups.
  • DoLa-static is less robust across data distributions and requires more extensive validation, while Dynamic DoLa reduces the need for in-distribution validation.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.