Skip to content

Recurrent network (RNN) in 3D

Watch the memory of an RNN pass from letter to letter as you type.

What this lab shows

An RNN reads one letter at a time and carries a memory of 24 units from one step to the next. Each column of bars is the memory after one letter. The prediction comes from that memory, so it can depend on everything read so far, but the memory fades little by little.

A tiny RNN, really trained with numpy on simple sentences in Portuguese. The numbers in each unit have no fixed meaning.

How to use it

  1. Type a sentence and watch a column appear with each letter.
  2. Tap a column to see the prediction at that point.
  3. Compare short and long sentences and watch the memory change.
LabRecurrent network (RNN) in 3DTry it

After “o␣gato”, the network thinks the next letter is:

  1. ␣99%
  2. r1%
  3. d0.1%
  4. m0%
  5. v0%

Example calculated with the trained network (the interactive version needs JavaScript).

What to notice: The memory changes with each letter, and older letters count less and less. This forgetting is the problem the LSTM tries to solve.

Books that use this lab

No published book uses this lab yet.