How To (Figure Out How To) Make the Perfect Espresso Shot

IMG_4929I recently moved into a new place, temporarily, before heading out to grad school. Well actually I’m just crashing at this place, I haven’t technically moved in, but I have all my stuff, so… anyways I’m living with my old friend Max, and he has a new toy – a fancy espresso machine. A couple days ago he showed me how to “pull a shot,” and I was launched into the extreme world of espresso-shot-making. That afternoon we watched a few youtube videos (i.e.) and I started to understand the seriousness and depth of this world. With the sidebar full of related videos proclaiming to depict the perfect shot pulling technique or the perfect way to prepare and pack the grounds, we watched experts show the world how to use these shiny machines and how to pour steamed milk into a latte to make symmetric, slowly dissipating patterns.

Max explained his technique to me like a senior scientist talking to an undergraduate about to start working on an important project. First we tare the scale with the metal scoop on it. We scoop some espresso beans and start adding and removing single beans with our fingers, looking for a “16.8 g” on the scale.

IMG_4935

Perfect

Then the beans head over to the grinder, but only after getting a quick spray of steam and a shake (The “Ross Droplet Technique”).

IMG_4936IMG_4941

I sweep them into the burs and start turning the lever (it’s human powered, which means it’s coffee powered, which means it powers itself right?). I grind away, the grounds falling into the sculpted aluminum cup, held magnetically in place right under the center of the grinder.

After sweeping out the burs (we gotta get all 16.8 grams), I stir the grounds with a chopstick, place the cup on top of the portafilter, and lift the trapdoor in the bottom of the cup. I knock and push the grounds in, remove the cup and smooth out the surface on top of the portafilter. Then I use a custom wooden piece that Max’s dad made to evenly press the grounds in to a specific depth (and a specific density, since we’ve controlled for mass). At long last, w­­­e’ve prepared the grounds to go forth and serve their duty. Espresso.

4pics

The portafilter fits into a handle scoop, and that attaches under the steam spout. But first we need to spray some hot water into our cup to heat it up. That done, we latch the grounds in under the super-espresso-showerhead and start pulling up on the lever. Now comes the action. Max is over my shoulder giving instructions as I start to pull up on the handle. Easy does it. I pull up to the top, then slowly move the handle up and down slightly for 7 one-thousands. We’re “pre-soaking” the grounds before we push the water through them at high pressure. Then I start the pull, bringing it down slowly. Too slowly. “A little more, a little more,” Max councils frantically, and I speed up, trying to get a nice little stream of golden caffeine to drop into my cup.

IMG_4968

When it’s all over I taste it and it’s a bitter dark mess. I’d comment on how it scored as an espresso, but it’s the first time I’ve had espresso, so I’m not really qualified.   Max informs that there’s certainly some room for improvement. He’s on his own quest right now for better and better espresso shots, adjusting his recipe and techniques slightly each day to find a more balanced, aromatic, delicious, and even sweet espresso shot.

Which brings me, at long last, to my question: How should Max go about this quest?

IMG_4971

Right now he makes changes to his procedure sporadically, sometimes slightly altering his pull speed, sometimes choosing an entirely different type of beans. Even though it is essentially a two-ingredient dish, the espresso shot is incredibly complex, a product of a large number of variables. This is why so many people enjoy the quest, why they argue about techniques, ingredients, machines, and so on.

Fewer people argue about the best way to make a Jack and Coke. If we control for temperature, I would be willing to bet the taste is almost a direct result of the ratio. In that case, we can pretty quickly explore the entire range of ratio possibilities and find where the optimal point in our individual “taste-preference” is. The case with espresso is more complex, I think, because of the complicated interactions between the input variables – the type of beans, the mass / density of grounds, the grinder gauge setting, the pre-soak time, the pull speed, the pull length etc.

So what if we reduce Max’s quest to one variable? Let’s say he controls for everything but the length of time he pre-soaks the grounds for. Then he can alter the soak time each day and find where his taste-preference peaks (this is assuming that Max’s taste-preference is objective and unchanging). Maybe he can even graph it out. Will there be multiple peaks, or just one? If it continues to get worse as he lets the grounds soak for longer and longer, can he assume that the trend will continue and save himself from testing longer and longer soak times through eternity hoping for some sudden upturn in taste (Can he infer the boundary behavior)?

More importantly, if we add another variable once Max finds his optimal soak time, can we expect the peaks to be in the same place? For example, if Max finds that a 3 second soak produces the best tasting result while always testing using 4 second pull, will he still think a 3 second soak is best when he starts changing the pull length? Now he is searching in a two-dimensional space, and the possible options have multiplied. Already, with just 2 variables, it’s beginning to seem impossible to find the best method for a delicious espresso. Is there still a single peak, or will different combinations of soak time and pull time be optimal in their own little neighborhood?

If we add a third variable, maybe the density of grounds in the portafilter, the number of possibilities grows again. As we add more variables, the possibility “space” we need to explore EXPLODES (that’s seriously the technical term). Even if we make the system discrete by considering only a range of values and set increments for each variable (for soaking time & pulling time: between 0 and 10 seconds, in 1 second increments, and something similar for density), the number of possibilities is immense. The idea of simply trying them all is laughable.

If the variables interacted in a simple way, Max might be able to write down some formula that captures all the interactions and can be used to find the optimum variable combination (Tastiness = (soak_time / pull_time) * (pull_time – 5)2 * (density – 0.345)2). But if the variables interact in more complicated ways, and they almost certainly do, Max is in a pickle. He’s going to have to make up his own way to explore the space of possibilities, with no hope of exploring it fully or reaching some prove-able global peak. This process depends on two things: 1)Max’s chosen “algorithm” for espresso improvement and 2) The (unknowable in a complete way) relation between all of the variables and Max’s taste-preference.

Should Max change his recipe every day in some small way, keeping the changes only if the espresso improves? Or should he make large changes, sometimes experimenting in directions that haven’t been fruitful in the past? Should he make hundreds of cups a day, sorting them by input variables and taste results in a state of frantic caffeination?

I really can’t answer these questions (if I could I think I might be able to make some serious money at some engineering firm), but I think I can say that the two unknowns, Max’s algorithm, and the “mapping” between the input variables and the resulting taste, can be used to tell us about each other. Clearly, if we understand the mapping (as in the one-variable case, where we can test every possibility), we can say more about how different algorithms will lead to different results in terms of the level of tastiness we can achieve. At the same time, and in a more subtle way, if we try different algorithms, we can start to record and understand things about the mapping.

This second way is what I’m most interested in researching. How can we use different algorithms of change in systems with interacting parts like espresso to understand the structure of the mapping between their input variables and some important output? If Max tries two ways of changing variables and gets two different “tastiness trajectories” over time, can we say something about how the variables interact in terms of tastiness?

Without formalizing my thoughts here, I would say that features of the tastiness trajectory under different change algorithms can tell us something about the underlying mapping, which can, in a circular kind of way, tell us something about how different change algorithms will function. Maybe it will be possible to characterize different types of systems that are best tackled by different kinds of algorithms. I have a sneaking suspicion that this is already a field in engineering that I haven’t found out about yet – but it’s certainly just starting to emerge in biological systems where microbial reproduction times and cheap sequencing and fitness assaying technology are allowing researchers to watch evolution in action under different conditions.

These are hard problems, but they’re fun to think about, and I like to think that world would be pretty damn boring without all this combinatorics and interaction. Who knows, maybe by the end of my PhD I’ll be able to tell Max what procedure he should use to continue improving his espresso. But with the complexity and enormity of these systems, I bet I’ll be wrong. I can probably at least get some free espresso out of the deal though, so that’ll be nice.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>