What is positional encoding and why is it needed?hard

Type
conceptual
Topic
positional-encoding
Frequency
common
Tags
deep-learning, positional-encoding, rope
Answer

Positional encoding injects word-order information into token embeddings, since self-attention on its own treats input as an unordered set of tokens.

Explanation

Without it, “dog bites man” and “man bites dog” would look identical to the model. Common approaches include sinusoidal encodings (original Transformer), learned position embeddings, and rotary position embeddings (RoPE) used in most modern LLMs.

Follow-upHow does RoPE differ from absolute positional encoding?