Exercises — Sinusoidal positional encoding
Questions, exercises, and worked answers
← Back to the lesson: Sinusoidal positional encoding
8. Check your understanding
TipYour turn
- If \(d_{\text{model}}\) doubles, how many frequency pairs are used?
- As pair index \(i\) increases, does wavelength increase or decrease?
- Why does the transformation associated with offset \(k\) not depend on the starting position \(p\)?
- What is the difference between “computing the signal at position 20,000” and “successfully performing a task with a 20,000-token context”?
- Is \(PE(p)^\top PE(q)\) a learned attention score?
NoteAnswer sketch
- The number of pairs changes from \(d_{\text{model}}/2\) to \(d_{\text{model}}\).
- It increases: \(\lambda_i=2\pi\,10000^{2i/d_{\text{model}}}\).
- Addition identities express the sine and cosine at \(p+k\) as a linear combination of those at \(p\), with coefficients depending only on \(k\) and \(\omega_i\).
- The first is a property of the formula; the second depends on the model’s learned behaviour and must be evaluated empirically.
- No. It is a similarity between fixed positional vectors; an attention score depends on learned projections of representations.