Contrastive Decoding Improves Reasoning in Large Language Models

Authors: Sean O'Brien, Mike Lewis

Submitted to arXiv on 17 Sep. 2023
License: CC BY 4.0
Abstract

We demonstrate that Contrastive Decoding -- a simple, computationally light, and training-free text generation method proposed by Li et al 2022 -- achieves large out-of-the-box improvements over greedy decoding on a variety of reasoning tasks. Originally shown to improve the perceived quality of long-form text generation, Contrastive Decoding searches for strings that maximize a weighted difference in likelihood between strong and weak models. We show that Contrastive Decoding leads LLaMA-65B to outperform LLaMA 2, GPT-3.5 and PaLM 2-L on the HellaSwag commonsense reasoning benchmark, and to outperform LLaMA 2, GPT-3.5 and PaLM-540B on the GSM8K math word reasoning benchmark, in addition to improvements on a collection of other tasks. Analysis suggests that Contrastive Decoding improves over existing methods by preventing some abstract reasoning errors, as well as by avoiding simpler modes such as copying sections of the input during chain-of-thought. Overall, Contrastive Decoding outperforms nucleus sampling for long-form generation and greedy decoding for reasoning tasks, making it a powerful general purpose method for generating text from language models.

The papers around it, by date and closeness

Higher is closer to this paper; left is older. Lines join papers close to each other: groups of lines are sub-topics. Select a point to see why it is there. Back to the summary of this paper

How to read this map? Illustrated guide

Closest papers Prior work it builds on Papers that cite it

Papers around this one

Ranked by how close their title and abstract are to this paper’s. Select some to read them together.

Closest papers

  1. Very close Cited by this paper Used in depth by this paper A method it uses
    Self-Consistency Improves Chain of Thought Reasoning in Language Models
    Xuezhi Wang, Jason Wei, Dale Schuurmans et al. · 2022 · Computation and Language · cited 8,196 times · AI summary available
    Abstract

    Chain-of-thought prompting combined with pre-trained large language models has achieved encouraging results on complex reasoning tasks. In this paper, we propose a new decoding strategy, self-consistency, to replace the naive greedy decoding used in chain-of-thought prompting. It first samples a diverse set of reasoning paths instead of only taking the greedy one, and then selects the most consistent answer by marginalizing out the sampled reasoning paths. Self-consistency leverages the intuition that a complex reasoning problem typically admits multiple different ways of thinking leading to its unique correct answer. Our extensive empirical evaluation shows that self-consistency boosts the …

  2. Very close Cites this paper
    Thinking by Subtraction: Confidence-Driven Contrastive Decoding for LLM Reasoning
    Le-Xiang Tang, Weihao Gao, Bing Zhao et al. · 2026 · arXiv.org · preprint, not peer reviewed · cited 8 times · Not summarized yet
    Abstract

    Recent work on test-time scaling for large language model (LLM) reasoning typically assumes that allocating more inference-time computation uniformly improves correctness. However, prior studies show that reasoning uncertainty is highly localized: a small subset of low-confidence tokens disproportionately contributes to reasoning errors and unnecessary output expansion. Motivated by this observation, we propose Thinking by Subtraction, a confidence-driven contrastive decoding approach that improves reasoning reliability through targeted token-level intervention. Our method, Confidence-Driven Contrastive Decoding, detects low-confidence tokens during decoding and intervenes selectively at the…

  3. Very close Cited by this paper
    Surfacing Biases in Large Language Models using Contrastive Input Decoding
    G. Yona, Or Honovich, Itay Laish et al. · 2023 · arXiv.org · preprint, not peer reviewed · cited 15 times · Not summarized yet
    Abstract

    Ensuring that large language models (LMs) are fair, robust and useful requires an understanding of how different modifications to their inputs impact the model's behaviour. In the context of open-text generation tasks, however, such an evaluation is not trivial. For example, when introducing a model with an input text and a perturbed,"contrastive"version of it, meaningful differences in the next-token predictions may not be revealed with standard decoding strategies. With this motivation in mind, we propose Contrastive Input Decoding (CID): a decoding algorithm to generate text given two inputs, where the generated text is likely given one input but unlikely given the other. In this way, the…

  4. Very close
    MagicDec: Breaking the Latency-Throughput Tradeoff for Long Context Generation with Speculative Decoding
    Jian Chen, Vashisth Tiwari, Ranajoy Sadhukhan et al. · 2024 · Computation and Language · cited 120 times · Not summarized yet
    Abstract

    Large Language Models (LLMs) have become more prevalent in long-context applications such as interactive chatbots, document analysis, and agent workflows, but it is challenging to serve long-context requests with low latency and high throughput. Speculative decoding (SD) is a widely used technique to reduce latency without sacrificing performance but the conventional wisdom suggests that its efficacy is limited to small batch sizes. In MagicDec, we show that surprisingly SD can achieve speedup even for a high throughput inference regime for moderate to long sequences. More interestingly, an intelligent drafting strategy can achieve better speedup with increasing batch size based on our rigor…

  5. Very close
    On the Advance of Making Language Models Better Reasoners
    Yifei Li, Zeqi Lin, Shizhuo Zhang et al. · 2022 · Computation and Language · cited 359 times · AI summary available
    Abstract

    Large language models such as GPT-3 and PaLM have shown remarkable performance in few-shot learning. However, they still struggle with reasoning tasks such as the arithmetic benchmark GSM8K. Recent advances deliberately guide the language model to generate a chain of reasoning steps before producing the final answer, successfully boosting the GSM8K benchmark from 17.9% to 58.1% in terms of problem solving rate. In this paper, we propose a new approach, DiVeRSe (Diverse Verifier on Reasoning Step), to further advance their reasoning capability. DiVeRSe first explores different prompts to enhance the diversity in reasoning paths. Second, DiVeRSe introduces a verifier to distinguish good answer…

  6. Very close Cited by this paper
    Contrastive Decoding: Open-ended Text Generation as Optimization
    Xiang Lisa Li, Ari Holtzman, Daniel Fried et al. · 2022 · Annual Meeting of the Association for Computational Linguistics · cited 805 times · Not summarized yet
    Abstract

    Given a language model (LM), maximum probability is a poor decoding objective for open-ended generation, because it produces short and repetitive text. On the other hand, sampling can often produce incoherent text that drifts from the original topics. We propose contrastive decoding (CD), a reliable decoding approach that optimizes a contrastive objective subject to a plausibility constraint. The contrastive objective returns the difference between the likelihood under a large LM (called the expert, e.g. OPT-13B) and a small LM (called the amateur, e.g. OPT-125M), and the constraint ensures that the outputs are plausible. CD is inspired by the fact that the failures of larger LMs (e.g., repe…

  7. Close Cited by this paper A method it uses
    Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
    Jason Wei, Xuezhi Wang, Dale Schuurmans et al. · 2022 · Computation and Language · cited 23,619 times · AI summary available
    Abstract

    We explore how generating a chain of thought -- a series of intermediate reasoning steps -- significantly improves the ability of large language models to perform complex reasoning. In particular, we show how such reasoning abilities emerge naturally in sufficiently large language models via a simple method called chain of thought prompting, where a few chain of thought demonstrations are provided as exemplars in prompting. Experiments on three large language models show that chain of thought prompting improves performance on a range of arithmetic, commonsense, and symbolic reasoning tasks. The empirical gains can be striking. For instance, prompting a 540B-parameter language model with just…

  8. Close Cites this paper
    Fast and Slow Generating: An Empirical Study on Large and Small Language Models Collaborative Decoding
    Kaiyan Zhang, Jianyu Wang, Ning Ding et al. · 2024 · arXiv.org · preprint, not peer reviewed · cited 19 times · Not summarized yet
    Abstract

    Large Language Models (LLMs) exhibit impressive capabilities across various applications but encounter substantial challenges such as high inference latency, considerable training costs, and the generation of hallucinations. Collaborative decoding between large and small language models (SLMs) presents a promising strategy to mitigate these issues through methods including speculative decoding, contrastive decoding, and emulator or proxy fine-tuning. However, the specifics of such collaborations, particularly from a unified perspective, remain largely unexplored. Inspired by dual-process cognitive theory, we propose a unified framework in this paper, termed Fast and Slow Generating (FS-GEN).…

Prior work it builds on

  1. Close A method it uses
    Chain-of-Thought Hub: A Continuous Effort to Measure Large Language Models' Reasoning Performance
    Yao Fu, Litu Ou, Mingyu Chen et al. · 2023 · arXiv.org · preprint, not peer reviewed · cited 137 times · Not summarized yet
    Abstract

    As large language models (LLMs) are continuously being developed, their evaluation becomes increasingly important yet challenging. This work proposes Chain-of-Thought Hub, an open-source evaluation suite on the multi-step reasoning capabilities of large language models. We are interested in this setting for two reasons: (1) from the behavior of GPT and PaLM model family, we observe that complex reasoning is likely to be a key differentiator between weaker and stronger LLMs; (2) we envisage large language models to become the next-generation computational platform and foster an ecosystem of LLM-based new applications, this naturally requires the foundation models to perform complex tasks that…

  2. Related Used in depth by this paper A method it uses
    Towards Understanding Chain-of-Thought Prompting: An Empirical Study of What Matters
    Boshi Wang, Sewon Min, Xiang Deng et al. · 2022 · Annual Meeting of the Association for Computational Linguistics · cited 428 times · Not summarized yet
    Abstract

    Chain-of-Thought (CoT) prompting can dramatically improve the multi-step reasoning abilities of large language models (LLMs). CoT explicitly encourages the LLM to generate intermediate rationales for solving a problem, by providing a series of reasoning steps in the demonstrations. Despite its success, there is still little understanding of what makes CoT prompting effective and which aspects of the demonstrated reasoning steps contribute to its performance. In this paper, we show that CoT reasoning is possible even with invalid demonstrations - prompting with invalid reasoning steps can achieve over 80-90% of the performance obtained using CoT under various metrics, while still generating c…

  3. Close A method it uses
    The Curious Case of Neural Text Degeneration
    Ari Holtzman, Jan Buys, Li Du et al. · 2019 · International Conference on Learning Representations · cited 4,749 times · Not summarized yet
    Abstract

    Despite considerable advancements with deep neural language models, the enigma of neural text degeneration persists when these models are tested as text generators. The counter-intuitive empirical observation is that even though the use of likelihood as training objective leads to high quality models for a broad range of language understanding tasks, using likelihood as a decoding objective leads to text that is bland and strangely repetitive. In this paper, we reveal surprising distributional differences between human text and machine text. In addition, we find that decoding strategies alone can dramatically effect the quality of machine text, even when generated from exactly the same neura…

  4. Close Cites this paper
    DoLa: Decoding by Contrasting Layers Improves Factuality in Large Language Models
    Yung-Sung Chuang, Yujia Xie, Hong-Yin Luo et al. · 2023 · International Conference on Learning Representations · cited 502 times · Not summarized yet
    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 Contrast…

  5. Related Used in depth by this paper A method it uses
    DExperts: Decoding-Time Controlled Text Generation with Experts and Anti-Experts
    Alisa Liu, Maarten Sap, Ximing Lu et al. · 2021 · Annual Meeting of the Association for Computational Linguistics · cited 640 times · Not summarized yet
    Abstract

    Despite recent advances in natural language generation, it remains challenging to control attributes of generated text. We propose DExperts: Decoding-time Experts, a decoding-time method for controlled text generation that combines a pretrained language model with “expert” LMs and/or “anti-expert” LMs in a product of experts. Intuitively, under the ensemble, tokens only get high probability if they are considered likely by the experts, and unlikely by the anti-experts. We apply DExperts to language detoxification and sentiment-controlled generation, where we outperform existing controllable generation methods on both automatic and human evaluations. Moreover, because DExperts operates only o…

Papers that cite it

  1. Close
    Integrative Decoding: Improve Factuality via Implicit Self-consistency
    Yi Cheng, Xiao Liang, Yeyun Gong et al. · 2024 · arXiv.org · preprint, not peer reviewed · cited 12 times · Not summarized yet
    Abstract

    Self-consistency-based approaches, which involve repeatedly sampling multiple outputs and selecting the most consistent one as the final response, prove to be remarkably effective in improving the factual accuracy of large language models. Nonetheless, existing methods usually have strict constraints on the task format, largely limiting their applicability. In this paper, we present Integrative Decoding (ID), to unlock the potential of self-consistency in open-ended generation tasks. ID operates by constructing a set of inputs, each prepended with a previously sampled response, and then processes them concurrently, with the next token being selected by aggregating of all their corresponding …

  2. Close
    ThinkOmni: Lifting Textual Reasoning to Omni-modal Scenarios via Guidance Decoding
    Yiran Guan, Si-Fan Tu, Ding-Kang Liang et al. · 2026 · International Conference on Learning Representations · cited 7 times · Not summarized yet
    Abstract

    Omni-modal reasoning is essential for intelligent systems to understand and draw inferences from diverse data sources. While existing omni-modal large language models (OLLM) excel at perceiving diverse modalities, they lack the complex reasoning abilities of recent large reasoning models (LRM). However, enhancing the reasoning ability of OLLMs through additional training presents significant challenges, including the need for high-quality data, task-specific adaptation, and substantial computational costs. To address these limitations, we propose ThinkOmni, a training-free and data-free framework that lifts textual reasoning to omni-modal scenarios. ThinkOmni introduces two key components: 1…

  3. Close Uses this paper in depth
    Synthesizing Instruction-Tuning Datasets with Contrastive Decoding
    Tatsuya Ichinose, Youmi Ma, Masanari Oi et al. · 2026 · arXiv.org · preprint, not peer reviewed · Not summarized yet
    Abstract

    Using responses generated by high-performing large language models (LLMs) for instruction tuning has become a widely adopted approach. However, the existing literature overlooks a property of LLM-generated responses: they conflate world knowledge acquired during pre-training with instruction-following capabilities acquired during post-training. We hypothesize that disentangling the instruction-following capabilities from pre-trained knowledge improves the effectiveness of instruction tuning. To this end, we propose CoDIT, a method that applies contrastive decoding between a post-trained model and its pre-trained counterpart during response generation. The method suppresses pre-trained knowle…

  4. Close
    Adaptive Contrastive Decoding for Instruction-Following in Large Language Models
    Jiarong Zhang, Junping Du, Zhe Xue · 2025 · 2025 8th International Conference on Artificial Intelligence and Big Data (ICAIBD) · Not summarized yet
    Abstract

    Large language models (LLMs) fine-tuned with instructions demonstrate promising capabilities in adhering to constraints embedded within prompts. However, their performance remains limited when handling more complex constraints. Moreover, existing studies suggest that imposing additional constraints can adversely impact the model’s reasoning ability and understanding of domain-specific knowledge. To address these challenges, we propose a novel approach called Adaptive Contrastive Decoding (ACD). This method decouples instructions from constraints, allowing the model to generate initial predictions based solely on unconstrained instructions. Subsequently, constrained instructions are used to v…

  5. Close
    Beyond Tokens: A Survey on Decoding Methods for Large Language and Vision-Language Models
    Haoran Wang, Xiong-Xiao Xu, Philip S. Yu et al. · 2026 · SIGKDD Explorations · cited 1 time · Not summarized yet
    Abstract

    Large language models (LLMs) and large vision-language models (LVLMs) have demonstrated impressive generative capabilities, yet ensuring their outputs align with user intent is still challenging. While most existing approaches address this issue at the training stage, inference-time approaches like decoding methods offer a more efficient and scalable solution. Decoding methods control model generation by guiding token-level selection, performing sequencelevel generation, or generating tokens in parallel to accelerate the process. In this survey, we identify three emerging paradigms from recent works on decoding methods for LLMs and LVLMs, provide a systematic review of these methods, highlig…

How are these papers found?

We compare the title and abstract of this paper with those of every paper summarized on this site, and with the papers Semantic Scholar recommends, those it cites and those citing it (for a much-cited paper, its most recent citations and, from OpenAlex, the most cited ones). Among the prior work and the follow-ups, the papers that use each other in depth, a method it uses and the much-cited follow-ups come a little higher. The levels (very close, close, related) come from the similarity of the texts, not from a judgment of quality; * marks a paper without an abstract, compared by its title. The sentence under a paper is written by an AI from the two abstracts: check it in the papers. A paper marked not relevant by three readers leaves the list.

Updated on 5 November 2026.

The illustrated guide to the papers around a paper