Availit World How AI really works, in your language

Lesson 12 of 4614 minFacts checked October 20, 2026

Before transformers: the networks that led here

The transformer did not come from nowhere. Networks for images, networks with memory and a 2014 trick called attention each solved one piece of the puzzle. And some of those old ideas are coming back inside the newest models.

In this lesson you will

  • Explain what a convolutional network does, and why it suits images
  • Explain how a recurrent network reads text one token at a time, and why that was slow
  • Describe the 2014 attention idea, the direct ancestor of the transformer
  • See why today’s long-context models, such as Qwen3.8 and Kimi Linear, bring recurrent ideas back
On this page
  1. Networks for images: convolutions
  2. Networks with memory: RNNs
  3. Translation, and a bottleneck
  4. The fix: attention
  5. The comeback: recurrence returns
  6. Remember
  7. Check yourself

Networks for images: convolutions

An ordinary layer connects every input to every neuron. For a photo with a million pixels, that is a million weights per neuron, and the network would have to learn separately what an edge looks like at every position in the image. That is wasteful: an edge is an edge wherever it appears.

A convolutional neural network (CNN) uses a small filter instead, say 3 × 3 pixels with 9 weights, and slides it across the whole image, computing the same dot product at every position. One filter might light up wherever there is a vertical edge. Stack layers of filters and the network builds up from edges to textures to parts to whole objects, the ladder you saw in the neural networks lesson.

  • 1989–1998: Yann LeCun’s LeNet reads handwritten digits; versions of it read millions of bank cheques.
  • 2012: AlexNet, a much bigger CNN trained on two gaming GPUs, wins the ImageNet contest by a huge margin and starts the deep-learning boom.
  • 2015: ResNet’s residual connections make CNNs 152 layers deep.

Networks with memory: RNNs

Text has an order, and the meaning of a word depends on what came before. A recurrent neural network (RNN) handles this by reading one token at a time and carrying a hidden state: a vector that acts as its memory of everything so far. At each step it combines the new token with the old state to make a new state.

An RNN reading “the cat sat”
  1. state₀Empty memory
  2. + “the” → state₁Remembers: a noun is probably coming
  3. + “cat” → state₂Remembers: the subject is a cat
  4. + “sat” → state₃Remembers: the cat did something; predict what comes next
stateₜ = bend(W · stateₜ₋₁ + U · tokenₜ)

The same two matrices, W and U, are used at every step: weight sharing again, this time across time.

RNNs had two big problems. First, they forget: the whole past has to squeeze into one fixed-size vector, and the slopes for early tokens vanish as they pass back through many steps. A 1997 design called the LSTM (long short-term memory) added gates that decide what to keep, forget and output, and it powered speech recognition and, from 2016, Google Translate. Second, and worse, RNNs are slow to train: step 100 cannot start until step 99 is done, so the thousands of cores of a GPU sit waiting.

Quick check

Why were RNNs slow to train on GPUs?

Show the answer

Answer: Each token had to wait for the previous one, so the work could not run in parallel An RNN’s state at step t depends on step t − 1, so a sentence is processed in strict order. GPUs are fast only when many sums can happen at once.

Translation, and a bottleneck

In 2014, researchers at Google built a translator from two LSTMs, an idea called sequence to sequence (seq2seq). The encoder reads the whole English sentence and ends with one vector. The decoder starts from that vector and writes the French sentence one token at a time.

It worked surprisingly well, with one weakness you can probably guess: the entire meaning of the sentence, however long, had to pass through that one vector. Long sentences came out worse. The vector was a bottleneck.

The fix: attention

Also in 2014, Dzmitry Bahdanau, Kyunghyun Cho and Yoshua Bengio proposed a fix. Keep the encoder’s state for every source word, not just the last one. Then, each time the decoder writes a word, let it look back at all of them and decide how much each one matters right now. It scores every source word, turns the scores into weights with softmax, and takes a weighted average of their vectors. This is attention.

Three years later came the decisive step. If attention can connect any word to any other directly, why keep the slow, forgetful recurrence at all? The 2017 paper “Attention Is All You Need” dropped it entirely. Every token looks at every other token at once, so a whole sentence can be processed in parallel, exactly what GPUs are good at. That is the transformer, the subject of part 4.

RNN with attention (2014)

  • Reads tokens one after another.
  • Memory is a hidden state, plus attention over the source sentence.
  • Training is slow, because the steps run in order.

Transformer (2017)

  • Every token looks at every other token directly, through attention.
  • No recurrence: the whole text is processed at once during training.
  • Scales to huge data on GPUs, which is how today’s models were possible.

The comeback: recurrence returns

Transformers have a cost of their own. Every token attends to every earlier token, so the work grows with the square of the text length, and the memory each conversation needs (the KV cache) grows with every token. At a million tokens of context, that hurts. So researchers went back to the RNN’s great strength: a fixed-size state that does not grow, however long the text.

The new versions are designed so they can still be trained in parallel, which fixes the RNN’s old weakness. They go by names such as state space models and linear attention:

  • Mamba (2023): a selective state space model with about 5 times the throughput of a transformer of the same size.
  • Gated DeltaNet (2024): used in Qwen3.8-27B, where 48 of its 64 layers are Gated DeltaNet and only 16 use full attention.
  • Kimi Delta Attention (2025): in Kimi Linear it cut the KV cache by 75 % and decoded up to 6 times faster at a million tokens; Kimi K3 uses it.
  • Lightning attention: MiniMax-M1 mixes it with ordinary attention to reach a million-token context.

The winning recipe today is a hybrid: mostly cheap recurrent-style layers, with a few full attention layers mixed in to keep precise recall. Old ideas rarely die in AI; they wait for the right hardware and the right problem.

Which kind of network is described?

0 of 6 sorted
  • Slides a small filter across an image

    Answer: CNN

  • Carries one hidden state from token to token

    Answer: RNN

  • Lets every token look at every other token at once

    Answer: Transformer

  • Won the ImageNet contest in 2012

    Answer: CNN

  • Cannot start step 100 until step 99 is done

    Answer: RNN

  • Introduced in “Attention Is All You Need”

    Answer: Transformer

Remember

  • CNNs slide small shared filters across images, building from edges to objects. AlexNet (2012) started the deep-learning boom.
  • RNNs read text token by token with a hidden state as memory. They forget, and they are slow to train because the steps run in order. LSTMs helped with forgetting.
  • Seq2seq translation squeezed a sentence into one vector, a bottleneck.
  • Attention (2014) lets the decoder look back at every source word. The transformer (2017) kept attention and dropped recurrence, so everything runs in parallel.
  • For very long contexts, linear attention and state space layers bring back a fixed-size state; models like Qwen3.8 and Kimi K3 are hybrids.

Words to know

Convolutional neural network (CNN)
A network that slides small shared filters across an image to detect patterns anywhere.
Filter
A small grid of weights, such as 3 × 3, applied at every position of an image.
Recurrent neural network (RNN)
A network that reads a sequence one step at a time, carrying a hidden state as memory.
Hidden state
The vector an RNN carries from step to step, summarising everything so far.
LSTM
An RNN with gates that decide what to remember and forget. Standard for text and speech before transformers.
Encoder and decoder
The part that reads the input, and the part that writes the output.
Attention
Scoring every earlier item, turning the scores into weights, and taking a weighted average, so a model can look where it needs to.
Linear attention / state space model
Newer layers with a fixed-size, RNN-like memory that can still be trained in parallel.
Hybrid model
A model that mixes cheap linear-attention layers with a few full attention layers.

Go to the source

This lesson is built on these papers and documents. Paper links open arxiv.org, a separate site.

Check yourself

5 questions. Tap the answer you think is right.

0 of 5 answered

What does a convolutional network reuse at every position of an image?

Show the answer

Answer: The same small filter of weights Sliding the same filter everywhere lets one set of weights detect a pattern wherever it appears.

What is an RNN’s hidden state?

Show the answer

Answer: A vector that carries its memory of the sequence so far At each step the RNN combines the new token with its previous state, so the state summarises everything it has read.

What problem did attention solve in 2014 translation models?

Show the answer

Answer: The whole sentence had to squeeze through one vector Attention let the decoder look back at every source word’s vector instead of relying on a single summary vector.

What did the transformer remove from earlier designs?

Show the answer

Answer: Recurrence: reading tokens one after another “Attention Is All You Need” kept attention and dropped recurrence, so all tokens can be processed in parallel.

Why are recurrent-style layers coming back in models like Qwen3.8 and Kimi K3?

Show the answer

Answer: Their fixed-size state does not grow with the context, which helps at a million tokens Full attention’s cost and cache grow with length. Linear-attention layers keep a fixed-size state, so hybrids handle very long contexts more cheaply.

Lesson complete

Answer every question above to complete this lesson.

Your progress is saved on this device only.

Next lessonTokens: how a model reads
Previous lesson All lessons

Choose your language