← AI ChannelInside AIChapter 16 / 255日本語

Volume 1 / Part 2 History — 70 Years of Setbacks and Comebacks / Chapter 16

RNN and LSTM — The Limits of Reading Words "In Order"

About 6 min read

Last time we turned words into coordinates with Word2Vec. But a sentence's meaning only comes alive through word order. How did AI learn to read that order? This time it's the story of RNNs, machines that chase words one at a time, and LSTM, which tried to fix their biggest weakness.

RNN — A Machine That Reads Straight Through, One Word at a Time

When you read a book, you move line by line, carrying what you remember from earlier pages with you. An RNN, or recurrent neural network, works in a strikingly similar way. Every time it reads one word, it updates a hidden state that represents "everything so far," then hands that state off to process the next word.

Take the sentence "The cat escaped through the window." An RNN reads "The," forms a state, reads "cat," updates that state, and keeps going through "escaped," "through," "the," "window." By the time it processes the final word, information about "cat" should, in theory, still be sitting somewhere in that state.

Here's the key detail: an RNN can only process a sentence one word at a time, strictly in order. This sequential habit seems harmless at first, but it turns out to matter a great deal later. The real question is whether the memory of "cat" actually survives all the way to the end of the sentence.

Try this yourself. Cover the following sentence word by word with your finger as you read it: "Yesterday, the dog I met at the park was really friendly." When you got to "friendly," were you still holding onto "dog" from the start? For a short sentence like this, sure, easily. But stretch that sentence to a hundred words, two hundred words, and it gets a lot less certain whether that early detail survives.

Remember this

An RNN reads a sentence by passing a hidden state like a baton, one word at a time.

The Longer the Sentence, the More the Memory Fades — Vanishing Gradients

RNNs had one serious weakness: the longer the sentence, the more information from the beginning faded away. The cause lies in how they're trained. An RNN adjusts its weights by sending error signals backward through time, and the further back those signals have to travel, the smaller they get.

Picture the game of telephone. The first person whispers a sentence, and by the time it's passed through ten or twenty people, it's unrecognizable. The same thing happens during RNN training. The error signal, the piece of information trying to get back to the earlier steps, keeps shrinking with every step it travels, until it's practically zero. This is what's known as the vanishing gradient problem.

A rough number helps make this concrete. If the error signal gets cut in half at every single step, then after just 10 steps back it's already down to less than a thousandth of its original size. Once a sentence runs past a hundred words, it's no surprise that the influence of the very first word has all but disappeared. This is a simplified example, not an exact measurement, but it captures why RNNs struggle with long sentences.

The 1997 LSTM paper noted that it was building on the analysis in Hochreiter's 1991 diploma thesis when tackling this exact problem. Researchers wanted to handle long sentences, but the networks couldn't learn long-range dependencies well enough to do it. Breaking through that wall became the next challenge.

1997: A Mechanism to Protect Memory Is Born — LSTM

The answer to the vanishing gradient problem came in 1997, when Sepp Hochreiter and Jürgen Schmidhuber published "Long Short-Term Memory" in the journal Neural Computation. Their idea: build a dedicated lane inside the network where information could keep flowing without decaying.

Later research would call this mechanism the "constant error carousel," or CEC. Think of a highway. Local roads slow you down with traffic lights and merges, but once you're on the highway's main lane, you cruise along without obstacles. Inside an LSTM cell, that's exactly what got built: a dedicated lane where error signals and information could travel with almost no decay.

Traffic in and out of that lane is managed by two gates: an input gate and an output gate. "Is this information worth remembering?" and "Should it be released right now?" The network learns to answer both questions itself, by opening and closing gates. That was the heart of LSTM.

Try a small experiment. Write one sentence of a diary entry, then go word by word and mark each one with a yes or no: should this be remembered later, or is it fine to forget? It's a simple game, but the spirit of it is close to what an LSTM's gates are doing, learned automatically, inside the network.

Remember this

LSTM achieves long-term memory with a dedicated lane that carries information without decay, plus gates that control what moves in and out.

The LSTM That Learned to Forget

Here's a detail that often gets lost: the original 1997 paper didn't yet include a gate for forgetting. There was a mechanism for keeping information, but nothing that actively cleared out information once it was no longer needed.

Left as is, values inside the cell would just keep accumulating, and that actually breaks down when you feed it long sentences. It's like writing in a notebook that eventually runs out of blank pages. Gers, Schmidhuber, and Cummins addressed this with a technical report in 1999, followed by the formal publication "Learning to Forget" in Neural Computation in 2000, which added a new piece: the forget gate.

The Forget Gate That Completed LSTM

The forget gate's job is to look at what's stored in the cell and decide what's no longer needed, then clear it out. With this addition, LSTM could not just remember, it could learn to forget appropriately, too. Most of what people mean today when they say "LSTM" actually includes this 1999–2000 extension.

Forgetting might sound like it would hurt performance, but think about the papers on your desk. If you never clear out documents you're done with, it takes forever to find the one you actually need. Only when you can let go of things at the right time can you quickly pull out what's truly important.

A New Wall Called Speed — The Fate of Sequential Processing

LSTM solved the memory problem. But another weakness remained untouched. Both RNNs and LSTMs still process words one at a time, in strict order. That basic structure never changed.

Picture a reception desk with a hundred visitors waiting but only one window open. People can only be served one at a time. Computing hardware, GPUs especially, is excellent at opening many windows simultaneously, but the RNN's structure can't take advantage of that. You simply can't compute the next time step until the hidden state from the previous one is finished.

When we read a thick novel, we often flip back and forth as needed, checking an earlier page to confirm a detail we half-remember from a dropped hint. RNNs and LSTMs can't do that. Computation always flows in one direction, and there's no going back to process things in parallel. This single constraint, moving one word at a time in one direction only, is exactly what opened the door to the next generation of technology.

The 2017 paper "Attention Is All You Need" pointed out that this sequential nature was precisely what blocked parallelization during training, and that the problem only got worse as sentences grew longer. The memory problem had been solved. The speed problem hadn't. That gap is what made an entirely different kind of architecture necessary.

FAQ

What's the difference between RNN and LSTM?

An RNN is the basic structure that reads words in order while updating a hidden state. LSTM is a type of RNN that introduced a gated cell structure in 1997, designed to keep information from fading away even in long sentences.

What is the vanishing gradient problem?

During training, error signals get sent backward through time to adjust earlier weights. With each step back, that signal shrinks, so information from early in a sentence stops meaningfully influencing learning.

Why was Transformer needed after LSTM?

LSTM solved the memory problem, but it still processed words one at a time, in order, which made training hard to parallelize. The 2017 paper called out this sequential bottleneck and proposed a new architecture built entirely on attention instead.

The memory problem got solved, but the speed problem never went away. Next time, we look at 2017, the year a single paper tore down that wall: "Attention Is All You Need."

Primary sources

This article organizes general knowledge based on our experience and public sources. Product specs, prices, and regulations reflect the time of writing (October 2, 2026) and may change.