Without Google’s artificial intelligence research team in Pittsburgh, Jeanette Harris never would have thought to put two teaspoons of cardamom into her chocolate chip cookie dough.

“I thought, ‘That’s too much,’ but it worked, so I stand corrected,” says Harris, who opened Gluten Free Goat Bakery in Garfield in February 2017, two years after starting her wholesale vegan, gluten- and soy-free operation.

Chef John Karbowski with Google’s teaching kitchen had asked Harris to take part in an experiment involving Google’s black-box optimization technology after she did a demonstration in vegan and gluten-free cooking for their employees.

The result of their teamwork is her “smart cookie,” made from brown rice flour, sorghum flour, flaxseed meal and 10 other ingredients — including the cardamom, a potent spice ground from seed pods of plants in the ginger family.

Google’s AI made testing and refining an incomplete recipe much easier, even though Harris baked about 60 batches —  more than the typical number when developing a recipe — with varying ingredients over a month’s time. They tried adding things such as Sichuan pepper (Chinese coriander), but not everyone could stomach some of the alternatives.

“To do it with fewer tests, you’d have to have strong prior biases about what constitutes a good cookie,” says Dan Golovin, a member of the Google research team. The AI technology enabled researchers to gain feedback on ingredients using numeric scores that determined how much people liked the cookie without delving into particulars such as chewiness, sweetness or saltiness.

“We didn’t want to rely on that,” Golovin says of allowing people to suggest variables. “The typical person is not going to be able to predict whether they like that cookie more or less very accurately.”

The “smart cookie” team: Jeanette Harris, John Karbowski and Google researchers Dan Golovin and Greg Kochanski.

Black-box optimization is the task of optimizing an objective function with a limited budget for evaluations. Google Vizier, the company’s internal service for performing black-box optimization, has become its de facto parameter-tuning engine. The technology developed in Pittsburgh has wide-ranging and more serious uses. NASA, for example, used it to identify a lightweight antenna for spacecraft that puts out a strong signal.

“The potential applications are enormous here,” says Golovin, whose goal now is to reduce the system’s cost so that small businesses such as Harris’ can utilize it.

Conceptually it’s not complicated, says Google software developer Greg Kochanski. Think of developing the optimal cookie as climbing a hill, he says. There are points along the hill — the various ingredients — at which you can rate the experiment until you reach the top of the hill, which represents the finished product.

If you think it might be easier just to test various cookie ingredients without AI input, consider the time involved. “Testing ingredients is great if you just have one or two ingredients,” says Kochanski. “But if you’ve got six or eight or 10 ingredients, it rapidly gets impractical to do the kind of exhaustive manual search you want to do (to determine quantities).”

The research team developed its AI tool for Google to use in-house, he says. A machine-learning system needs a learning rate — that is, how much attention it pays to a new example — and if the factors get too big, the system will become untrustworthy and chase “weird ideas,” he says. The goal is to find optimum parameters.

The chocolate chip cardamom cookie from Gluten Free Goat Bakery, developed with Google AI technology.

Harris says developing recipes can take up to four hours. She’s done only the one cookie recipe with Google AI, and already had several recipes developed when she started her bakery after being diagnosed with gluten sensitivity 12 years ago.

Gluten is a protein and binding agent in wheat, barley and rye that gives dough its elastic nature, helps it to rise and makes the resulting baked good chewy. The trick to gluten-free baking is to use several flours, Harris says; her favorite combination is brown rice and quinoa. To keep gluten-free baked goods from being too crumbly, add xanthan gum, potato flour or tapioca starch.

Harris’ bakery delivers to 15 shops around Pittsburgh and has grown in popularity for holiday orders. She’s planning a New Year’s Day brunch that will let people start 2018 with a healthy, plant-based meal. If you’re wondering about the name of her bakery, it’s simply that Harris is “obsessed with goats.”

“They’re spazzy and happy, and they make me happy,” she says. “Plus, I just like the alliteration of Gluten Free Goat.”

Gluten-Free Chocolate Chip and Cardamom Cookie Recipe

Ingredients

1/2 cup + 2 TBSP tapioca starch

1/2 cup brown rice flour

3/4 cup + 1.5 TBSP organic sugar

2 tsp cardamom

1.5 TBSP flaxseed meal

1/4 cup sorghum flour

1/4 cup raw sugar

1.5 tsp xanthan gum

1.5 tsp sea salt

1 tsp baking soda

1 cup chocolate chips

3/4 cup water

3/4 cup safflower oil

Directions

Combine all the dry ingredients except the chocolate chips in a bowl and mix well.

In another bowl, combine all the wet ingredients, and then add to the dry ingredients and mix enough to combine.

Add the chocolate chips and fold in until just mixed. Using a large spoon, drop on a parchment-lined sheet pan and bake at 350 degrees for about 12 minutes.