An Optimized Approach towards Classical Poetry Generation based on LSTM Models
Abstract
In the field of natural language processing(NLP), the automated generation of classical Chinese poetry remains a challenging task. Recent models have increasingly relied on neural networks, such as working memory model, Transformer, and generative adversarial network (GAN). Although widespread attention has been given to these architectural innovations, the impact of software engineering practices and implementation quality on model performance is often overlooked. This gap leads to reproducibility issues and a disconnect between theoretical design and practical efficacy. In this paper, we systematically examine the effect of code optimization on a standard LSTM-based poetry generation model, without altering its mathematical foundation or hyperparameters. We identify common engineering weaknesses in baseline implementations and introduce an enhanced version incorporating object-oriented design, modular components, explicit variable scoping, and a unified training interface. Experimental results show that the optimized model achieves a 28.3% reduction in validation loss (from 4.6 to 3.3) and a 72.8% improvement in perplexity (from 99.5 to 27.1). Human evaluation further confirms gains in semantic coherence (3.8 vs. 2.6) and poetic aesthetics (3.5 vs. 2.4). Our work highlights that code quality is a critical factor in deep learning performance, offering a reproducible framework that facilitates the practical deployment of poetry generation systems.
Fields of Study & Subjects
Topic Modeling
Natural Language Processing Techniques
Software Engineering Research
Publication details
- Journal / source
- International Conference on Intelligent Control and Information Processing
- Pages
- 154–163
- Publication date
- 21 February 2026
- Language
- EN