Sunday, March 01, 2009

The Evolutionary View of Software

Evolution, as Daniel Dennett explains, is at heart a simple algorithm. 1) Replicate new copies with variations. 2) Select according to some criteria. 3) Repeat. As a pure algorithm, evolution applies to not just biology, but any entities that can provide the required replication-with-variation and selection steps.

The non-intuitive thing about the evolutionary algorithm is that such a simple set of rules can create such incredible complexity. Thus, when the evolutionary algorithm is used by software to design solutions to problems, it is often difficult for humans to understand the design of the resulting solution -- just as it is often difficult for us to understand the design of complex biological entities that evolution has created.

Software as Evolutionary Candidate

The most obvious application of evolution to software is to write software that replicates itself with variations and let it evolve. This gives rise to the scary Kurzweillian future in which software reaches a sentient state and evolves so quickly there's virtually no problem it cannot solve (watch out if it decides humans are a "problem" that needs solving!).

But one reason this doesn't seem to be happening very fast is that software is a lousy replicant. The most obvious proof is that when, on a daily basis across the planet, someone stands up and shrieks because they just lost an important piece of software because of hardware failure, this is never followed by "Ah, never mind, I found another copy growing on the windowsill." Software still needs a directed human hand to replicate, and certainly a directed human hand to select for "fitness".

But what if software is embedded in sensor-ridden boxes so that we can just drop it into the real world and let all the complex rules of reality perform the selection? Then, something closer to real evolution takes place -- but at a pace that is bounded by the pace at which reality happens. Thus, as Dennett reports, it takes such machines many days to "realize" and react to the fact that ambient light on this planet comes in 24-hour cycles. And, when Kurzweil's software goes sentient, all its exponential power will not make it that much better at solving the problem of divorce than humans, since it will have to experience many marriages in real time to begin to evolve improved performance. It is Bonini's Paradox all over again: the better a model approaches reality, the closer it gets to being just as difficult to use and understand as reality. No matter how exponentially increasing our computing power is, reality plods along at the same speed, and many of our most interesting problems have to do with reality.

Units of Selection

There may be more interesting ways to apply evolution to software. Leo Buss, in The Evolution of Individuality says that "The history of life is a history of different units of selection. Novel selective scenarios dominate at times of transition between units of selection." He is talking about a hierarchical view of evolution where, for example, cells transition to multi-celled organisms. Long ago, our ancestor cells had to battle natural selection to survive. Now, my cells play a multi-part game of selection, in which the pressure on their individual survival is less, but they have pooled their fate into the survival of a conglomerate of fellow cells (me!), and that conglomerate faces more directly the selection pressures of the environment.

Of course, where to draw the line between "conglomerate of entities" and "new entity of more complexity" is a little fuzzy. I'm pretty sure I'm a single entity, but if you really get down to the level of one my cells, tirelessly performing hundreds of different tasks, trying to fight off free radicals, perhaps reproduce a few times before it can no longer stave off death -- from that cell's perspective, I look a lot more like a big conglomeration that happens to have some emergent behavior it, endearingly, likes to call "consciousness".

But there is room for kinds of hierarchy in evolution other than just conglomeration. For example, it is now nearly an orthodox view that the reason each of our cells has 2 sets of DNA is that, long ago, the single-DNA ancestor of our cells captured and enslaved another type of cell -- what we now call the mitochondria. Whereas the DNA in the nucleus of your cells came from a combination of your mother and father, the DNA in your mitochondria comes only from your mother -- the slave gets rather less of a shot at the evolutionary algorithm. I wonder if, instead of thinking that software might one day become a better replicator and evolve on its own, it might instead already participate in a master-slave relationship with an existing evolutionary entity: us.

Mitochondria doesn't really get to reproduce except under the direction of its master cell, and this is true of software as well. Mitochondria is also somewhat insulated from selection pressures except as dictated by the enslaving cell, and this is also true of software. Mitochondria gets to live because it serves a purpose in the evolutionary survival of the enslaving cell. Does software serve any purpose in our evolutionary survival?

It does, and that purpose is: information flow. It is information flow that makes a conglomerate of entities survive, and lack of information that destroys the conglomerate. At the level of human society, it is information flow that leads to non-zero-sumness and positive growth. Lack of information flow from code breakers to island defenders allowed the devastating attack at Pearl Harbor that put America in a losing starting position for World War II. Lack of information flow allowed investment banks to take on increasingly untenable amounts of risk without being reined in by their investors -- until it was too late. When the President announces a website to provide transparency on how his gigantic gamble of a stimulus package is spent, it may be part PR, but it is conceptually functional -- if you want to decrease corruption, you have to increase information flow.

Software as Evolutionary Advantage

Software, of course, is pure information. It offers opportunities for increasing both the speed and accuracy of information transmitted between entities in the conglomerate of human society.

In modern society, we have pooled our evolutionary fate into a conglomerate. Although I'm very busy on a daily basis with concerns related to my own survival, it turns out that these require constant interaction with the other "cells" in the conglomerate entity. Much of my food comes from specialists in distant places, and much of the work I do to survive is, rather than being directly related to my nutritional needs, sent out to satisfy other needs of the conglomerate.

In this model, software is a new form of information exchange. Software lets us exchange, not just ideas, but ideas in a precise, executable form. Just as cells had to evolve complex machinery for correcting errors in DNA replication, software represents an evolutionary advance in our ability to accurately replicate ideas.

And this brings me back to the Leo Buss quote. As many authors have noted, human history is grinding towards a turning point, where we either have to evolve an ability to face the kind of global, long-term problems that evolution never prepared us for, or fall back to the "nasty, brutish, and short" lifestyle of simpler times. This may be one of the "times of transition between units of selection" that Buss was talking about, and software may be key to the "novel selective scenarios" that decide the outcome.

Now I have to go write some code.