Study the paper
Attention Is All You Need
Lessons, visuals, quizzes, flashcards, and resources—organized in teaching order.
24 activities
At a glance
Introduction to the Transformer ArchitectureIntroduction to the Transformer Architecture
LessonSequential Computation Bottleneck in Recurrent Models
Introduction to the Transformer ArchitectureThe Sequential Bottleneck of Recurrent Architectures
LessonScaled Dot-Product Attention
Scaled Dot-Product AttentionMathematical Formulation
LessonScaled Dot-Product Attention
Scaled Dot-Product AttentionThe Scaled Dot-Product Attention mechanism computes attention weights over a set of values based on queries and keys. The scaling factor sqrt d k is introduced to prevent the dot products from growing extremely large in magnitude for high-dimensional keys, which would otherwise push the softmax function into regions with extremely small gradients.
VisualIllustrative teaching scenarios: attention scaling (not paper-reported)
Scaled Dot-Product AttentionCompare fixed illustrative teaching scenarios; these are not paper-reported results.
VisualIllustrative teaching scenarios: attention concentration (not paper-reported)
Scaled Dot-Product AttentionTrace fixed illustrative teaching scenarios; these are not paper-reported results.
VisualHow attention redistributes weight
Scaled Dot-Product AttentionIllustrative attention weights computed from a fixed teaching example; these are not paper-reported values.
VisualExplore attention score scaling
Scaled Dot-Product AttentionMove across fixed illustrative scenarios to see how score scaling changes concentration.
VisualScaled Dot-Product Attention: step by step
Scaled Dot-Product AttentionFollow the existing bounded walkthrough in its intended sequence.
LessonMulti-Head Attention
Multi-Head AttentionMulti-Head Attention Mechanism
LessonMulti-Head Attention
Multi-Head AttentionThe Multi-Head Attention mechanism allows the model to jointly attend to information from different representation subspaces at different positions. Instead of performing a single attention function with d text model -dimensional queries, keys, and values, we project them h times with different, learned linear projections.
VisualMulti-Head Attention: step by step
Multi-Head AttentionFollow the existing bounded walkthrough in its intended sequence.
LessonInjecting Sequence Order: Positional Encodings
Injecting Sequence Order: Positional EncodingsSinusoidal Positional Encodings
LessonSinusoidal Positional Encoding (Even Dimensions)
Injecting Sequence Order: Positional EncodingsIn non-recurrent architectures like the Transformer, sequence order is not implicitly captured by the network structure. To inject positional information, sinusoidal positional encodings are added to the input embeddings. This equation defines the encoding value for even dimensions of the positional vector.
VisualSinusoidal Positional Encoding (Even Dimensions): step by step
Injecting Sequence Order: Positional EncodingsFollow the existing bounded walkthrough in its intended sequence.
LessonEmpirical Results and Performance
Empirical Results and PerformanceEmpirical Evaluation and Efficiency
LessonMachine Translation Performance and Training Costs
Empirical Results and PerformanceThe Transformer model achieves state-of-the-art BLEU scores on both English-to-German (EN-DE) and English-to-French (EN-FR) translation tasks while requiring significantly lower training costs compared to previous recurrent or convolutional architectures.
LessonEnglish Constituency Parsing Results
Empirical Results and PerformanceTo evaluate if the Transformer generalizes well to other tasks, it was evaluated on English constituency parsing on Section 23 of WSJ. Despite the lack of task-specific tuning, the Transformer (4 layers) achieves strong results in both WSJ-only discriminative and semi-supervised settings.
VisualEnglish Constituency Parsing Results
Empirical Results and PerformanceExplore paper-reported results and reconciled deterministic comparisons.
VisualEnglish Constituency Parsing Results: WSJ 23 F1
Empirical Results and PerformanceCompare reconciled WSJ 23 F1 values reported by the paper.
QuizTest your understanding
Comprehensive Assessment10 questions grounded in this paper section.
VisualPaper concept map
Comprehensive AssessmentFollow how prerequisites and the paper’s main ideas connect in teaching order.
ResourceFurther learning
Comprehensive Assessment3 supplementary resources for this paper section.
ResourceResearch and implementation context
Comprehensive AssessmentExplore notable related work and public implementation context.