You are reading immutable version 39. The current guide may be newer.

Study the paper

Attention Is All You Need

Lessons, visuals, quizzes, flashcards, and resources—organized in teaching order.

All activities

Comprehensive Assessment

Test your understanding

Check your understanding

1. Why does the sequential nature of recurrent neural networks (RNNs) limit parallelization during training?
2. Explain how the maximum path length between any two input and output positions in a self-attention layer compares to a recurrent layer, and why this difference affects the model's ability to learn long-range dependencies.
3. What is the primary reason for scaling the dot products of queries and keys by $1/\sqrt{d_k}$ in the attention mechanism?
4. Assume that the components of $q$ and $k$ are independent random variables with mean 0 and variance 1. Show mathematically what the mean and variance of their dot product $q \cdot k$ are, and explain how this relates to the necessity of the scaling factor.
5. How does Multi-Head Attention prevent the averaging effect that occurs with a single attention head?
6. Write down the mathematical formulation of Multi-Head Attention and explain the role of the projection matrices $W_i^Q$, $W_i^K$, $W_i^V$, and $W^O$.
7. Why must positional encodings be added to the input embeddings in the Transformer architecture?
8. Explain why the positional encodings have the same dimension $d_{\text{model}}$ as the input embeddings, and write down the formulas for the even and odd dimensions of the sinusoidal positional encodings.
9. According to Table 2, how does the training cost (in FLOPs) of the Transformer (base model) compare to the GNMT + RL model on the English-to-German (EN-DE) translation task?
10. Based on the empirical results in Table 4, evaluate the performance (WSJ 23 F1 score) of the Transformer (4 layers) under the semi-supervised setup compared to other semi-supervised models.