February 10, 2021
CMU Students Train AI to Write Book of Limericks
Language Technologies Institute course explores artificial intelligence and creative expression
By Byron SpiceMedia Inquiries
- School of Computer Science
CMU students all get their kicks
By building apps that attract mass clicks
So they teamed up in class
Built an AI with sass
That wrote them a book full of lim'ricks.
Pardon the doggerel, but what else would be appropriate when Carnegie Mellon University students create an artificial intelligence for writing poetry?
Their digital Shakespeare was a project last semester in the School of Computer Science's Introduction to Deep Learning course. The instructor, Rita Singh, associate research professor in the Language Technologies Institute, said she suggested the project as a way for students to explore how AI might capture elements of artistic expression that are hard to quantify.
"What makes a few lines of English written by Tennyson 'poetry' and a 'masterpiece' while the same number of lines written by someone else following the same pattern/rule/rhyme turn out to be perfectly mundane and mediocre?" she said.
Mitch Fogelson, a Ph.D. student in mechanical engineering, said he and his fellow students — Xinkai Chen, who completed the Master of Information Systems Management program in December 2020; Qifei Dong, a master's degree candidate in electrical and computer engineering; Christopher Dare, a master's degree candidate in information and communication technology; and Tony Qin, a junior artificial intelligence major — opted to focus their AI on limericks because the form has a fixed AABBA rhyming structure. Also, they had access to a database of 90,000 limericks that they could use to train their AI.
They used an open-source language model called GPT-2, which was developed by OpenAI and had previously been used to produce poetry.
"It generated a virtually endless stream of poetry — thousands of poems," Fogelson recalled. "The quality overall wasn't amazing." In fact, the early efforts included some really weird stuff — sort of limerick conversations. The AI also didn't always produce neat, five-line limericks. Some were just single lines.
The bulk of the project for the students was developing a computational method for wading through this sea of poetry and plucking out the relative few samples that were worth reading, Fogelson said. They created an algorithm that included constraints for rhyme and rhythm and, by monitoring whether words occurred in the vicinity of related words, looked for poems that made some sense.
Among those selected by the algorithm:
A cougar, intending to ride
Through the marshlands, he chose with his stride
To the green wider bay
It's a lovely display
Such a paradise, lacking a guide
When an orchestra plays a soft part
The accord of each music is smart
But the music is slow
And they never can know
All the music is only a start
The students then manually selected the 100 to 200 limericks that merited publication. The result is the first AI-generated book of limericks, "For You, Humans," which is now available for sale on Amazon.
Fogelson said it was a useful exercise, demonstrating how data-driven models might support creative efforts in the future.
"The AI does not, to our knowledge, impart meaning whilst generating poems, but the neurons in our brains were nevertheless able to draw connections between the words," he added.
Singh said the book is just a beginning.
"The project will continue this semester with other student teams, and go on until what the AI produces rivals human creativity in poetry," she said. "We want to see how far we can go."
For now, she said, even the AI seems to know that more work is needed:
I'm not guilty, am I? On reflection?
That my knowledge, of meter negition
Is that writing is shoddy
I'll build on a noddy...
My brain barely works in perfection.