Computers are constantly getting smarter. But can they ever be creative? A team of IBM researchers believes so. They’ve built a program that uses math, chemistry, and vast quantities of data to churn out new and unusual recipes.
To build their algorithm, the researchers modeled the steps that we might go through to develop creative ideas. First, you need to understand the problem that you’re trying to solve. Then, build expertise by learning everything you can about the problem. With this knowledge under your belt, generate a bunch of new ideas, and maybe even combine different types of ideas. Then pick the most creative ideas from the lot. Finally, implement your idea. While computers have executed many of these steps before, the key insight of the IBM group was to find a way to quantitatively gauge the creativity of a recipe, and to put all the different pieces together.
“I have dishes from the system all the time”, says Lav Varshney, who led IBM’s team to develop this novel recipe generation engine. “Some of the recipes that we created ourselves like the Kenyan Brussels sprout gratin, the Caymanian plantain dessert, and the Swiss-Thai asparagus quiche are very good. Others that we did jointly with our partners, the Institute of Culinary Education, like the Spanish almond crescent and the Ecuadorian strawberry dessert are world-class.”
So let’s see how IBM’s computational chef gets creative.
Step 1: Define the problem
When you start the program, you’re asked to pick a key ingredient, choose some regional cuisines you’d like to explore, and decide what type of dish you’re interested in (a soup, a quiche, etc.).
Step 2: Learn everything you can about the problem
This is where all that data comes in. The researchers used natural language processing algorithms to scan and parse the text of millions of different recipes. Using this data, they convert a written recipe into a web of relationships, including the quantities of different ingredients and the processes that transform these ingredients into food. They also scanned Wikipedia to learn which ingredients are commonly used in various regional cuisines. They went through handbooks of flavor ingredients to learn which molecules are present in different food ingredients, and also included information about the chemical structures of these molecules. They also included data on how humans rate the ‘pleasantness’ of 70 different chemical compounds.
In the end, the researchers had amassed a vast computer-readable body of knowledge about human flavor preferences, regional recipes, and about the chemistry behind these recipes.
Now the program is ready to start cooking.
Step 3: Generate ideas to solve the problem
Starting with the traditional recipes of a certain cuisine, the software generates millions of new recipe ideas that match the user’s preferences. They don’t just throw out these recipes at random. The recipes that are generated respect an empirical rule-of-thumb called the food pairing principle. This says that ingredients that pair well together in a recipe share common flavor molecules. (You can read more about food pairing in this great summary by Wired’s Sam Arbesman.)
The new recipes are generated by ‘mutating’ the ingredients of existing recipes, and then fusing these with other recipes, resulting in all sorts of new hybrid concoctions. (This idea, known as a genetic algorithm, is modeled after the process of genetic change.)
As the comic suggests, it’s somewhat unfeasible to find friends willing to try out a million bizarre new recipe ideas (deep-fried skittles, anyone?) So, instead, the program automates the process. This is the really clever bit.
Step 4: Select the best ideas
According to Varshney, “Many previous attempts at computational creativity have been good at the generative part of creativity but not at the selective part of creativity. I think our major contribution has been to show how [..] big data models can be useful not just for creating a billion ideas but for pointing out, say, the ten best ideas.”
So how does a computer decide which ideas are the most creative? The first thing you need is an operational definition of creativity. Ken Robinson defines creativity as “the process of having original ideas that have value.” The IBM researchers adopt a similar metric. According to them, a creative idea should be novel, and should be high-quality.
Let’s take on novelty first. You’d probably agree that peanut butter and jelly can go together. And you probably also think it’s ok to put mustard on a hotdog. That’s because you have a set of beliefs about the likelihood of various recipes. These beliefs are based on what you think tastes good, but they’re also strongly influenced by the foods that you’ve been exposed to.
But you might never have thought to put peanut butter on a hot dog. This recipe clashes with your beliefs about food, and this is what makes it surprising. In contrast, a hotdog with mustard has absolutely no effect on your beliefs about recipes. It’s a totally boring recipe.
This IBM scientists used a very similar idea – they measured the novelty of a recipe by quantifying how much it alters one’s existing recipe worldview. They accomplished this with a mathematical tool known as Bayesian surprisal. (This tool has previously been used to identify what parts of a video people tend to pay most attention to.) Here’s how Varshney explained the concept to me. “Bayesian surprise basically compares prior beliefs about food with new beliefs after the introduction of the newly created recipe; the greater the change in beliefs, the greater the surprise.”
Now, consider quality. Taste is a complex thing. Our tongue teases apart the basic tastes: sweet, salty, sour, bitter, and umami. But there’s so much more to our experience of food: whether the food is warm, creamy, gooey, chunky, slimy, the way it sits on your tongue, the way it crunches when you bite into it, how hungry you are, the memories that you associate a taste with, and so on.
The researchers argue that in spite of all this, they key to taste is really smell. “Work in neurogastronomy argues quite strongly that [smell] is the central contributor [to flavor perception]”, says Varshney. If that sounds counter-intuitive, think about how bland your food tastes when you have a bad cold — your taste receptors are working fine, but you can’t smell a thing.
But how does the program know how a dish smells? It all comes down to chemistry. The software goes through all the different flavor molecules in a recipe and looks up their chemical properties – these include technical terms like “topological polar surface area, heavy atom count, complexity, rotatable bond count, and hydrogen bond acceptor count.” By comparing these chemical properties to that of 70 other odor molecules, the researchers can predict how ‘pleasant’ a particular molecule will smell. They then mix the scents of different molecules together on the computer, and arrive at an overall ‘pleasantness’ of smell of each dish. Think about how surprising this is for a moment — they’re predicting how pleasant a dish will smell using the chemistry of the flavor molecules inside the it!
I asked Varshney about this startling finding, and he responded, “I also find it surprising that it is possible to predict a hedonic percept like pleasantness from molecular properties like the number of heavy atoms, but there is much emerging work in hedonic psychophysics that shows exactly this. Going forward, we hope to incorporate finer aspects of human flavor perception into our models.”
Step 5: Implement your idea
Finally, the software generates a list of recipes ranked using three categories: surprise, pleasantness of odor, and flavor pairings.
Now it’s finally time to leave your laptop and head to the kitchen.
As for Lav Varshney, he isn’t done exploring what the system has to offer. He says, “I was in Berlin this past weekend and we partnered with a chef there to do a full banquet which turned out really well. I particularly liked a grilled tomato on a saffron crouton, and a quark crème caramel with cranberry and caraway ice cream.”
In the near future, you might even see computer generated food in a store near you. Varshney adds, “We have been having discussions now with several large food manufacturing companies, food services companies, and flavor/fragrance houses about this technology.”
A Big Data Approach to Computational Creativity. Lav R. Varshney, Florian Pinel, Kush R. Varshney, Debarun Bhattacharjya, Angela Schoergendorfer, Yi-Min Chee.
Flavor networks and the principles of food pairing. Yong-Yeol Ahn, Sebastian E. Ahnert, James P. Bagrow, Albert-László Barabási.
Are There Fundamental Laws of Cooking? By Wired’s Sam Arbesman.
Want to use food pairing principles to invent new recipes at home? Try this handy website.