“What on earth are YOU doing here?!?!”, yelled Richard Dawkins at me from across a crowded lobby.
A few years ago, he was over here in the US to give some talks, and one of them was happening nearby, so I’d gone to listen to him. But even though we’d talked by email a few times since we last met in England, he didn’t actually know that I lived here now. So I think he was a bit surprised, when he saw me marching towards him on entirely the wrong continent!
We went for a beer afterwards, along with some of the talk organizers, and he was keen to ask me what I was working on (i.e. this project). “But you’re still working on evolution, right?” “No, not especially; this time it’s more about neuroscience.” “Oh, okay. Er, but didn’t you just tell me it involves genetics?”
For some reason, I was now as baffled as he was, because it hadn’t really occurred to me that Richard, of all people, would expect me to use anything else! But we were in a noisy bar, with a bunch of other people who were keen to feel included in the conversation, so I just said, “Well, it seemed like the right programming language to use”, and left it at that.
This is a very boring anecdote, I know, but the point of it is to introduce a couple of things that I think need unpacking: Firstly, why do these creatures involve genetics, if the main point is actually to explore some ideas about the brain? And secondly, since they do have genes and I work in artificial life, why wouldn’t I expect them to evolve?
Let’s start with the second one. Most artificial life projects are totally focused on evolution. It’s understandable, because it’s a fascinating subject and it’s really easy to do in a computer (badly, for the most part, but still). Richard had attended the first ever A-life conference in history, organized by Chris Langton in the 1980’s, to talk about his Biomorphs program, and then he (and Chris) came to my own conference in the 1990’s to talk about, well, evolution again, because he’s an evolutionary biologist. It’s a bit of a theme…
Typically, an a-life program will involve making large numbers of small ‘creatures’, defined by perhaps a dozen or so genes apiece. These genes are often just a string of letters, with one letter per trait. So a creature’s genotype might consist of GDKADDBRJASU, meaning that it has type G legs, type D coloration, type K energy levels, and so on.
In a traditional Genetic Algorithm (also called a GA, by those in the know), these genes don’t necessarily have to code for creature-like objects at all – they could be anything. I’ve used GA’s to solve real-world problems that I couldn’t solve myself, such as finding a way to convert lots of graphics from one arcane 1980’s computer format into another, or evolving a machine that could (occasionally) model economics, but for now, let’s imagine that the genes are being used to make recognizably creature-like entities, as they often are.
A GA works by generating hundreds of these gene strings at random (the genotypes), and then producing simple creatures with those characteristics (the phenotypes). The creatures then ‘reproduce’, perhaps by dividing periodically into two copies, rather like bacteria do, with a few random mistakes in one copy. Or, more rarely, they might ‘mate’ with whoever they happen to bump into, mingling the two gene strings together to produce a third. Either way, this creates a new gene string, which is then used to create a new creature, and so on through the generations.
The clever bit (such as it is) comes when some of the creatures have to be killed off, to make room for new ones. In a conventional GA, the decision about who lives and who dies is made by an explicit ‘fitness test’ – a piece of code that judges whether one gene string has produced a ‘better’ result than another, and thus has more right to live. In Richard’s original Biomorphs program, this decision was actually made by human beings, who would choose which creatures lived and died according to whether they liked the look of them or not. Richard’s point was simply to show how quickly such random changes, combined with selection, can converge on something interesting. But if we were trying to evolve a good design for an aircraft wing, say, we might go through millions of generations, breeding from among the ones that seem to fly a little bit less badly when they’re tested in a simulated wind tunnel. Over time, the wings will get better and better.
In a more overtly creature-like simulation, we might instead use something more like natural selection, rather than an explicit fitness test. For example, the creatures that somehow find a way to grab the most food and/or evade the most predators, would – quite naturally – be more likely to hand on their genes to the next generation, since they survive for longer. There are many possible intermediates between explicit fitness tests and true natural selection. In the 1990’s, Karl Sims wrote a famous and sometimes hilarious example using explicit fitness tests but naturally behaving creatures, which ran (although admittedly not in real time – this was the 1990’s) on a supercomputer. In talks, Karl mentions that he once tried to get some of his cube creatures to walk, using a fitness test in which success was measured by how far a creature’s body managed to travel over a certain period. At first glance this seems like a rational idea, but what actually happened was that the creatures didn’t evolve the ability to walk at all; they just grew exceedingly tall, and then fell over! Evolution doesn’t always solve problems the way we hope it will.
The thing is: When the genes are just a simple string of characters that define explicit traits or parameters, and when there are hundreds of creatures at a time, mating very frequently, evolution can happen extremely quickly. The rate at which it happens depends on the total number of creatures in the population, the frequency at which they can reproduce, the total number of ‘letter’ combinations their genes can express, and the likelihood that random combinations of these letters will produce a creature that does anything useful at all.
For a typical a-life sim, evolution happens billions of times faster than it does in nature, and often we need only to wait a few hours of computer time before the results start to look quite interesting. But the time this takes can grow very quickly indeed as the scale of the problem is increased. Very quickly. Imagine a typical gene string, consisting of a dozen letters, each of which can express 26 different values, from A to Z. How many possible ‘words’ can we make out of those twelve letters? It’s actually worth guessing, to see how far out your intuition is. You might be surprised to find that the answer is 95 quadrillion (26 raised to the power 12, which is 95,428,956,661,682,176). But what’s harder to grasp intuitively is that simply doubling the size of the string to 24 letters, doesn’t just double the number of possible words – it now becomes 95 quadrillion times as big!
Evolution is amazingly good at searching through such enormous spaces of possible creature designs, but it can certainly take it a while, to put it mildly! To get from the first, fully working, totally successful fish, to the first, fully working, totally successful dolphin, took Nature around 500 million years. That’s a long time. Right now, I’m looking at some footprints that were made by an early four-footed creature, just half as long ago as that – 270 million years, give or take a week. 270 doesn’t sound like a big number, but just let it sink in: That’s 27 million centuries, or 270,000 millennia. Geological time is simply too big to comprehend! At the other end of the scale, human beings and chimpanzees are extremely similar to each other and share a very recent common ancestor, but it’s still taken six million years for the two of us incredibly close cousins to become that tiny bit different. So, even if phantasians were simple enough that I could speed the entire process up by a factor of a million, you’d still have to wait six years before you noticed that they’d got a little less hairy and walked slightly more upright.
These numbers are almost impossible to get across in any meaningful way. Phantasians don’t have 12 genes, nor 24; they currently have 803. These are not simple letters, so I can’t tell you how many possible combinations there are, and anyway I’m not sure my calculator can even count that high. But the other important factor to bear in mind is the time between generations. Natural selection, as opposed to the fitness function in a genetic algorithm, requires some actually meaningful selection to happen: some creatures legitimately need to succeed in mating more often than others. And since I’m interested in brains, this means they have to actually learn things for themselves: figure out what to eat, find ways to stay warm at night, decide that they like each other, go ahead and mate, survive through pregnancy, and then bring up their children well enough for them to have some hope that they will eventually mate too. It all takes time. You can’t speed this up very much. Sure, phantasians might reach puberty after a few hours, and pregnancy might only take minutes (I haven’t decided on good numbers yet), but they still need time to learn new behaviors and determine their fitness by making actual mistakes. It’s not like we have a thousand tiny creatures reproducing and dying every single second. It’s just not that kind of simulation.
On the positive side, though, you can expect these creatures to vary, even if they don’t evolve. They will be polymorphic. The actual gene pool will eventually be huge, even though most of the creatures right now are almost identical, since I’m busy trying to debug them. And it’s variation that matters, as far as caring about these creatures as individuals is concerned.
You don’t buy a dog to see if its puppies eventually develop six legs and a shell, do you? That’s not what dogs are for. You choose a dog or, for that matter, a husband or wife, because of who they are, as individuals. Genes are a big part of what defines these characteristics, and they vary quite a bit across the population. Some dogs are more cheerful than others, while some are more excitable and some are both. Some can’t seem to get across a narrow bridge with a big stick in their mouth, while others eventually figure it out. Genetic variation is the thing that counts in practice, far more than evolution does. We can definitely expect this variation to change over time, as some creatures turn out to be more interesting than others and hence get shared and bred from more often, and there’s really nothing to stop some aspects of evolution from happening, as long as you aren’t expecting your scruffy, dimwitted alpacas to actually turn into glorious, intelligent unicorns overnight (or even this century); it’s just not the point of what I’m doing.
And yet phantasians do still have genes, even though I don’t expect them to significantly evolve. And I didn’t do this just because it allows for variation, either. Nor especially because it’s ‘authentic’. So, why did I do it? Richard Dawkins was a bit baffled about this, although I’m sure he would have have quickly grasped my logic after a few more beers.
In most genetic algorithms, genes are just a set of parameters – a template for what color the creature’s skin is, how long its legs are, etc. In the a-life world, we call this a 1:1 genotype:phenotype mapping. But out in the real world, genetics is essentially a programming language, and a genome is a program, not a template. It’s an active process; a set of rules for constructing a very complex living being out of proteins, step by step. The execution of these programs is called embryology, and it’s as fascinating as it is mysterious.
One day I might tell you about another friend from my past – Dick Gordon – who, among many other achievements, wrote an enormous book about embryology, or at least one aspect of it. The ways in which proteins made cells; those cells then divided and differentiated to make tissues; the tissues folded and creased, developed chemical gradients and turned genes on and off; and then somehow all this bizarre origami ended up as you, is absolutely mind-blowing. Also, as Dick points out, learning is basically just another aspect of embryology. Growing and learning are the same thing. The development of our brain and the interactions between its genes and our experiences involve much the same processes as those that gave us two legs, two arms and a four-chambered heart. Despite what we get taught in school, genes and environment are just as inextricably intertwined before birth as they are after; the physical environment is actually just as vital to the development of an unborn embryo as it is to the later development of a learned language, or gaining skill with computers. This entire process of becoming is quite a miracle, and it continues all our lives, from the moment of conception to the day we die.
But more on that another day. My point for today is that I needed a way to assemble my creatures out of relatively simple building blocks, and the ideas that Nature employs to assemble her creatures seem self-evidently well-suited to creating artificial ones, too. I didn’t give the creatures genetics for ‘authenticity’; I did it because I needed to. Of course, phantasian genes are nowhere near as profound in their actions as natural ones – there’s hardly any actual morphogenesis – but I was at least able to steal some of Nature’s tricks!
So, phantasians are partially programmed in C#, but they’re also very much programmed using genetics. The C# code determines how a single neuron works, how an arbitrary chemical reacts, and how some of the processes work that are really hard to reproduce virtually, such as seeing and hearing. But a brain is not a neuron. It’s not even a million neurons, thrown into a container and shaken. It’s a complex circuit of neurons, connected to each other in very specific patterns, with very specific functions. Genetics is the medium through which I define that circuit, it’s also how I adjust it as I learn better ways to do things, and it’s how I will be able to produce a gene pool of variants when I’ve finally got the hang of what I’m doing. The same simple C# objects, arranged into a different structure by genes, can one day make entirely new species of creatures, with different brains and physiology. I hope to produce several species this way in the next year or so, although I’m starting with one, because, you know, this stuff is kinda hard…
Argh! I seem to have reached the end of this post without telling you anything at all useful about phantasian genetics! Nothing about chromosomes, polymorphism, meiosis, dominance, mutation and all the rest. Sorry about that. I can get to it in a later post, but I wanted to make it clear first that true evolution itself is rather irrelevant, if the objective is to make creatures we can actually care about. Variation, on the other hand, is much more relevant. Either way, genetics is still very important, because it’s the ‘programming language’ that I use for assembling actual creatures out of relatively simple building blocks, and wiring everything together. Hopefully I’ve got those ideas across, at least. There will be more later on the actual genetics, but in the next Biology 101 post I think I should begin to introduce the ideas behind the phantasian brain, because otherwise you won’t be able to understand what most of these genes are even for.
P.S., I’m still working on the user interface at the moment, but, as often tends to happen, it’s become a bit more involved and weird than I originally anticipated. Still, you know me, I tend to have to let these things just… evolve over time! I’ll get something out for you to look at in a week or so, just as soon as enough of it actually works.
> You can’t speed this up very much
Yeah my dog might disagree, her grandpa is a pug… If humans used selective breeding to get a dolphin, we could get it in a fraction of the time. And we would even have it look “cuter”
And this is one of the few games I consider real evolution simulation, because it is as slow.
Then I start it and never stop the world for continuous evolution. One of the things I hated in creatures, I had to always start from scratch again at generation zero (because fastagers and immortals evolved)
This is an evolution game, because it teaches how slow evolution can be, if there is no selective pressure. But any serious breeder of plants or animals can confirm how fast the breeding population can change
… wait, does that mean I can say your AI / AL Project is written in C# and genetic code?
I need to know that, for the chats in the other AI communitys where I spam … Might have meantioned your project there a few times….
To quote a famous zombie; “Brains!”
about instand learning again, after chatting in an AI-streamer discord, i got the link to this video of a quick learning AI https://www.youtube.com/watch?v=A2hOWShiYoM papers are in the video description, not sure if this helps/inspirates you with your current instandlearning solutions?
Could you elaborate on your usage of a GA to convert something between computer formats? I’m curious how that works.