From Micrograd to coppergrad
summary
Recreates Karpathy’s micrograd micrograd in Rust by implementing a scalar automatic differentiation engine and simple optimizer: defines Value nodes with Option<Box> children, implements Add/Mul via Rust operator traits, renders computation graphs with dot and plotters, and runs backprop + gradient descent on examples. Shows linear-regression math (single-parameter solution W=15.4, two-parameter solved to W=10, B=21), explains ownership issues and why Rc/RefCell and topological sort are needed for a full DAG. Works end-to-end.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 1:07Tiny learning model example
- 3:59Loss functions and derivatives
- 8:14Adding bias to linear model
- 11:04Why calculus isn’t enough
- 13:11Automatic differentiation in Rust
- 14:57Building AD engine
- 20:35Defining operations in Rust
- 24:30Implementing backprop
- 31:37Summary
related talks
29mMacromancy: an introduction to Rust macros
10mstd::autodiff - computing derivatives with your compiler
54mKEYNOTE: A journey through incremental computation
25mIntro and Overview to Rust
31mFunctional programming guerilla in the land of Rust
29mLearning Rust by accident
24mMacros for a More Productive Rust
56mReady for Rust
