Code & Implementation
Where to read well-tested code, find idiomatic patterns, and learn by reading the source. The site won't reinvent these — they're already excellent.
Core library docs
The official reference for the libraries you'll use daily. Read the user guides, not just the API reference.
- scikit-learn user guide The gold standard for classical-ML reference code. Every algorithm has a worked example, a "tips on practical use" subsection, and references to the original papers. The user guide alone is a full course.
- PyTorch documentation The framework most modern research uses. Start with the 60-minute blitz, then read the autograd notes — understanding autograd well is what separates beginners from intermediate users.
- JAX documentation Google's NumPy-on-GPU with first-class transformations (jit, vmap, grad). Increasingly the choice for research; the Thinking in JAX guide is essential.
- Hugging Face docs The default entry point for pretrained transformers, datasets, and serving. The "transformers" library is the de-facto standard for working with LLMs and vision transformers in Python.
- PyTorch Lightning Removes the boilerplate from PyTorch training loops. If you find yourself re-writing the same trainer for every project, this is the abstraction to learn.
- SciPy Statistical tests, special functions, optimization, sparse matrices. Often the right tool when scikit-learn is too high-level and NumPy is too low.
Books with executable code
Textbooks where every figure has a Jupyter notebook behind it. Best for learning by typing along.
- Dive Into Deep Learning Free textbook with executable code for every concept (PyTorch / TF / JAX / MXNet). The closest thing to a comprehensive DL textbook with runnable examples. Updated regularly.
- Hands-On ML — Aurélien Géron "Hands-On Machine Learning with Scikit-Learn, Keras & TensorFlow", 3rd ed. The notebooks are free even if you don't buy the book; the most-recommended practical ML book.
- Murphy — PML notebooks Companion code to Murphy's "Probabilistic ML" textbooks. Hundreds of notebooks covering Bayesian methods, generative models, and more.
Code-along tutorials
Where you watch (or read) someone build a model from scratch and follow along. The fastest way to internalize a technique.
- Karpathy — Neural Networks: Zero to Hero Andrej Karpathy's full video course building from scratch: micrograd → makemore → GPT. The single best resource for understanding modern transformers at the implementation level.
- nanoGPT Karpathy's ~300-line GPT implementation. Trains real models. Read the file top-to-bottom — every line teaches something about transformer training.
- Annotated Deep Learning Paper Implementations ~150 paper implementations with side-by-side annotations. Best when you've read a paper and want to see exactly how the math becomes code.
- The Annotated Transformer Harvard NLP's annotated re-implementation of "Attention Is All You Need" — every equation in the paper paired with the PyTorch line that implements it.
Worked examples
Example-by-example reference code. Best for "I want to do X — show me the canonical way".
- scikit-learn examples gallery Hundreds of small worked examples with plots. Filter by topic. Excellent for finding the right tool for a specific problem.
- pytorch/examples Official PyTorch example repository — MNIST, ImageNet, RL, language modelling, GAN. Reference for idiomatic PyTorch patterns.
- Keras code examples Curated, self-contained Keras / TF examples across every modality (vision, audio, NLP, RL, generative). Each is short and runnable end-to-end.
- Hugging Face examples Official scripts for every transformer task — classification, QA, summarisation, translation, generation. The starting point for any fine-tuning work.
Reading great code
Open-source projects worth reading for their own sake — not just to use, but to learn from how they're written.
- scikit-learn source A model of careful Python: consistent API, thorough docstrings, regression tests for every estimator. Reading sklearn/linear_model/_base.py teaches more about API design than most tutorials.
- transformers — model implementations Every major transformer architecture (BERT, GPT, Llama, ViT, …) implemented in PyTorch with consistent structure. Reading two implementations side-by-side is the best way to learn an architecture.
- Flax — JAX neural network library Compact, functional JAX library. Excellent example of how to design composable neural-network APIs without classes-everywhere.
- llm.c — Karpathy GPT-2 training in pure C/CUDA. ~1000 lines. Read this when you want to see what frameworks actually compile down to.
Papers with implementations
Finding the implementation alongside the paper.
- Papers With Code Papers indexed by task with linked implementations and benchmark rankings. The best single place to find a strong baseline for any benchmark.
- Annotated DL Paper Implementations Side-by-side paper text + clean PyTorch implementation for ~150 influential papers. Listed twice because it's that useful.