Series

Deep dives into specific topics.


Online softmax, flash attention and flash decoding

How attention kernels avoid trips to GPU memory. This series starts with online softmax, builds Flash Attention 1 and 2 on it, and ends with flash decoding, with each CUDA kernel stepped through as tiles move between HBM and SRAM.


Integer and floating point representations

How computers turn bits into numbers. This series starts with four ways to represent integers, seen through one formula, and then takes a floating point number apart bit by bit.


From Permutations to Sinkhorn

Explore the journey from the spectral properties of permutations to the geometry of doubly stochastic matrices, Birkhoff’s polytope, and how it all leads to Sinkhorn distances in optimization and machine learning.


Matrix calculus and autodiff

Starting from the idea of a small change in output given a small change in input, this series builds the concepts of linear operators, gradients and Jacobians, and covers the foundational ideas behind autodiff alongwith links to implementations in PyTorch and JAX.


Rotations, quaternions and Lie algebras

This series starts from 2D rotation matrices and takes us through the developments we have made to understand and describe rotations - it covers imaginary numbers, intrinsic and extrinsic rotations, Euler angles, quaternions, geometric algebra and Lie theory.