Contents
- The problem
- The first attempt wasn't enough
- What closed the gap
- Where the value was
- Try it
- Closing thought
The problem
I'd just spent a few sessions in fast.ai's 04_mnist_basics.ipynb finally pinning down what a gradient actually means: not "3's gradient," but the slope of the loss curve at the exact point where the weight currently sits. Small distinction, but it's the one that had stayed fuzzy since high school calculus. Calculus itself still sounds like a foreign language to me 🥲.
Understanding it in a chat window is one thing. Explaining it well enough for someone else to follow using the Feynman Method, felt like a different bar entirely. So the best way to learn it was to build something around it.
The first attempt wasn't enough
The obvious demo already exists in the fast.ai material: a ball rolling downhill on y = x² − 4x + 7, a learning rate slider, watch it converge or fly off the curve. It's a fine five minute demo (crank the learning rate too high and the ball leaves the screen, which is memorable). I played with it in Colab and had Claude explain it to me, repeatedly, until it stuck. But it's still one number moving on one curve. Real models don't have one weight, they have thousands, and there's no curve you can draw for that.
What closed the gap
The fast.ai chapter already had the answer, I just hadn't noticed it. Train a simple linear model on raw pixel values and the weights come out the same shape as the image. Draw the weights as a picture and you can watch them sharpen into something recognizable as training progresses.
So I had Claude produce a javascript app around that idea. It took a few short tries to get right, but the core of it is: 8x8 pixel cat, dog, and rabbit silhouettes added later, a weight grid per class rendered as a heatmap, and three things students can do instead of just watch.
- Draw their own creature on the pixel grid and label it, so "picture becomes numbers" stops being abstract
- Guess before the model does, with a running scoreboard of human versus model accuracy
- Train on one image at a time and see the actual arithmetic: pixel value, error, gradient = error times pixel, old weight, new weight, worked out for a handful of real pixels, not just a color changing on screen
Toggling in a third class turned into a useful accident. With two classes, one weight grid can decide cat-or-not by itself. Add a third and that stops working: now each class needs its own weight grid, the model scores all three, and picks whichever comes back highest. That's the beginner version of what's called one-vs-rest classification. The next step up, softmax, does the same job but turns those scores into probabilities that add up to 100 percent, so instead of just picking a winner you get something like 70 percent cat, 20 percent dog, 10 percent rabbit. I didn't build that part, but watching three weight grids compete made the idea click in a way the term itself never did.
Where the value was
Claude wrote all the code. I didn't need to worry about the code at all. I described what I wanted, looked at what came back, and pushed it in a different direction when it wasn't right. A few rounds of that.
The value wasn't in writing JavaScript. It was in being forced to specify, precisely enough for another system to build it, what a correct demo of gradient descent for a linear pixel model actually looks like. The fast.ai notebook taught me the concept. Directing Claude through "no, the weight grid has to update after every single image, not after each epoch" is what actually pinned it down. Reading forces you to follow someone else's precision. Building, even by proxy, forces you to produce your own.
Try it
Runs entirely in the browser. No install, no backend. Draw something, guess, train it, watch the weight grid learn.
Closing thought
The bet this demo makes is that watching numbers change on a screen isn't the same as understanding why they change, and that the fastest way to close that gap is to make something that explains it to someone else, even if an AI writes the code for you. Directing that build was harder than reading the notebook a third time would have been. That's probably the point.
If you've used an AI agent to build a teaching tool for something you were still shaky on yourself, I'd like to hear what part of the build finally made it click.
Part of the same AI-tools learning log as I built two AI tools, the second one told me how I should be learning AI.
Find me on GitHub: github.com/mediblacksand
Top comments (0)