Flashcards · Transformers · Free
Transformers flashcards, generated for you.
Example Transformers study cards to learn from right now — then generate a full set from your own notes (plus a practice quiz) and export to Quizlet or Anki. Free, no account needed.
Example Transformers flashcards
What is the core problem that Transformers solve that RNNs couldn't handle well?
RNNs process sequences one step at a time sequentially, creating long-range dependencies that are hard to learn. Transformers process entire sequences in parallel and can directly relate any two positions, regardless of distance.
What does 'attention' mean intuitively in Transformers?
Attention is the model's ability to focus on relevant parts of the input when processing each element. For each word, it learns to weight how important every other word is for understanding it.
What are the three components of self-attention and what do they represent?
Query (Q): what am I looking for? Key (K): what can I offer? Value (V): what information do I contain? For each position, Q matches against all Ks to decide which Vs to blend together.
Why is the dot product (Q·K^T) used in attention, and why divide by √d_k?
Q·K^T measures similarity between queries and keys. Dividing by √d_k (scaling) prevents dot products from growing too large, which would crush gradients through softmax. This stabilizes training.
What is the mathematical formula for scaled dot-product attention?
Attention(Q,K,V) = softmax(QK^T/√d_k)V. This computes attention weights via softmax over scaled similarities, then uses those weights to average the values.
Why do Transformers use multiple attention heads instead of a single attention mechanism?
Multiple heads allow the model to attend to different aspects simultaneously (e.g., one head tracks nouns, another tracks verbs). Each head learns different representation subspaces independently, then results concatenate.
What is positional encoding and why is it necessary in Transformers?
Since Transformers process all tokens in parallel without sequential order, positional encoding injects position information by adding learnable or fixed sinusoidal patterns to embeddings. This tells the model where each word is in the sequence.
Describe the structure of a Transformer block (encoder layer).
Multi-head self-attention → Add & Norm (residual + layer norm) → Feed-forward (two linear layers with ReLU) → Add & Norm. Residual connections and normalization stabilize deep stacking.
Why is masking used in decoder self-attention, and what does it prevent?
Causal masking prevents the decoder from attending to future tokens during training. Without it, the model could 'cheat' by looking ahead at answer tokens. At inference, no masking is needed; autoregressive generation handles causality naturally.
How does a Transformer differ from an RNN in terms of parallelization and computational complexity?
RNNs process sequentially (can't parallelize), O(n) steps with O(d²) per step. Transformers process all tokens in parallel in O(1) steps, but each step is O(n²d) due to all-pairs attention. For long sequences, Transformers are faster in wall-clock time despite higher complexity.
Make your own Transformers study set
Flashcards for related topics
Studying Transformers to build with AI? MindloomHQ turns it into real skills — structured courses, agent projects, and certificates.
Explore MindloomHQ →