Growing Neural Cellular Automata
machine learning deep learning cellular automata game of life conway google distill interactive colab local global update
The Game of Life on steroids! This model learns to grow complex patterns in an entirely local way. Each cell is trained to listen to its neighbors and update itself in a way such that, collectively, an overall goal is reached. Fascinating and interactive!

https://distill.pub/2020/growing-ca/
https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life

Abstract:
Most multicellular organisms begin their life as a single egg cell - a single cell whose progeny reliably self-assemble into highly complex anatomies with many organs and tissues in precisely the same arrangement each time. The ability to build their own bodies is probably the most fundamental skill every living creature possesses. Morphogenesis (the process of an organism’s shape development) is one of the most striking examples of a phenomenon called self-organisation. Cells, the tiny building blocks of bodies, communicate with their neighbors to decide the shape of organs and body plans, where to grow each organ, how to interconnect them, and when to eventually stop. Understanding the interplay of the emergence of complex outcomes from simple rules and homeostatic 1 feedback loops is an active area of research. What is clear is that evolution has learned to exploit the laws of physics and computation to implement the highly robust morphogenetic software that runs on genome-encoded cellular hardware.

This process is extremely robust to perturbations. Even when the organism is fully developed, some species still have the capability to repair damage - a process known as regeneration. Some creatures, such as salamanders, can fully regenerate vital organs, limbs, eyes, or even parts of the brain! Morphogenesis is a surprisingly adaptive process. Sometimes even a very atypical development process can result in a viable organism - for example, when an early mammalian embryo is cut in two, each half will form a complete individual - monozygotic twins!

The biggest puzzle in this field is the question of how the cell collective knows what to build and when to stop. The sciences of genomics and stem cell biology are only part of the puzzle, as they explain the distribution of specific components in each cell, and the establishment of different types of cells. While we know of many genes that are required for the process of regeneration, we still do not know the algorithm that is sufficient for cells to know how to build or remodel complex organs to a very specific anatomical end-goal. Thus, one major lynch-pin of future work in biomedicine is the discovery of the process by which large-scale anatomy is specified within cell collectives, and how we can rewrite this information to have rational control of growth and form. It is also becoming clear that the software of life possesses numerous modules or subroutines, such as “build an eye here”, which can be activated with simple signal triggers. Discovery of such subroutines and a mapping out of the developmental logic is a new field at the intersection of developmental biology and computer science. An important next step is to try to formulate computational models of this process, both to enrich the conceptual toolkit of biologists and to help translate the discoveries of biology into better robotics and computational technology.

Imagine if we could design systems of the same plasticity and robustness as biological life: structures and machines that could grow and repair themselves. Such technology would transform the current efforts in regenerative medicine, where scientists and clinicians seek to discover the inputs or stimuli that could cause cells in the body to build structures on demand as needed. To help crack the puzzle of the morphogenetic code, and also exploit the insights of biology to create self-repairing systems in real life, we try to replicate some of the desired properties in an in silico experiment.

Authors: Alexander Mordvintsev, Ettore Randazzo, Eyvind Niklasson, Michael Levin

Links:
YouTube: https://www.youtube.com/c/yannickilcher
Twitter: https://twitter.com/ykilcher
BitChute: https://www.bitchute.com/channel/yannic-kilcher
Minds: https://www.minds.com/ykilcher
 Hi there. Today I thought we would be looking at growing neural cellular automata, which is an article on distill.pub, which I found pretty neat. So this is kind of an interactive article. If you don't know distill.pub, check it out. It is a cool new concept as an alternative to the classical journals or the conference system. So what it allows you to do is to kind of write articles that are a bit more interactive, a bit more engaging and don't have the... There's no PDFs, there's no pages, there are animations and so on. So I thought we'd be looking at this article today, which is kind of a growing neural cellular automata. So if you don't know what cellular automata are, this is a very kind of old concept. The most famous one is called the game of life, where you have these cells. Here you can see every pixel is a cell and they follow some kind of update rule. And usually it's the update rule, something like if my neighbor is alive, I'm going to be alive as well in the next time step. Or if enough neighbors are alive and if only very few neighbors are alive, I'm going to die. So this gives rise to these kinds of patterns. And here the same is done with color. And the update rules are a bit more complicated. So basically, ah, traveler. Oh, nice. Okay. So in the game of life, if you play it, the most prestigious thing to get is are these kind of travelers. I've not... This is the first time I've managed to do this in this thing. So what does it do? So each pixel here is kind of an autonomous thing that is only allowed to look at its neighbors in order to decide whether or not in the next time step it is going to be alive. Look, it's like incorporating again. So each cell looks at its neighbors and then decides what its next state will be. And here it's not only alive or dead. Dead would be white and alive would be anything else. But it is also, I guess this white is... It is also the color. So each cell decides on what color it should have. And then this is a live thing. So it kind of reproduces, right? You can see if I start it new. If you double click here, it grows from somewhere else. And this is completely local. So these cells really only look at their neighbors. That's the special part, right? They don't look at the global structure. It's not like a GAN that can look at the entire picture and decide what's still missing. What these can also do if you destroy part of it, they can kind of grow back just, again, just out of local update rules at the level of the individual cells and their neighbors. They're trained to do these big structures. So let's look at how they do it. So basically, here's how they model a cell. And let's go over here. So each cell, as I said, is made up of 16 channels. And here it's modeled as three by three, but I think each cell is really one pixel. And each cell is allowed to look at its eight neighbors, right? So each cell is allowed to look at its eight neighbors across 16 different channels. And the 16 channels here mean the first three are RGB. So this is the actual color that is seen. Then there is an alive or dead channel. So what they call an alpha channel. So if this channel is high, the cell is considered alive. Otherwise, it is considered dead and not part of the pattern. So a cell can come alive or die, depending on its neighbors. And then the rest, the rest 12 channels are what they call hidden channels. So the cell is allowed to encode some hidden state there. So there's each cell is represented by the 16 dimensional vector, which is not much right. And then each cell is allowed to look at three things. So from the bottom here, it's allowed to look at its own state, so at its own 16 dimensional vectors, and it is allowed to look at its neighbors. And it does this by doing a convolution with a sobel filter. And the sobel filter is simply a fixed filter that you do a three by three convolution with, as you can see here, is basically a gradient filter. So basically measures the difference between what's to the left of the cell and what's to the right of the cell. And here in the sobel y direction, the same in the y direction. So it's basically allowed to look at gradients in states of its neighbors. This is modeled after real cells kind of looking at chemical gradients in their neighborhoods. So this is all this, this is all that the cell has to decide what it's supposed to do next, right. And what we want is we want that each individual cell only looking at its neighbors produces in total, they will produce these kind of very complex pattern. So the update rule is the following, you convolute with the sobel filters and you take the cell identity, you put this all into a vector, you put it through a very, very small neural network. So this is one dense layer, one relu, and then another dense layer to get the next 16 dimensional vector, which is the next state. And that defines your update rules. That doesn't really define the next state that defines the Delta to the next state, kind of like a residual neural network. So basically, which cells need to come alive in the next time step, which cells need to die and how are they to change their colors, right. And then you get the output of the next step, right. So that's, that's basically the entire thing. So all that is learned here is the the update rule of the neural network, right. So basically, the neural network decides, it looks at a cell and its neighbors and decides what the information in the cell in the next step should be, right. And you do this for multiple time steps. That's I actually want to go down here, you do this for multiple time steps, the initial state is simply one cell that is alive here in the middle, everything else is dead, this cell is alive and black, you do this for many steps, right. And then at some point, you get an output. And you compare the output to your desired output, you compute a loss that is differentiable. And because your update rule is differentiable, and your loss is differentiable, you can backprop through time to the original pattern here. And you can basically learn this update rule by backproping through time. This is a bit like an LSTM. And if you see in the architecture here, I think this residual connection is really the key to making this work over time. Because usually, I would not expect something like this to easily emerge over time because you have the problem of vanishing and exploding gradients. And you have no way of mitigating this problem here, this problem here in this simple neural network. But in any case, they backprop through time here. So each of these update steps, which again, this isn't one neural network with many layers, this is the same neural network applied over and over and over and over again, and then there is a loss computed. So basically, the gradients will accumulate over these steps, and they tell the network what it needs to adjust to go from this one single black pixel to this final desired state. If you do this over and over again, you learn things, you learn a update rule that will give rise to that pattern, hopefully. Now, here is a kind of an illustration of this alive and dead thing. So what they do is they consider cells that have an alpha channel, one of these channels called alpha, they have an alpha channel above 0.1, it's considered alive, right, and part of the loss. Then the neighbors, the neighbors of these cells that are below 0.1, but are neighboring a cell that is mature, alive, they're called growing, they're also part of the loss, right. So simply by being close to something, someone that is alive, a cell that is alive, you are considered alive as well, but your neighbors aren't, right, only the neighbors of really alive. So there's really alive, kind of alive, and then there is dead. And dead, the meaning of dead here, the gray ones, is they're not, they won't become part of the pattern, part of the loss, right, they're dead. All right, so what will this get you initially? So here is an animation, if they train this just like that, just back up through time with a target pattern, and then they let it run, you see these patterns actually emerge. So that's pretty cool. But then if you let them run for longer than they've been trained, you basically have no guarantees on what's going to happen. Like these update rules are simply trained to achieve the pattern within a certain number of steps, right. If you run for more than that, and apply the update rules for longer than that, you you have like there's little like you have no guarantee what's going to happen, these update rules will simply continue, as you can see here and produce some weird stuff. So they are trying to fix this. So what they do is basically they train for longer, but they do it in a in a kind of different way. So at each at each step of training, and as a step, I mean, a batch over these number of time steps. So so they sample a batch, initially, it's just all black pixels, right, as we see above. And then they optimize for these number of time steps. And then they're at the end. So what they do is they don't always start from the black pixel. But sometimes they also start from a previously seen end state. So basically, they take the end state of a previous training run, and then they just continue from that instead of starting from the initial point. And you see after some training, they get better and better. So initially, you see the thing on the left here. The thing on the left here being a starting state. And then it progressively gets better. So basically, by starting from end states of other things, you learn to. So if the end state of the other thing isn't very good, you basically learn to go to the good pattern to the pattern you want. But of course, over time, there's going to be more and more of these end states that you train from that are already pretty close to the pattern you want. And so then what that means is you learn to reproduce the pattern. So you are already at a good point, you learn to stay at that good point. And then that enables you to basically learn update rules that if you're not at the pattern you want, they go towards the pattern you want. But also if you run for longer, if you are already are at the pattern you want, then you stay at the pattern you want. So that's what we basically saw in the very initial demonstration where you could, this is a live demonstration like this thing up here, this is a live, this is running, right. And you see the update rules data, they are continuously applied, they basically stay at the pattern where they are. And that is also that is learned because of this protocol that you train from end states as well as from beginning states. So the next thing is what I'm doing here is I can destroy part of the pattern, and it will kind of regrow right you see that here. So this is also a part so for now we've also only learned to go from a single pixel like here from a black pixel to the pattern. But now we also want to learn to go to regrow when destroyed because that is, you can see this is modeled after kind of live tissue. So here you can see the parts are cut away and then the cells try to regrow. So this is I think initially, this is initially when you just train them, they exhibit some of that property, but not like very satisfying in some cases. So what they do is they train not only do they use end states, like we saw before, but also some of their training samples are simply the pattern destroyed a bit. So as you can see in some of these samples, like these here, they in each sample, they kind of cut out part of the sample and they train the update rules to regrow that part that gives you that now gives you the ability to if you damage to pretty consistently regrow the pattern, as you can see here. And they also train for rotation, which is non trivial if you have these kind of pixel based, pixel based models. But I want to jump that because I want to keep it kind of short here. So the entire goal of this is to kind of model the behavior of natural cells, because the natural cells, they don't have an overarching view, they only have the view of their neighbors, right, and they are able to grow into very complex structures. I invite you to give this a try. The distilled out pop journal is very cool. It's very interactive, you can play around with it, you can reproduce things in a collab. And yeah, shout out to the authors here, Alexander Morbintsev, Ettore Randazzo, Evan Nicholson and Michael Levin. Yeah, that was it from me. Thanks for watching and bye bye.
 Hi there. Today I thought we would be looking at growing neural cellular automata, which
 is an article on distill.pub, which I found pretty neat. So this is kind of an interactive
 article. If you don't know distill.pub, check it out. It is a cool new concept as an alternative
 to the classical journals or the conference system. So what it allows you to do is to
 kind of write articles that are a bit more interactive, a bit more engaging and don't
 have the... There's no PDFs, there's no pages, there are animations and so on. So I thought
 we'd be looking at this article today, which is kind of a growing neural cellular automata.
 So if you don't know what cellular automata are, this is a very kind of old concept. The
 most famous one is called the game of life, where you have these cells. Here you can see
 every pixel is a cell and they follow some kind of update rule. And usually it's the
 update rule, something like if my neighbor is alive, I'm going to be alive as well in
 the next time step. Or if enough neighbors are alive and if only very few neighbors are
 alive, I'm going to die. So this gives rise to these kinds of patterns. And here the same
 is done with color. And the update rules are a bit more complicated. So basically, ah,
 traveler. Oh, nice. Okay. So in the game of life, if you play it, the most prestigious
 thing to get is are these kind of travelers. I've not... This is the first time I've managed
 to do this in this thing. So what does it do? So each pixel here is kind of an autonomous
 thing that is only allowed to look at its neighbors in order to decide whether or not
 in the next time step it is going to be alive. Look, it's like incorporating again. So each
 cell looks at its neighbors and then decides what its next state will be. And here it's
 not only alive or dead. Dead would be white and alive would be anything else. But it is
 also, I guess this white is... It is also the color. So each cell decides on what color
 it should have. And then this is a live thing. So it kind of reproduces, right? You can see
 if I start it new. If you double click here, it grows from somewhere else. And this is
 completely local. So these cells really only look at their neighbors. That's the special
 part, right? They don't look at the global structure. It's not like a GAN that can look
 at the entire picture and decide what's still missing. What these can also do if you destroy
 part of it, they can kind of grow back just, again, just out of local update rules at the
 level of the individual cells and their neighbors. They're trained to do these big structures.
 So let's look at how they do it. So basically, here's how they model a cell. And let's go
 over here. So each cell, as I said, is made up of 16 channels. And here it's modeled as
 three by three, but I think each cell is really one pixel. And each cell is allowed to look
 at its eight neighbors, right? So each cell is allowed to look at its eight neighbors
 across 16 different channels. And the 16 channels here mean the first three are RGB. So this
 is the actual color that is seen. Then there is an alive or dead channel. So what they
 call an alpha channel. So if this channel is high, the cell is considered alive. Otherwise,
 it is considered dead and not part of the pattern. So a cell can come alive or die,
 depending on its neighbors. And then the rest, the rest 12 channels are what they call hidden
 channels. So the cell is allowed to encode some hidden state there. So there's each cell
 is represented by the 16 dimensional vector, which is not much right. And then each cell
 is allowed to look at three things. So from the bottom here, it's allowed to look at its
 own state, so at its own 16 dimensional vectors, and it is allowed to look at its neighbors.
 And it does this by doing a convolution with a sobel filter. And the sobel filter is simply
 a fixed filter that you do a three by three convolution with, as you can see here, is
 basically a gradient filter. So basically measures the difference between what's to
 the left of the cell and what's to the right of the cell. And here in the sobel y direction,
 the same in the y direction. So it's basically allowed to look at gradients in states of
 its neighbors. This is modeled after real cells kind of looking at chemical gradients
 in their neighborhoods. So this is all this, this is all that the cell has to decide what
 it's supposed to do next, right. And what we want is we want that each individual cell
 only looking at its neighbors produces in total, they will produce these kind of very
 complex pattern. So the update rule is the following, you convolute with the sobel filters
 and you take the cell identity, you put this all into a vector, you put it through a very,
 very small neural network. So this is one dense layer, one relu, and then another dense
 layer to get the next 16 dimensional vector, which is the next state. And that defines
 your update rules. That doesn't really define the next state that defines the Delta to the
 next state, kind of like a residual neural network. So basically, which cells need to
 come alive in the next time step, which cells need to die and how are they to change their
 colors, right. And then you get the output of the next step, right. So that's, that's
 basically the entire thing. So all that is learned here is the the update rule of the
 neural network, right. So basically, the neural network decides, it looks at a cell and its
 neighbors and decides what the information in the cell in the next step should be, right.
 And you do this for multiple time steps. That's I actually want to go down here, you do this
 for multiple time steps, the initial state is simply one cell that is alive here in the
 middle, everything else is dead, this cell is alive and black, you do this for many steps,
 right. And then at some point, you get an output. And you compare the output to your
 desired output, you compute a loss that is differentiable. And because your update rule
 is differentiable, and your loss is differentiable, you can backprop through time to the original
 pattern here. And you can basically learn this update rule by backproping through time.
 This is a bit like an LSTM. And if you see in the architecture here, I think this residual
 connection is really the key to making this work over time. Because usually, I would not
 expect something like this to easily emerge over time because you have the problem of
 vanishing and exploding gradients. And you have no way of mitigating this problem here,
 this problem here in this simple neural network. But in any case, they backprop through time
 here. So each of these update steps, which again, this isn't one neural network with
 many layers, this is the same neural network applied over and over and over and over again,
 and then there is a loss computed. So basically, the gradients will accumulate over these steps,
 and they tell the network what it needs to adjust to go from this one single black pixel
 to this final desired state. If you do this over and over again, you learn things, you
 learn a update rule that will give rise to that pattern, hopefully. Now, here is a kind
 of an illustration of this alive and dead thing. So what they do is they consider cells
 that have an alpha channel, one of these channels called alpha, they have an alpha channel above
 0.1, it's considered alive, right, and part of the loss. Then the neighbors, the neighbors
 of these cells that are below 0.1, but are neighboring a cell that is mature, alive,
 they're called growing, they're also part of the loss, right. So simply by being close
 to something, someone that is alive, a cell that is alive, you are considered alive as
 well, but your neighbors aren't, right, only the neighbors of really alive. So there's
 really alive, kind of alive, and then there is dead. And dead, the meaning of dead here,
 the gray ones, is they're not, they won't become part of the pattern, part of the loss,
 right, they're dead. All right, so what will this get you initially? So here is an animation,
 if they train this just like that, just back up through time with a target pattern, and
 then they let it run, you see these patterns actually emerge. So that's pretty cool. But
 then if you let them run for longer than they've been trained, you basically have no guarantees
 on what's going to happen. Like these update rules are simply trained to achieve the pattern
 within a certain number of steps, right. If you run for more than that, and apply the
 update rules for longer than that, you you have like there's little like you have no
 guarantee what's going to happen, these update rules will simply continue, as you can see
 here and produce some weird stuff. So they are trying to fix this. So what they do is
 basically they train for longer, but they do it in a in a kind of different way. So
 at each at each step of training, and as a step, I mean, a batch over these number of
 time steps. So so they sample a batch, initially, it's just all black pixels, right, as we see
 above. And then they optimize for these number of time steps. And then they're at the end.
 So what they do is they don't always start from the black pixel. But sometimes they also
 start from a previously seen end state. So basically, they take the end state of a previous
 training run, and then they just continue from that instead of starting from the initial
 point. And you see after some training, they get better and better. So initially, you see
 the thing on the left here. The thing on the left here being a starting state. And then
 it progressively gets better. So basically, by starting from end states of other things,
 you learn to. So if the end state of the other thing isn't very good, you basically learn
 to go to the good pattern to the pattern you want. But of course, over time, there's going
 to be more and more of these end states that you train from that are already pretty close
 to the pattern you want. And so then what that means is you learn to reproduce the pattern.
 So you are already at a good point, you learn to stay at that good point. And then that
 enables you to basically learn update rules that if you're not at the pattern you want,
 they go towards the pattern you want. But also if you run for longer, if you are already
 are at the pattern you want, then you stay at the pattern you want. So that's what we
 basically saw in the very initial demonstration where you could, this is a live demonstration
 like this thing up here, this is a live, this is running, right. And you see the update
 rules data, they are continuously applied, they basically stay at the pattern where they
 are. And that is also that is learned because of this protocol that you train from end states
 as well as from beginning states. So the next thing is what I'm doing here is I can destroy
 part of the pattern, and it will kind of regrow right you see that here. So this is also a
 part so for now we've also only learned to go from a single pixel like here from a black
 pixel to the pattern. But now we also want to learn to go to regrow when destroyed because
 that is, you can see this is modeled after kind of live tissue. So here you can see the
 parts are cut away and then the cells try to regrow. So this is I think initially, this
 is initially when you just train them, they exhibit some of that property, but not like
 very satisfying in some cases. So what they do is they train not only do they use end
 states, like we saw before, but also some of their training samples are simply the pattern
 destroyed a bit. So as you can see in some of these samples, like these here, they in
 each sample, they kind of cut out part of the sample and they train the update rules
 to regrow that part that gives you that now gives you the ability to if you damage to
 pretty consistently regrow the pattern, as you can see here. And they also train for
 rotation, which is non trivial if you have these kind of pixel based, pixel based models.
 But I want to jump that because I want to keep it kind of short here. So the entire
 goal of this is to kind of model the behavior of natural cells, because the natural cells,
 they don't have an overarching view, they only have the view of their neighbors, right,
 and they are able to grow into very complex structures. I invite you to give this a try.
 The distilled out pop journal is very cool. It's very interactive, you can play around
 with it, you can reproduce things in a collab. And yeah, shout out to the authors here,
 Alexander Morbintsev, Ettore Randazzo, Evan Nicholson and Michael Levin. Yeah, that was
 it from me. Thanks for watching and bye bye.