Chapter audiobook
हम यहाँ तक कैसे पहुँचे
Listen to the complete teaching text, with spoken descriptions of diagrams. The lesson activities remain available below.
31:09 remaining at 1×
Press play to listen and follow the words here.
With this player focused: Space plays or pauses; arrow keys skip fifteen seconds.
Chapter sections and transcript
Download the transcriptHindi synthetic narration using Resemble AI Chatterbox-Multilingual-hi, MIT. Original Addaly teaching text adapted for listening.
Eight authors and a translation problem
In June 2017 eight authors published “Attention Is All You Need”, introducing the transformer and evaluating machine translation. It was part of a wider history of attention and sequence modelling. Its later use in many language models made the paper influential, but the design does not underlie every chatbot or every AI system.
Earlier lessons explained why parallelisable training mattered. This lesson examines the recurrent and convolutional sequence models the transformer was compared with, how its attention works, and why related designs were adapted to several other domains.
What it replaced
Recurrent networks were an important approach to sequence modelling before 2017, alongside convolutional and other designs. A recurrent state carries information from earlier positions to later ones. Long short-term memory, introduced in 1997, added mechanisms for retaining and updating information; it was not the only earlier design.
Recurrence creates a dependency across positions within a sequence, which can limit training parallelism. Preserving distant information through recurrent states can also be difficult, although gates and attention helped. There is no general rule that a forty-word sentence erases its first ten words, nor that GPUs doing recurrent work must be mostly idle.
During training, the transformer can compute representations for many known sequence positions in parallel within a layer. Attention connects positions allowed by a mask: an encoder may use the full input, while a causal decoder can use only earlier positions and its current input position. Layers still depend on earlier layers. At ordinary generation time the next output token is not yet known, so autoregressive decoding remains sequential. Direct connections to distant context help, but do not guarantee correct recall.
The model also needs information about position, because the same words in a different order can mean something different. The original transformer added positional encodings to token representations. Later designs use other position mechanisms. Parallel computation does not mean that order is absent from the computation or from the causal mask.
The 2018 fork
Two influential 2018 developments used related parts of the architecture differently. BERT used an encoder and masked-word pretraining, together with an additional sentence objective in its original version. GPT used a decoder-style, next-token objective. These are useful landmarks, rather than an exhaustive two-way split of the field. Google described applying BERT to Search in 2019; its release in 2018 did not instantly replace all search ranking.
Generative systems attracted public attention because they produce text people can inspect. Encoder-based models also remain useful for representation and classification tasks. Different products can combine these approaches with other components; a product’s quiet or visible interface does not identify its architecture.
Pretrain, then adapt and evaluate
Large-scale pretraining followed by adaptation became especially influential with these models. Transfer learning was older than the transformer, and some tasks still benefit from specialised models. A broadly trained model can provide a useful starting point; supervised instruction training or preference optimisation can then alter its behaviour for an assistant. That does not make one model optimal for every text task.
Adaptations beyond text
Vision Transformer in 2020 represented images as sequences of patches and achieved strong classification results with large-scale pretraining. Whisper’s 2022 paper described an encoder-decoder transformer trained on 680,000 hours of audio. AlphaFold2 achieved a major protein-structure prediction advance at CASP14 in 2020 using a specialised architecture with attention. These are adaptations with domain-specific inputs, objectives and components, not proof that every problem is the same sequence or that protein science was solved.
The cost the design carries
In standard dense self-attention, the number of position pairs grows quadratically: doubling sequence length gives four times as many pairs. This describes one component, not a universal fourfold increase in total runtime or cost. Masks, caches, efficient attention implementations and alternative architectures change the practical calculation. State-space models such as Mamba, introduced in 2023, explore other sequence-computation trade-offs; comparing them requires a specified task, model and resource budget.
Check your understanding
Which advantage did the original transformer offer over recurrent processing during training?
Pick the one you would defend. Your answer stays private.
Your place and first choices stay on this browser. Classroom credit is recorded separately.
Stuck on something?Ask Meenal, your AI tutor