protologue

Contrastive Decoding

Also called CD.

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.

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.

Sources

  1. Li et al. (2022). Contrastive Decoding: Open-ended Text Generation as Optimization.

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/

BibTeX
@misc{protologue_contrastive_decoding,
  title = {Contrastive Decoding},
  author = {{Protologue}},
  year = {2026},
  howpublished = {Protologue: A Taxonomy of Prompting and LLM Techniques, v1.7.0},
  note = {Entry PTL-0250},
  url = {https://protologue.com/t/contrastive-decoding/}
}

Markdown JSON