Fundamentals of Machine Learning and Neural Networks
What this topic covers
Explain how neural networks learn patterns and generate text through next-token prediction. Recognize how causal masking prevents future tokens from influencing each prediction.
What does causal masking do in a decoder-only transformer during training?
Causal masking blocks attention to future token positions, so the model predicts each next token using only earlier tokens. Without it, the model could copy the answer from later positions and the training loss would be meaningless. The mask is applied to attention scores before softmax.