Stanislaw Lem, Poetry & AI in 2022

One of my favorite books is a whimsical collection of stories by Stanislaw Lem called “The Cyberiad: Fables for the Cybernetic Age”.

One of the stories, called “Trurl’s Electronic Bard” concerns a computer that is created to write poetry. It is given more and more difficult prompts until finally it is given a seemingly impossible task, that it completes with ease.

In building the Electronic Bard, Trurl (one of two inventors who try to out-do each other in the stories) realizes it will be quite a task to create a machine poet.

First Trurl collected eight hundred and twenty tons of books on cybernetics and twelve thousand tons of the finest poetry, then sat down to read it all. Whenever he felt he just couldn’t take another chart or equation, he would switch over to verse, and vice versa. After a while it became clear to him that the construction of the machine itself was child’s play in comparison with the writing of the program. The program found in the head of an average poet, after all, was written by the poet’s civilization, and that civilization was in turn programmed by the civilization that preceded it, and so on to the very Dawn of Time, when those bits of information that concerned the poet-to-be were still swirling about in the primordial chaos of the cosmic deep. Hence in order to program a poetry machine, one would first have to repeat the entire Universe from the beginning or at least a good piece of it.

Kind of the “to create an apple pie from scratch, first one has to create the universe” quote from Carl Sagan. Now, in the story, Trurl basically does just that, building a model of the universe, then planets, then evolving digital life until he gets a poet, which he then has to tweak so it’s not too morose.

But in actuality, this is not *too* far from how AI researchers ended up creating the latest and greatest AIs – basically, it started as an autocomplete algorithm that would try to predict the next word in a sentence. This algorithm was improved until it got to the point where it could autocomplete a whole article from a short description.

The source material? Basically, as much of the internet as researchers could reasonably cram into the neural net processor. To process essentially all of human civilization, the computer takes apart each section and looks at how they connect together, and stores that connection information in a growing web or “neural network” – a functional distillation of the information. The original information isn’t in there per se, but how it was connected together is.

Boiling all of civilization down into a relatively small file is incredibly computationally complex, and would take you hundreds or even thousands of years. Fortunately, the companies building these models have access to a lot of computers, so running on a large array of powerful computers, these massive datasets can be boiled down in six months or a year.

So, now that we have essentially replicated Trurl’s Electronic Bard, let’s put it to the test. I’ll be using OpenAI’s GPT3 engine, running their DaVinci model. I’ll feed it the same prompts as Trurl, and see how our AI results stack up to the fictional AI from 1965 (or more accurately, the masterful English translation by Michael Kandel in 1974, the year I was born).

Trurl’s friend/competitor Klapaucius presents the increasingly difficult challenges to try to stump the electronic bard. Only two are presented in their entirety in the story, so we will use those two to test current AI vs. fictional AI.

The First Challenge

“Have it compose a poem—a poem about a haircut! But lofty, noble, tragic, timeless, full of love, treachery, retribution, quiet heroism in the face of certain doom! Six lines, cleverly rhymed, and every word beginning with the letter s!!”

Here are the resulting poems, first Trurl’s Electronic Bard:

Seduced, shaggy Samson snored.
She scissored short. Sorely shorn,
Soon shackled slave, Samson sighed,
Silently scheming,
Sightlessly seeking
Some savage, spectacular suicide.

And here is OpenAI’s GPT3 DaVinci model:

Somber strands of sorrowful strands
Shed by the scissor’s solemn slice;
Sharp sorrow soon shall sever these
Scintillating, shiny sighs.
Still some solace found in shearing
Sacredly shaved sacrifice.

GPT3 comes close – but didn’t quite manage to only use words starting with S, and Lem uses mythic references that make it the winner.

The Second Challenge

“Very well. Let’s have a love poem, lyrical, pastoral, and expressed in the language of pure mathematics. Tensor algebra mainly, with a little topology and higher calculus, if need be. But with feeling, you understand, and in the cybernetic spirit.”

Trurl’s Electronic Bard:

Come, let us hasten to a higher plane,
Where dyads tread the fairy fields of Venn,
Their indices bedecked from one to n,
Commingled in an endless Markov chain!

Come, every frustum longs to be a cone,
And every vector dreams of matrices.
Hark to the gentle gradient of the breeze:
It whispers of a more ergodic zone.

In Riemann, Hilbert or in Banach space
Let superscripts and subscripts go their ways.
Our asymptotes no longer out of phase,
We shall encounter, counting, face to face.

I’ll grant thee random access to my heart,
Thou’lt tell me all the constants of thy love;
And so we two shall all love’s lemmas prove,
And in our bound partition never part.

For what did Cauchy know, or Christoffel,
Or Fourier, or any Boole or Euler,
Wielding their compasses, their pens and rulers,
Of thy supernal sinusoidal spell?

Cancel me not—for what then shall remain?
Abscissas, some mantissas, modules, modes,
A root or two, a torus and a node:
The inverse of my verse, a null domain.

Ellipse of bliss, converge, O lips divine!
The product of our scalars is defined!
Cyberiad draws nigh, and the skew mind
Cuts capers like a happy haversine.

I see the eigenvalue in thine eye,
I hear the tender tensor in thy sigh.
Bernoulli would have been content to die,
Had he but known such a2 cos 2 ø!

OpenAI GPT3 DaVinci:

For my love, my only true one,
I need no other, the love of my life.
My heart is a vector of love,
It points to you forever,
A scalar of magnitude that can never be done.

The dimensions of our love cannot be measured,
The polytopes of our universe, infinite and treasured.
An algebra of love such as this
Cannot be expressed in any other way
Than by the language of mathematics.

The manifolds of our relationship
Express the functions of our love
The topology of our togetherness
Larger than infinity, and ever more above.

The cybernetic spirit of our love
Will never cease to be,
For it is a love that transcends
The boundaries of time and space,
An eternal and boundless love,
We will never be apart,
For our love is a calculus of infinity,
In the language of mathematics.

What do you think? Lem and Kandel have the edge for cleverness, and are the clear winner, but the actual AI was able to construct a reasonable result.

It should also be noted that I was using OpenAI’s website for this, so the generation was not free. They charge per block, essentially by the word. These two poems (plus an accidental third where I mistyped the prompt) cost $0.0075 – almost a penny.