What are the two gates of a GRU and what does each control? How is a GRU different from an LSTM?
Sequence models and transformers, Recurrent networks
Level L2 Elementary. Length Short. Nature Th Theoretical.
What's being asked
Whether you can name the update and reset gates of a GRU (gated recurrent unit), say what they do, and compare them with an LSTM (long short-term memory).
Key idea
A GRU has an update gate (how much of the old state is replaced by new information) and a reset gate (how much of the old state to use when proposing a new one). It has no separate cell state.
Steps
- Update gate (where is the sigmoid function) decides, per unit, how much of the previous hidden state is replaced by the new candidate.
- Reset gate decides how much of is shown to the candidate state . If , the unit ignores the past.
- The new state mixes old and candidate using element-wise multiplication : .
- LSTM has three gates (input, forget, output) and a separate cell state . GRU merges the forget and input gates into one gate and merges the cell and hidden states.
- So a GRU has fewer parameters (three weight blocks instead of four) and is quicker to train, with similar accuracy on many tasks.
Common mistakes
- Saying a GRU has no gates for forgetting; the update gate does that job.
- Mixing up the roles of and .
- Claiming a GRU is always better or always worse than an LSTM.
How long your answer should be
5 sentences.
Read this
Previous in Sequence models and transformers: The corpus word counts are: hug , pug , pun , bun , hugs . Starting from single characters, what are the first three merges of byte-pair encoding (BPE), done by hand? How are the words "bugs" and "mug" then tokenised?
Next in Sequence models and transformers: A training corpus has three sentences: " i like tea ", " i like coffee " and " you like tea ". The vocabulary of predicted words is i, you, like, tea, coffee, , so . Using add-one smoothing, what is the bigram probability of the sentence " you like coffee ", and what does the unsmoothed MLE give?