Machine learning models, built from scratch
Train them, take them apart and break them, right in your browser
No PyTorch and no inference library: convolution, attention, diffusion and SLAM are written line by line in TypeScript, and they run in the tab you have open. Every number in an article was measured.
- articles
- 14
- figures you can play with
- 51
- hand-written operators
- 30
Latest
№ 0148 minInteractive
Train your own AI composer in three minutes: from noodling to calm
Train a small Transformer to write four-part chorales from scratch, in your browser, and listen to it turn noodling into music. Then judge it: twenty clicks make it calmer — and show you how it games the judge.
Read
Notebook index
Newest first.
№ 01312 min
A mini Figure AI in three minutes: one camera, one arm
Figure's humanoids work from the cameras in their heads. This is the smallest version I could build from scratch: an arm made of boxes that picks a block up and puts it where you say, from one 48 × 48 camera. Knock the camera and it still gets there; a cut-down version trains in your browser in three minutes.
Interactive
№ 01211 min
Putting a path tracer in a 3D playground: crash a car, gun a plane, fly a helicopter
Part one's room stood still. This part takes the same path tracer outdoors and puts in a character you steer, five cars, a helicopter and an aeroplane, with the light computed anew every frame. When anything moves, every accumulated sample is void; four things keep it playable all the same.
Interactive
№ 01111 min
How a picture clears from snow: a WebGPU path tracer from scratch
The colour of one pixel is the average of many rays bouncing at random. Watch a picture clear from noise, shoot one ray and see how it becomes a colour, flip one switch that cuts the noise five times, swap in metal and glass, and see how a BVH keeps a million triangles running.
Interactive
№ 01010 min
A task scheduler from scratch
Sixty tasks that wait for one another, four workers, 215 lines of TypeScript. The scheduler itself is four rules, failed tasks and all; the hard part is answering "how long is left". Watch three progress bars mislead you, then use the scheduler to forecast itself, and let it learn from the tasks that have finished.
Interactive
№ 00911 min
A city nobody schedules — 300 people, each minding their own needs
A procedurally generated 3-D city where every person picks the next thing to do from four needs of their own. Swap the deciding for dice or a fixed timetable and watch the rhythm of the whole city change.
Interactive
№ 0088 min
Drawing the map while finding yourself on it — SLAM from scratch
A small car with no GPS and no map has to draw the map and find itself on it at the same time. Drive it round a loop, watch its map bend, and watch the whole thing snap straight the moment it gets back to where it started.
Interactive
Who writes this
I'm Paul. I like to own the whole path: the perception model on the edge device, the tracks and events it produces, and the agents that decide what to do with them.
- Computer vision
- Multi-task perception networks, teacher / student distillation, ONNX / TensorRT on Jetson.
- Multi-agent systems
- Orchestrator / worker designs, MCP tool contracts, the edge-and-cloud split.
- LLM
- Multimodal document understanding, structured output, VLMs on trigger rather than on every frame.
- Edge
- RTSP, GStreamer, WebRTC; Rust and Kotlin Multiplatform where Python is too slow.