Holding the Subject

Recurrent NetworksMedium+20 XP+20

Holding the Subject

An LSTM is reading

The cat that our neighbours across the street adopted from the shelter last spring …

and has to remember that the subject was singular until its verb finally arrives. When it reads "cat", it writes the value 0.80.80.8 into one slot of its cell state.

From then on, treat the rest of the clause as filler for that slot:

  • the input gate stays shut, so nothing new is ever written into it;
  • the forget gate's weights contribute nothing, so its value at every step is set by its bias alone: f=σ(b)f = \sigma(b)f=σ(b), where
σ(z)=11+e−z\sigma(z) = \frac{1}{1 + e^{-z}}σ(z)=1+e−z1​

At every step after "cat", the slot is multiplied by fff. If the verb arrives kkk steps after "cat", the slot has been multiplied by fff exactly kkk times.

The team has set the forget-gate bias to b=3b = 3b=3. The verb can only use the subject if the slot still holds at least 0.40.40.4 when the verb arrives.

What is the largest number of steps kkk between "cat" and the verb for which that holds? Give a whole number.

old cell state
0.80
-0.50
0.60
0.30
↓ × forget
0.80
-0.50
0.60
0.30
forget1.00

Near 1: keep everything.

Hints

Solve it to unlock the solution

Once you get it right, the reasoning behind the answer shows up here.