Exercises
Practice ID validation, lookup, positions, block parameters, shapes, tied logits, shared identity, cross-entropy, masked means, causal interventions, and end-to-end failure diagnosis.
Use the frozen vocabulary, dimensions, position table, and parameter conventions. Show intermediate values for numerical answers.
Q1. Validate an ID window
Is input [0,2,7,8] valid for the frozen model? If not, identify the first
invalid value.
Answer it first, then check.
Hint
Solution
Q2. Calculate position-aware lookup
Token B has row . What record represents it at position 2?
Compute it first, then check your number.
Hint
Solution
Q3. Count one decoder block
Under the frozen conventions, count attention matrices, biased MLP, and two LayerNorms for one block.
Compute it first, then check your number.
Hint
Solution
Q4. Track every major shape
For , give the ID, residual-stream, final-record, and logits shapes.
Answer it first, then check.
Hint
Solution
Q5. Calculate two tied logits
For , calculate tied logits for D with embedding
and Y with embedding .
Answer it first, then check.
Hint
Solution
Q6. Distinguish sharing from copying
Two matrices begin numerically equal, but changing an embedding entry leaves the output matrix unchanged. Are the weights tied?
Answer it first, then check.
Hint
Solution
Q7. Calculate one cross-entropy
For logits and target index 1, calculate natural-log cross-entropy.
Compute it first, then check your number.
Hint
Solution
Q8. Calculate a masked mean loss
Per-position losses are and valid-target mask is . What mean loss should be reported?
Compute it first, then check your number.
Hint
Solution
Q9. Design a causal intervention
Using zero-based indices, to test whether logits row 1 reads future position 3, what should you change and what should remain invariant?
Select one choice, then check.
Hint
Solution
Q10. Audit a misleading successful run
A model returns shape and finite loss, but reports 400 parameters while configured as tied. Changing the token at the fourth input position (index 3) also changes logits row 1. Identify both independent failures.
Select one choice, then check.