Question 14
Domain 2: Core Machine Learning, AI, and Transformer FoundationsWhat is the primary purpose of positional encoding in transformer models?
Correct answer: B
Explanation
Transformers process tokens in parallel, so they need an added signal to represent order. Positional encoding provides that by giving the model "sequence order information," allowing it to distinguish "the cat bit the dog" from "the dog bit the cat."
Why each option is right or wrong
A. To reduce computational complexity of attention
B. To provide sequence order information to the model
Transformers do not inherently encode token order because self-attention treats the input set in parallel, so an added positional signal is required to distinguish different permutations of the same words. In the standard Transformer architecture, positional encodings are added to the input embeddings at the start of the model to inject sequence position information, enabling the network to learn relationships that depend on order rather than just token identity.
C. To compress input token representations
D. To enable variable-length sequence processing