MemotivaLLM Engineer Interview Questions: Transformer Architecture, Self-Attention, and Modern LLM Foundations

What is positional encoding and why is it needed?

LLM Engineer Interview Questions: Transformer Architecture, Self-Attention, and Modern LLM Foundations

Audio flashcard · 0:19

Nortren·

What is positional encoding and why is it needed?

0:19

Positional encoding adds information about token position to embeddings, because self-attention by itself is order-agnostic and treats input as a set rather than a sequence. Without position information, the model could not distinguish "dog bites man" from "man bites dog". Modern LLMs use rotary position embeddings, which encode position through rotation in vector space.
huggingface.co