NumPy allowed · plain Python earns 10 bonus points
Q · Kᵀ / √d scores normalized with softmax
Build a causal (autoregressive) attention mask matrix preventing query positions from attending to future key positions during decoding.
Implement causal_attention_mask(seq_len). Return a 2D integer list of size (seq_len, seq_len) where element (i, j) is 1 if j <= i (visible) and 0 if j > i (masked future token).
causal_attention_mask(seq_len: int) -> list[list[int]]