Back to Projects

LSTMs from Scratch

Explore the mathematics of gated recurrence, implement custom PyTorch cells, and visualize gate dynamics over long-range dependencies.

Part 1

The Math of Gated Recurrence

Deconstructing the mathematical foundation of LSTMs: the cell state, the three gates, and how they enable gradient flow across hundreds of time steps.

Part 2

Pure PyTorch Implementation

Translating gated recurrence equations into pure PyTorch code, building architectures from single cells to sequence-to-sequence networks.
View Code on GitHub

Part 3

Training & Analyzing Gates

Analyzing forget, input, and output gate trajectory dynamics and training convergence over long-range dependencies.