Free · no signup
Play with the ideas behind AI
Every Math to Machine lesson has a demo you can poke. Here are 20 of them — drag the sliders, press the buttons, build the intuition. This is what “learn by doing” actually looks like.
Gradient descent
FoundationsThe algorithm that trains every model. Press Step and watch it roll downhill — crank the learning rate and watch it overshoot.
Set a learning rate, then Step downhill
Loss surface
Step 0
loss = 6.25
x = -2.5, gradient = -5 · One minimum at x = 0. Convex — descent always finds it.
Function explorer
FoundationsDrag the coefficients and see how lines, parabolas, exponentials and sine waves reshape — the vocabulary of everything ahead.
Pick a family · drag the sliders
y = 1·e^(1x)
Growth (b>0) explodes; decay (b<0) melts toward 0. Never negative if a>0.
Vectors & the dot product
FoundationsAdd, subtract and project 2-D vectors. The dot product becomes 'how similar are these two things?' for embeddings later.
Drag the components
Show
Dot · angle
u·v = 6
|u| = 3.16, |v| = 3.16 · angle ≈ 53.1°
Matrix transforms
FoundationsWatch a 2×2 matrix rotate, scale, shear and flip space. Every neural-net layer is, at heart, a matrix reshaping data.
Drag the matrix entries
Determinant (area scale)
det = 2
area grows by this factor
The derivative
FoundationsDrag a point along a curve and shrink the gap — watch the secant close in on the tangent. That limit is the derivative.
Drag the point (x) and shrink the gap (h)
Function
Tangent slope = f′(x)
3
f′(x) = 2x
Secant slope (gap h)
4.5
As h → 0, this closes in on 3. That limit IS the derivative.
Real Python, in your browser
FoundationsActual CPython compiled to WebAssembly. Edit the code, press Run — nothing installed, nothing sent to a server.
Run Python — right here, no install
Output
Press Run to execute.
Real CPython, compiled to WebAssembly, running in your browser. Nothing is sent to a server.
Linear regression by hand
Classical MLDrag the line to fit the dots and watch the error shrink. 'Snap to best fit' shows the mathematically optimal line.
Drag the line to fit the dots
Mean squared error
0.444
best possible is 0.116 — the amber misses are what MSE squares and averages
Precision vs recall
Classical MLSlide the decision threshold and watch precision and recall pull against each other — why one accuracy number is never enough.
Slide the threshold — watch precision vs recall fight
True Positive
5
False Positive
2
False Negative
2
True Negative
5
top row = predicted positive · left column = actually positive
Precision · Recall
71% · 71%
of flagged, how many right · of real, how many caught
Accuracy · F1
71% · 0.71
F1 balances precision and recall in one number
k-means clustering
Classical MLStep through assign → update and watch clumsy starting centroids snap to the real clusters, then converge.
Step through assign → update
Iteration 0
keep stepping
Each ✕ chases the middle of the points that chose it.
Notice: k-means never sees the "true" clusters — it only ever minimises distance to the nearest ✕. 12 points, 3 centroids.
A single neuron
Deep LearningInputs × weights + bias → activation. The atom of every neural network, made draggable.
Drag inputs, weights & bias
Activation
z → output
0.75 → 0.68
green edges = positive weights, red = negative. Thicker = stronger. The activation squashes z into the output.
Backpropagation
Deep LearningForward values flow in; gradients flow back through the chain rule. The one idea that makes deep learning work.
Forward computes the loss — then backprop the gradients
Loss (target = 8)
1
Prediction z should hit the target. Now press Run backward to see how to fix it.
Convolution
Deep LearningSlide a kernel over an image grid and watch the feature map light up — how CNNs see edges and shapes.
Slide the kernel across the image
Kernel
Window (1,1)
3
sum of the 9 overlapping cells × the kernel weights
The edge kernel gives ~0 on flat areas and a big value right at the light/dark boundary — it has detected an edge.
Attention
Deep LearningClick a token and see how much it draws from every other token. The mechanism at the heart of every transformer.
Click a query token (a row)
"sat" attends most to
"cat" (44%)
Each row is a softmax — the query's attention split across all tokens, summing to 100%. Content words matter; filler doesn't.
Darker cell = stronger attention. This one mechanism, run in parallel across many "heads", is what replaced RNNs.
Tokenization
Generative AIWatch text split into the tokens an LLM actually reads — and why the model bills and thinks per token.
See text split into tokens
Example text
“transformers are unbelievably powerful!”
Token count
9 tokens
Amber chips (##) are sub-word continuations of the previous piece — one word can cost several tokens.
Models bill and remember in tokens, not words. That's why prompt length, context windows and costs are all measured this way.
Next-token prediction
Generative AIA probability bar chart over candidate next words. Slide the temperature from careful to wild.
Turn the temperature — reshape the odds
The cat sat on the ___
Top token probability
73%
Balanced: usually sensible, with room to vary.
Embeddings
Generative AIClick a word to rank the rest by meaning. The semantic search behind every RAG system.
Click a word to find its nearest meanings
Closest to "king"
queen, prince
cosine similarity 1 & 1 — nearly 1 means same direction = same kind of thing.
Real embeddings do this in hundreds of dimensions, but the rule is identical: to find related text, compare vector directions.
Diffusion
Generative AIScrub an image into pure noise and back — the forward-and-reverse process behind Stable Diffusion and DALL·E.
Scrub the noise level (forward ⇄ reverse)
Noised 40%
in between
Each real step adds/removes just a little noise; there are hundreds of them.
Retrieval-augmented generation
Generative AIStep through query → retrieve → augment → generate — how you give an LLM private, current, citable knowledge.
Step through the RAG pipeline
Document store
1 · Query
The user asks a question.
The agent loop
Agentic AIThought → Action → Observation, repeated. Watch an agent refuse to guess and call tools instead.
Step through the agent's think–act–observe loop
The model can't multiply reliably or know live facts — so instead of guessing, it acts (calls a tool), observes the result, and reasons on. Loop until it can answer.
The MLOps loop
ProductionData → train → evaluate → deploy → monitor → back to data. Shipping a model is the start of its life, not the end.
Step around the MLOps loop
🗄️ Data
Collect, clean and version the data. Garbage in, garbage out — most real effort lives here.
Liked poking at these? Try a full lesson.
Every one of the 234 lessons wraps a demo like these in predict-then-reveal teaching, worked examples, and a boss check. The first five are free.