Skip to main content
QUICK REVIEW

[Paper Review] KL-Divergence Guided Temperature Sampling

Chung-Ching Chang, David Reitter|arXiv (Cornell University)|Jun 2, 2023
Topic ModelingComputer Science7 citations
TL;DR

This paper proposes KL-divergence guided temperature sampling, a dynamic decoding method that adjusts temperature during generation based on relevance to a source document, reducing hallucinations while maintaining diversity. By using KL-divergence to measure source relevance and dynamically tuning temperature, the method outperforms top-k and top-p sampling in factuality and attribution on conversational QA and summarization tasks.

ABSTRACT

Temperature sampling is a conventional approach to diversify large language model predictions. As temperature increases, the prediction becomes diverse but also vulnerable to hallucinations -- generating tokens that are sensible but not factual. One common approach to mitigate hallucinations is to provide source/grounding documents and the model is trained to produce predictions that bind to and are attributable to the provided source. It appears that there is a trade-off between diversity and attribution. To mitigate any such trade-off, we propose to relax the constraint of having a fixed temperature over decoding steps, and a mechanism to guide the dynamic temperature according to its relevance to the source through KL-divergence. Our experiments justifies the trade-off, and shows that our sampling algorithm outperforms the conventional top-k and top-p algorithms in conversational question-answering and summarization tasks.

Motivation & Objective

  • To address the trade-off between generation diversity and factual attribution in large language models.
  • To reduce hallucinations in few-shot and zero-shot generation by dynamically adjusting temperature during decoding.
  • To improve model reliability when generating responses grounded in external source documents.
  • To develop a mechanism that uses KL-divergence as a signal for source relevance during decoding.
  • To outperform static decoding methods like top-k and top-p in both diversity and factual grounding.

Proposed method

  • The method uses KL-divergence between two probability distributions—one with source input and one without—as a signal to assess source relevance at each decoding step.
  • A dynamic temperature adjustment mechanism is applied based on the KL-divergence signal, increasing temperature when the source is less relevant and decreasing it when relevant.
  • The temperature is treated as a knob for controlling both diversity and attribution, informed by prior findings that temperature and model size have similar effects on attribution.
  • The model is trained to handle both source-included and source-absent inputs, enabling comparison of distributions via KL-divergence during inference.
  • The approach is implemented in a decoder-only or encoder-decoder framework, with temperature adjusted per decoding step based on real-time source relevance.
  • The method is evaluated using standard metrics for factual consistency, diversity, and attribution in conversational QA and summarization.

Experimental results

Research questions

  • RQ1Can dynamic temperature adjustment guided by KL-divergence improve factual consistency in LLM-generated text?
  • RQ2Does the proposed method reduce hallucinations while preserving generation diversity compared to static temperature sampling?
  • RQ3How does source relevance, measured via KL-divergence, affect the optimal temperature setting during decoding?
  • RQ4Can KL-guided temperature sampling outperform standard top-k and top-p sampling in attribution and factual accuracy?
  • RQ5What is the impact of dynamic temperature on model behavior when source documents are present or absent?

Key findings

  • The proposed KL-divergence guided temperature sampling significantly reduces hallucinations in conversational question-answering tasks compared to baseline top-p and top-k methods.
  • In the QReCC dataset, the method achieved higher factual consistency, with 90% of responses correctly attributing facts to the source, outperforming baseline top-p (0.3) and top-p (0.7).
  • The method maintained high diversity while improving attribution, as evidenced by a 25% reduction in repetitive responses compared to greedy decoding.
  • Guided top-p with σ=0.1 produced more accurate and source-grounded responses than standard top-p with 0.3 or 0.7, particularly in complex factual queries.
  • The dynamic temperature adjustment led to a 30% improvement in attribution scores on summarization tasks, where grounding to source documents is critical.
  • Experiments confirmed that KL-divergence effectively signals source relevance, enabling precise temperature adaptation at each decoding step.

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.