LLMs
Causal mask
A causal mask prevents a decoder token from attending to future tokens.
How it works
The mask sets forbidden attention logits to negative infinity before softmax. Each position can therefore depend only on itself and earlier positions.
A concrete example
Illustrative: position 3 in a 5-token sequence can read positions 1 to 3 but not 4 or 5.
Do not confuse it with Padding mask
a causal mask blocks the future; a padding mask blocks non-content positions.