Mappa Psyche

I’m kind of feeling my way, here, trying to work out how to explain a lifetime of treading my own path, and the comments to yesterday’s post have shown me just how far apart we all wander in our conceptual journey through life. It’s difficult even to come to shared definitions of terms, let alone shared concepts. But such metaphors as ‘paths’ and ‘journeys’ are actually quite apt, so I thought I’d talk a little about the most important travel metaphor by far that underlies the work I’m doing: the idea of a map.

This is trivial stuff. It’s obvious. BUT, the art of philosophy is to state the blindingly obvious (or at least, after someone has actually stated it, everyone thinks “well that’s just blindingly obvious; I could have thought of that”), so don’t just assume that because it’s obvious it’s not profound!

So, imagine a map – not a road atlas but a topographical map, with contours. A map is a model of the world. It isn’t a copy of the world, because the contours don’t actually go up and down and the map isn’t made from soil and rock. It’s a representation of the world, and it’s a representation with some crucial and useful correspondences to the world.

To highlight this, think of a metro map instead, for a moment. I think the London Underground map was the first to do this. A metro map is a model of the rail network, but unlike a topographic map it corresponds to that network only in one way – stations that are connected by lines on the map are connected by rails underground. In every other respect the map is a lie. I’m not the only person to have found this out the hard way, by wanting to go from station A to station B and spending an hour travelling the Tube and changing lines, only to discover when I got back to the surface that station B was right across the street from station A! A metro map is an abstract representation of connectivity and serves its purpose very well, but it wouldn’t be much use for navigating above ground.

A topographical map corresponds to space in a much more direct way. If you walk east from where you are, you’ll end up at a point on the map that is to the right of the point representing where you started. Both kinds of map are maps, obviously, but they differ in how the world is mapped onto them. Different kinds of mapping have different uses, but the important point here is that both retain some useful information about how the world works. A map is not just a description of a place, it’s also a description of the laws of geometry (or in the case of metro maps, topology). In the physical world we know that it’s not possible to move from A to B without passing through the points in-between, and this fact is represented in topographical maps, too. Similarly, if a map’s contours suddenly become very close together, we know that in the real world we’ll find a cliff at this point, because the contours are expressing a fact about gradients.

So a map is a model of how the world actually functions, albeit at such a basic level that it might not even occur to you that you once had to learn these truths for yourself, by observation and trial-and-error. It’s not just a static representation of the world as it is, it also encodes vital truths about how one can or can’t get from one place to another.

And of course someone has to make it. Actually moving around on the earth and making observations of what you can see allows you to build a map of your experiences. “I walked around this corner and I saw a hill over there, so I shall record it on my map.” A map is a memory.

Many of the earliest maps we know of have big gaps where knowledge didn’t exist, or vague statements like “here be dragons”. And many of them are badly distorted, partly because people weren’t able to do accurate surveys, and partly because the utility of n:1 mapping hadn’t completely crystallized in people’s minds yet (in much the same way that early medieval drawings tend to show important people as larger than unimportant ones). So maps can be incomplete, inaccurate and misguided, just like memories, but they still have utility and can be further honed over time.

Okay, so a map is a description of the nature of the world. Now imagine a point or a marker on this map, representing where you are currently standing. This point represents a fact about the current state of the world. The geography is relatively fixed, but the point can move across it. Without the map, the point means nothing; without the point, the map is irrelevant. The two are deeply interrelated.

A map enables a point to represent a state. But it also describes how that state may change over time. If the point is just west of a high cliff face, you know you can’t walk east in real life. If you’re currently at the bottom-left of the map you know you aren’t going to suddenly find yourself at the top-right without having passed through a connected series of points in-between. Maps describe possible state transitions, although I’m cagey about using that term, because these are not digital state transitions, so if you’re a computery person, don’t allow your mind to leap straight to abstractions like state tables and Hidden Markov Models!

And now, here’s the blindingly obvious but really, really important fact: If a point can represent the current state of the world, then another point can represent a future state of the world; perhaps a goal state – a destination. The map then contains the information we need in order to get us from where we are to where we want to go.

Alternatively, remembering that we were once at point A and then later found ourselves at point B, enables us to draw the intervening map. If we wander around at random we can draw the map from our experiences, until we no longer have to wander at random; we know how to get from where we are to where we want to go. The map has learned.

Not only do we know how to get from where we are to where we want to go, but we also know something about where we are likely to end up next – the map permits us to make predictions. Furthermore, we can contemplate a future point on the map and consider ways to get there, or look at the direction in which we are heading and decide whether we like the look of where we’re likely to end up. Or we can mark a hazard that we want to avoid – “Uh-oh, there be dragons!”. In each case, we are using points on the map to represent a) our current state, and b) states that could exist but aren’t currently true – in other words, imaginary states. These may be states to seek, to avoid or otherwise pay attention to, or they might just be speculative states, as in “thinking about where to go on vacation”, or “looking for interesting places”, or even simply “dropping a pin in the map, blindfold.” They can also represent temporarily useful past states, such as “where I left my car.” The map then tells us how the world works in relation to our current state, and therefore how this relates functionally to one of these imagined states.

By now I imagine you can see some important correspondences – some mappings – between my metaphor and the nature of intelligence. Before you start thinking “well that’s blindingly obvious, I want my money back”, there’s a lot more to my theories than this, and you shouldn’t take the metaphor too literally. To turn this idea into a functioning brain we have to think about multiple maps; patterns and surfaces rather than points; map-to-map transformations with direct biological significance; much more abstract coordinate spaces; functional and perceptual categorization; non-physical semantics for points, such as symbols; morphs and frame intersections; neural mechanisms by which routes can be found and maps can be assembled and optimized… Turning this metaphor into a real thinking being is harder than it looks – it certainly took me by surprise! But I just wanted to give you a basic analogy for what I’m building, so that you have something to place in your own imagination. By the way, I hesitate to mention this, but analogies are maps too!

I hope this helps. I’ll probably leave it to sink in for a while, at least as far as this blog is concerned, and start to fill in the details later, ready for my backers as promised. I really should be programming!

Introduction to an artificial mind

I don’t want to get technical right now, but I thought I’d write a little introduction to what I’m actually trying to do in my Grandroids project. Or perhaps what I’m not trying to do. For instance, a few people have asked me whether I’ll be using neural networks, and yes, I will be, but very probably not of the kind you’re expecting.

When I wrote Creatures I had to solve some fairly tricky problems that few people had thought much about before. Neural networks have been around for a long time, but they’re generally used in very stylized contexts, to recognize and classify patterns. Trying to create a creature that can interact with the world in real-time and in a natural way is a very different matter. For example, a number of researchers have used what are called randomly recurrent networks to evolve simple creatures that can live in specialized environments, but mine was a rather different problem. I wanted people to care about their norns and have some fun interacting with them. I didn’t expect people to sit around passively watching hundreds of successive generations of norns blundering around the landscape, in the hope that one would finally evolve the ability not to bump into things.

Norns had to learn during their own lifetimes, and they had to do so while they were actively living out their lives, not during a special training session. They also had to learn in a fairly realistic manner in a rich environment. They needed short- and long-term memories for this, and mechanisms to ensure that they didn’t waste neural real-estate on things that later would turn out not to be worth knowing. And they needed instincts to get them started, which was a bit of a problem because this instinct mechanism still had to work, even if the brains of later generations of norns had evolved beyond recognition. All of these were tricky challenges and it required a little ingenuity to make an artificial brain that was up to the task.

So at one level I was reasonably happy with what I’d developed, even though norns are not exactly the brightest sparks on the planet. At least it worked, and I hadn’t spent five years working for nothing. But at another level I was embarrassed and deeply frustrated. Norns learn, they generalize from their past to help them deal with novel situations, and they react intelligently to stimuli. BUT THEY DON’T THINK.

It may not be immediately obvious what the difference is between thinking and reacting, because we’re rarely aware of ourselves when we’re not thinking and yet at the same time we don’t necessarily pay much attention to our thoughts. In fact the idea that animals have thoughts at all (with the notable exception of us, of course, because we all know how special we are) became something of a taboo concept in psychology. Behaviorism started with the fairly defensible observation that we can’t directly study mental states, and so we should focus our attention solely on the inputs and outputs. We should think of the brain as a black box that somehow connects inputs (stimuli) with outputs (actions), and pay no attention to intention, because that was hidden from us. The problem was that this led to a kind of dogma that still exists to some extent today, especially in behavioral psychology. Just because we can’t see animals’ intentions and other mental states, this doesn’t mean they don’t have any, and yet many psychological and neurological models have been designed on this very assumption. Including the vast bulk of neural networks.

But that’s not what it’s like inside my head, and I’m sure you feel the same way about yours. I don’t sit here passively waiting for a stimulus to arrive, and then just react to it automatically, on the basis of a learned reflex. Sometimes I do, but not always by any means. Most of the time I have thoughts going through my mind. I’m watching what’s going on and trying to interpret it in the light of the present context. I’m worrying about things, wondering about things, making plans, exploring possibilities, hoping for things, fearing things, daydreaming, inventing artificial brains…

Thinking is not reacting. A thought is not a learned reflex. But nor is it some kind of algorithm or logical deduction. This is another common misapprehension, both within AI and among the general public. Sometimes, thinking equates to reasoning, but not most of the time. How often do you actually form and test logical propositions in your head? About as often as you perform formal mathematics, probably. And yet artificial intelligence was founded largely on the assumption that thinking is reasoning, and reasoning is the logical application of knowledge. Computers are logical machines, and they were invented by extrapolation from what people (or rather mathematicians, which explains a lot) thought the human mind was like. That’s why we talk about a computer’s memory, instructions, rules, etc. But in truth there is no algorithm for thought.

So a thought is not a simple learned reflex, and it’s not a logical algorithm. But what is it? How do the neurons in the brain actually implement an idea or a hope? What is the physical manifestation of an expectation or a worry? Where does it store dreams? Why do we have dreams? These are some of the questions I’ve been asking myself for the past 15 years or so. And that’s what I want to explore in this project. Not blindly, I should add – it’s not like I’m sitting here today thinking how cool it will be to start coming up with ideas. I already have ideas; quite specific ones. There are gaps yet, but I’m confident enough to stick my neck out and say that I have a fair idea what I’m doing.

Explaining how my theories work and what that means for the design of neural networks that can think, are things that will take some explaining. But for now I just wanted to let you know the key element of this project. My new creatures will certainly be capable of evolving, but evolution is not what makes them intelligent and it’s not the focus of the game. They’ll certainly have neural network brains, but nothing you may have learned about neural networks is likely to help you imagine what they’re going to be like; in fact it may put you at a disadvantage! The central idea I’m exploring is mental imagery in its broadest sense – the ability for a virtual creature to visualize a state of the world that doesn’t actually exist at that moment. I think there are several important reasons why such a mechanism evolved, and this gives us clues about how it might be implemented. Incidentally, consciousness is one of the consequences. I’m not saying my creatures will be conscious in any meaningful way, just that without imagery consciousness is not possible. In fact without imagery a lot of the things that AI has been searching for are not possible.

So, in short, this is a project to implement imagination using virtual neurons. It’s a rather different way of thinking about artificial intelligence, I think, and it’s going to be a struggle to describe it, but from a user perspective I think it makes for creatures that you can genuinely engage with. When they look at you, there will hopefully be someone behind their eyes in a way that wasn’t true for norns.

I’m funded!!!! Yippee!!!!

Today has been a bit thrilling, I have to say! Pledges to my Kickstarter project had begun to tail off a bit, as expected, although amazingly I was still on target to reach my goal in a couple of days. And then someone posted about it on slashdot and all my fellow geeks, many of whom happened to be leaving the Games Developer’s Conference at that moment, suddenly got to hear of it. Whoosh!

So I’m funded! My life’s work can continue! I get my chance to show you all what I’ve been thinking about this past 15 years, and I promise it’s really rather interesting.

People have already pledged more than I asked for and pledges are still coming in, so if that continues for a little while yet I’ll feel a lot more comfortable about the future and able to buy the tools I need to do a good job. It will also help plug the gap between releasing the software and seeing any new revenue from it.

Not only am I funded, but I’m funded by some incredibly nice people, who are doing it because they believe in the same things that I do, and they want to get the chance to play with the results, not because they want to make money out of me. That feels really good. When things go wrong now, as they surely will from time to time, it’ll be my fault, and not because investors are getting nervous, or people don’t deliver on time, or a publisher is interfering with the design. It may seem perverse but I’m really much happier when it’s my fault and therefore something I have control over.

Anyway, the Kickstarter period is not over yet. There are still 34 days to go! When I started I wasn’t at all sure that this would be enough; now it seems hilarious that we all have to sit here and wait! I’ll say my thanks properly after the project closes, but for now, thank you all so much for your support, whether it was (or will be) money, publicity or good wishes. Love and gratitude to my old friends and hello and thank you to my new ones.


Grandroids FAQ

I’m putting FAQs for my Kickstarter project here, so that I can add to them without bothering everyone with updates. Oh, damn! I’ve already thought of another one… So if you have a question, check here first! I’ll add a new blog category.

1. Linux: Several people have asked if I’m going to support Linux. I’m committed to using Unity3D as my graphics engine (I chose it very carefully, and I really don’t think I could make this project happen without Unity). At the moment Unity doesn’t support Linux. It does support Windows, Mac, iPhone, Android, X-Box and Wii, so it’s certainly not impossible they’ll support Linux eventually too. In fact the underlying framework is already very Linux-friendly, so it shouldn’t be too difficult if they think there’s a market. A number of Unity developers have asked for it. However, it’s not something I have any control over. If Unity offers Linux support then I’ll definitely port the game to Linux too, but I can’t do anything until/unless that happens.

2. Collaboration: People have offered to help with the project in various ways, which I’m very flattered by. Thank you. The situation is this: As far as the core engine is concerned, I have to work alone. The computational neuroscience and biology involved is very, very complex and unique, and it has an impact on almost every aspect of the code (and even the graphics). There’s no way I could do this stuff in a collaborative environment. I have to keep everything inside my head, because I’m inventing completely new things as I go, and every time one part of it changes, it has knock-on effects throughout the system. So I’m just not in a position to share the core programming with anyone. Sorry.

Having said that, I’m writing an engine, at both the computing and biological levels. It will have an open API and an open genetics, so everyone is free to write new tools, create new objects and scenes, manipulate genes, create new species, etc. and I’d be delighted if you would do that. This is my living, so I need to retain some of the action, but if you had any connection to Creatures you’ll know that I design things in such a way that people can contribute. This project will be more open than Creatures was, because the technology for it has come a long way since then. Some of this may take a while to roll out, but I’ll be publishing updates as time goes on.

3. The AI: Is it for real? Sure it’s for real! But before anyone who’s not familiar with my work gets the wrong idea, I should point out that these creatures are not going to win Jeopardy! The field I work in is biologically-inspired AI, and I make complex, realistic living organisms. Think rabbits and dogs, not Terminator or Data. Most people don’t really question the nature of intelligence much, but I can tell you, winning a game of chess is easy peasy compared to recognizing the difference between a pawn and a bishop, or picking up the chess pieces. Just because we find something easy now, after years of infant practice, it doesn’t mean it IS easy. Most AI is not real intelligence at all. Especially game AI, which is to intelligence what a portrait is to a person – a shallow imitation of the real thing. What I’m interested in is real, learned intelligence and hopefully the first glimmerings of a real mind, with desires and fears and intentions. It’s much more exciting than a pseudo-HAL.

4. Timing, features, etc. I’m banking on this taking about another year. Hopefully I’ll get enough money to go on a little longer than that and do a better job. I don’t know how long until I have alphas, betas, etc. There’s a lot of very new stuff in this project so I don’t have a precedent. I don’t know what I’ll actually be able to achieve either. I’ve found that the key is to get the biology right. Biology is an incredibly powerful toolkit, and very flexible. Get that core right and lots of happy things will fall out of it. So I don’t work in the normal way, with specifications and schedules and milestones. It cramps my style. My job is to be a good biologist and let the creatures emerge. This is all about emergence.

5. Helping out: Some of you have said you don’t have any money but you’ll spread the word. Great! Thank you! I don’t have any money either, so I quite understand. I appreciate all tweets, posts, articles, submissions, reviews… anything. Well, perhaps not holding a knife to someone and stealing their wallet, but most things. I appreciate all kinds of support, even if just good wishes. Oh, and I read every single comment, etc., so I notice and care, even if I don’t get a chance to reply personally.

6. The name: I had to pick a project name for Kickstarter, so I went with Grandroids because I like it (thanks to Andrew Lovelock for coming up with it!). But I see this as a kind of brand name to describe what I “purvey” in general terms. The game will almost certainly be called something else, but I don’t have a clue what, yet. It depends how the creatures turn out and what world they tell me they want to live in.

7. What will the creatures look like? Dunno. In my head the stars of the show are rather like orangutan babies – fairly shy, semi-bipedal, cute, slightly shadowy creatures whose confidence you have to work hard to win, but we’ll see. I’ve also had requests for tails, dragons and cute eyes. The creatures are physics-based, and that is a very demanding thing, especially since computer physics engines have some strange characteristics. The creatures’  limbs have elastic muscles and the weights of different parts of their bodies have an effect on inertia and balance. It’s quite challenging getting one that has a fair chance of learning to walk and doesn’t fall over when it glances sideways! On the upside, real physics allows real intelligence, as well as complex interactions with the world, and their motion can be quite startlingly natural, compared to animation. Animation is cheating.

8. Evolution. Just so’s you know, this is not a game about evolution. The creatures will certainly be able to evolve in a pretty sophisticated way (perhaps even the most sophisticated way ever tried), but in practice it’s not the primary focus of the game. Natural selection is VERY SLOW, and the time it takes is proportional to both the complexity of the creatures that are evolving and their life span. For these creatures to live long enough for you to get to know them and care about them means that they will evolve very slowly – not that many orders of magnitude faster than happens in the real world. Selective breeding will definitely speed this up a lot, so evolutionary changes will doubtless happen. But the most important thing is actually variation – children will inherit characteristics from both parents and so will have their own unique personalities, even if they’re often problematic ones! Evolution is there, but it’s not the point of the game. I just wanted to be sure we’re all clear on that, because most A-life projects are primarily about evolving very simple creatures with very short lifespans.

So how’s it going?

Just a short post to say that I’m going to tweet my programming journal in real-time, as I work on my new game, so if any of you are fellow Twits, feel free to follow @enchantedloom. I don’t really understand Twitter yet, and 140 characters is just not ‘me’ somehow, but it seems like a good way to keep my nose to the grindstone (or avoid any actual work, possibly) and at the same time let you guys know how things are going. I’d appreciate the company, so see you in Twit-land maybe!

Brainstorm 7: How long is now?

I worry too much. I live too far into the future; always so acutely aware of the potential distant knock-on effects of my actions that I’m sometimes quite paralyzed. On the downside this can be a real handicap, but on the upside it means I’m intelligent, because seeing into the future is what intelligence is for. But how? And how do we differentiate between past, present and future? What do we really mean by “now”?

My main thesis for this project is that the brain is a prediction machine. In other words I think it takes so long for nerve signals to reach the brain and be analyzed by it (you may be surprised to know it takes about a tenth of a second merely for signals to reach the primary visual cortex from the retina, never mind be turned into understanding), that we’d be dead by now if it weren’t for our ability to create a simulation of the world and run it ahead of time, so that we are ready for what’s about to happen instead of always reacting to what has already happened. I’m suggesting that this simulation ability derives, at least in part, from a capacity to make small predictions based on experience, at ALL levels of the nervous system. These little fragments of “if this happens then I suspect that will happen next” are there to counter processing delays and reaction times, and give us the ability to anticipate. But they also (I suggest) provide the building blocks for other, more interesting things: a) our ability to create a contextual understanding of the world – a stable sense of what is happening; b) our ability to form plans, by assembling sequences of little predictions that will get us from a starting state to a goal state; and c) our capacity for imagination, by allowing us to link up sequences of cause and effect in an open-ended way. The capacity for imagination, in turn, is what allows us to be creative and provides the virtual world in which consciousness arises and free thought (unconstrained by external events) can occur.

I rather think some clever tricks are involved, most especially the ability to form analog models of reality, as opposed to simple chains of IF/THEN statements, and the ability to generalize from one set of experiences to similar ones that have never been experienced (even to the extent that we can use analogies and metaphors to help us reason about things we don’t directly understand). But I’d say that the root of the mechanism lies in simple statistical associations between what is happening now and what usually happens next.

So let’s look at a wiring diagram for a very simple predictive machine.

This is the simple touch-sensitive creature I talked about in Brainstorm 6. The blue neurons receive inputs, from touch-sensitive nerve endings, which occurred some milliseconds ago on its skin. The red neuron shows two touch inputs being compared (in this case the cell has become tuned to fire if the right input is present just before the left input). I think we can call the red neuron an abstraction: it takes two concrete “I am being touched” inputs and creates an abstract fact – “I am being stroked leftwards here”. This abstraction then becomes an input for higher-level abstractions and so on.

The green neuron is then a prediction cell. It is saying, “if I’m being stroked leftwards at this point, then I expect to be touched here next.” Other predictions may be more conditional, requiring two or more abstractions, but in this case one abstraction is enough. The strength of the cell’s response is a measure of how likely it is that this will happen. The more often the prediction cell is firing at the moment the leftmost touch sensor is triggered, the stronger the connection will become, and the more often that this fails to happen, the weaker it will become (neurologically I’d hypothesize that this occurs due to LTP and LTD (long-term potentiation and long-term depression) in glutamate receptors, giving it an interesting nonlinear relationship to time).

So what do we DO with this prediction? I’m guessing that one consequence is surprise. If the touch sensor fires when the prediction wasn’t present, or the prediction occurs and nothing touches that sensor, then the creature needs a little jolt of surprise (purple neuron). Surprise should draw the creature’s attention to that spot, and alert it that something unexpected is happening. It may not be terribly surprising that a particular touch sensor fails to fire, but the cumulative effect of many unfulfilled predictions tells the creature that something needs to be worried about, at some level. On the other hand, if everything’s going according to expectations then no action need be taken and the creature can even remain oblivious.

But for the rest of my hypothesis to make sense, the prediction also needs to chain with other predictions. We need this to be possible so that top-down influences (not shown on the diagram) can assemble plans and daydreams, and see far into the future. But I believe there has to be an evolutionary imperative that predates this advanced capacity, and I’d guess that this is the need to see if a trend leads ultimately to pain or pleasure (or other changes in drives). Are we being stroked in such a way that it’s going to hurt when the stimulus reaches a tender spot? Or is the moving stimulus a hint that some food is on its way towards our mouth, which we need to start opening?

Now here comes my problem (or so I thought): In the diagram I’m assuming that the prediction gets mixed with the sensory signal (the green axon leading into the blue cell) so that predictions act like sensations. This way, the organism will react as if the prediction came true, leading to another prediction, and another. Eventually one of these predictions will predict pleasure or pain.

[Technical note: Connectionists wouldn’t think this way. They’d assume that pleasure/pain are back-propagated during learning, such that this first prediction neuron already “knows” how much pleasure or pain is likely to result further down the line, since this fact is stored in its synaptic weight(s). I’m not happy with this. For one thing, thinking is never going to arise in such a system, because it’s entirely reactive. Secondly (and this is perhaps why brains DO think), the reward value for this prediction is likely to be highly conditional upon other active predictions. This isn’t obvious in such a simple model, but in a complete organism the amount of pleasure/pain that ultimately results may depend very heavily on what else is going on. It may depend on the nature of the touch, or have its meaning changed radically by the context the creature is in (is it being threatened or is something having sex with it?). It’s therefore not possible to apportion a fixed estimate of reward by back-propagating it through the network. That sort of thing works up to a point in an abstract pattern-recognition network like a three-layer perceptron, but not in a real creature. In my humble opinion, anyway!]

Oh yes, my problem: So, if a prediction acts as if it were a sensation (and this is the only way it can make use of the subsequent (red) abstraction cells in order to make further predictions) then how does the organism know the difference between what is happening and what it merely suspects will happen??? If all these predictions are chained together, the creature will feel as if everything that might happen next already is happening.

This has bugged me for the past few days. But this morning I came to a somewhat counter-intuitive conclusion, which is that it really doesn’t matter.

What does “now” actually mean? We think of it as the infinitesimal boundary between past and future; between things that are as yet unknown and our memories. But now is not infinitesimal. I realized this in the shower. I was looking at the droplets of water spraying from the shower-head and realized that I can see them. This perhaps won’t surprise you, but it did me, because I’ve become so conditioned now to the view that the world I’m aware of is actually a predictive simulation of reality, not reality itself. This HAS to be true (although now is not the time to discuss it). And yet here I was, looking at actual reality. I wasn’t inventing these water droplets and I couldn’t predict their individual occurrence. Nor was the information merely being used to synchronize my model and keep my predictions in line with how things have actually turned out – I was consciously aware of each individual water droplet.

But I was looking at water that actually came out of my shower-head over a tenth of a second ago; maybe far longer. By the time the signals had caused retinal ganglion cells to fire, zoomed down my optic nerve, chuntered through my optic chiasm and lateral geniculate nucleus, and made their tortuous and mysterious way through my cortex, right up to the level of conscious awareness, those droplets were long gone. So I was aware of the past and only believed I was aware of the present. (In fact, just to make it more complex, I think I was aware of several pasts – the moment at which I “saw” the droplets was different from the moment that I knew that I’d seen the droplets.)

Yet at the same time, I was demonstrably aware of an anticipated present, based upon equally retarded but easier to extrapolate facts. I wasn’t simply responding to things that happened a large fraction of a second ago. If a fish had jumped out of the shower-head I’d certainly have been surprised and it would have taken me a while to get to grips with events, but for the most part I was “on top of the situation” and able to react to things as they were actually happening, even though I wouldn’t find out about them until a moment later. I was even starting bodily actions in anticipation of future events. If the soap had started to slip I’d have begun moving so that I could catch it where it was about to be, not where it was when I saw it fall. But for the most part my anticipations exactly canceled out my processing delays, so that, as far as I knew, I was living in the moment.

So I was simultaneously aware of events that happened a fraction of a second ago, as if they were happening now; events that I believed were happening now, even though I wouldn’t get confirmation of them for another fraction of a second; and events that hadn’t even happened yet (positioning my hands to catch the soap in a place it hadn’t even reached). ALL of these were happening at once, according to my brain; they all seemed like “now”.

Perhaps, therefore, these little predictive circuits really do act as if they are sensations. Perhaps the initial sensation is weak, and the predictions (if they are confident) build up to create a wave of activity whose peak is over a touch neuron that won’t actually get touched until some time in the future. Beyond a certain distance, the innate uncertainty or conditionality of each prediction would prevent the wave from extending indefinitely. Perhaps this blurred “sensation” is what we’re actually aware of. Perhaps for touch there’s an optimum distance and spread. In general, the peak of the wave should lie over the piece of skin that will probably get touched X milliseconds into the future, where X is the time it takes for an actual sensation to reach awareness or trigger an appropriate response. But it means the creature’s sense of “now” is smeared. Some information exists before the event; some reaches awareness at the very moment it is (probably) actually happening; the news that it DID actually happen arrives some time later. All of this is “now.”

Or perhaps not. After all, if I imagine something happening in my mind, it happens more or less in real time, as a narrative. I don’t see the ghosts of past, present and future superimposed. This, though, may be due to the high-level selection process that is piecing together the narrative. Perhaps the building blocks can only see a certain distance into the future. Primitive building blocks, like primary sensations, only predict a few milliseconds. Highly abstract building blocks, like “we’re in a bar; someone is offering me a drink” predict much further into the future, but only in a vague way. To “act out” what actually happens, these abstractions need to assemble chains of more primitive predictions to fill in the details, and so the brain always has to wait and see what happens in its own story, before initiating the next step. I’m not at all sure about this, but I can’t see any other way to assemble a complex, arbitrarily detailed, visual and auditory narrative inside one’s head without utilizing memories of how one thing leads to another at a wide range of abstractions. These memories have to have uses beyond conscious, deliberate thought, and so must be wired into the very process of perception. And in order for them to be chained together, the predicted outcomes need to behave as if they were stimuli.

I’m going to muse on this some more yet. For instance I have a hunch that attention plays a part in how far a chain of predictions can proceed (while prediction in turn drives attention), and I haven’t even begun to think about precisely how these simulations can be taken offline for use as plans or speculations, or precisely how this set-up maps onto motor actions (in which I believe intentions are seen as a kind of prediction). But this general architecture of abstractions and predictions is beginning to look like it might form the basis for my artificial brain. Of course there’s an awful lot of twiddly bits to add, but this seems like it might be a rough starting point from which to start painting in some details, and I have to start somewhere. Preferably soon.

Brainstorm 6: All change

In my last Brainstorming session I was musing on associations and asked myself what is being associated with what, that enables a brain to make a prediction (and hence perform simulations). A present state is clearly being associated with the state that tends to follow it, but what does that mean? It’s obvious for some forms of information but a lot less obvious for others and for the general case. Learning that one ten-million-dimension vector tends to follow another is neither practical nor intelligent – it doesn’t permit generalization, which is essential. Something more compact and meaningful is happening.

If the brain is to be able to imagine things, there must be a comprehensive simulation mechanism, capable of predicting the future state in any arbitrary scenario (as long as it’s sufficiently familiar). If I imagine a coffee cup in my hand and then tilt my imaginary hand, the cup falls. I can even get a fair simulation of how it will break when it hits the floor. If I imagine myself talking to someone, we can have a complete conversation that matches the kinds of thing this person might say in reality – I have a comprehensive simulation of their own mind inside mine. It’s comparatively easy to see how a brain might predict the future position of a moving stimulus on the retina, but a lot less obvious how this more general kind of simulation works. Coffee cups don’t have information about how they fall built into their properties, nor do they fall on a whim. Somehow it’s the entirety of the situation that matters – the interaction of cup and hand – and knowledge of falling objects in general (as well as the physical properties of pottery) somehow gets transferred automatically into the simulation as needed.

Pierre-Simon Laplace once said: “An intellect which at a certain moment would know all forces that set nature in motion, and all positions of all items of which nature is composed … the future just like the past would be present before its eyes.” In other words, if you know the current state of the universe precisely then you can work out its state at any time in the future. He wasn’t entirely right, as it happens – if Laplace was himself that intellect, then he would also be part of the universe, and so the act of gathering the data would change some of the data he needed to gather. He could never have perfect knowledge. And we know now that the most infinitesimal inaccuracy will magnify very rapidly until the prediction is out of whack with reality. But even so, in practical terms determinism works. If our artificial brain knew everything it was capable of knowing about the state of its region of the universe (in other words, the value of a ten-million-dimensional vector) then it would have enough knowledge to make a fair stab at the value of this vector a short while later. If that weren’t true, intelligence wouldn’t be possible.

But Laplace had a very good point when he mentioned “all forces that set nature in motion.” It’s not just the state of the world that matters, but the rate and direction of change. It’s an interesting philosophical question, how an object can embody a rate of change at an instant in time (discuss!). It has a momentum, but that’s dodging the issue. Nevertheless, change is all-important, and real brains are far more interested in change than they are in static states. In fact they’re more-or-less blind to things that don’t change – quite literally. If you can hold your eyes perfectly still when focusing on a fixed point, you’ll go temporarily blind in a matter of seconds! Try it – it’s not easy but it can be done with practice and it’s quite startling.

Getting preoccupied with recognizing objects, etc. fails to help me with this question of prediction, and vision is misleading because it’s essentially a movement-detection system that has been heavily modified by evolution to make it possible to establish facts about things that aren’t moving. The static world is essentially transformed into a moving one (e.g. through microsaccades) before being analyzed in ways we don’t understand and may never be able to, unless we understand how change and prediction are handled more generally. So how about our tactile sense? Maybe that’s a good model to think about for a while?

Ok, I’ll start with a very simple creature – a straight line, with touch sensors along its surface. If I touch this creature with my finger one of the sensors will be triggered (because its input has changed), but will soon become silent again as the nerve ending habituates. At this point the creature can make a prediction, but not a very useful one: my finger might move left or it might move right. It can’t tell which at first, but if my finger starts to move left, it can immediately predict where it’s going to go next. It’s easy to imagine a neuron connected to a pair of adjacent sensors, which will fire when one sensor is triggered before the other.

Eureka! We have a prediction neuron – it knows that the third sensor in the line is likely to be triggered shortly. In fact we can imagine a whole host of these neurons, tuned to different delays and hence sensitive to speed. Each one can make a prediction about which other sensors are likely to be touched within a given period. We can imagine each neuron feeding some kind of information back down to the sensor that it is predicting will be touched. The neurons have a memory of the past, which they can compare to the present in order to establish future trends. The more abstract this memory, the more we can describe it as forming our present context. Context is all-important. If you’ve ever woken from a general anesthetic, you’ll know that it takes a while to re-establish a context – who you are, where you are, how you got there – and until you have this you can’t figure out what’s likely to happen next.

So far, so good. We have a reciprocal connection of the kind that seems to be universal in the brain. We can imagine a further layer of neurons that listen to these simpler neurons and develop a more general sense of the direction and speed of movement, which is less dependent on the actual location of the stimulus. By the time we get a few layers deep, we have cells that can tell us if the stroking of my finger is deviating from a straight line (well, we could if my simplified creature wasn’t one-dimensional!).

But what’s the point of feeding back this information to the sensory neurons themselves? The first layer of cells is telling specific sensory neurons to expect to be touched in a few milliseconds. Big deal – they’ll soon find out anyway. Nevertheless, two valuable pieces of information come out of this prediction:

Firstly, if a sensory neuron is told to expect a touch and it doesn’t arrive, we want our creature to be surprised. Things that just behave according to expectations can usually be safely ignored, and we only want to be alerted to things that don’t do what we were expecting. Surprise gives us a little shock – it causes a bunch of physiological responses. We may get a little burst of adrenaline, to prepare us in case we need to act, and our other sensory systems get alerted to pay more attention to the source of the unexpected change (this is called an “orienting response”). Neurons higher up in the system are thus primed and able to make decisions about what, if anything, to do about this unexpected turn of events. The shock will ripple up the system until something finally knows what to do about that sort of thing. Most of the time this will be an unconscious response (like when we flick an insect off our arm) but sometimes nothing will know how to deal with this, and consciousness needs to get in on the act.

Secondly, once we have a hunch about where the stimulus is going to show up next, we can start to look further ahead to where it is likely to be heading. The more often our low-level predictions are confirmed, the more confident we can be, and the more time we’ve had in which to make this ripple of predictive activity travel ahead of the stimulus, to figure out what might happen in a few moments’ time. Perhaps my finger is stroking along the creature towards a tender spot that will hurt it; perhaps it’s moving in the other direction, towards the creature’s mouth, where it has a hope of eating my finger. Pain or pleasure get predicted, and behavior results whenever one or the other seems likely.

We have to presume that all of this stuff wires itself up through experience – by association. The first layer of sensory neurons learns when the sensor it is associated with is about to be touched, by understanding statistical relationships between the states of neighboring sensors. These first-level neurons presumably cooperate and compete with each other to ensure that each one develops a unique tuning and all possible circumstances get represented (this is exactly homologous, IMHO, to what happens in primary visual cortex, with edge-orientation/motion-sensitive neurons). The higher layers, which make longer-term predictions, learn to associate certain patterns of movement with pain or pleasure. The most abstract layers are presumably capable of learning that certain responses maximize pleasure or minimize pain.

Leaving aside the question of how these responses get coordinated, we now have a complete behavioral mechanism. And it’s NOT a stimulus-response system. The behavior is being triggered by predictions of what is about to happen, not what has just happened (this is a moot point and you may object that the system is still responding to the past stimuli, but I think an essential threshold has been crossed here and it’s fair to call this an anticipatory mechanism).

It’s clear that somehow the prediction needs to be compared to reality, and surprise should be generated if they don’t match, and it’s clear that predictions need to be able to associate themselves with reward. Somehow predictions also need to take part in servo action – actions are goal-directed, and hence are themselves predictions of a future state. Comparing what your sensors predict is going to happen, to what you intend to happen, is what allows you to make anticipatory changes and bring reality into line with your intentions. I need to think about that a bit, though.

But what about the ability to use this predictive mechanism to imagine possible futures? We presumably now have the facility to imagine a high-level construct, such as “let’s suppose I’m feeling someone stroke my skin” and actually feel the stroke occurring, as these higher-level neurons pass down their predictions to lower levels at which individual touch sensors are told to expect/pretend they’ve been stimulated. Although obviously this time we shouldn’t be surprised when nothing happens! The surprise response needs to be suppressed, and somehow the predictions ought to stand in for the sensations. That has implications for the wiring and all sorts of questions remain unresolved here.

It’s much harder, though, to see how we can assemble an entire context in our heads – the hand and the coffee cup, say. Coffee cups only fall when hands drop them. Dropping something only occurs when a hand is placed at a certain set of angles. A motor action is associated with a visual change, but only in a particular class of contexts, and the actual visual change is also highly context-dependent: If a cup was in your hand, that’s what you’ll see fall. Remarkably, if you imagine holding a little gnome in your hand instead, what you’ll see is a falling gnome, not a falling cup, even if you’ve never actually dropped a minuscule fantasy creature before in your life! In fact your imaginary gnome may even surprise you by leaping to safety! Somehow the properties of objects are able to interact in a highly generalizable way, and these interactions can trigger mental imagery, which eventually trickles down to the actual sensory system as if they’d really occurred (there are several lines of evidence to suggest that when we imagine something we “see” it using the same parts of our visual system that would be active if we’d really seen it).

Somehow the brain encodes cause and effect, at many levels, in a generalizable way. Complex chains of inference occur when we mentally decide to rotate our hand and see what happens to the thing it was holding, and the ability to make these inferences must arise from statistical learning that is designed to predict future states from past ones.

And somehow I have to come up with just such a general scheme, but at a level of abstraction suitable for a game. My creatures are not going to be covered in touch sensors or see the world in terms of moving colored pixels. It’s a shame really, because I understand these things at the low level – it’s the high level that still eludes me…

P.S. This post got auto-linked to a post on the question of why we can’t tickle ourselves (I’m assuming you’re not schizophrenic here, or you won’t know what I’m talking about, because you can!). We can’t tickle ourselves because our brain knows the difference between things we do and things that get done to us (self/non-self determination). If we try to tickle ourselves, we predict there will be a certain sensation and this prediction is used to cancel out the actual sensation. It’s pretty important for an organism to differentiate between things it does to the world and things the world does to it (bumping into something feels the same as being bumped into, but the appropriate responses are different). So here’s another pathway that requires anticipation, and another example of the brain as a simulation engine.