Log inStart free
LESSON 7.05 · 5 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

LSTM and GRU

Watch gates carry cat across a long gap, which a plain RNN cannot do.


Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 7.05 · MEMORY BAYLSTM · 9 WORDS · SUBJECT CAT
01
Stage 1 of 5 · The words
The RNN, LSTM and GRU read one word per step. Only "cat" names the animal, and 6 words follow it.
Explain it simply

The network reads the sentence one word at a time, from left to right. Each word becomes 2 numbers: the top one says cat or dog, the bottom one marks the animal. Only cat has a 1 there. To translate it at the end, the network must carry that one fact past 6 more words.

9 words in a row: the, black, cat, eats, bread, and, cheese, and, fish. Under each word are its 2 numbers. Only "cat" has a noun number of 1.

words x, memorygatesanswergradient
wordcat/doganimalthe0.040black0.130cat1.001eats0.030bread0.100and−0.090cheese−0.160and−0.090fish−0.030LSTM · one word per stepx(cat) = (1.00, 1): +1 means cat, a nounwordcat/doganimalthe0.040black0.130cat1.001eats0.030bread0.100and−0.090cheese−0.160and−0.090fish−0.030LSTM · one word per stepx(cat) = (1.00, 1): +1 means cat, a noun
Toy: 1 memory unit · weights set by hand, not trained
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
xt=(cat/dog, animal)\sy{x}{data}{x_t} = (\sy{x}{data}{\text{cat/dog}},\ \sy{x}{data}{\text{animal}})
x3=(1.00, 1)for “cat”x_{3} = (1.00,\ 1)\quad\text{for “cat”}

Each word is 2 numbers: cat or dog, and animal or not.

Common mix-ups

MYTHA gate is an on or off switch.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With 6 words after "cat", does the plain RNN still write "chat"?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
  • 4 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.