Course Projects ยท Jake Bodishbaugh

AI Poem Generator

During my sophomore year of college, I spent the year studying abroad in South Korea at Sogang University. In the spring semester, I took a course called Natural Language Processing. As my final project I built and trained an AI on the corpus of the Poetry Foundation using the Python library Pytorch.

I used two different styles of data sets for the training and inference of the model. In one data set, the input is the poem title and the expected output is the entire poem. In the other data set, the input is a line of poetry and the expected output is the next line from the same poem. The result of the two different approaches are compared further below.

Model

Inference Results

Title-Poem Data set

Poem Line Pair Data set

Clearly, the model is not perfect. It makes a lot of mistakes: certain phrases cause it hallucinate more than others, there are words from other languages mixed in, and occasionally makes no grammatical sense. Yet, considering this model was trained just on poems I am proud of how it performed. For better performance, it would be better to train the model on a larger, more general corpus, then retrain the model on the poem data set after it already learned from the larger corpus.