Skip to main content

Quiz: Module 2 - Transformer Architecture

Test your understanding of the Transformer architecture. This quiz contains 30 questions covering attention mechanisms, multi-head attention, and positional encoding.


Chapter 1: Attention Mechanism​

Question 1​

In the attention formula, what does the Query (Q) represent?

Question 2​

Why is the attention score scaled by √d_k?

Question 3​

What is the shape of the attention weights matrix for a sequence of length n?

Question 4​

In causal (masked) attention, what does the mask prevent?

Question 5​

What is the time complexity of standard attention with respect to sequence length n?

Question 6​

What value is used to mask out positions in attention?

Question 7​

What does the Value (V) matrix contain?

Question 8​

What does softmax ensure about attention weights?

Question 9​

Flash Attention primarily addresses which problem?

Question 10​

How is the final attention output computed?


Chapter 2: Self-Attention and Multi-Head Attention​

Question 11​

What distinguishes self-attention from cross-attention?

Question 12​

If d_model = 512 and we have 8 attention heads, what is d_k per head?

Question 13​

What is the main benefit of multi-head attention?

Question 14​

In multi-head attention, how are the outputs of different heads combined?

Question 15​

Where is cross-attention typically used?

Question 16​

Why can attention heads be computed in parallel?

Question 17​

What might different attention heads learn?

Question 18​

What is the output dimension of multi-head attention with d_model = 512?

Question 19​

Why is self-attention permutation equivariant?

Question 20​

What is the role of the output projection (W_O) in multi-head attention?


Chapter 3: Positional Encoding and Embeddings​

Question 21​

Why do Transformers need positional encoding?

Question 22​

In sinusoidal positional encoding, what varies across different dimensions?

Question 23​

What is the range of values for sinusoidal positional encoding?

Question 24​

How are token embeddings combined with positional encodings?

Question 25​

What is an advantage of learned positional embeddings over sinusoidal?

Question 26​

What is RoPE (Rotary Position Embedding)?

Question 27​

Which models commonly use RoPE?

Question 28​

Why is the token embedding scaled by √d_model in the original Transformer?

Question 29​

What is ALiBi's approach to position encoding?

Question 30​

What is a limitation of learned positional embeddings?


Quiz Complete!​

Congratulations on completing the Module 2 Quiz! Review any questions you found challenging and revisit the relevant chapter sections.

Passing Score: 24/30 (80%)