The Transformer: a change in how sequences are built
Transformer 的历史位置
Trace the 2017 architecture into different pretraining and adaptation paths.
transformer-historyThe problem in its time
Suppose a translation system must connect the first word of a sentence with its last. In a recurrent layer, information travels through successive states. Self-attention offers a direct connection between positions. The Transformer made that alternative the organizing principle of an encoder–decoder model and demonstrated useful translation quality under a concrete training setup. It did not invent every form of attention.
The arXiv record dates the first submission of Attention Is All You Need to 12 June 2017. Its author list has eight names, and the contribution footnote explicitly describes a team effort rather than a single inventor. This chapter checked the later v7 PDF, dated 2 August 2023, while using the submission record for the historical date. A file revision and the first announcement are different timestamps. Paper and version history
The title is memorable, but it is not a literal inventory. The architecture also contains feed-forward layers, embeddings, positional information, residual connections and normalization. Reading the title as “only attention operations exist” misses the system that was actually trained.
What the evidence establishes
The original design has an encoder and an autoregressive decoder. Encoder self-attention can use the input sequence; decoder self-attention masks future target positions. During training, known shifted target tokens allow many positions to be processed together. During ordinary autoregressive generation, the next token still depends on the generated prefix. Training parallelism therefore does not imply that every output token is generated simultaneously. Sections 3.2.3–4
The paper reports WMT 2014 English–German results, including 28.4 BLEU for the big configuration. It describes eight P100 GPUs, 300,000 training steps and about 3.5 days for the big models. These are conditions of the reported experiment, not a price quote or a general speed guarantee. The checked PDF contains an English–French discrepancy: Table 2 and the abstract give 41.8, while section 6.1 says 41.0. This chapter does not silently choose or combine those values.
Subsequent work illustrates more than one direction. BERT uses bidirectional representations and masked pretraining; GPT-3 studies autoregressive models and task demonstrations supplied in context without gradient updates. These papers show how an architectural family supported different objectives and adaptation procedures. They do not make every later Transformer the original translation model. BERT introduction GPT-3 abstract and task conditions
Work through the idea
Use a tiny accounting exercise to separate connectivity from cost. Four tokens permit 4×4=16 ordered attention-score entries per head. Eight tokens permit 8×8=64. Doubling sequence length quadruples this dense score count. This is not the whole model’s operation count: projections, feed-forward layers, batching and hardware also matter.
| Sequence length | Dense score entries per head | Causal allowed entries |
|---|---|---|
| 4 | 16 | 10 |
| 8 | 64 | 36 |
The causal count includes each token attending to itself: 1+2+…+n. A dense implementation can still allocate and mask the full square, so counting allowed entries does not automatically predict memory savings. Nor does a direct connection guarantee that the network learns the right relation.
Now compare two prompts: “red means stop; green means go” followed by a query, and a second prompt that reverses those mappings. A model may change its answer because the context changed, without any weight update. Fine-tuning instead modifies parameters. This invented task helps separate the in-context adaptation investigated by GPT-3 from the fine-tuning route described in BERT. It is a thought experiment, not a claim that a tested model solved both prompts. Feature-based and fine-tuning distinction In-context task specification
Attribution and limits
The historical claim is strongest when kept specific: a translation architecture demonstrated a useful combination of parallel training, short information paths and measured quality. It is weaker to say that recurrence became useless overnight, that attention solved understanding, or that one paper alone caused every later language-model advance.
Data, training objectives, optimization, compute and evaluation continued to change. Later encoder-only, decoder-only and encoder–decoder models also differ in what information is visible at each position. That visibility determines which tasks and training losses make sense.
Attention weights can be inspected, but an attractive heat map does not by itself establish a causal explanation of the prediction. Treat architectural connectivity, measured behavior and a human explanation as separate claims. For historical comparisons, keep the test set, preprocessing and decoding procedure attached to the score; BLEU is not a percentage of all sentences understood.
Exercises with answers
1. Does parallel training remove sequential generation?
No. Ordinary autoregressive decoding still conditions each next token on its generated prefix.
2. What happens to dense score entries from length four to eight?
They rise from16 to64 per head; this is not a full runtime estimate.
3. Does changing demonstrations necessarily train the weights?
No. Context can change the conditional prediction while parameters remain fixed.
4. How should the English–French discrepancy be handled?
Record the conflicting locations and avoid an unsupported reconciliation; use consistent results for comparisons.
Read the original sources
Start with the introduction and contribution footnote, then compare the mask description with the complexity table and training section. Follow BERT and GPT-3 to see how objectives and adaptation changed. Their first arXiv submissions were in October 2018 and May 2020 respectively; the BERT source read here is its 2019 proceedings paper.
For the mechanics, use the separate Transformer chapter and attention lab. For the historical consequences, continue to foundation models. A useful reading note records both what a paper changed and which parts it inherited.
Make a prediction, then check
What does doubling sequence length do to dense attention-score entries?
Learning objectives
- Distinguish training parallelism from autoregressive inference.
- Compare architecture, objective and adaptation without conflating them.
Prerequisites & connections
This article can be used as an entry point.
Explore related knowledge →References
- Attention Is All You Need
Ashish Vaswani and coauthors · 2017 - BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
Jacob Devlin; Ming-Wei Chang; Kenton Lee; Kristina Toutanova · 2019 - Language Models are Few-Shot Learners — arXiv v4
Tom B. Brown; Benjamin Mann; Nick Ryder and coauthors · 2020
Version1 · Editorial status: Recorded technical checks completed
View technical check record (AI)
Codex · 2026-09-07 · Codex single-AI-author historical check: bounded source passages, contemporary disagreement versus later interpretation, hand-traced teaching examples, bilingual alignment. Not independent human or second-agent review; no historical program execution claimed.
- Single-AI-author historical check of bounded primary passages, chronology, attribution, claims versus later interpretation, and corresponding bilingual examples and exercises. No independent human or second-agent review; historical essays require no executable program.
- Hand-counted dense16/64 and causal10/36; no benchmark or model-output execution claimed. PDF41.8/41.0 conflict retained.
- Complete bilingual prose and corresponding exercises promoted with formal status and SHA binding. Algorithm tests read formal MDX; historical essays claim no executable program or computational tests.
- Publication navigation points published topics to complete articles and removes corresponding pending wording, retaining directory entries for unwritten targets. Principles, equations, programs and exercises are unchanged; final article SHA values rebound.
Source locations checked:
- Attention Is All You Need · Read arXiv metadata: v1 2017-06-12, v7 2023-08-02. Downloaded v7: title/contribution footnote, introduction, sections3.2.3–6.1 and Tables1–2. English–French table/abstract41.8 conflicts with section6.1 prose41.0; use only consistent EN–DE28.4. No latest-paper version silently labeled original upload.
- BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding · Read original NAACL2019 pp4171–4172 abstract/introduction: bidirectional masked pretraining, feature-based versus fine-tuning. arXiv metadata separately confirms first submission2018-10-11. No original benchmark rerun.
- Language Models are Few-Shot Learners — arXiv v4 · Read v4 abstract and pp4–5 on zero/one/few-shot conditioning without gradient updates; metadata v1 2020-05-28 and v4 2020-07-22. No all-benchmark or full contamination audit claimed.
Related topics