Automatic Poetry Generation from Prosaic Text

Tim Van de CruysACL 2020

Introduction

Traditional automatic poetry generation systems typically rely on large corpora of existing poetry to learn stylistic and structural rules. However, these datasets are often limited in size and can restrict models to specific historical styles or rigid structures. This research addresses the challenge of creating a system that understands natural language nuances while adhering to strict poetic constraints like rhyme, meter, and topical focus. The central question explored is whether a general-purpose language model can be endowed with a poetic character using only inference-time constraints, without ever being trained on a single poem.

Methodology

The proposed system utilizes a hybrid approach that combines neural networks for linguistic fluency with matrix factorization for topical control.

Neural Architecture and Reverse Decoding

The core architecture is a Gated Recurrent Unit (GRU) encoder-decoder equipped with an attention mechanism. It is trained on a "next-sentence prediction" task using general prose. A key innovation is the use of reverse decoding: the decoder is trained to generate sentences from right-to-left. This allows the model to select a rhyme word first and then construct a grammatically sound sentence leading up to it, effectively solving the "dead-end" problem where a model cannot find a suitable rhyme for a pre-written line.

Architecture diagram showing the encoder-decoder with attention, rhyme priors, and entropy-based topical constraints.

Topical Constraints and Entropy-based Weighting

To maintain thematic consistency, Non-negative Matrix Factorization (NMF) is used to induce topics from the corpus. During inference, the model's output distribution is shifted toward words belonging to a specific topic. To preserve grammatical integrity, an entropy-based weighting mechanism is employed. Topical constraints are only applied when the neural network's uncertainty (entropy) is high. For functional words where the network is certain (e.g., "the", "of"), the system avoids intervention to maintain fluency.

Global Optimization

Final line selection involves generating multiple candidates and scoring them based on a harmonic mean of five criteria: neural log-probability, rhyme compliance, topicality, syllable count (modeled via a Gaussian distribution), and an n-gram model score.

Data and Training

The models were trained on a 500-million-word subset of the CommonCrawl corpus for both English and French. Phonetic data for rhyme constraints was extracted from Wiktionary. Evaluation was conducted by human annotators, including experts in linguistics and literature, who compared the system's output against various baselines and human-written poetry.

Results

The system was evaluated across four dimensions: fluency, coherence, meaningfulness, and poeticness.

Comparative evaluation of poetry generation models across English and French datasets.

The results demonstrate that the best-performing model (nmf_spec) achieves human-like performance. In English, it reached a poeticness score of 3.86, nearly matching the human score of 4.00. Remarkably, 55% of the English poems generated by this model were judged by humans to be human-written. The system outperformed or matched specialized state-of-the-art poetry generators like Hafez and Deep-speare, despite those models being specifically trained on poetic datasets.

Discussion and Future Work

This research highlights that "poeticness" can be effectively treated as a set of filters applied to a general language model. The "reverse" decoding strategy and selective topical intervention prove to be robust methods for balancing syntax and semantics.

However, limitations remain. The current system uses a simplified syllable count rather than complex meter patterns like iambic pentameter. Additionally, it does not explicitly model figurative language such as metaphors or symbolism. Future work will explore Transformer-based architectures, hierarchical approaches for long-term coherence, and the potential for automatic poetry translation.

Summary updated

BibTeX
@inproceedings{cruys2020automatic,
  author = {Tim Van de Cruys},
  title = {{Automatic Poetry Generation from Prosaic Text}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2020},
  doi = {10.18653/v1/2020.acl-main.223},
}
Figure