A Contrastive Framework for Neural Text Generation

Yixuan Su, Tian Lan, Yan Wang, Dani Yogatama, Lingpeng Kong +1 more
2/13/2022
356 citations
cs.CL
contrastive-ssl

Official code: yxuansu/SimCTG (476 stars, Python, MIT, last commit 2024-03-07).

Abstract

Text generation is of great importance to many natural language processing applications. However, maximization-based decoding methods (e.g. beam search) of neural language models often lead to degenerate solutions -- the generated text is unnatural and contains undesirable repetitions.

Show full abstract

Existing approaches introduce stochasticity via sampling or modify training objectives to decrease probabilities of certain tokens (e.g., unlikelihood training). However, they often lead to solutions that lack coherence. In this work, we show that an underlying reason for model degeneration is the anisotropic distribution of token representations. We present a contrastive solution: (i) SimCTG, a contrastive training objective to calibrate the model's representation space, and (ii) a decoding method -- contrastive search -- to encourage diversity while maintaining coherence in the generated text. Extensive experiments and analyses on three benchmarks from two languages demonstrate that our proposed approach significantly outperforms current state-of-the-art text generation methods as evaluated by both human and automatic metrics.

View on arXivView PDF

Code Implementations(1)

yxuansu/SimCTGOfficial100%
MIT

[NeurIPS'22 Spotlight] A Contrastive Framework for Neural Text Generation

47641Python, ShellJan 25, 20222 years agoMIT
contrastive-learningdecodedeeplearninglanguage-modelinglanguagemodel+2 more

Similar Papers

Cite this paper

@article{su2022contrastive,
  title  = {A Contrastive Framework for Neural Text Generation},
  author = {Yixuan Su and Tian Lan and Yan Wang and Dani Yogatama and Lingpeng Kong and Nigel Collier},
  year   = {2022},
  eprint = {2202.06417},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2202.06417}
}

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

Discussion