Skip to content

Widget library

Each widget keeps its math in a small TypeScript core, separate from drawing. That core is unit-tested against NumPy reference outputs (references/gen_fixtures.py → widgets/fixtures/). Every widget has a text description, keyboard controls, light and dark themes, and a static fallback on phones. Each Part’s widgets are built along with that Part, flagship widgets (★) first.

Well-known visualizations elsewhere are linked under Go deeper rather than rebuilt: TensorFlow Playground, Brendan Bycroft’s LLM Visualization, Transformer Explainer, Distill and 3Blue1Brown.

Site-wide learning tools (10/14 built)

WidgetWhat you doWhat it teachesPriorityStatus
Course mapZoomable prerequisite graph of all 53 modules, coloured by progress; click a node to open itWhere you are and what each module needsP1✓ built
Progress dashboardCompletion per Part, tests passed, quiz scores, estimated hours leftPacingP1✓ built
In-browser code cellsEditable Python cells with NumPy that run in the pageTry ideas without installing anythingP1✓ built
In-browser test runnerRun a CPU-sized task's tests in the page and see pass/fail per testTight feedback on your codeP1✓ built
Notation hover cardsHover any symbol for its meaning and the module that introduced itOne notation across all sourcesP1✓ built
Derivation stepperReveal a derivation one line at a time; a "why?" on each line shows the rule usedDeriving by handP1✓ built
Progressive hintsThree levels per task: a nudge, the approach, then partial codeGetting unstuck without spoilersP1✓ built
Flashcard reviewSpaced-repetition cards from each module's key ideas, stored in the browserRetentionP2planned
Pipeline locatorMini map of the LLM or diffusion pipeline, highlighting the current moduleThe big pictureP2planned
Tensor shape tracerAnnotates each line of an example with array shapes as it runsShape reasoningP2✓ built
Training-curve clinicReal loss curves to diagnose: learning rate too high, overfitting, data bugDebugging trainingP2✓ built
Spot-the-bug labBroken training code to fix; tests confirm the fixDebugging codeP2planned
Paper reading guideFollow three passes through Attention Is All You Need, then recompute its table 2Reading papersP3✓ built
DiscussionA comment thread per module through GitHub Discussions (Giscus)Asking for helpP3planned

Part 1 (9/9 built)

WidgetWhat you doWhat it teachesUsed inStatus
★ Matrix transformerDrag a 2×2 matrix's columns and watch the grid deformMatrices as maps, determinant as area, eigenvectors as directions that don't turn1.1✓ built
SVD image compressorSlide the rank kLow-rank approximation and reconstruction error1.2✓ built
PCA point cloudStretch and rotate a 2D cloudPrincipal axes are covariance eigenvectors1.2✓ built
★ Gradient field explorerDrag a point over a contour plotGradient direction, magnitude and level sets1.3✓ built
Jacobian lensMove a small square through a nonlinear mapThe Jacobian as a local linear map1.3✓ built
Distribution playgroundTune parameters, draw samplesCommon distributions, law of large numbers, CLT1.4✓ built
Covariance ellipseEdit covariance entriesCorrelation and 2D Gaussians1.4✓ built
Entropy and KL visualizerReshape two distributionsEntropy, cross-entropy, why KL is asymmetric1.5✓ built
Step-size explorerChange the learning rate on 1D and 2D functionsConvergence, oscillation, divergence1.6✓ built

Part 2 (6/6 built)

WidgetWhat you doWhat it teachesUsed inStatus
★ Perceptron playgroundClick to add points, step the update ruleHow the boundary moves; why XOR fails2.3✓ built
Regression fitterDrag points; switch closed-form vs gradient descentLeast squares, with the loss surface beside the fit2.2✓ built
Polynomial overfit labDegree and λ slidersOverfitting, regularization, train vs test error2.1✓ built
Bias–variance samplerResample datasets and refitVariance across fits, bias of a model class2.5✓ built
Logistic boundaryAdjust weights and biasProbabilistic classification and log-loss2.3✓ built
k-means / EM stepperStep the E and M updatesClustering, GMM ellipses, local optima2.6✓ built

Part 3 (11/11 built)

WidgetWhat you doWhat it teachesUsed inStatus
★ Network playgroundChoose layers and activations, train liveHow depth bends decision regions3.1✓ built
ReLU region viewerAdd hidden unitsNetworks as piecewise-linear functions3.1✓ built
★ Computation graph stepperStep forward values, then gradients flowing backwardBackprop, chain rule, gradient accumulation3.2✓ built
Activation histogram labChange init scale and depth; toggle BatchNorm / LayerNormVanishing and exploding activations; why normalization helps3.4✓ built
Optimizer racePick a surface, learning rate and betasSGD vs momentum vs RMSProp vs Adam3.3✓ built
LR schedule viewerWarmup, cosine, step decayHow schedules shape the loss curve3.3✓ built
★ Convolution scannerMove the kernel; set stride, padding, dilationFeature maps, output sizes, receptive fields3.6✓ built
Feature map viewerPick an image for a tiny CNN running in the browserWhat each layer detects3.6✓ built
Residual gradient flowToggle skip connectionsGradient size per layer, why ResNets train3.7✓ built
Character language modelTrain an MLP on names; change the context length and temperatureLearned character embeddings, bigram vs MLP, sampling3.8✓ built
Dropout visualizerChange the drop rateDropout as an implicit ensemble3.5✓ built

Part 4 (9/9 built)

WidgetWhat you doWhat it teachesUsed inStatus
★ Tokenizer playgroundType any textTokens, IDs, how words, numbers and other scripts split4.1✓ built
BPE merge stepperTrain BPE on a toy corpus, one merge at a timeMerge rules and vocabulary growth4.1✓ built
Embedding explorerSearch words in a 2D/3D projectionSimilarity, analogies, clusters4.2✓ built
RNN unrollerStep through time, watch the gradient normWhy RNNs forget4.3✓ built
★ Attention calculatorStep Q·Kᵀ, scale, mask, softmax, ×V with live matricesExactly what attention computes4.4✓ built
Attention head viewerPick a layer and head of a tiny model on your textWhat heads attend to4.6, 7.3✓ built
Transformer block walkthroughFollow one token through a block with shapes shownResidual stream, norms, MLP4.5✓ built
RoPE viewerChange positionsSinusoidal encodings and RoPE as rotation4.5✓ built
Decoding playgroundTemperature, top-k, top-p on a tiny modelHow sampling shapes output4.6✓ built

Part 5 (16/16 built)

WidgetWhat you doWhat it teachesUsed inStatus
★ GPU memory calculatorSet model size, batch, sequence length, precision, optimizerWhere memory goes: weights, gradients, optimizer states, activations, KV cache5.1✓ built
Roofline explorerChange arithmetic intensityCompute-bound vs memory-bound kernels5.1✓ built
FlashAttention tiling animationStep through tilesWhy tiling avoids slow memory reads5.2✓ built
Parallelism simulatorSplit a model over N GPUs: data, tensor, pipelineCommunication cost and pipeline bubbles5.3✓ built
Scaling-law explorerSlide a compute budgetCompute-optimal model size and token count5.4✓ built
Data pipeline explorerToggle filters on sample documentsDeduplication and quality filtering5.5✓ built
MoE routerRoute tokens; change top-k and capacityLoad balancing and dropped tokens5.6✓ built
KV cache animationGenerate token by tokenWhat the cache saves and how memory grows5.7✓ built
Quantization explorerChoose int8 / int4 and group sizeRounding error and outliers5.7✓ built
Speculative decoding demoStep draft and verifyAcceptance rate and speedup5.7✓ built
Loss-mask viewerToggle which chat tokens count toward the lossHow SFT data is formatted5.8✓ built
DPO explorerAdjust β; compare chosen vs rejected log-probsWhat preference optimization pushes5.9✓ built
Policy-gradient banditPull arms, watch the policy updateREINFORCE basics5.10✓ built
★ RL loop animationSample, verify, reward, updateHow models learn from verifiable rewards (GRPO)5.10✓ built
LoRA rank explorerSlide the rank rLow-rank updates and parameter count5.11✓ built
How noisy is a benchmark?Resample a benchmark; compare pass@k before and after RLConfidence intervals, paired comparisons, pass@k5.12✓ built

Part 6 (9/9 built)

WidgetWhat you doWhat it teachesUsed inStatus
Autoencoder latent explorerDrag through a 2D latent space of digitsDecoding latents into images6.1✓ built
ELBO decompositionSlide βReconstruction vs KL trade-off6.2✓ built
Flow density warperStack invertible transformsChange of variables6.3✓ built
ODE/SDE particle simulatorDraw a vector field, add noiseEuler vs Euler–Maruyama sampling6.4✓ built
Forward diffusion sliderMove t, change the noise scheduleHow data becomes noise6.5✓ built
Score-field viewerChange the noise level on 2D dataScores as denoising directions6.5✓ built
★ Flow-matching playgroundCompare crossing training lines with the exact marginal flow on toy 2D data; watch particles flowConditional and marginal velocity fields, and ODE sampling6.6✓ built
Guidance sliderChange the CFG scaleFidelity vs diversity6.7✓ built
Latent diffusion pipelineClick through text encoder, denoiser, VAE decoderHow Stable Diffusion-style models fit together6.8✓ built

Part 7 (3/3 built)

WidgetWhat you doWhat it teachesUsed inStatus
Logit lensRead the residual stream of a tiny GPT through its output layer after each blockWhen a prediction forms7.3✓ built
Ablation plannerList factors, generate an ablation gridExperiment design7.2✓ built
Reproduction trackerLog your runs against a paper's numbersSystematic reproduction7.4✓ built