Sunday, January 7, 2024

Fiction Is Dreaming In Print

There are mathematical techniques intended to counter over-fitting in data. Imagine a stockmarket analysis program. If it's trained on a year of data when, that year on June 23, all tech stocks dropped, it might start to recommend selling (or shorting) all its tech stocks just prior to June 23 every year. Obviously this isn't smart; the program has overfitted. What you might do is take the training data and slice it up and restack it in some new way - different sectors, different months - and the program might start finding more meaningful relationships.

This is analogous to dreaming, and has been rediscovered (or re-engineered, if you prefer) in other settings for some years now. We still don't really know why we sleep, let alone why we dream. But if we assume that brains are doing the same thing - avoiding overfitting - the explanation makes sense, and is consistent with the characteristics of dreams. Suddenly you're at the beach you used to go to every summer as a kid, but then in your school; your deceased grandmother is there, at the same time as your asshole coworker from the last company, and then you're driving down a steep mountain road with no brakes. Obviously they never met, and they especially didn't meet in some bizarre hybrid beach-school-mountain place. By mixing them, you're trying to avoid overfitting. In contrast, if you have PTSD, you do dream literally the same concrete traumatic experience over and over - and your waking behavior is overfitted - you avoid trucks under overpasses, or that one street corner, or movies about fire, based on whatever experience you had that you can't "digest", integrate with the rest of your life's experience, and move past.

Returning to computers, Andrej Karpathy on Twitter says "...in some sense, hallucination is all LLMs do. They are dream machines. We direct their dreams with prompts. The prompts start the dream, and based on the LLM's hazy recollection of its training documents, most of the time the result goes someplace useful." Similarly, the data stored and sliced and diced in our dreams influences how we perceive the world. It provides the top-down filter for the bottom-up sense data pouring in.[1] Without this, we veer off into hallucinations and delusions within days.[2]

But sometimes we humans' dreams intrude into our waking hours, drawing attention to themselves in full form, like stars briefly visible in the daytime if you know where to look[3], or if you like, a laundry dryer opened mid-cycle to let a sock or a shirt fly out. In the shower, you start laughing when a joke you heard in eighth grade pops out of nowhere. While driving to work somehow you're suddenly thinking of your recently deceased cat, and you're sad.

It seems to me that fiction is a more elaborated version of this, committed to a less ephemeral form, one that produces fossils of our overfitting-avoidance. Something has to explain the reason that we write stories that never actually happened, that we know no one will ever think actually happened, and that we (mostly) never even show to anyone else. (Out of all the short stories ever completed in history, what percentage of them was even intended for publication, let alone did the author think had a real chance of being read by someone else?) So why do we bother? Why are we so compelled? We're avoiding overfitting the things that are important to us. We write character-driven stories examining the psychology of people similar to those we know, or we write alternate history what-ifs about events that we find interesting - all of which we are trying to understand better and connect to our other experience, as we turn it over, and slice and dice it and rub it up against our other experiences.. Even the writing process itself is consistent with this - the ideas somehow just appear automatically, along with some scenes and images and events, that the writer has to organize (often laboriously, decidedly non-automatically) into a coherent narrative.


[1] In psychosis, the top-down part of the process dominates and you're lost in a waking dream of hallucinations and delusions. Autism is sometimes thought of as a diametric opposite to psychosis, when the bottom-up sense data dominates and unfiltered and the overwhelming cacophony of sounds, lights, or textures become intolerable.

[2] Waters F, Chiu Vivian, Atkinson A, Blom JD. Severe Sleep Deprivation Causes Hallucinations and a Gradual Progression Toward Psychosis With Increasing Time Awake. Front Psychiatry. 2018; 9: 303.

[3] When Venus is on the same side of the Sun as Earth, you can actually see it with the naked eye during the day. When I first located it in a blue daytime sky, I found this almost disorienting.

No comments: