GCP – How sweet it is: Using Cloud AI to whip up new treats with Mars Maltesers
Google Cloud AI is baked into our work with customers all over the world. We’ve partnered with organizations to use AI to make new predictions, automate business processes, forecast flooding and even combat climate change and chronic diseases. And sometimes, we even get to help our customers use AI to invent new things—tasty new things.
When legendary confectionery manufacturer Mars, Inc. approached us for a Maltesers + AI kitchen collaboration, we couldn’t resist. Maltesers are a popular British candy made by Mars. They have an airy malted milk center with a delicious chocolate coating. We saw this opportunity as a way to partner with a storied and innovative company like Mars and also a chance to showcase the magic that can happen when AI and humans work together.
Good AI, or good design for that matter, happens when human designers consider the capabilities of humans and technology, and strike the delicate balance between the two. In our case, our AI pastry chef offered a helpful assist to its creator—our very own amateur baker and ML engineer extraordinaire, Sara Robinson!
Hunkered down in 2020, Sara and millions of others started baking. And, like a good dough, that trend continues to rise. According to Google Search Trends, in 2021 baking was searched 44% more compared to the same time last year. Sara hopped on the home baking trend to investigate the relationship between AI and baking.
AI + Google Search trends create a quirky dessert
This time around, Sara trained a new ML model to generate recipes for cookies, cakes, scones, traybakes, and any hy-bread of these. Armed with a dataset of tried-and-true recipes, Sara set out to the kitchen to find ways to infuse her own creativity and Mars’ Maltesers into the model’s creation.
After hours of model training and baking experiments, Sara cleverly combined chopped and whole Maltesers with her model’s AI-optimized cake and cookie recipes to create a brand new dessert.
But the team didn’t want to stop there. Our recipe needed a creative twist to top it off. We searched for something savory, creamy, and UK-inspired that we could use to balance the sweet, crunchy Maltesers. Enter, Marmite-infused buttercream!
With some help from Google Search Trends, we discovered that one of the top searched questions recently regarding “sweet and salty” was “Is Marmite sweet or savory?” A popular savory spread in the UK, we decided to incorporate Marmite into our recipe. Sara headed back into the kitchen and whipped up a Marmite-infused buttercream topping. Yum!
So, how exactly did Sara build the model? She started by thinking more deeply about baking as an exact science.
Building a sweet model with TensorFlow and Cloud AI
Our goal for the project was to build a model that could provide the foundation for us to create a new recipe featuring Maltesers and Marmite. To develop a model that could produce a recipe, Sara wondered: what if the model took a type of baked good as input, and produced the amounts of the different ingredients needed to bake it?
Since Maltesers are primarily sold in the UK, we wanted the recipe to use ingredients common to British baking, like self-raising flour, caster sugar, and golden syrup. To account for this, Sara used a dataset of British recipes to create the model. The dataset consisted of four categories of popular British baked goods: biscuits (that’s cookies if you’re reading this in the US), cakes, scones, and traybakes. To create a cake recipe, for example, the model inputs and outputs would look like the following:
Sara looked to Google Cloud for the tooling to build this model, starting with Cloud AI Platform Notebooks for feature engineering and model development. Working in AI Platform Notebooks helped her identify areas where data preprocessing was needed. After visualizing the data and generating statistics on it, she realized she’d need to scale the model inputs so that all ingredient amounts fell within a standard range.
With data preprocessing complete, it was time to feed the data to a model. To build the model, Sara used TensorFlow’s Keras API. Rather than using trial and error to determine the optimal model architecture, she made use of AI Platform Hyperparameter Tuning, a service for running multiple training job trials to optimize a model’s hyperparameters. Once she found the ideal combination of hyperparameters, she deployed the model using AI Platform Prediction.
AI and human creativity: better together
The deployed model returns a list of ingredient amounts. If you’ve ever baked something, you know that this is far from a finished recipe. To complete the recipe, we needed to turn ingredient amounts into recipe steps, and find a creative way to incorporate both Maltesers and Marmite.
Our model was pretty good at predicting recipes for each of the distinct baked goods, but, thanks to the magic of its architecture, could also generate hybrids! The model’s best recipes were for biscuits and cake, which sparked the idea: what would happen if you combine two ML-generated recipes into a single dessert? The end result was a ML-generated cake batter sitting atop an ML-generated cookie.
We wanted the recipe to feature Mars’ Maltesers, and since the model outputs only included basic baking ingredients, deciding how to add Maltesers to the cake and biscuit recipes was up to us. Maltesers are delicious and versatile, so we decided to incorporate them in a few different ways. We chopped and incorporated them into the batter, and three whole Maltesers are hidden between the cake and biscuit:
Finally, to top off the dessert, Sara wanted to find a tasty way to include the salty addition of Marmite. After a few trials, she landed on a frosting combination that paired Marmite with a buttercream base and golden syrup (a popular ingredient in the UK). The final product features this sweet and salty frosting, made even better with extra Maltesers for garnish:
Digital experimentation is encouraged and embraced at Mars. “The ease and speed of bringing this idea to life has already sparked multiple ideas around the endless possibilities of how AI can bring innovation to the kitchen by creating a foundation for recipe development,” said Sam Chang, Global Head of Data Science & Advanced Analytics at Mars Wrigley. “We have long looked for ways to connect consumers with their favourite brands. By collaborating with the Cloud AI team, we discovered new avenues to inspire more creative cooking moments at home,” said Christine Cruz-Clarke, Marketing Director at Mars Wrigley UK.
Want to start baking?
The only thing left to do is bake! If you want to make Maltesers® AI Cakes (4d6172730a) at home, the recipe is below. And if making cake dough, cookie dough, and frosting sounds like a daunting task, you can make and enjoy any of these three components on their own (even the frosting, we won’t judge). When you make this, we’d love to see your creations. Share photos on Twitter or Instagram using the hashtag #BakeAgainstTheMachine.
Read More for the details.