AIInterviewTraining logoAIInterview/Training
🧠 Foundations of LLMs & GenAI
Core

Positional Encodings (RoPE and ALiBi)

Attention is order-blind, so models inject token position separately. Modern LLMs rely on relative schemes: RoPE rotates query/key vectors by an angle proportional to position so the attention score hinges only on the offset between tokens, and ALiBi adds a distance penalty to attention scores. Both extrapolate to longer sequences far better than learned absolute positions, which is why RoPE-with-scaling is how context windows get extended. AI, ML, and GenAI engineer interviews probe it because it explains how long-context models are built.

a free account unlocks the core curriculum tier · no card
RELATED CONCEPTS
PRACTICE THIS IN REAL QUESTIONS
COMPANIES THAT ASSUME THIS
NEXT IN FOUNDATIONS OF LLMS & GENAITemperature and Sampling