Branch Misprediction in Humans

Guillaume GuyGuillaume Guy
2 min read

Branch prediction refers to a CPU's ability to predict the outcome of a boolean statement to streamline processing. This concept parallels human decision-making, where people continuously assess potential outcomes based on experience and inference, often leading to errors or mispredictions. Such errors can result from incorrect priors and can be challenging to correct, similar to the sunk cost fallacy in human behavior.

What is branch prediction?

Brand prediction is a relatively unknown term to non-CS folks. It describes the ability for modern CPU to predict the value of a boolean statement and proceed ahead while verifying the aforementioned statement in parallel. It usually speeds up computations but hurts when the problem is intrinsically difficult to predict (think coin flip).

There is a famous Stack Overflow answer with 33k upvotes that covers an easy-to-understand use case for those who want to learn more.

How does it relate to humans?

As it turns out, humans are equally trying to predict things in our day to day life. Is this person a threat? Can I park here without getting a ticket? When assessing these questions, one would usually comb through prior experience using some type of Bayesian inference to get to an estimate. For instance, guns increase the risk whereas some locations (e.g. playground) reduce it. Humans always compute the odds in their background process, which only triggers an alarm when the computed risks crosses a certain threshold.

The problem is that Humans make mispredictions too. Priors may be informed by past experience that may not be representative, or worse, built upon some beliefs that are plain false. In such case, one may misconstrue certain animals to be dangerous; and worse, not offer a feedback loop that correct this imperfect belief. As for CPUs, Human branch mispredictions can therefore be costly. And we have a name for it: Sunk cost fallacy (wikipedia). And yes, it’s hard to correct.

0
Subscribe to my newsletter

Read articles from Guillaume Guy directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Guillaume Guy
Guillaume Guy