The System Design of Human Cognition
Parallels of brain and software architecture

Written by
Kevin Yeboah
hand typed, not AI generated

The human brain is one of the world's best computing platforms. It's not the most efficient at running deterministic calculations and it's not the best at storing uncorrupted information for retrieval. However, for the job it's meant to do it is one of the most efficient and effective solutions.
The average human brain can run a process on just 20 watts (barely enough to light a dim lightbulb) while an AI system trying to match that scale would drain over 20 million watts.
A lot of modern literature emphasizes the fact that we don't know much about how the human brain works. But, from what I've read, modern science has the human brain mapped out pretty well. At least the black box behavior.
The "Black Box" Model of Software
During my time engineering software at companies like Twitter and Google, I've learned that most system design problems start with a "black box" and are then fleshed out from there.
In software, the black box is a system where we understand the shape of the inputs and outputs but have little knowledge of the inner workings of that system. For example, an email inbox system takes the input of someone's email address and outputs a list of their most recent emails.
Everything that happens in between the inputs and outputs is highly variable. In fact, different email systems may implement the solution completely differently. Some may use cursor-based pagination with data sourced from NoSQL documents. Some may use offset-based pagination with data sourced from a SQL database. The inputs and outputs of those two systems would be almost identical.
The cool thing about engineering software is, with verifiable input and output shapes, we can get creative with what happens inside the black box. This allows us to optimize for the needs of our specific use case.
The Encapsulated Black Box
Usually black boxes contain smaller webs of even more black boxes. For example, in the email system that retrieves your recent emails, there's a black box that takes your pagination cursor and returns which record of the database should start the paged query. There's also a black box that takes a person's email address and returns their userID.
You can always get more granular. Even down to a single function or line of code. Inside the userID retrieval box, there's a function that parses an email and makes sure it includes an '@' symbol. That's also a black box.
The Building Blocks of Software Systems
The black box is the fundamental building block of all software architecture. When you call an API, instantiate a class, include a library, and even send a prompt to an LLM, you're invoking a black box. You know, with high certainty, what kind of output you expect given your input. You can also derive other assumptions like the expected latency of your call.
Every well designed software architecture is essentially a web of interconnected and encapsulated black boxes. The black box is a conceptual piece of processing that has verifiable inputs and outputs.
The "Black Box" Model of the Brain
When you read modern science you understand that the human brain is also a web of interconnected and encapsulated black boxes; and we have a pretty good understanding of how most of these boxes work.
The Neuron Black Box
One of the smallest black box components, one that everyone knows very well, is the neuron. The neuron has one essential job: fire when you receive enough electrical stimulation and pass that current on to your neighbors.
The neuron is a black box. The input is electrical stimulation. The output is activation.
Human Behavior is Predictable
We can also conceptualize the brain as a black box on the highest levels. Human behavior is very predictable. This is the reason things like mass marketing campaigns and propaganda work. The system is deterministic enough that when you give enough humans a certain input you can predict how many of them will exhibit a certain output. Ever find it interesting that click though rates, conversation rates, and marketing ROI are all highly predicable metrics with enough data? Your ads rarely ever hit the same exact set of humans every time they are presented to the public but you can expect a consistent percentage of people to click the call to action.
Why is this? We all have similar base-functionality in our brains. You show a person the color red, there is a slight increase in heart rate. You say a person's name, they're more likely to snap to attention. This is universal and it's a black box. Verifiable input and output shapes. The input is sensory stimulation (vision of the color red, auditory reception of one's name). The output is the action (increase in heart rate, snapping to attention).
The Brain is Object Orientated
The brain is not a lump of random grey matter. Neurologists know very well and have empirically proven that most parts of the brain serve a specific function.
The Hippocampus is responsible for consolidation of memories.
The Amygdala is responsible for fear responses and other emotional stimuli.
The Prefrontal Cortex is responsible for high order reasoning and planning.
The Thalamus is responsible for retrieval and organization of sensory data.
The brain is no different in this matter than a highly complex web of micro-services. Each system serves a specific role which neatly defined inputs and outputs. No neighbor of the Amygdala expects it to return information about which motor functions to perform during reflex responses.
These are all black box system and there are many more in the brain.