Masked Attention
What is Masked Attention?
In one sentence: Masked attention is attention where some positions are hidden, so certain words cannot look at certain other words.
A mask is like putting a sticky note over parts of the page. It is used to block future words in causal models, to ignore padding added to make sentences the same length, or to keep separate documents from seeing each other in a batch.
What does Masked Attention look like?
When two short sentences are packed into one batch, masked attention stops words from one sentence attending to the other.
Why does Masked Attention matter?
Masks control what information a model is allowed to use.
Last updated · Fact-checked by The AI Math
Linking to this page from a lesson or article? <a href="https://getaimath.com/dictionary/masked-attention/">Masked Attention, explained simply</a> (The AI Math Dictionary)