AlgoPlus//machine learning / gpt
Read the theory

GPT (Decoder-Only LLM)

Causal masking lets the model predict the next token everywhere, then generate left-to-right.

Phase
Done
Legend
Attends
Masked (future)
AI Tutor Workspace
In a nutshell
GPT is a decoder-only transformer: a token may look at the tokens before it but never ahead. That causal rule lets it be trained to predict the next token at every position at once, and to generate text left to right — one token at a time, feeding each new token back in (autoregressive).
Ready
Press play to begin the cinematic walkthrough.
Read-only rear-view mirror: a token can study everything behind it but nothing ahead. That one rule lets the model practice predicting every word at once, yet still write left to right.
Key terms
Go deeper in the lesson
Read the full theory, intuition & complexity for GPT (Decoder-Only LLM).