FDEInterviews logo
🧠 Foundations of LLMs & GenAI
Core

Attention and Self-Attention

Attention computes a weighted sum of value vectors, where the weights come from how well each token's query matches every other token's key. Self-attention applies this within one sequence so each token can pull from all the others, and the all-pairs comparison is why cost grows with the square of sequence length. FDE loops probe it because it explains context limits, latency, and the KV cache in one mental model.

a free account unlocks the core curriculum tier · no card
RELATED CONCEPTS
PRACTICE THIS IN REAL QUESTIONS