Exercises
Practice permutation equivariance, absolute-vector addition, sinusoidal values, signed relative offsets, clipping, RoPE rotations and offsets, ALiBi softmax, and valid-shape position audits.
These exercises test reordering, absolute and relative position calculations, RoPE geometry, ALiBi scores, and position audits. Each prompt states its index and sign conventions.
Reordering and Absolute Position
Q1. Name the reordering property
An unmasked content-only self-attention layer satisfies for every row permutation matrix . Which property does this equation state?
Select one choice, then check.
Hint
Solution
Q2. Reorder an unmasked output
An unmasked content-only layer returns rows . The input rows are reordered from to . What output row order follows from permutation equivariance?
Select one choice, then check.
Hint
Solution
Q3. Add an absolute position vector
A repeated token has embedding . At index 4 its learned position vector is . What is the second coordinate of ?
Compute it first, then check your number.
Hint
Solution
Q4. Calculate one sinusoidal value
For , the first sine coordinate is . What is ?
Compute it first, then check your number.
Hint
Solution
Relative Offsets and RoPE
Q5. Apply the offset convention
Relative offset is defined as key index minus query index, . A query at index 8 reads a key at index 5. Which offset is used?
Compute it first, then check your number.
Hint
Solution
Q6. Clip a relative offset
A relation table clips to . The original offset is . Which table offset is selected?
Compute it first, then check your number.
Hint
Solution
Q7. Rotate a coordinate pair
Using , rotate by . What is the first coordinate?
Compute it first, then check your number.
Hint
Solution
Q8. Compare equal RoPE offsets
The same unrotated query and key pair uses the same RoPE frequency. Which two position pairs must produce the same pairwise RoPE dot product?
Select one choice, then check.
Hint
Solution
Score Bias and Integrated Audit
Q9. Normalize an ALiBi row
A causal query has four equal content scores. ALiBi adds biases . What is the softmax weight on the final key? Give at least three decimal places.
Compute it first, then check your number.
Hint
Solution
Q10. Audit a valid-shape position mismatch
Training uses left padding and assigns the first real token position 0. Evaluation also uses left padding but assigns physical column indices, so the first real token may receive position 3. All input, mask, and output shapes match. Which audit is most direct?
Select one choice, then check.