Attention Mechanism

Module: fundamentals

What it is

The attention mechanism allows AI models to focus on relevant parts of their input when producing each part of their output. When generating a word, the model can "attend" to different parts of the input with varying degrees of focus. This mimics how humans pay attention to relevant information while ignoring irrelevant details.

Why it matters

Attention is why modern AI understands context so well. When you ask a follow-up question, the model can attend to relevant parts of the earlier conversation. When summarising a document, it can focus on key passages. Understanding attention helps explain why longer, clearer context in your prompts produces better results.