No history yet

Final Exam

 

1.In the implementation of a causal attention mechanism for a GPT-style model, what is the primary purpose of applying torch.tril to the attention score matrix before the softmax function?

 

2.When implementing Rotary Positional Embeddings (RoPE), the sinusoidal rotations are applied to which tensors?

 

3.In a modern 'Pre-Norm' Transformer block architecture, what is the correct sequence of operations?

 

4.What is the primary function of torch.cuda.amp.GradScaler when implementing automatic mixed precision (AMP) training?

 

5.When implementing an autoregressive generation loop, what is the computational complexity of generating a new token at step N of a sequence, assuming a Key-Value (KV) cache is in use?

 

6.What is the key difference between Distributed Data Parallel (DDP) and Fully Sharded Data Parallel (FSDP)?

 

7.Which torch.einsum expression correctly computes the batched matrix multiplication for attention scores (QKTQK^T) where Q and K have shape (batch, heads, seq_len, head_dim)?

 

8.True or False: The primary advantage of Rotary Positional Embeddings (RoPE) over learned absolute positional embeddings is their improved ability to generalize to sequence lengths longer than those seen during training.

 

9.When implementing a Feed-Forward Network (FFN) in a Transformer block, a GeLU activation is typically used. What is the primary role of the FFN?

 

10.The AdamW optimizer is preferred over the standard Adam optimizer for training Transformers. What is the key modification in AdamW?

 

11.In the context of sampling strategies for text generation, how does Top-P (Nucleus) sampling differ from Top-K sampling?

 

12.What is the primary motivation for using FlashAttention in a large-scale LLM?

All done? Get your grade