Abstract
Learning and generating Chinese poems is a charming yet challenging task. Traditional approaches involve various language modeling and machine translation techniques, however, they perform not as well when generating poems with complex pattern constraints, for example Song iambics, a famous type of poems that involve variable-length sentences and strict rhythmic patterns. This paper applies the attention-based sequence-to-sequence model to generate Chinese Song iambics. Specifically, we encode the cue sentences by a bi-directional Long-Short Term Memory (LSTM) model and then predict the entire iambic with the information provided by the encoder, in the form of an attention-based LSTM that can regularize the generation process by the fine structure of the input cues. Several techniques are investigated to improve the model, including global context integration, hybrid style training, character vector initialization and adaptation. Both the automatic and subjective evaluation results show that our model indeed can learn the complex structural and rhythmic patterns of Song iambics, and the generation is rather successful.
Introduction
Classical Chinese poetry is a rigorous art form defined by strict structural and phonetic rules. While previous research has successfully addressed "Regulated Verses" (like Tang poetry) with fixed line lengths, generating Song iambics (Songci) presents a significantly higher hurdle. Song iambics follow specific "tunes" (cipai), each serving as a unique template for sentence length, rhyming, and tonal patterns—specifically the arrangement of Ping (level) and Ze (downward) tones.
The challenges are three-fold: the variable structure of lines, the risk of "concept drift" in longer poems where the thematic focus is lost, and data sparsity, as many of the thousands of known tunes have very few surviving examples.
Methodology
The proposed system utilizes a Sequence-to-Sequence (Seq2Seq) framework enhanced with several specialized components to handle the intricacies of Songci.
Neural Architecture
The model employs a bi-directional Long Short-Term Memory (LSTM) network as an encoder to process a "cue sentence" (the initial line). An attention-based LSTM decoder then generates the subsequent lines. The attention mechanism is crucial; it allows the decoder to dynamically focus on relevant parts of the cue sentence at each step, maintaining thematic consistency throughout the poem.
Specialized Enhancements
- Global Context Supervision: To prevent the model from losing the original intent during long generations, the final hidden states of the forward and backward LSTMs are concatenated to serve as a permanent "anchor."
- Hybrid-tune Training: To address data sparsity, a single large model is trained on all available tunes. A "tune indicator"—an eigenvector representing the specific poetic template—is provided as input, allowing the model to learn general poetic structures while adhering to the specific rules of a target tune.
- Character Vector Initialization: Embeddings are pre-trained on the massive Gigaword corpus and a specialized Songci corpus to capture deep semantic relationships between characters.
Experimental Results
The model was evaluated using the Songci Corpus (15,689 iambics) and compared against Statistical Machine Translation (SMT) and standard RNN language models (RNNLM).
Quantitative Evaluation
The "Attention-All" model achieved a BLEU-2 score of 0.1482, significantly outperforming the SMT baseline (0.0598) and the RNNLM (0.0330). This indicates a much higher degree of structural and lexical alignment with human-written poetry.
Subjective Evaluation
A panel of 24 experts in Chinese literature evaluated the generated poems on a 1-5 scale across three dimensions: Poeticness (adherence to rhythm/tone), Fluency, and Meaningfulness.
The results demonstrate that the model is remarkably competitive. Notably, in "Poeticness," the model often scores higher than human poets. This is attributed to the model's ability to perfectly scan thousands of character combinations to satisfy rigid tonal rules, whereas human artists might occasionally prioritize emotional expression over strict formal adherence. While humans still lead in "Meaningfulness" (4.30 vs 3.60), the gap in "Fluency" is narrow (4.23 vs 3.52).
Conclusion
This research demonstrates that neural attention-based models can successfully capture the complex structural and rhythmic patterns of Song iambics. By integrating global context and hybrid-tune training, the model maintains thematic focus and handles rare poetic templates effectively. While the model excels at following formal rules, future work will focus on bridging the gap in deep semantic consistency and creative narrative depth to match the profound emotional resonance of human masters.
Summary updated