Could AI benefit from Sleep?

Sleep is a Computational Technique

The best evidence that our brains are computers is what happens when we sleep. Our reasons for sleeping are explained in ‘Why We Sleep’, by Dr. Matthew Walker, the Director of the UC Berkeley Center for Human Sleep. It’s an excellent read, and it has encouraged me to take sleep far more seriously. As a result, I find myself calmer, more present, and happier.

This book is packed with computational analogies.  Deep sleep brain waves act as a “file-transfer process” that moves memories from short term storage in the Hippocampus (described as “a USB Memory Stick”), to long term storage.  REM sleep is described as “an Internet service provider populating new neighborhoods of the brain with vast networks of fiber-optic cables”. I’d say the author is screaming at us “YOUR BRAIN IS A COMPUTER!”, except I heard him on Joe Rogan and he’s got a wonderfully calm, polite, English accent.

If I had to summarize “why we sleep” in one sentence, the answer would be “to make our brains work better during the day.”  

Our brains contain detailed models of reality, and we use these models to navigate our day-to-day lives.  While we sleep, our brains update these models, making them more accurate and efficient.

From a computational perspective, our brains act as streaming processing systems.  We react to our senses in near-real time, both avoiding threats and pursuing goals. Streaming processing systems are difficult to build and maintain, and they’re not at all efficient. The only reason you ever build one is when you need to react fast to incoming data – which most living things do. 

What’s the fastest way to compute a solution to a problem? Finding an existing, known solution from a lookup table. And that’s exactly what animals – including humans – do. Rather than computing a solution to every problem we face in real time, we rely heavily on our intuition.

When someone asks ‘how are you’, you don’t enumerate from a list of possible responses, predict the results of saying each possible thing, and weigh each possible statement according to its predicted results. That computation is done for you while you’re sleeping, over the course of many nights. Only the results of these computations are cached. If you encounter a problem enough times during the day, your brain will search for good solutions while you sleep.

Our intuitions act, essentially, as a lookup table. While we sleep, our internal models of reality are updated and fine tuned, and so are the intuitive hunches we get during the day.  Why we sleep cites several examples of studies showing that sleeping helps us consolidate memories and learn new skills faster.  

Our need for sleep is thus not so much about our biology, as it is a solution to a computational problem. We need to react fast to successfully navigate reality. Slow animals get eaten by faster ones. But we also need to react correctly in order to successfully navigate reality. Wrong animals get eaten by less wrong animals.  Sleeping allows us to make our reality models faster and more accurate, at the cost of spending less time using those faster, more accurate models.

The tremendous cost of being inert and unable to respond to threats, gather resources, or mate while we sleep ends up being worth it because this investment makes us able to simultaneously respond quickly and accurately, even though we can’t do so all the time.  It turns out that always being, say 70% fast and accurate, is not as good as being 100% fast and accurate, but only 70% of the time.

The main constraint for evolution is energy. In the animal kingdom – for every animal that ever lived, ever, except a small number of humans over the past few centuries – calories are hard to come by.  It might be possible to have our brains update our reality models in real time, while we go about our business, but this would end up requiring way more energy. And thus sleep looks like it allows us to hit a sweet spot, where we get the best performance per calorie.

It’s as if there’s something like a CAP theorem for sleep – the most energy efficient way to be both fast and accurate is to sacrifice on availability and sometimes – hours at a time – be neither fast nor accurate. If we didn’t sleep at night, we’d either use a lot more energy to update our reality models continuously, or else do what some animals do, and have half our brain sleep at a time. (It turns out we actually do something like this, when we aren’t sleeping at home, and the cost of being unavailable is higher.)

Since nature is so good at building systems efficiently, I wondered if sleep might be helpful for electronic intelligent systems, not just those made from meat. Would AI benefit from sleep?

The Collective Unconscious of Tesla Vehicles

After a little bit of thought, I realized that in one sense, many AI systems already do “sleep”, or something like it.  For example, consider Tesla vehicles reporting the data from their self-driving systems to a centralized cloud service. 

Individual Tesla vehicles navigate reality just like individual humans do – using a streaming processing system to avoid dangers and pursue goals.  Unlike humans, the Tesla vehicles have a high bandwidth connection to a centralized processing service, which can then combine the data from many vehicles to produce better software models. 

So, in a sense, the Tesla vehicles “sleep” via a cloud service run by the Tesla corporation. Instead of waking up fresh each morning, with a finely tuned model of how to drive, Tesla vehicles receive periodic updates from the centralized service. The Tesla vehicles “sleep”, then, but they do so using a form of specialization.

If humans slept the way Teslas did, some of us would spend our entire lives sleeping, while integrating the sensory inputs of very large numbers of humans into a tightly coupled, coherent model of reality. These reality models would be transmitted back out to the humans who never slept, not because they didn’t need to sleep, but because someone else slept for them. 

Most of us don’t grow or hunt our own food. Most of us outsource the majority of our thinking and decision making to other people – but we have to manually calibrate our own reality models by closing our eyes, lapsing into unconscious, and allowing our brains to alternate between cycles of garbage collection, data transfer, and furious activity.

Because I’m not afraid of sounding ridiculous, I’m going to ask if this “sleep outsourcing” thing isn’t happening already. How much of popular culture, art, and media, acts something like a shared form of sleep, which makes our reality models more accurate?  Maybe the idea of a starving, delusional artist actually makes sense in this context. The people who are sleeping for everyone else are those who endlessly process memes and symbols, mutating and playing with them, occasionally finding something useful in the process.    How many of us learned how to act and behave in certain contexts by encountering representations in books, films, songs, or games?

In another sense, even Google updating its search indices is doing something like sleep for the human species – it’s making information more accessible to those of us who are awake and really need to know what that episode of Saved by the Bell was, the one where Jessie takes caffeine pills and gets so excited, and thus the herd learns some immunity by caching the story of a bad choice and its consequences.

The key difference in sleeping patterns between Teslas and Humans is not that one is made of metal and the other meat. From a computational perspective, that hardware difference isn’t nearly as important as the informational bandwidth going into and out of the system. Teslas can transmit and receive data far faster than human brains can.  The Tesla can dump the contents of its day-to-day experience into remote hardware, and have that remote hardware update its reality models for all Teslas. We humans don’t have high-bandwidth connections to remote computing hardware. Thus, we have to do that computational work using our own brains, while we aren’t driving – or walking, or eating, or talking, or doing anything that requires us to be awake.

What really matters here is the ratio of sensory bandwidth to communication bandwidth. Maybe the Teslas could be uploading the entire videos of every single trip they take, but that’s because they aren’t driving 24×7. Even a Tesla being parked, charging, and transmitting a bunch of video files is similar to the function of Deep Sleep, with the local storage on the Tesla vehicles acting like the Hippocampus – the short term store of memory.

Now, maybe this Tesla example feels like a rip-off. They don’t really sleep, and I’ve just been hand waving and making vague equivocations. You say you’re mad, and you want more for your money! That’s a fair point, so here’s an example where I think AI systems actually would benefit from sleep.

To summarize, our need to sleep comes from a tradeoff where we have to navigate a dangerous reality, we have a limited energy budget to do so, and we don’t have the ability to transmit huge amounts of information.  Thus, If we want to find an example of a robot that needs sleep, we need to imagine a robot that has similar constraints. This thing should operate where it has limited power and communication bandwidth that’s much, much less than its sensory bandwidth.

So consider a military robot whose purpose is to explore enemy territory.  We don’t want this robot getting caught, and so we can’t have it transmitting data to any external systems. It will have solar panels, but they can’t be huge, because we don’t want it to be visible.  It’ll be heavily energy constrained. Imagine something roughly the size of a rat. This thing could store days of video files, audio files, and detailed maps.  Of course, it’ll still have limited storage if it is only storing raw video. The ability to compress video files would make this thing far more useful. Unfortunately, the solar panels will only give it so much energy per day.

And thus we arrive at a design for a robot that benefits from sleep. During the day, this thing sets up solar panels somewhere that’s not usually visible and gets a lot of sun. Say, the roof of a building. During the day it charges its batteries.  Perhaps some of the harvested solar energy is used to compress the video files and audio recordings it has made, so that it can gather more data. Perhaps some more of that energy is used to build and update its real-time map of its surroundings – useful once it has gotten back into safe territory, but also to help it navigate and avoid danger.

At night, our robot roams around, gathering raw data, and being on hair-trigger alert for danger. Just before dawn, the robot finds a safe place to set up its solar panels and compress the data it gathered that day – to maximize the amount of data it can get on a single excursion into enemy territory.

Maybe it’s just a coincidence that this thing sounds to me like a rat would sound to dinosaurs. A tiny, skittish, weird thing that I could easily crush if I bothered looking for it, but it hides when I’m awake, and only moves around when I’m asleep. I wonder if there’s a meteor coming…

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.