The attention mask determines which positions can see which.
Causal (GPT, Llama): each token attends only to previous tokens. Lower triangular.
Bidirectional (BERT): each token attends to all positions. Full matrix.
Prefix-LM (T5): bidirectional on the prompt, causal on the generation.
Sliding window (Phi, Mistral): each token attends to the last W positions only. Diagonal band.