Who this is for
For people who like to learn architectures from scratch
This notebook is for anyone who enjoys pulling a model apart and rebuilding it with a pencil. You don't need to have trained a neural network before. You only need to be comfortable multiplying and adding numbers, and to be curious about why each step is there.
The goal is simple. Once you've walked through the interactive steps and done the homework on each one, you should carry a clear mental image of BERT: the Transformer encoder you already know, fed two sentences at once, trained by filling in blanks and judging whether one sentence follows another. With that picture in place, the many BERT variants read as small edits to it.
Building this tutorial is how I learn. I hope it nudges you to do the same: take the pieces, imagine the forward pass your own way, and make an even more vivid version of it.
How the notebook works
1Read the note on the left of each step. It says what happens, why the paper does it, and whether it's the same as the Transformer or changed.
2Watch the worked example on the right. It computes the step on your own sentences, one number at a time.
3Do the homework in the “Your turn” sheet under it. Fill in a matrix entry or a shape yourself, then check it. On a phone the sheet opens as a pop-up so the walkthrough isn't interrupted.
4Track the shapes in the bar at the top. It shows the size of the matrix after every step, so you can see where it grows, shrinks and stays the same.