The paper changed sequence modeling
In 2017, Ashish Vaswani and seven coauthors introduced the Transformer for sequence transduction. Their central move was architectural: replace the recurrence and convolution used by leading encoder-decoder systems with attention mechanisms. The reported experiments focused on machine translation, not on chat assistants or general-purpose agents.
That distinction matters. The title says that attention was sufficient for the sequence model studied in the paper. It does not claim that a deployed AI product needs no retrieval, memory, tools, data pipeline, safety layer, or human review. Those are system concerns outside the paper's narrow architectural claim.
Before the Transformer, recurrent networks carried information forward through a chain of hidden states. That structure made sequence order natural, but it also created a sequential training path. The Transformer traded that recurrence for direct pairwise interaction between positions, then supplied order separately through positional information.
What scaled dot-product attention computes
Attention begins with three learned representations: queries, keys, and values. The model compares queries with keys, scales the dot products by the square root of the key dimension, applies a softmax, and uses the resulting weights to combine values. In compact form, the paper writes this as softmax(QKᵀ / √dₖ)V.
Multi-head attention repeats that operation in different learned projection spaces, then combines the results. The base Transformer used eight heads, a model width of 512, and a position-wise feed-forward inner dimension of 2,048. Because attention itself does not encode order, the paper added sinusoidal positional encodings to the input representations.
A head does not come with a fixed human-readable job. Each head receives learned projections and can develop a different pattern when that helps the training objective. Multiple heads increase the model's opportunity to represent several relationships at once, but inspecting a weight pattern is not automatically a complete explanation of why the model produced an answer.
The original Transformer was an encoder-decoder
The 2017 design used a stack of six encoder layers and six decoder layers. Each encoder layer combined multi-head self-attention with a feed-forward network. Each decoder layer added masked self-attention and attention over the encoder output. Residual connections and layer normalization surrounded the sublayers.
Masking in the decoder prevented a position from attending to later output positions during autoregressive generation. That causal constraint remains conceptually important in later decoder-only language models, even though their overall architecture is not identical to the original translation system.
The encoder and decoder had different information roles. The encoder built contextual representations of the entire source sentence. The decoder generated the target one position at a time, using its previous outputs and cross-attention to the encoded source. This is why the original architecture diagram has two towers rather than one repeated stack.
Source figure
The architecture published in the 2017 paper

Figure 1 from the paper shows the encoder on the left and the autoregressive decoder on the right, including masked attention, cross-attention, feed-forward layers, residual paths, and normalization.
Vaswani et al., Figure 1The original encoder-decoder path
A simplified reconstruction of the architecture in Figure 1 of the paper. Each attention and feed-forward block also uses residual connections and layer normalization.
Source sequence
Tokens plus position
Source embeddings are combined with positional encodings so order is available to the network.
Encoder, repeated 6 times
Self-attention and feed-forward
Every source position can exchange information before a position-wise transformation.
Context bridge
Encoder representations
The completed source representations become keys and values for decoder cross-attention.
Partial target
Masked self-attention
The decoder can use earlier target positions but cannot inspect future target tokens.
Decoder, repeated 6 times
Cross-attention and feed-forward
The target state attends to the encoded source, then passes through a feed-forward sublayer.
Next token
Linear layer and softmax
The final decoder state becomes a probability distribution over the output vocabulary.
Original explanatory visualization based on the architecture and dimensions reported by Vaswani et al.
How a token becomes contextual
An input token begins as an embedding that represents its identity, combined with positional information. Within a self-attention layer, that position creates a query and compares it with keys from every allowed position. The weighted value vectors form a new representation shaped by the surrounding sequence.
The feed-forward network then transforms each position independently using the same learned function. Attention moves information between positions; the feed-forward sublayer processes the information at each position. Stacking these operations lets later layers work with representations that already contain contextual evidence.
During training, the full target sequence can be processed in parallel because the causal mask blocks forbidden future connections. During generation, however, the system still produces output autoregressively: it predicts a token, appends it to the prefix, and repeats. Parallel training and sequential generation are therefore compatible rather than contradictory.
Why parallelism was the decisive advantage
Recurrent networks process a sequence step by step. Self-attention can connect every position to every other position within a layer and compute positions in parallel during training. The tradeoff is quadratic work in sequence length for dense self-attention, which becomes important as contexts grow.
Maximum path length describes how many computational steps information must traverse between distant positions. In a self-attention layer, any two positions can interact directly, giving a constant-length path within that layer. A recurrent path grows with sequence length because information passes through intermediate states.
| Layer type | Per-layer complexity | Sequential operations | Maximum path length |
|---|---|---|---|
| Self-attention | O(n²d) | O(1) | O(1) |
| Recurrent | O(nd²) | O(n) | O(n) |
| Convolutional | O(knd²) | O(1) | O(logₖ(n)) |
Results are evidence, not a timeless leaderboard
On WMT 2014 English-to-German translation, Table 2 reported 28.4 BLEU for the big model. The same table and abstract report 41.8 BLEU on English-to-French, while the prose in Section 6.1 states 41.0. The paper reports 3.5 days on eight NVIDIA P100 GPUs for the big English-to-German model. Keeping those protocol details and the paper's internal discrepancy visible is more accurate than presenting one number without context.
The durable lesson is not that one mechanism solved intelligence. It is that removing sequential computation made large-scale sequence learning more parallelizable, while attention created short paths between distant tokens. The modern AI stack grew from that foundation, then added new training objectives, much larger datasets, alignment methods, retrieval, tools, and product-level controls.
When reading later model papers, separate the inherited core from the surrounding choices. Decoder-only language modeling, larger context windows, new positional methods, sparse or local attention, mixture-of-experts layers, and post-training methods are later design decisions. Calling every one of them simply a Transformer can hide the differences that matter for behavior and cost.
| Model | WMT14 English-German BLEU | WMT14 English-French BLEU | Reported training cost |
|---|---|---|---|
| Transformer base | 27.3 | 38.1 | 3.3 × 10¹⁸ FLOPs for English-German |
| Transformer big | 28.4 | 41.8 in Table 2 | 2.3 × 10¹⁹ FLOPs for English-German |
Sources and further reading
Claims and figures in this article were checked against these original papers and official project resources.
- 1Attention Is All You Need
Advances in Neural Information Processing Systems, 2017
- 2Language Models are Few-Shot Learners
Advances in Neural Information Processing Systems, 2020