[Paper Review] Improving Language Generation with Sentence Coherence Objective
This paper proposes a two-stage method to improve topic coherence in conditional text generation by training a GPT-2-based coherence classifier and co-training the language model with a reinforcement learning objective using REINFORCE. The approach significantly reduces topic drift in long-form generation while maintaining high coherence, though at a slight cost to fluency.
Conditional story generation and contextual text continuation have become increasingly popular topics in NLP community. Existing models are often prone to output paragraphs of texts that gradually diverge from the given prompt. Although the generated text may have a reasonable perplexity and diversity, it could easily be identified by human as gibberish. The goal of our project is to improve the coherence and consistency across sentences in a language-generation model. We aim to solve this issue by first training a sentence pair coherence classifier with GPT-2 pretrained model, and then co-train the GPT-2 language model with this new coherence objective using a method analogous to the REINFORCE algorithm. This fine-tuned language model is able to generate lengthy paragraph conditioned on a given topic without diverging too much. The simplicity of this model allows it to be applicable to a variety of underlying language model architecture since it only modifies the final layer of the pre-trained model.
Motivation & Objective
- To address topic drift in conditional text generation, where autoregressive models like GPT-2 gradually diverge from the prompt.
- To enhance coherence between generated text and the input prompt without modifying the underlying language model architecture.
- To develop a trainable, lightweight coherence objective that can be integrated into pre-trained models via reinforcement learning.
- To evaluate whether a fine-tuned coherence objective improves long-form generation consistency while preserving fluency.
Proposed method
- Fine-tune a GPT-2 model to predict sentence pair coherence using a binary classification task on paragraph-adjacent vs. random sentence pairs.
- Use the [CLS] token representation from the fine-tuned GPT-2 as sentence embeddings for coherence prediction.
- Train a logistic regression head on top of the sentence embeddings to predict whether two sentences belong to the same paragraph.
- Co-train the GPT-2 language model with a reinforcement learning objective using the REINFORCE algorithm to maximize coherence between generated text and the prompt.
- Introduce a weighted auxiliary loss based on the coherence classifier’s output, active after the second training epoch to stabilize learning.
- Apply the coherence objective during generation by guiding the next word prediction to align with the prompt’s topic via the classifier’s score.
Experimental results
Research questions
- RQ1Can a fine-tuned GPT-2 model serve as an effective sentence coherence classifier for detecting topic alignment between sentences?
- RQ2Does co-training a language model with a REINFORCE-optimized coherence objective reduce topic drift in long-form conditional generation?
- RQ3How does the inclusion of a coherence objective affect the fluency and naturalness of generated text compared to standard GPT-2?
- RQ4Can the coherence objective be applied to any pre-trained transformer model with minimal architectural changes?
- RQ5What is the impact of training schedule (e.g., delaying the coherence objective) on convergence and performance?
Key findings
- The coherence classifier achieved 94.21% accuracy on the test set, approaching human-level performance (92%) and outperforming a cross-attention baseline (94.52%).
- The co-trained model demonstrated a decreasing trend in coherence loss over time, indicating effective optimization via the REINFORCE algorithm despite noisy gradients.
- Perplexity on the validation set converged to 15, indicating stable language modeling performance.
- Generated text from the co-trained model showed significantly better topic consistency than standard GPT-2, with reduced divergence from the prompt over long sequences.
- Nonlinear transformation of the prompt embedding outperformed linear projection, which led to degenerate, repetitive outputs.
- The model maintained strong coherence at the cost of slightly reduced fluency and naturalness in word choice and grammar compared to the original GPT-2.
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.