Exploring Different Approaches to Computational Poem Generation

Exploring Different Approaches to Computational Poem Generation

Here I recap a lustrum long work on poem generation using different computational approaches. Artificial intelligence research has taken giant leaps over the recent years and this blog post reflects that radical change. I will showcase work conducted using foundation models, genetic algorithms and templates.

Poem generation using RoBERTa and GPT-2

In the enchanting world of language and creativity, a recent study emerges as a beacon of innovation in the realm of French poetry generation. Titled Modern French Poetry Generation with RoBERTa and GPT-2 (Hämäläinen et al., 2022), this paper introduces a groundbreaking approach by melding the analytical prowess of RoBERTa with the creative flair of GPT-2, thereby crafting poetry that resonates with the essence of human emotion and intellect.

Imagine a bridge between the structured understanding of language and the boundless creativity of poetic expression. This study constructs such a bridge, employing RoBERTa for its superior natural language understanding to analyze and encode the poetic input, and GPT-2 for its exceptional generation capabilities to weave verses that breathe life into words. This synergistic blend not only honors the complexity and beauty of French poetry but also pushes the boundaries of what artificial intelligence can achieve in the arts.

Combining two neural models can be beneficial when generating poems

The authors meticulously fine-tuned these models on a rich corpus of French poetry, ensuring that the generated verses carry the depth, emotion, and stylistic nuances characteristic of the language’s poetic heritage. The model’s capacity to engage with rhyme, a cornerstone of poetic beauty, further elevates the authenticity and appeal of the generated poetry.

What stands out is not just the technical achievement but the humanistic endeavor — the quest to understand and replicate the emotive and aesthetic dimensions of poetry. The evaluation by human judges underscores the model’s success, reflecting high scores in understandability and evoking emotions, hallmark traits of memorable poetry.

This study not only signifies a leap in computational creativity but also invites us to reimagine the collaboration between humans and machines in crafting art. It beckons poets, writers, and technologists to explore this confluence of technology and creativity, heralding a new era where AI becomes a co-creator in the timeless pursuit of beauty and expression in poetry.

Understanding poem generation as an evolutionary process

In the realm of computational creativity, the generation of poetry using artificial intelligence presents a fascinating intersection of technology and art. Next, I want to delve into a groundbreaking approach to poem generation in the Finnish language, as explored by Mika Hämäläinen and Khalid Alnajjar (2019) in their innovative paper. Their method employs a master-apprentice paradigm, where a genetic algorithm (the master) enhances a bidirectional recurrent neural network (BRNN) model (the apprentice) to craft poetry. This process not only embraces the complex morphology of Finnish but also intertwines various aspects of poetic aesthetics such as sonic features, semantic coherence, and imagery.

The evolutionary approach in the discussed paper utilizes a genetic algorithm that iteratively refines poem generation by evaluating generated poems through a set of fitness functions. These fitness functions assess various aspects such as phonetic qualities, semantic coherence, and emotional impact, guiding the algorithm towards generating poems that are not only structurally sound but also rich in imagery and emotion. By simulating a process of natural selection, the algorithm iteratively improves the quality of the poems, making adjustments based on the feedback from these fitness functions, leading to more creative and aesthetically pleasing outputs.

Poem generation can be seen as an evolutionary process

What sets their work apart is the use of the FACE model (Framing, Aesthetics, Concept, and Expression) to define and evaluate creativity. This allows for a nuanced consideration of the poem’s structure, the evocation of imagery, and the conveyance of sentiment, aiming for a holistic assessment that goes beyond mere linguistic construction. The genetic algorithm refines these elements through iterative learning, informed by a vast corpus of Finnish poetry, while the neural network learns to generate new poetic expressions, encapsulating the nuanced aesthetics of Finnish poetry.

Their research not only pushes the boundaries of what machines can create but also opens up discussions on the nature of creativity and the potential for AI to participate in cultural and artistic expressions. As we continue to explore this confluence of technology and art, it becomes clear that the future of creative writing, particularly in underrepresented languages like Finnish, may well be shaped by these advanced computational methods.

Poem generation using flexible and abstract templates

In the realm of computational creativity, the generation of poetry using Natural Language Generation (NLG) technologies presents a fascinating intersection of artificial intelligence and human artistic expression. A groundbreaking study, detailed in a paper by Mika Hämäläinen (2018) from the University of Helsinki, introduces a novel NLG-based approach for creating Finnish poetry. This method, designed for integration into the larger Poem Machine system, aims to foster human-computer co-creativity by offering a linguistically robust platform for poem construction.

The challenge of automatic poetry generation lies not only in producing grammatically correct text but in capturing the essence of poetry’s indirect expression through rhetorical devices such as metaphors, rhymes, and imagery. Finnish poetry poses additional complexities due to the language’s rich morphosyntax, where words change form based on their syntactic relationships, making grammaticality a significant hurdle.

Poem generation can also be about filling templates

Hämäläinen’s approach innovatively combines a linguistically solid foundation for generating syntactic Finnish with higher-level systems that structure poems and select appropriate lexical items. A key component is the development of an open-access semantic repository tailored for poem generation, enhancing the system’s ability to create semantically cohesive and meaningful poetry.

The system employs a pipeline comprising multiple independent modules addressing syntax, morphology, semantics, and poetic structure. It leverages Syntax Maker, a tool developed by Hämäläinen, for surface generation and a semantically linked database for content determination. The poem generation process involves diverse verse generators that ensure semantic cohesion by passing nouns from one verse to the next, enabling the creation of thematically coherent poems.

This innovative method surpasses previous Finnish poetry generation systems by not only adhering to grammatical correctness but also by enhancing the semantic and thematic depth of the generated poems. The system’s evaluation, through subjective metrics by university students, indicates its success in producing poetry recognized and appreciated as such, highlighting its potential as a tool for educational and creative purposes.

The paper’s exploration into Finnish poetry generation showcases the potential of NLG technologies in the arts, presenting a promising avenue for further research and development. This approach not only advances the technical field of NLG but also opens new doors for creative expression, inviting us to reconsider the boundaries between human creativity and artificial intelligence. The code is available on Github.


Hämäläinen, M., Alnajjar, K., & Poibeau, T. (2022). Modern French Poetry Generation with RoBERTa and GPT-2. In The Proceedings of the 13th International Conference on Computational Creativity (ICCC).

Hämäläinen, M., & Alnajjar, K. (2019). Let’s FACE it. Finnish Poetry Generation with Aesthetics and Framing. In Proceedings of the 12th International Conference on Natural Language Generation (pp. 290-300).

Hämäläinen, M. (2018). Harnessing NLG to Create Finnish Poetry Automatically. In Proceedings of the ninth international conference on computational creativity. Association for Computational Creativity (ACC).