i, Poet: Automatic Poetry Composition through Recurrent Neural Networks with Iterative Polishing Schema

Rui YanIJCAI 2016

Abstract

Classical Chinese poetry generation is a sophisticated task that demands strict adherence to structural constraints and deep semantic coherence. We present iPoet, a neural network-based system designed to compose poetry by simulating the human writing and revision process. By employing a hierarchical Recurrent Neural Network (RNN) architecture and a novel iterative polishing schema, iPoet generates poems that are not only structurally sound but also thematically unified. Our evaluation, involving both automated metrics and human judgment, shows that iPoet significantly improves upon existing single-pass generation models.

Introduction

Writing classical Chinese poetry is a high-bar creative endeavor. It requires balancing rigid structural rules—such as fixed line lengths and specific tonal patterns—with the need for profound semantic depth. Historically, AI attempts at poetry generation relied on rule-based templates or statistical machine translation. While these methods could produce lines that appeared correct in isolation, they often failed to maintain "global" meaning, resulting in poems that lacked a cohesive narrative or emotional arc.

Standard Recurrent Neural Networks (RNNs) typically generate text in a single forward pass. However, human poets rarely produce a masterpiece in one go; they rethink, re-word, and polish their work to ensure every line reinforces the central theme. The iPoet framework addresses this gap by introducing an iterative polishing schema, allowing the model to refine its drafts based on a global understanding of the initial output.

Methodology

The iPoet architecture is built upon an encoder-decoder framework with several key innovations designed to capture the nuances of poetic composition.

Hierarchical RNN Structure

To manage the nested structure of poetry—where characters form lines and lines form a complete poem—iPoet uses a two-level hierarchy. A Global RNN tracks the overall state and thematic progression across different lines. Simultaneously, a Local RNN generates individual characters within a line, guided by the context provided by the Global RNN. This separation ensures that the model maintains a long-term "memory" of the poem's intent while focusing on the immediate linguistic constraints of each line.

The iPoet framework architecture, illustrating the encoding of intents, the hierarchical decoding process, and the iterative polishing schema.

Iterative Polishing Schema

The defining feature of iPoet is its ability to "revise" its work. After an initial draft is generated, the system extracts a "gist"—a latent vector representation—of the entire poem. This gist, representing the model's own interpretation of its draft, is fed back into the decoder along with the original user keywords. This feedback loop allows the model to adjust earlier lines to better align with the themes established in later lines, a process that can repeat for up to ten iterations or until the output stabilizes.

Intention Representation

Users initiate the generation process by providing a set of keywords (e.g., "autumn," "moon," "lonely"). These "writing intents" are encoded into a starting vector. The researchers explored two different structures for this encoding: a Convolutional Neural Network (CNN)-based approach and an RNN-based approach.

Comparison of CNN-based and RNN-based structures for representing writing intentions from input keywords.

The study found that the RNN-based structure was slightly more effective at capturing the relationships between variable-length keyword terms, providing a more robust foundation for the subsequent generation phases.

Experimental Setup and Datasets

The model was trained on a comprehensive corpus of classical Chinese literature, specifically focusing on the Tang and Song dynasties. The authors utilized two primary datasets:

  • PTD (Poems of Tang Dynasty): 42,974 poems.
  • PSD (Poems of Song Dynasty): 18,986 poems. The combined dataset includes over 730,000 lines, primarily consisting of quatrains (4 lines) and regulated verses (8 lines) with 5 or 7 characters per line, which represent over 90% of the available corpus.

Results and Discussion

iPoet was benchmarked against several baselines, including Statistical Machine Translation (SMT) models and standard LSTM-RNNs without hierarchical or polishing components.

Quantitative Performance

iPoet achieved the lowest Perplexity (PPL)—a measure of how well the model predicts test data—and the highest BLEU scores across all tested formats. While BLEU scores are often criticized in creative tasks for their reliance on exact word matches, the consistent improvement across these metrics indicates that iPoet's outputs are linguistically closer to human-authored classics than those of its predecessors.

Qualitative Human Evaluation

To better assess the creative quality of the poems, human judges evaluated the outputs on a 0-4 scale based on four criteria: Fluency, Poeticness, Coherence, and Meaning. iPoet significantly outperformed baseline models, particularly in the areas of Coherence and Meaning. This confirms that the iterative polishing schema successfully anchors the poem to a central theme, preventing the thematic "drift" often seen in long-sequence generation.

Conclusion

The iPoet system demonstrates that modeling the iterative nature of human creativity can significantly enhance the quality of AI-generated art. By combining a hierarchical structure with a polishing feedback loop, the model moves beyond simple sequence prediction toward a more holistic form of composition. Future work will focus on incorporating more complex poetic constraints, such as tonal patterns (Ping-Ze) and emotional nuances, to further bridge the gap between machine and human poets.

Summary updated

BibTeX
@inproceedings{yan2016i,
  author = {Rui Yan},
  title = {{i, Poet: Automatic Poetry Composition through Recurrent Neural Networks with Iterative Polishing Schema}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2016},
}
Figure