ChatGPT and Poetry

The intersection of science and art — contains discussions of rhythm, rhyme, and puns

Evan SooHoo
8 min readDec 26, 2022

In my first year of college, our professor gave us a “giveaway question” on the final to pad our grades — Write your vision for what coding could one day be. At the time it seemed like a nice gesture, but today I am convinced he was trying to steal our intellectual property.

I wrote an idea that many people have thought of already: In the future, you should simply be able to tell a program what kind of code you wish to create, and it should create it for you. When I was in high school, this was simply not how computer programs worked. You could “tell” a program to increment a counter. You could “tell” a website to render some visual element when a button was pushed. You could not simply prompt a computer program to create something for you based on simple, plain-English requirements.

One of my first experiences with ChatGPT (which you can try here) was feeding it an interview question I had had, verbatim. I asked it to write Java code for storing device IDs, and it complied. I asked it if it could rewrite the code using hashmaps, and it complied. What impressed me was not the initial code-writing, but that when I asked it to modify the device ID’s to unique 16-digit integers, it “knew” exactly what I was talking about.

You can ask ChatGPT to write poetry, too. A similar product OpenAI released produces custom art, but this raises some red flags with respect to copyright. As discussed in the video below, some artists recognized distorted versions of their own signatures on the “original” art this AI produced.

Poetry

A poem is defined as:

1. A composition in verse, especially one that is characterized by a highly developed artistic form and by the use of heightened language and rhythm to express an intensely imaginative interpretation of the subject.

2. Composition that, though not in verse, is characterized by great beauty of language or expression
https://www.dictionary.com/browse/poem

In high school, I read a definition of poetry that defined it as “having more VOLTAGE than typical prose.” This is not helpful for most people, but I liked the analogy — it went on to say that a poem can lack rhythm and rhyme, but still be poetry. 30 Days Hath September, by this definition, is not real poetry…it is just a collection of words that rhyme.

My favorite example of a poem without rhythm or rhyme is this:

In this spoken-word poem, Useless Bay, Kay describes her ability to write metaphors almost as an affliction — if she is the same person as the speaker in her poem (a speaker is not always the poet), then she is likely describing her poetry as well. In the beginning, the tone is light. She describes being afraid, having what turned out to be a positive (albeit uneventful) experience with the man she loved, and some jokes that the two exchanged along the way. With the line, “and the man who went up to tell me to let go,” the tone changes. Time passes, that person is no longer there anymore, and the speaker seems to revise her previous statement.

“I climbed up because I believe in you.
Because I love you and I knew that you could do it.
Because I will climb up when you need me.
Because you did need me.”
And he was already asleep before he could answer
leaving me to stalk my own hallways for the meanings
of the clutched rock, the shaking legs, the racing heart,
the fall, the smack, the coldest shock,
and the man who climbed up to tell me to let go.
Source

He went up because he said he loved her, but he told her to let go. A year later, the speaker travels alone and tries anything to forget. She confesses that she would give up “this relentless weight of meaning,” even if things she valued lost their meaning and even if she lost her ability to express herself. If that happened, my interpretation goes, she would stop writing poetry but she would finally be able to be happy again.

Top THAT, ChatGPT.

ChatGPT Writes Poetry

Here is a poem in iambic pentameter about Elon Musk’s acquisition of Twitter:

Elon Musk, a man of tech and innovation,
Now owns the platform of Twitter, with its reach
To share ideas, thoughts, and news with all the nation.
What will he do with this great power to teach?

He’s known for pushing boundaries, breaking molds,
And now with Twitter, he can share his vision
Of a world that’s driven by science, not by old
Ideas that hold us back and cause division.

Perhaps he’ll use this platform to inspire
Others to follow in his footsteps, strive
To make a difference, to ignite a fire
That burns within and helps us all to thrive.

Or maybe he’ll just tweet about memes and jokes,
But either way, it’s clear that Twitter now belongs
To Elon Musk, and he can use it to invoke
Change and progress, or just have some fun.

If you are not into poetry, you are probably thinking: What is iambic pentameter, and why should I care?

If you are into poetry, you are probably thinking: Wait a minute…that’s not iambic pentameter.

As much as I like Kay’s poem, part of poetry is in its auditory quality. Take this Robert Frost poem:

The old dog barks backward without getting up.
I can remember when he was a pup.

Robert Frost (1874–1963) (with someone else’s analysis)

What’s that? How is that poetry? An old dog “barks backward,” okay…a bit of disconcerting imagery and a small sprinkle of alliteration. Now the speaker states the fact that he, or she, remembers when the dog was a pup.

Well at this point you can use something called “scansion,” which is what the person in the link above does. “Old dog barks back” is Frost employing four consecutive accented syllables. This is not natural in the English language, so he manages to use sound to make the first line distinct from the second. The second line, in contrast, is more fluid.

In the Dr. Seuss poem “Sam I Am,” the two speakers use contrasting rhythmic patterns — that’s part of the reason this poem is so fun for children. One blogger even writes that “Sam I Am” is a pun because of his iambic rhythm.

Scansion Is Nontrivial For Computers

First I tried feeding ChatGPT lines from the poem it just gave me, and it confirmed that it had given me iambic pentameter. Then I asked it to write me code for checking whether or not something was in iambic pentameter.

Failure case

ChatGPT was wrong. This received the line “I can’t make rhymes when I am fast asleep,” which IS iambic pentameter. Also, what is with this code? The meat of it is between lines 32 and 52. Are those 20 lines that check for vowel placement the secret to having a computer program analyze scansion?

Probably not. This group wrote a 26-page paper about their creation of a technology capable of performing metrical scansion. You can find discussions of the topic here, with this Wolfram blog post on the topic and this open source product on GitHub that they say worked pretty well (it did not work for me out of the box).

Revising The Poem

I am going to show you my revised version of the poem, with the parts I wrote myself bolded:

Elon Musk, a man of tech and innovation
Purchased a site, a platform and its reach
to share our thoughts and news with all the nation
but with power comes responsibility
some are wary of what he may achieve
and if this move is really what it needs

On one hand, he could inspire us to dream
of a platform driven by science, not by greed
If we would unite and solve our problems, it would seem
Like stars are in our grasp, if we believe
He’s shown us what’s possible, with hard work and wit
And now with Twitter he can Tweet and share it

But on the other hand, his works can incite
Anger and division, causing harm and schism
He’s known for making controversial remarks
And some worry that he’ll use this site to impart
Projections of his ego, misinformation
Leaving all of us to witness his frustrations

So we watch and we wait to see what he’ll do
even if he’s just owner, not CEO too
with this new acquisition, we’ll hope and we’ll pray
that he uses it wisely, not just for his play
there are many who blog, who look up to this man
as lead, as model, so they wait for his plan

Elon Musk, who called engineers in
to whiteboard a picture of the site that was his
Elon Musk, who cut half of his staff
and then, when some things failed, hired them back
Elon Musk, who tells all what he thinks
as the tweeters debate if it’s them that he’ll sink

Elon Musk, who reached for the stars
Who shot rockets to space, and also a car
Elon Musk, with his visions and dreams
but are visions divisions, is he all that he seems?
Said he’d open the algo, his vision he’d share
cut down on the services, called them bloatware
asked one guy at Netflix for total rewrite
leaked a series of files, then memed left and right

It’s a transparent website of system design
It’s a marvelous marvel that’s caught in a bind
It gave us a framework for caching our bytes
It gave us our Bootstrap (don’t tell Jason Knight)
Can a marvel of coding be terrible, too
Will they publish a textbook, written by Alex Xu?
Is it really a marvel, propped up as it read
Or is it just chaos, just strung on a thread?

Atop on this mountain
On a pedestal, man
closer we draw, with his vision in hand
is it genius, his genius across that we see
or is it just madness we want to believe?
history books will call all as it was
at present, I can’t tell
where they will put Musk

(TIL if you use the shortcut keys for “paste but preserve formatting,” Medium maintains your indentation on poetry)

Is that poem now in iambic pentameter? No, I just tried to add some rhythm. I also messed with the ABAB… rhyme scheme ChatGPT had employed, but I thought it was weird that the original poem never rhymed the last two lines.

Is that poetry? Probably not, and I don’t know if anyone will give me a poetry award for “marvelous marvel,” but listen to the sound. Two of those sounds are the same.

Closing Thoughts

I can’t get ChatGPT to write poetry that has rhythm, a customized topic, and a melancholy message about searching for meaning where there is none.

--

--

Evan SooHoo

I never use paywalls (anymore) because I would get stuck behind them.