What is a recurrent neural network?

A recurrent neural network is a network that feeds part of its own output back into itself on the next step. That single addition gives it something a plain feedforward network does not have: what it does now depends on what happened before.

Background concept

Why the loop matters

A feedforward network is a function. The same input always produces the same output, with no history. That is fine for classifying a photograph and useless for anything where sequence carries meaning. A creature that cannot tell "the resource reading is rising" from "the resource reading is falling" is missing information that exists only in the comparison between two moments.

A recurrent network keeps a set of internal values, the hidden state, which is updated each step from the current input and from its own previous value. Nothing tells it what to store. Whatever the weights make it carry forward is what it carries forward, and a well-adapted network stores whatever turned out to be worth storing.

The leaky variant

A common and very simple form updates the hidden state as a blend of its old value and the newly computed one, controlled by a leak rate: h = (1 - leak) * h_old + leak * h_new. A low leak makes the state slow and persistent, a high leak makes it fast and forgetful. It is one number, and it sets how long the network's memory effectively is.

The training problem, and why it is avoided here

Training a recurrent network by gradient descent means unrolling it through time and propagating error backwards along the whole sequence. Gradients that pass through many steps tend to shrink to nothing or blow up, which is the vanishing and exploding gradient problem. Architectures such as LSTM and GRU were designed largely to manage it, by adding gates that control what is kept and what is discarded.

Evolutionary methods sidestep the problem rather than solving it. There is no gradient to vanish, because no gradient is computed. The price is the one described under neuroevolution: many more evaluations for far less information per evaluation.

The network inside every organism here

Each organism in Emergent Life runs a leaky recurrent network of fixed shape: sensory channels in, a hidden layer that carries state between ticks, action channels out. The exact dimensions, the parameter count, and the cost of a single decision are listed on the evolving neural controller, generated from the code rather than typed into the page.

Two details matter for reading anything else on this site. First, the hidden state is set to zero at birth: an organism inherits its weights, never its parent's train of thought. Second, the leak rate is itself inherited and mutable, so how long an organism's memory persists is a heritable trait under the same selection as everything else.

You can watch this directly. Select any organism on Watch and open its controller, and the panel shows that individual's real sensory values, hidden units and action outputs on the current tick. How the panel is built, and how reading an organism is proven not to change it, is covered in inside the Brain Inspector.

What a hidden unit is not

A hidden unit is a number. It is not a thought, a memory of an event, or a representation of anything nameable, and this site does not label them as though it were. Where a unit's value correlates with something in the world, that is a measurable correlation, reported as one.

References and further reading

Primary sources for the claims on this page. Where this project's own results are referred to, they link to the page carrying the evidence instead.

  1. Elman, J. L. (1990). Finding Structure in Time. Cognitive Science, 14(2), 179-211. doi:10.1207/s15516709cog1402_1
  2. Bengio, Y., Simard, P., & Frasconi, P. (1994). Learning long-term dependencies with gradient descent is difficult. IEEE Transactions on Neural Networks, 5(2), 157-166. doi:10.1109/72.279181
  3. Hochreiter, S., & Schmidhuber, J. (1997). Long Short-Term Memory. Neural Computation, 9(8), 1735-1780. doi:10.1162/neco.1997.9.8.1735