We asked a neural network to bake us a cake. The results were...interesting.

It, uh, had blood in it?

recipe card
Just add a dash of data.eboy

When computers try to imitate humans, they often get confused. But simulated brain cells in so-called neural networks can mimic our problem-solving skills. An AI will look at a dataset, figure out its governing rules, and use those instructions to make something new. We already employ these bots to recognize faces, drive cars, and caption images for the blind. But can a computer cook? I fed a neural network thousands of recipes and asked it to whip up something of its own. It spat out an...interesting dish.

1. Amnesiac AI

To keep processing fast, the network recalls only 65 characters at a time. It adds cocoa just before it would otherwise forget we're making "chocolate." Hopefully it forgets that black puddings usually feature blood.

2. Word salad

Title, category, ingredients, directions. It gets this format every time because of consistency across all the recipes we pulled from. But my AI hasn’t seen as many examples of how to use rare ingredients like sesame.

3. Date holy

Sounds like frosting! We’re staying in dessert territory. But what’s with the name? Capital letters are tough; they’re treated as unrelated to lowercase. A neural net has to learn these from scratch with few examples.

4. Sweet defeat

The ingredient list has already passed out of memory. Chocolate is just a lucky guess pulled from your average cookbook. "Until golden brown" could mean sweet or savory, and ambiguity confuses the network. Garlic? Game over.

5. Feedback

The confused network is spitting out random words—creating more confusion, leading to more random words. But it remembered to close its parenthesis. There’s probably a neuron solely devoted to parentheses.

6. Yum?

Words like “frost” or “serve” can cue a ­network to finish; many recipes in our dataset end this way. Ours just happened to give up—it could have kept going forever. We were making cake, right? Let’s say it’s cake.

The data

Internet recipes: 24,044
Number of recipes that begin with "chocolate": 647
Training time on a 2010 Macbook Pro: Two days
Number of recipes containing blood: 8

This article was originally published in the Spring 2018 Intelligence issue of Popular Science.