The Nightmare Machine

Over at the Massachusetts Institute of Technology, something very creepy is underfoot. A new project has demonstrated how artificial intelligence can generate horror images.  A type of deep learning, computer AI develops images that it believes to be the scariest around. The algorithms are called the ‘Nightmare Machine’ and the computer is taught which images are scary and which aren’t. The idea is to test to see if computers are capable of scaring humans.


From the Taj Mahal looking like a haunted house to a blood stained Tower Bridge, there’s some pretty scary stuff on show just in time for Halloween! We got in touch with Pinar Yanardag, a researcher in the Media Lab’s Scalable Cooperation Group and two of her colleagues, to find out more on these harrowing images and how it all works.


Why has MIT undertaken this project? What’s its purpose?


Over the past two years, we’ve seen a rising number of intellectuals and luminaries raising alarms about the potential threat of superintelligent AI on humanity. Pioneer and inventor Elon Musk famously said that as we develop AI, we are “summoning the demon”. Physicist Stephen Hawking recently stated that “the rise of powerful AI will be either the best, or the worst thing, ever to happen to humanity. We do not yet know which.”


We know that AI terrifies us in the abstract sense. But can AI scare us in the immediate, visceral sense? Scholars have long commented on the phenomenon of the uncanny valley, which describes how people feel a sense of eeriness and revulsion at robots that appear almost, but not exactly, like real human beings. But can AI elicit more powerful visceral reactions more akin to what we see in a horror movie? That is, can AI creatively imagine things that we find terrifying?


Following the tradition of MIT Hacks, we wanted to playfully commemorate humanity’s fear of AI, which is a growing theme in popular culture. We found it appropriate to explore how machines, themselves, can generate the scary content.  So we launched the Nightmare Machine, a Website that showcases horror imagery created by cutting-edge Artificial Intelligence.

The Nightmare Machine

How are these frightening images created? How is it related to algorithms and AI?

Pinar: To generate faces, we used a landmark study, “Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks”, or DCGAN for short. This algorithm is an instance of a class of algorithms called Generative Adversarial Networks (GANs). These algorithms work under a very simple principle: a “generator” component that learns to -so to speak- synthesize samples that resemble faces as best as possible, and a “ discriminator” component that learns to distinguish between real faces from the dataset we provide and the samples “faked” by the generator. In other words, you can think of generator as a shop of counterfeit products, and discriminator as a police that tries to detect the counterfeits. The faces we showcase on the Nightmare Machine are actually “fake” faces “generated” by the generator function, none of these faces are from the original dataset!

In order to “scarify” the generated faces, we further utilized another landmark work, ‘A Neural Algorithm of Artistic Style‘, which learns the artistic style of a given image, and transfers this style onto another picture. In this case, we used this framework to extract the style from an arbitrary zombie picture, and applied this “zombie style” onto the generated faces. Even though there is a lot of room for improvement, some of the resulted faces already look remarkably creepy!

Manuel: Also we noticed something very interesting that we are still trying to understand. When we train our neural network on places, say a haunted house, and apply it to a person or group of people, the result is equally haunting! Of course these are just preliminary experiments but it makes one wonder whether fear, be it a haunted building or a frightening face, all come from the same mental place!

The Nightmare Machine

The Nightmare Machine

What other amazing images can be created using this technique?

Manuel: We have so far collected over 400,000 individual evaluations of our fully computer-generated images. Initial tallies reveal that humans quickly converge on finding some of them very scary, and others not so much. In the future, we might be able to use this dataset to further “scarify” our generation process and maybe come up with the scariest image human kind has ever seen!


Pinar: Interesting to note, these faces make no difference for a computer, they are equally creepy. So that reveals that there is extra information in how human perceive horror that can be exploited to make even scarier faces as you suggest, or even personalized horror images were we to tailor the generation process to the individual data.


Iyad: Our research group’s main goal is to understand the barriers between human and machine cooperation. Psychological perceptions of what makes humans tick and what make machines tick are important barrier for such cooperation to emerge. This project tries to shed some light on that front, of course in a goofy hackerish Halloween manner!


The Nightmare Machine The Nightmare Machine

Discover more amazing science in the latest issue of How It Works. It’s available from all good retailers, or you can order it online from the ImagineShop. If you have a tablet or smartphone, you can also download the digital version onto your iOS or Android device. To make sure you never miss an issue of How It Works, make sure you subscribe today!

You might also like:

Top 5 Facts: Halloween

Victorian seances: The ingenious tricks used to ‘speak to the dead’

Halloween History: The spellbinding tale of Essex’s ‘Witchfinder General’strong>