ANN Types: LSTM And GRU
A memory with gates
A plain recurrent net has only one hidden state, updated at every step. Over a long sequence that memory can fade: the gradient has to travel back through many steps, and a slope a little below one, multiplied often, shrinks the message to almost nothing. That is the vanishing-gradient problem, told in easy words on ANN: Gradient.
LSTM (long short-term memory) and GRU (gated recurrent unit) give the network gates: small valves that decide what to write into memory, what to forget, and what to read out.
An everyday picture is a notebook, not a single whispered rumour. A forget gate is the decision to rub out an old line. An input (or update) gate is the decision to write a new one. An output gate, in LSTM, is the decision about what to show next. You do not have to carry every detail forever, and you do not have to lose the plot at the next sentence.
LSTM has a separate memory cell and, usually, three gates (forget, input, output). It is the older and slightly richer of the two, and it helped machine translation and speech recognition when long memory was otherwise hard. GRU is a later, slimmer cousin: typically two gates (reset and update) and no separate cell. It often reaches similar quality with fewer parameters, which is why it is popular when you want a recurrent model that is cheaper to train.
Which one to start with? For a first reading, treat them as the same idea — a recurrent net that can keep or drop memory on purpose. For a longer sequence, or a task that must remember an earlier clue, prefer LSTM or GRU over a plain RNN. For many modern language tasks, a Transformer now does that long-range work with attention instead of a running state; that story lives in the LLMs section.
See also
- ANN Types: Overview
- ANN Types: Recurrent (RNN)
- ANN: Gradient — vanishing gradients, in simple words
- ANN: Evolution
- LLMs and Transformers