Contrastive Decoding: Open-ended Text Generation as Optimization

Xiang Lisa Li, Ari Holtzman, Daniel Fried, Percy Liang, Jason Eisner +3 more
10/27/2022
816 citations
cs.CLcs.AIcs.LG
contrastive-ssl

Official code: XiangLi1999/ContrastiveDecoding (207 stars, Python, last commit 2022-11-14).

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.

Show full abstract

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., repetition, incoherence) are even more prevalent in smaller LMs, and that this difference signals which texts should be preferred. CD requires zero additional training, and produces higher quality text than decoding from the larger LM alone. It also works across model scales (OPT-13B and GPT2-1.5B) and significantly outperforms four strong decoding algorithms (e.g., nucleus, top-k) in automatic and human evaluations across wikipedia, news and story domains.

View on arXivView PDF

Code Implementations(1)

contrastive decoding

20714Python, CudaOct 10, 20224 years ago

Similar Papers

Cite this paper

@article{li2022contrastive,
  title  = {Contrastive Decoding: Open-ended Text Generation as Optimization},
  author = {Xiang Lisa Li and Ari Holtzman and Daniel Fried and Percy Liang and Jason Eisner and Tatsunori Hashimoto and Luke Zettlemoyer and Mike Lewis},
  year   = {2022},
  eprint = {2210.15097},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2210.15097}
}

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/2210.15097.svg)](https://codeofpaper.com/paper/2210.15097)

Discussion