Skip to content

LSTM in 3D

Watch the gates of an LSTM decide what to forget, keep and show.

What this lab shows

The LSTM adds a separate memory and three gates to the RNN: forget, input and output. Each column in the 3D view has five layers: the memory, the three gates and the output. You see how much memory each gate let through at each letter.

A tiny LSTM, 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 longer than ten letters.
  2. Rotate the scene and compare the height of the gates from one letter to the next.
  3. Read the summary of the gates below the scene.
LabLSTM in 3DTry it

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

  1. ␣99%
  2. r0.6%
  3. n0.2%
  4. s0.1%
  5. t0%

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

What to notice: The forget gate stays close to 1 when the memory has to be kept. Through it, old information manages to travel far.

Books that use this lab

No published book uses this lab yet.