Introduction
Despite the remarkable capabilities of Transformer-based models like GPT-2, they frequently suffer from "model degeneration"—a phenomenon where generated text becomes repetitive, dull, or semantically inconsistent. While stochastic decoding methods like nucleus sampling can mitigate repetition, they often sacrifice coherence. This paper introduces SimCTG (Simple Contrastive Framework for Neural Text Generation), a novel approach that addresses degeneration by fostering a more "isotropic" (spread out) representation space.
The Anisotropy-Degeneration Link
The authors identify the root cause of degeneration as the anisotropic nature of the model's representation space. In standard models trained with Maximum Likelihood Estimation (MLE), token representations tend to cluster into a narrow cone. This high similarity—often exceeding 0.95—makes it difficult for the model to differentiate between distinct concepts during generation, leading to repetitive loops.
As shown in the visualization above, standard MLE results in a nearly uniform high-similarity matrix. In contrast, SimCTG produces a sparse, diagonal-heavy matrix, indicating that the model has learned to represent tokens as distinct entities.
Methodology: SimCTG
The SimCTG framework attacks degeneration through two primary components:
- Contrastive Training: A contrastive loss term ($L_{CL}$) is added to the standard MLE objective. This margin-based loss "pushes" the representations of different tokens in a sequence away from each other, forcing the model to learn a more discriminative and isotropic space.
- Contrastive Search: This new deterministic decoding strategy replaces traditional greedy or beam search. At each step, it selects a token by balancing model confidence (probability) with a "degeneration penalty"—the maximum cosine similarity between the candidate token and all previously generated tokens.
Experimental Results
The framework was evaluated on major benchmarks including Wikitext-103 (English), LCCC (Chinese), and DailyDialog (English). SimCTG consistently outperformed baselines like standard MLE and Unlikelihood Training across metrics such as Perplexity, MAUVE, and Diversity.
A key highlight of the study is the human evaluation performance. On the Wikitext-103 dataset, the SimCTG-large model achieved coherence and fluency scores that closely approach human-level quality.
Furthermore, the approach is highly efficient; the contrastive training objective adds only approximately 1.48% extra computational overhead compared to standard MLE training, and contrastive search remains faster than beam search for larger beam widths.
Conclusion
SimCTG provides a robust solution to the degeneration problem by aligning the model's internal representation space with the distinctiveness of natural language. By combining contrastive training with a similarity-penalizing search algorithm, the framework achieves state-of-the-art results that significantly narrow the gap between machine-generated and human-written text. Future work may involve refining the contrastive loss to better handle true synonyms and scaling the framework to even larger language models.
Summary updated