FYI.

This story is over 5 years old.

Tech

Here's What Happens When You Ask a Neural Network to Write Presidential Speeches

Obama-RNN offers machine-generated inspiration.
Image: BeckyF/Flickr

A few weeks ago I wrote about the "anti-Turing Test," which was actually a recurrent neural network trained on the nonsense-lit masterpiece Finnegan's Wake. Turns out that same algorithm can do a pretty good Obama impersonation as well, as demonstrated in a recent experiment by artist and new-media storyteller Samim (just Samim, apparently).

Like the Finnegan's Wake project, the Obama RNN is based on some Lua code released recently by Stanford's Andrej Karpathy designed to implement character-by-character language learning. It's easy enough to get started with it: Karpathy has a project page with some pointers and more examples here and all that's really needed is the code itself and the text document to be used as a training set. (Though it can get much more involved.)

Advertisement

Samim basically did just that. First, he built a web-crawler in Python and had it gather all publicly available speeches, parsing the text and removing content from interviews and debates. All of this is fed to Karpathy's RNN model. The algorithmically-produced speeches are then generated using a small string of words as a seed or point of entry.

"In recent years, Barack Obama has emerged as one of the most memorable and effective political speakers on the world stage," Samim writes. "Messages like Hope and Yes we can have clearly left a mark on our collective consciousness. Since 2007, Obama's highly skilled speech writers have written over 4.3 megabytes or 730,895 words of text, not counting interviews and debates." Finnegan's Wake: 218,528 words.

A sampling of the RNN's output:

SEED: War on terror
Good everybody. Thank you very much. God bless the United States of America, and has already began with the world's gathering their health insurance. It's about hard-earned for our efforts that are not continued.

SEED: China
Thank you so much. Please, everybody, be seated. Thank you very much. You're very kind. Thank you.

SEED: Jobs
Good afternoon. God bless you. The United States will step up to the cost of a new challenges of the American people that will share the fact that we created the problem.

So, yeah. It's a mixed bag, but remember that this is based on character-by-character learning and not word-by-word or phrase-by-phrase.

But, does it mean anything? Eh, not really.

"One of the most hilarious patterns to emerge," Samim writes, "is that the Obama-RNN really loves to politely say: Good afternoon. Good day. God bless you. Good bless the United States of America. Thank you." He's also not quite done with the experiment.

"I did a test combining Obamas speeches with other famous speeches from the 20st century,including everything from Mother Theresa, Malcom X to Mussolini and Hitler," Samim says. "This gives us an rather insane amalgam of human thought, seen through the 'eyes' of a machine. A story for an other day."