DoLa: Decoding by Contrasting Layers Improves Factuality in Large Language Models

Yung-Sung Chuang, Yujia Xie, Hongyin Luo, Yoon Kim, James R. Glass +1 more
2/12/2026

Official code: shikiw/OPERA (415 stars, MIT, last commit 2024-08-24). 1 more implementation below.

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.

View on arXivView PDF

Code Implementations(2)

shikiw/OPERAOfficial71%
MIT

[CVPR 2024 Highlight] OPERA: Alleviating Hallucination in Multi-Modal Large Language Models via Over-Trust Penalty and Retrospection-Allocation

41531C, C++Nov 30, 20232 years agoMIT
chatbotchatgptgpt-4large-multimodal-modelsllama+3 more
voidism/DoLaCommunity76%

Official implementation for the paper "DoLa: Decoding by Contrasting Layers Improves Factuality in Large Language Models"

55968C, C++Aug 21, 20231 years ago
factualityhallucinationslarge-language-models

Similar Papers

Cite this paper

@article{chuang2026dola,
  title  = {DoLa: Decoding by Contrasting Layers Improves Factuality in Large Language Models},
  author = {Yung-Sung Chuang and Yujia Xie and Hongyin Luo and Yoon Kim and James R. Glass and Pengcheng He},
  year   = {2026},
  eprint = {2309.03883},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/pdf/2309.03883},
  journal = {ICLR 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2309.03883.svg)](https://codeofpaper.com/paper/2309.03883)

Discussion