# Contrastive Decoding

> Contrastive decoding is a text-generation method that chooses tokens by maximizing the difference in log-likelihood between a large "expert" language model and a smaller "amateur" model, restricted to tokens the expert itself finds plausible.

- Identifier: PTL-0250
- Category: Foundations
- Canonical URL: https://protologue.com/t/contrastive-decoding/
- Also known as: CD
- Introduced: 2022

## Description

The idea is that failures such as repetition and incoherence are even more likely under a small model, so subtracting its preferences filters them out while keeping what the larger model does better. It needs no extra training. Li et al. reported that it produced higher-quality text than decoding from the larger model alone and outperformed nucleus and top-k sampling in automatic and human evaluations on Wikipedia, news and story text.

## Related terms

- [Top-p Sampling](https://protologue.com/t/top-p-sampling/)
- [Top-k Sampling](https://protologue.com/t/top-k-sampling/)
- [Greedy Decoding](https://protologue.com/t/greedy-decoding/)
- [Text Degeneration](https://protologue.com/t/text-degeneration/)
- [Speculative Decoding](https://protologue.com/t/speculative-decoding/)

## Sources

- Li et al. (2022). Contrastive Decoding: Open-ended Text Generation as Optimization. https://arxiv.org/abs/2210.15097

## Cite this entry

Protologue. (2026). Contrastive Decoding. In Protologue: A Taxonomy of Prompting and LLM Techniques (v1.7.0, PTL-0250). https://protologue.com/t/contrastive-decoding/

License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
