Build a transformer from scratch
Assemble a small decoder-only transformer and trace one complete forward, backward, and Adam update.
Read guideBuild a working mental model from tensors and gradients through a complete decoder-only transformer.
Assemble a small decoder-only transformer and trace one complete forward, backward, and Adam update.
Read guideUnderstand contiguous storage, shapes, strides, scalar tensors, indexing, reshape, and backend transfer.
Read guideLearn the checked tensor-operation contracts, broadcasting rules, reductions, and relationship to autograd.
Read guideFollow reverse-mode automatic differentiation from graph construction through gradient accumulation and custom gradients.
Read guideUnderstand embeddings, linear layers, normalization, activations, feed-forward composition, softmax, and cross-entropy.
Read guideTrace causal multi-head self-attention shapes, masking, materialized execution, and exact memory-linear execution.
Read guideFollow embeddings, pre-normalized residual blocks, final normalization, and the language-model head through a decoder-only transformer.
Read guideUnderstand how Python orchestrates seeded batches and metrics while C++ executes fresh graphs, all-position or time-range cross-entropy, backward, and Adam.
Read guide