Don’t let a neural net mix drinks.

So I’ve used neural networks to generate recipes in the past. They’re computer programs that can learn to imitate the data we give them, copying the way that humans drive cars, label images, or translate languages.

That is, they try to learn. They’re called “neural” because they have virtual neurons that work a little like the real neurons in our brains. Their virtual brains, however, are really tiny. Where a human has about 86 billion neurons, the neural networks we use today have hundreds to low thousands - think nematode worm or, optimistically, jellyfish. So they often struggle, and recipes, my friends, are one of those times. (you haven’t lived until you’ve seen a neural net’s attempt at “small sandwiches”)

I turned to cocktails, inspired by Beth Skwarecki’s cocktails bot (and helped immensely by the dataset she sent me).

The neural net’s first attempt was… an attempt.

I let it train for a little longer, and things got a little more recognizable, as it learned to kinda spell more ingredients.

It had, however, not learned when to quit. 64-ounce (2 liter) cocktails are not unheard of at this stage.

It continued to learn on its own, all without input from me, and eventually ended up with cocktails that were almost plausible.

Some of my other training attempts, however, did not go so well. At first the cocktail titles in my training set were in all caps, which confused the heck out of the neural net because capital letters were so rare that it didn’t see enough examples of what to do with them. It struggled with the titles.

You may also notice that the ill-fated all-caps attempt had a lot of repetition - that’s because I was using textgenrnn, which has a somewhat limited memory. It could learn to spell ingredients, but had no idea whether it had already added sugar and cream. When I switched to char-rnn for the lowercase recipes above, I could give it a memory of 50 characters, enough to cut down on repetition. The textgenrnn version, however, became strangely obsessed with creme de cacao. The less said about its cocktails, the better.

For more neural net cocktails (including custom-generated cocktails for any name you care to provide), check out Beth’s cocktails bot!

For a few more of the cocktails I generated (including some very unfortunately-named ones), you can become an AI Weirdness supporter to get bonus content. Or become a free subscriber to get new AI Weirdness posts in your inbox!

Subscribe now