Machine Learning In The Kitchen Makes For Tasty Mashup Desserts

What did you do during lockdown? A whole lot of people turned to baking in between trips to the store to search for toilet paper and hand sanitizer. Many of them baked bread for some reason, but like us, [Sara Robinson] turned to sweeter stuff to get through it.

The first Cakie ever made. Image via Google Cloud

Her pandemic ponderings wandered into the realm of baking existentialist questions, like what separates baked goods from each other, categorically speaking? What is the science behind the crunchiness of cookies, the sponginess of cake, and the fluffiness of bread?

As a developer advocate for Google Cloud, [Sara] turned to machine learning to figure out why the cookie crumbles. She collected 33 recipes each of cookies, cake, and bread and built a TensorFlow model to analyze them, which resulted in a cookie/cake/bread lineage for each recipe in a set of percentages. Not only was the model able to accurately classify recipes by type, [Sara] was able to use the model to come up with a 50/50 cookie-cake hybrid recipe. The AI delivered a list of ingredients to which she added vanilla extract and chocolate chips for flavor. From there, she had to wing it and come up with her own baking directions for the Cakie.

From the Data Table to the Kitchen Table

In December 2020, [Sara] teamed up with [Dale Markowitz], an Applied AI Engineer for Google to build version 2.0 of the recipe predictor. They also came up with a cookie-bread hybrid recipe that they’re calling the Breakie.

This time, they made a bigger dataset by collecting about 600 recipes. In order to level the playing field, they whittled all the recipes down to 16 essential ingredients: yeast, flour, sugar, egg, fat (any type of oil), milk, baking soda, baking powder, apple cider vinegar, buttermilk, banana, pumpkin puree, avocado, water, butter, and salt.

Feature importance of the essential ingredients in baked goods. Image via Google Cloud

The point was to include ingredients that affect texture and consistency and leave out the ones that don’t, like cinnamon. They also converted everything to ounces and shuffled a few items around, mainly moving recipes like banana bread and pumpkin bread into the cake category (where they belong).

This time, the model had explainability baked in. Explainability in machine learning amounts to making models more interpretable, and understanding why they make the predictions they do. This is the meat and potatoes of finding out what delineates cookies from cakes from breads. [Sara] and [Dale] used Google’s AutoML Tables, which is a no-code machine learning tool that builds models based on tabular data. They fed in a CSV file and did the same thing as before — AutoML analyzed the ingredients of each recipe and judged them as cookies, cake, or bread based on the ingredients and their amounts.

One of the nifty things AutoML does is to compute ‘correlation with target’. Here, the target is whichever baked good they are trying to predict: cookie, cake, or bread. The biggest predictors of each category turned out to be the amounts of butter, sugar, yeast (if any), and egg. To this amateur baker, these results are interesting but not totally unexpected — the more eggs a recipe has, the more likely it is to be cake. And have you ever made cookies or cake with yeast? It’s not completely unheard of, but it’s not really the norm for those, either.

Baking for Science: the Cakie

I was so intrigued by these AI-created dessert mashups that I had to try them. I fired up the oven in the Hackaday test kitchen and got to baking. For the first experiment, I decided to make the cake-cookie hybrid recipe, because it sounded slightly more delicious than ‘bread-inspired cookies’.

The dessert you didn’t know you needed — a perfect cross between chocolate chip cookies and cake. Image via Food & Wine

I followed the recipe as closely as possible and used room temperature butter. After doing some research, I decided to leave the egg out on the counter as well. My research indicated that the butter should be about 65 °F (18.33 °C), and it took around four hours for the butter to warm up to usable temperature.

One thing I did change was the pan. Who has a 6″ cake pan, anyway? Not me. I couldn’t even find a foil version at the grocery store, so I used a single 9″ round non-stick cake pan instead, and greased it as indicated. I thought 25 minutes sounded a bit too long, so I started with 20 minutes and then added two minutes when my toothpick didn’t come out clean. That turned out to be pretty spot on, so if you’re going to make these (and you definitely should), go for about 22 minutes in a 9″ round pan. Trust the toothpick test.

Once the cakie had been out of the oven for about ten minutes, I dug in. As you can see, it crumbles like a cookie and has a flaky top layer that is ever-so-slightly grainy from the sugars. I think it tastes amazing and my husband agrees. It tastes like an exact cross between cookie and cake, and somehow manages to have the mouthfeel of both. When I went back later for more, it held together much better.

Them’s the Breakies

“Bread-inspired cookies” is better than it may sound. Image via Google Cloud

The next day, I made the breakies. Following the previous day’s success, I put my butter and egg out on the counter at 9:00 AM and I started baking around 1:15 PM.

There’s a little more to this recipe, which is clearly divided into ‘the bread part’ and ‘the cookie part’ as you can see in the directions. Although if you think about it, chocolate chip cookies are made the same way — you combine the dry ingredients in a separate bowl and gradually add it to a creamed mixture of butter, brown sugar, white sugar, eggs, and vanilla. The breakies come together much the same way, though the dough ended up quite thick — much more bread-like than cookie-like.

[Sara] and her breakies. See how poofy they are? Image via Google Cloud
I said it to myself going in, and I stand by it after eating these breakies– yeast does not belong in cookies. There’s a reason cookies use baking soda to rise instead, like a quick bread. It’s not that I can taste the yeast in them, but I think it definitely affects the texture.

All of that said, the breakies taste pretty good. They have the mouthfeel of an oatmeal raisin or a sugar cookie — very textured. I found the yeast difficult to dissolve in in the prescribed amount of milk, and that’s likely why mine didn’t rise as impressively as [Sara]’s. It also may have something to do with the milk I used, which has lactase enzyme added to it for the lactose-intolerant. Or maybe I didn’t heat it up enough in the microwave.

Much like the cakie, the warm breakies sort of fell apart, but cooled breakies stay together much better. I had one fresh out the oven (as you do), and I think I prefer them cooled. Now, they have a sort of crisp outer shell to bite into.

All in all, I would say this experiment was a success. I think that ultimately we can and should trust AI to give us tasty mashup desserts, if nothing else. I for one would be interested in experimenting even further by throwing pie recipes in the mix. Pudding cookies are delicious, so why not pie cookies?

21 thoughts on “Machine Learning In The Kitchen Makes For Tasty Mashup Desserts

  1. Did the machine-learning algorithm allow for the off-by-one error in the naming of baked goods as you cross the Atlantic?
    Particularly obvious with muffins and biscuits.
    And I don’t think the US even has crumpets (which must be a real trial for them)

      1. Yes, but they are probably really pikelets or shortbread or something :-)

        Round things with holes almost (but not quite) all the way through for the Marmite to soak down in to?

        1. They are mostly crumpet shaped, but more rubbery, and instead of becoming crisp when toasted, and fluffy isn’t the word, but more delicate in the middle, they form a hard shell over rubbery middle. It’s the flour I think, too much gluten.

        2. We (Americans) don’t call them crumpets, we call them English Muffins. During the 1800s in US every small round cake and bread was muffin. It’s a hold over, the term Crumpet also implies snootiness. Usually use it in a mocking form. So no one wants to buy a snooty crumpet when they can buy a common english muffin.

          Really interesting use of tensorflow. When bake experimentally it usually ends up being like Edison. I just toss stuff if it isn’t just right. But how much is a sack of flower anyway? But the real cost is time. So baking two or four recipes at once and weeding the trash out is the way to go, for me.

          1. (English) Muffins and crumpets are completely different things. They are generally the same shape and size, but the texture, recipe and appearance are very different.

            So, maybe I was right that you don’t have them, if you think that muffins are equivalent.

            Crumpet: Very porous, butter soaks in deliciously:
            Muffin: Nice too, but in a different way:

            Muffins are a type of bread, crumpets are closer to pancakes.

    1. Crumpets are rather tough to find here, although it’s possible if you look hard enough. But it appears to be easier to find English muffins on our side of the Atlantic from what I’ve seen.

  2. > I found the yeast difficult to dissolve in in the prescribed amount of milk, and that’s likely why mine didn’t rise as impressively as [Sarah]’s.

    But if you use yeast, you should let the cookie dough rise before putting them in the oven. At least 15 minutes, I would bet. Maybe even 30 minutes. Just like bread.

    If you put the dough into the oven with letting it rise first, well, I think the heat will quickly kill (part of the) the yeast and the dough will not rise. Or at least, not much.

    Yeast can’t survive heat higher than 60 C (140 F). I am surprised your cookies actually did rise a bit in the oven. But I expect that the yeast in the center of the dough had a little longer to live than the yeast on the outside, and did manage to fart enough CO2 ;) to rise the cookies a little.

    I think that part is missing from the recipe.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.