Viewers can support creators through their shared Watches.
One paper threw out loops and rebuilt AI
Vaswani et al. (2017): pure attention replaced step-by-step reading
Optional. Your school, company or community appears by your seat, including on future Watch links you open in this browser.
Rotate your phone for a larger view
Before 2017, AI read a sentence like someone peeking through a tiny keyhole, one word at a time. Then eight researchers published Attention Is All You Need and replaced that slow chain with direct links between every word at once. By the way, you can interrupt me anytime using the question or microphone button right below me in Watch. First, let's see why reading word by word broke down.
Older models like recurrent neural networks passed information down a daisy chain, one word after another. In a thirty-word sentence, the first word had to survive thirty handoffs just to reach the end, and GPUs sat waiting for each step to finish. The Transformer connects any two words in a single hop, so every word sees the whole sentence in parallel.
Here is an example of why direct links matter. Look at the sentence: The animal stopped because it was tired. If we focus on the pronoun 'it', how does the model know whether 'it' means the animal or something else? Self-attention lets 'it' reach straight back to 'animal' in one jump, and checks the clue 'tired' at the end, without playing telephone through the words in between.
Inside self-attention, every word acts like a searchlight called a Query scanning index cards called Keys. The query sweeps across the keys. When the key matches, it lights up and sends its value upward. So the word pulls in a blend weighted toward the context it actually needs.
Here is the engine behind that match: Scaled Dot-Product Attention. First, multiplying Queries by Keys scores how strongly every pair of words relates. Next, we divide by the square root of the key dimension, sixty-four here, because huge dot products push softmax into flat corners where learning stalls. Imagine turning down a microphone so subtle differences stay audible instead of clipping. Finally, softmax turns scores into percentages that blend the Values. Curious why that square root matters mathematically? You can ask me about it right now with the Ask button below me. Next, let's see why one spotlight still isn't enough.
If you use just one attention spotlight, averaging blurs different relationships together. So Figure 2 starts with learned linear projections that shrink the 512-dimensional vectors into smaller subspaces. Then those vectors run through h parallel attention heads, specifically eight heads of dimension sixty-four each, so one head can follow grammar while another tracks pronouns. Finally, the Concat and Linear layers at the top concatenate the results back into one rich representation.
Wait: if self-attention processes every word at the same time with no loop, how does it tell 'dog chases cat' apart from 'cat chases dog'? Without order, both look like the same bag of words! The authors solved this by adding sinusoidal positional encodings: smooth sine and cosine waves of different wavelengths, ranging from two pi up to ten thousand times two pi, stamped onto each word's vector. Each position gets a unique rhythmic fingerprint, and relative offsets act like simple linear shifts.
If you remove positional encoding from a Transformer encoder, how does it treat 'Dog bites man' versus 'Man bites dog'? As the exact same set of words. Without positional waves, self-attention has no built-in sense of left or right, so shuffling the input produces the exact same word relationships, just in shuffled slots. Without positional encodings, self-attention is permutation-equivariant: shuffling the words gives the same attention
Now put all the pieces together in the paper's original diagram. On the bottom, embeddings meet the positional wave stamps. Then the encoder stack on the left runs six identical layers to build a rich map of the input sentence. Meanwhile, the decoder stack on the right generates the translation one word at a time, using masked self-attention so it cannot peek at future words, while cross-attending back to the encoder.
Did dropping loops actually pay off? On the WMT 2014 benchmarks, where BLEU measures how closely machine translations match human references, even the base Transformer scored 27.3 on English to German, beating every previous single model and ensemble. And the big Transformer hits 28.4 BLEU on English to German, over two full points ahead of the best prior ensemble, and reaches 41.8 on English to French in Table 2, establishing a new single-model best.
The real jaw-dropper is the compute bill shown in Table 2, measured in ten-to-the-eighteenth floating-point operations. While the previous GNMT ensemble burned one hundred eighty units of compute, Transformer base used just 3.3 times ten to the eighteenth FLOPs, training in twelve hours on eight P100 GPUs and still beating those massive ensembles. Even the big model trained in three and a half days on eight GPUs.
That is the whole secret of Attention Is All You Need: drop the slow sequential bottleneck, link every token directly with scaled Queries, Keys, and Values, run multiple heads in parallel, and stamp order with position waves. That simple recipe is why today's language and multimodal models could scale so fast. Want to unpack how modern models like GPT changed the decoder-only setup, or walk through a live matrix calculation together? Tap the question or microphone button below me and ask away.