Causal Self-Attention in NumPy: Stop Future-Token Leakage
A beginner-friendly NumPy lesson on the triangular mask used by next-token models. Compare masked and unmasked attention, inspect real weights, and verify causality by changing a future token.
July 14, 2026 in Machine Learning, Python by Mehdi Lotfinejad9 minutes