Architectures · advanced · concept 72 of 176
Positional Encoding & RoPE
Attention treats its input as an unordered set, so word order has to be injected explicitly. Early transformers added sine-wave position signals; modern LLMs rotate query and key vectors by position (RoPE), which extends more gracefully to long contexts. Context-window tricks usually live here.
Key terms
Position embeddingsSinusoidal encodingRoPERelative positionContext extension
Learn these first
Where you meet it in the real world
Why a model knows 'dog bites man' from 'man bites dog', and how million-token contexts are stretched
Videos
▶ Stanford XCS224U: NLU I Contextual Word Representations, Part 3: Positional Encoding I Spring 2023 ↗
Stanford Online · YouTube
▶ RoPE: Understanding Rotary Positional Embeddings in transformers ↗
Hugging Face · YouTube
Guides and articles
Courses, papers, and more