[Paper Review] CoNT: Contrastive Neural Text Generation
CoNT introduces a contrastive learning framework for neural text generation that uses self-generated negative samples, an N-pairs loss, and learned sequence similarity in decoding, yielding state-of-the-art results across multiple generation tasks.
Recently, contrastive learning attracts increasing interests in neural text generation as a new solution to alleviate the exposure bias problem. It introduces a sequence-level training signal which is crucial to generation tasks that always rely on auto-regressive decoding. However, previous methods using contrastive learning in neural text generation usually lead to inferior performance. In this paper, we analyse the underlying reasons and propose a new Contrastive Neural Text generation framework, CoNT. CoNT addresses bottlenecks that prevent contrastive learning from being widely adopted in generation tasks from three aspects -- the construction of contrastive examples, the choice of the contrastive loss, and the strategy in decoding. We validate CoNT on five generation tasks with ten benchmarks, including machine translation, summarization, code comment generation, data-to-text generation and commonsense generation. Experimental results show that CoNT clearly outperforms the conventional training framework on all the ten benchmarks with a convincing margin. Especially, CoNT surpasses previous the most competitive contrastive learning method for text generation, by 1.50 BLEU on machine translation and 1.77 ROUGE-1 on summarization, respectively. It achieves new state-of-the-art on summarization, code comment generation (without external data) and data-to-text generation.
Motivation & Objective
- Motivate contrastive learning to alleviate exposure bias in autoregressive text generation.
- Design a framework that (i) samples contrastive negatives from model predictions, (ii) uses an N-pairs margin loss with sequence-level scores, and (iii) integrates a learned similarity score into decoding.
- Demonstrate improvements over MLE baselines and prior contrastive methods across multiple generation tasks.
- Show that CoNT achieves new state-of-the-art results on several benchmarks and remains efficient at inference.
Proposed method
- Sample negative/contrastive examples from the model’s own predictions via diverse beam search.
- Adopt an N-pairs contrastive loss that ranks contrastive samples using a sequence-level oracle score (e.g., BLEU) and a cosine similarity with the source representation.
- Use a margin-based loss: L_N-Pairs = sum max{0, cos(z_x, z_y^-) − cos(z_x, z_y^+) + xi} with xi reflecting rank-based margins.
- Incorporate a learned similarity score into decoding by maximizing a mixture of cosine similarity and traditional likelihood: y* = argmax_y { alpha * cos(z_x, z_y) + (1 - alpha) * p(y|x)}.
- Generate self-generated negatives and combine them with from-batch negatives to form the contrastive set.
- Provide an inference procedure that balances sequence similarity with language-model likelihood during decoding.
Experimental results
Research questions
- RQ1Does sample generation from the model’s own predictions provide more informative negatives than from-batch negatives alone?
- RQ2Does an N-pairs margin loss with sequence-level scores outperform InfoNCE in contrastive text generation?
- RQ3Can integrating a learned sequence similarity into decoding improve generation quality beyond standard MLE losses?
- RQ4How does CoNT perform across translation, summarization, code comment generation, data-to-text, and commonsense generation?
- RQ5What is the trade-off in training efficiency when applying CoNT compared to traditional MLE and prior contrastive methods?
Key findings
- CoNT substantially improves MLE baselines and outperforms prior contrastive methods across ten benchmarks.
- On WMT’16 Ro-En, CoNT with N-Pairs loss and decoding similarity achieves 30.91 BLEU, surpassing the prior best contrastive method by 1.50 BLEU.
- On IWSLT’14 De-En, sequence-similarity decoding yields up to 0.86 BLEU gain over vanilla beam search.
- On XSum summarization, CoNT with PEGASUS base establishes new state-of-the-art results.
- On code comment generation (CodeT5 backbone) CoNT improves BLEU to 20.56 for Python and Java.
- In data-to-text (WikiBio) CoNT surpasses R2D2 and approaches larger T5 variants while using a base model.
- In commonsense generation (CommonGen), CoNT with T5-base outperforms several larger baselines on CIDEr and SPICE metrics.
- CoNT achieves on-par performance with large pre-trained models (e.g., T5-large/3B) on data-to-text and commonsense generation while maintaining efficiency.
- Human evaluation indicates CoNT outputs are preferred over MLE and Naive CL in translation and summarization tasks.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.