personal blog of Gaurav Ramesh

What Data Structures Can Teach Us About Reclaiming Our Attention

This is not a post about attention as mentioned in the Transformer architecture. I'm talking about real attention, - the mental resource we're increasingly running short of - and how concepts from computer science mirror our cognitive process.


LSM-Trees

When I interned at Amazon years ago, my roommate at the time, also an intern, worked in the Dynamo team. He had told me about how NoSQL databases optimize data organization using LSM-Trees. They key problem they were designed to solve was handling high write throughput while maintaining good read performance. They do this through three main techniques -

  1. Write to memory first - All new writes go to an in-memory structure, called mem table, which is fast. It can be thought of as a small notepad
  2. Batch flush to disk - When the memory/notepad fills up, data is sorted and written to disk as one immutable table(called SSTable). This is like organizing the notepad in a shelf, when full, and grabbing a new one
  3. Background merging - Periodically, smaller files get merged into bigger ones in the background. This is like taking several notebooks and consolidating their entries into one volume, with labels, annotations and summary. This happens during "idle" times, i.e. in those stretches of time when the external processes are not making urgent claims on the CPU.

Brain, Attention and Stories

Our brains operate with striking similarities. The experiencing self temporarily holds recent experiences in a volatile state, primarily in the prefrontal cortex and hippocampus. Periodically, the brain transfers memories from short-term to long-term storage. When memories are recalled, they become temporarily malleable again, before being re-stored, often with modifications. This is where the brain transforms raw inputs into coherent narratives. A story, from this perspective, can be thought of as an optimal way to compress and store dense information in a way that's serves us well(mostly).

In the book The World Beyond Your Head, Matthew Crawford, explains this connection between attention and coherent-self formation:

We are wired to attend to our environment, but certain kinds of thinking require that we ignore it. Thus, when trying to recall something from memory, a person will often stare up toward the blank sky, or avert her gaze from the scene before her. Similarly, trying to predict the future and plan for it is an act of imagination that requires getting free of the present.



..

Suppressing the environment is dangerous because features of the environment that normally should be controlling action are ignored. “The effort is a warning signal: Take care; you are not attending to your actions!” .. “when working on a difficult intellectual problem (which should require suppression of the environment), we reduce the rate at which we are walking to avoid injury.”

..



“autobiographical memory arises from suppressing the environment.” Around the age of two or three years, as a child develops language, she learns to use narrative to organize and relate her experiences. By doing so, she starts to develop a coherent concept of self. This requires suppressing environmental input so the child can control what she is thinking about. And reciprocally, the ability to use language supports the ability to suppress the environment and control one’s recollective experience.

..



While animals certainly have memory and the ability to learn, human beings are thought to be the only creatures who can deliberately recall something not cued by the environment. But we do this only in those stretches of time when the environment is not making urgent claims on our attention. It is at these times that we try to find (or impose) coherence on our experience, retroactively. If we are currently facing a culturally and technologically induced trauma to our ability to suppress environmental input, that raises a big question: Is this distinctly human activity of coherence-finding at risk?

What can be gathered from this is that most of the times, things external to us grab our attention. Paying attention to the environment has its evolutionary advantages. It was developed in a world where threat was constantly looming. Not paying attention to whatever was in front of you, killed you. But we now live in a world where we have abundance of comfort and convenience. In other words, the worlds in which our attentional mechanisms evolved and the one we live in are radically different. But our brain hasn't caught up to that fact yet. What it also highlights that attention is one thing. Think of it as one core of a CPU. Only one task, or a thought, can hold it at any given point, and when it does, others don't get to have it. Because of it, the act of constructing a coherent story of self requires suppressing our attention to the environment, and so happens during idle times - while sleeping, mainly, but even other little pockets of it throughout the day.

What's fascinating is that both evolution and computer science somewhat independently arrived at similar solutions to comparable problems:

  1. Dealing with the challenge of managing vast amounts of information
  2. Balancing speed-vs-capacity tradeoffs
  3. Combining immediate recording with thoughtful organization
  4. Utilizing periods of idleness for optimization

The Critical Role of Idle Time

Just as databases degrade without regular re-organization and compaction, our mental processes suffer without proper consolidation periods. Without these "maintenance windows", we struggle to sort experiences, strengthen important connections, discard irrelevant information, integrate new knowledge, and create coherent stories about ourselves and the world.

Our Modern Attention Crisis

If we are currently facing a culturally and technologically induced trauma to our ability to suppress environmental input, that raises a big question: Is this distinctly human activity of coherence-finding at risk?

With today's digital landscape, we've systematically eliminated those crucial idle periods. We've become institutionalized to a world where screens fill every potential moment of boredom: messages arrive 24/7, social media provides infinite scrolling, and streaming services offer never-ending doses of entertainment. Even the smallest moments - waiting while pumping gas or the seconds it takes to pay with your credit card - are sprinkled with ads.

As Crawford notes:

..when I swiped my bank card to pay for groceries. I watched the screen intently, waiting for it to prompt me to do the next step. During the following seconds it became clear that some genius had realized that a person in this situation is a captive audience. During those intervals between swiping my card, confirming the amount, and entering my PIN, I was shown advertisements. The intervals themselves, which I had previously assumed were a mere artifact of the communication technology, now seemed to be something more deliberately calibrated. These haltings now served somebody’s interest.

What's more concerning is that all that screen time is also ruining our sleep, which is when most of the "maintenance" activities - consolidation, storage and recovery - happen in the brain. Netflix CEO once famously said that their competition is not any other company, but sleep. It was hailed as an exemplar vision of a great CEO. It should have been a warning. Never before was the ambition of a technology company made as clear.

Reclaiming Your Attention

Attempts to grab it back by mustering courage and will is like trying to snatch a toy from a child. Anybody who has tried to do that knows how stubborn and persistent a child can be. A more effective approach is redirection. Give the child something else that piques its interest, and the toy almost instantly loses grip. To get our attention back, we need to look elsewhere too - develop the discipline to carve periods without digital distractions. The brain will do what it's do best. It just needs the fertile ground of stretches of time when the environment is not making urgent claims on our attention. It does not matter as much what you do, as long it reduces the influx of information and stimulations thrown at you - walking without digital devices, or engaging in the most mundane of the physical activities that disconnects you from the noise in the world and chatter in the brain, something that grounds you in reality, or just sitting quietly. Over time, the grip of distractions loosens. It becomes easier to not care about them. It becomes easier to be alone with your thoughts, sleep better, and - most importantly - direct your attention deliberately rather than reactively.

The brain, like LSM-Tree, needs those idle optimization windows. Give it the space, and it'll serve you better.

Share or Subscribe

Get notified when new posts are published. Once a month, I share thoughtful essays around the themes of personal growth, health & fitness, software, culture, engineering and leadership — all with an occassional philosophical angle.