There’s something irresistible about light and fluffy cupcakes! While at first glance these tasty desserts may seem simple, bakers know that achieving the perfect recipe requires tedious testing.
In the past, I’ve struggled to master the leavening process. Cupcakes require air bubbles inside the batter to create a light and spongy texture. It’s usually accomplished through two methods: using baking powder and mixing the eggs and sugar.
Research question: What is the ideal mixing time (of eggs and sugar) and optimal amount of baking powder needed to achieve maximum cupcake rise without compromising its lightweight quality?
Why use Bayesian optimization for baking?
The primary reason to use it is because baking batches of cupcakes is time-consuming! Since Bayesian optimization uses active and adaptive learning, it can potentially reduce unnecessary testing. Also, cupcakes are responsive to small changes. Traditional experimental designs may “overlook” the targeted optimum region.
Responses/goals
- Maximize Height (cm): between 2-6 cm
- Minimize Weight (oz): between 0.5-3 oz
Factors
- Mix Time (min) for eggs and sugar: restricted between 1-10 minutes
- Baking Powder (oz): restricted between 0.01-0.15 oz
The recipe for this study was converted to ounces for the use of a standard kitchen scale. All ingredients except for baking powder were held constant.
The recipe
Eggs
|
0.9 oz
|
Butter
|
1 oz
|
Milk
|
2.25 oz
|
Flour
|
2.25 oz
|
Baking powder
|
VARIES (0.08 oz)
|
Salt
|
0.02 oz
|
Sugar
|
1.5 oz
|
Procedure
Mix eggs and sugar with a handheld mixer for a specified time as determined by the Bayesian Optimization platform in JMP Pro. Next, combine melted butter, milk, and dry ingredients with the eggs and sugar. Mix small amounts of the dry ingredients into the wet mixture, incorporating no longer than 30 seconds.
Add 2 oz of batter to a cupcake wrapper and place in a baking tray. Bake the cupcake at 350°F for 25 minutes.
Remove cupcake from the baking tray and measure height (in cm) using a standard ruler. Measure weight in ounces using the kitchen scale (wrapper included).
Record results and begin next trial.
Findings
Using two initial trials as historical data, six iterations of Bayesian optimization were required to reach an optimal mix time and baking powder amount. See the data table below:

The best iterations from Bayesian optimization: mixing eggs and sugar for nine minutes, paired with 0.12 ounces of baking powder. Experimental runs with these amounts yielded the tall cupcakes with a reduced weight.
The winner (with icing)!
Cupcakes from experimental runs. Notice the height differences, which are between 0.8-1.5 cm.
Conclusions
Despite inevitable measurement quirks in the baking process, the final cupcakes produced by Bayesian optimization were quite tasty. The cupcakes were tall and airy, perfect for a birthday party!
Overall, this baking session was a “sweet” success as goals of maximizing cupcake height and minimizing weight were satisfied. This simple example is one of the countless applications of Bayesian optimization in JMP Pro.