Case study · 2025

ML, From Scratch

No high-level wrappers: MLP, CNN, RNN, and Transformer architectures implemented from first principles — each with a live demo you can try.

fundamentalsPythonNumPyPyTorchTransformers

Why from scratch

Frameworks hide exactly the parts you should understand. So I built the parts — every model implemented from first principles, no high-level ML wrappers:

  • Multi-Layer Perceptron — MNIST digit classification, 784 → 256 → 128 → 10 with ReLU, Adam, He init, L2 regularization. 97%+ test accuracy. Live demo
  • Convolutional Neural Network — two-digit classification (0–99). 97.88% accuracy. Live demo
  • Recurrent Neural Network — doodle classification across 10 animals. 94.36% accuracy. Live demo
  • Transformers — "Attention Is All You Need" re-implemented end-to-end: an encoder for emotion analysis, a decoder trained as a Shakespeare generator, and the full encoder–decoder translating English to French. Live demo

What I learned

Backprop stops being magic the third time you derive it. The payoff shows up everywhere else: when a training run misbehaves in PyTorch, I have a mental model of what's actually happening in the graph — because I've built the graph.

The fundamentals repo is here and the transformer deep-dive (encoder/decoder walkthroughs) is here.