Build Your Own teenygrad
ML JOURNEY / FULL WALKTHROUGH

Build Your Own teenygrad

Construct a lazy buffer, reverse-mode autodiff engine, tensor API, neural primitives, and train a small MLP.

7 parts58 individual lessons4.8 estimated hours290 XP available
Build Your Own teenygrad project artwork
0%0 of 58 complete
Start walkthrough
No compressed chapters.

Every source step is its own lesson with intuition, concepts, correctly rendered MathJax mathematics, implementation, tests, mistakes, and a checkpoint.

01
PART 1

Shape Utilities

Implement the small helper functions for working with shape tuples and index ordering that the rest of the engine relies on.

0/2
001prod+5 XP002argsort+5 XP
03
PART 3

Autograd Functions

Define the differentiable Function base class and implement forward and backward passes for all unary, binary, reduce, and movement operations.

0/21
013Function+5 XP014function forward backward stubs+5 XP015apply+5 XP016Neg+5 XP017Relu+5 XP018Log+5 XP019Exp+5 XP020Sqrt+5 XP021Sigmoid+5 XP022Add+5 XP023Sub+5 XP024Mul+5 XP025Div+5 XP026sum function forward+5 XP027sum function backward+5 XP028max function forward+5 XP029max function backward+5 XP030Reshape+5 XP031expand function forward+5 XP032expand function backward+5 XP033permute function forward backward+5 XP