Skip to content

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
10
you can play with
10
hand-written operators
30
live · mnist-cnn
A ~9,000-parameter CNN running in your browser. No server, no libraries. How does it do that?

Latest

01010 minInteractive

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.

Read

Notebook index

Newest first.

View all posts
  1. 00910 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#ai-agent#from-scratch

  2. 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#ai-agent#robotics#from-scratch

  3. 00711 min

    How a cloud of noise becomes an apple: training a 3-D diffusion model in the browser

    Pick two fruit and press Train. A diffusion model written from scratch learns, in your browser, to pull a cloud of coloured 3-D noise into those two fruit, colours included. Then we take apart what it learned.

    Interactive#generative#diffusion#from-scratch

  4. 0069 min

    A robot dog in the browser: its walking policy is four matrix multiplications

    MuJoCo compiled to WebAssembly plus the walking policy Deep Robotics published make a Lite3 walk in your browser. Then you try to knock it over: blindfold its senses, shove it, detune its motors.

    Interactive#ai-agent#robotics#reinforcement-learning

  5. 00511 min

    One body, two heads: training a HydraNet that draws boxes and masks, in the browser

    Emoji fruit as training data, and a small network with one shared trunk and two output heads, trained from scratch in your browser. It finds the fruit within ten seconds. Then we measure honestly what multi-task learning bought us and what it cost.

    Interactive#computer-vision#multi-task#from-scratch

  6. 0048 min

    Training a Transformer from scratch in the browser: watching attention grow

    No PyTorch and no libraries. A tiny autodiff engine and a Transformer of about fourteen thousand parameters, written in TypeScript. Press a button and it learns to reverse a string of digits within seconds.

    Interactive#llm#transformer#from-scratch

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.

GitHub

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.