TL;DR
Most AI text generators produce output in a single pass, failing to capture the iterative drafting and editing process typical of human writers. This paper introduces a "generate-and-revise" framework for poetry that uses Reinforcement Learning—specifically Proximal Policy Optimization (PPO)—to progressively detect and replace words until a target rhyming scheme is met, all without explicit linguistic rules.
What Problem Does This Paper Address?
Standard Natural Language Generation (NLG) models operate in a single pass, generating text token-by-token from left to right. While effective for standard prose, this approach struggles with highly constrained creative writing like poetry, where strict structural requirements (such as meter and rhyme) often necessitate backtracking, editing, and revision.
Existing neural poem generators typically try to enforce these constraints through rigid rule-based post-processing or complex decoding tricks. This paper addresses a fundamental gap: how to design an AI agent that mimics the human creative process by generating an initial rough draft and then autonomously revising it to satisfy structural constraints.
Methods
The authors decouple the generation and revision process into three distinct neural modules:
- Conditional Poem Generator: A sequence-to-sequence model with attention (utilizing a bidirectional LSTM encoder and a GRU decoder) that takes an author's style and a target rhyme scheme to output an initial draft poem.
- Detector: An RL agent that evaluates the current draft and selects the index of a word that violates the target structure or context. Crucially, the detector is not given any prior linguistic knowledge about what a "rhyme" is or where it should occur.
- Prompter: A context-aware language model that analyzes the left and right context of the word selected by the detector to suggest a pool of top-$k$ replacement candidates.
The revision process is framed as a navigation or shortest-path problem. The RL agent receives a positive reward ($+1$) if the poem successfully matches the target rhyme scheme, and a penalty ($-1$) for every editing step taken. This setup incentivizes the agent to make the minimum necessary corrections to achieve the goal.
Datasets
The models were trained and evaluated on a dataset of English poetry:
- Source: English language poems extracted from Project Gutenberg using the GutenTag tool.
- Size: 757,891 quatrains, filtered to ensure clean structural formatting.
- Vocabulary: Limited to the 50,000 most frequent words, utilizing character-aware representations to capture sub-word rhyming patterns.
- Conditioning Factors: The dataset was labeled with the top 768 most frequent authors and the top 50 most common eight-verse rhyme schemes.
Key Insights and Ideas
- Decoupling the Action Space: Jointly deciding which word to change and what to change it to results in a massive action space ($|V| \times m$, where $V$ is vocabulary size and $m$ is poem length). By splitting this into a Detector (RL-driven) and a Prompter (standard language model), the RL agent's action space is drastically reduced to just the length of the poem ($m$), making RL training feasible.
- The Superiority of PPO over VPG: While Vanilla Policy Gradient (VPG) is commonly used in text-based RL applications, it proved highly unstable in this environment. Proximal Policy Optimization (PPO), with its clipped surrogate objective, successfully prevented catastrophic policy collapses and allowed the agent to steadily learn complex structural rules.
- Emergent Structural Awareness: Without explicit instructions, the detector naturally learns to focus its editing actions on the final words of each verse, discovering on its own that these positions are the ones responsible for satisfying rhyming schemes.
Key Results
The authors evaluated their framework on both a controlled "poem reconstruction" task (fixing artificially corrupted text) and the full "generate-and-revise" pipeline.
- Language Modeling Quality: Incorporating conditional features (author and rhyme scheme) improved the perplexity of the poem generator (dropping from 59.78 to 54.86) and the prompter (dropping from 14.78 to 13.40).
- RL Optimization: PPO significantly outperformed VPG across all test environments. In an evaluation using 100 poems, VPG failed to converge (stagnating at a final reward of -19.264), whereas PPO steadily improved from an initial reward of -15.598 to -5.200.
The qualitative impact of these revisions can be seen in the successful adjustments made to match target rhyme schemes:
Limitations and Future Work
- Lack of Human Evaluation: The authors relied entirely on automated reward metrics (verifying if a rhyming scheme was mathematically satisfied). They did not conduct human studies to evaluate the semantic coherence or aesthetic quality of the revised poems.
- Potential for Semantic Drift: While the prompter ensures local context compatibility, optimizing purely for a structural rhyme reward can cause the poem's overarching meaning to drift during long revision cycles.
- Broader Applications: The framework is fundamentally general. The authors suggest that with appropriate reward shaping, this generate-and-revise approach could be applied to other text-editing tasks such as style transfer, text simplification, or paraphrasing.
Summary updated