Skip to content
POLARISAI ACADEMY
Route R09

Under the Hood

The Under the Hood route has four courses that build on each other, from the basics to a final project of your own.

The four courses

  1. R09-101

    Linear Algebra, Probability and Autograd in Code

    The student can implement reverse-mode automatic differentiation, cross-entropy loss, and the AdamW optimiser from scratch in pure NumPy whose analytical gradients match numerical finite differences to < 1e-6.

    28 h · Prerequisites: F01–F07, R02-201 · first lesson open

  2. R09-201

    Building a Transformer from Scratch in PyTorch

    The student can implement a complete BPE tokeniser and decoder-only Transformer with RoPE and KV-caching from scratch in PyTorch (without nn.Transformer) that matches reference forward/backward tensors and KV-cache equivalence.

    32 h · Prerequisites: R09-101 · first lesson open

  3. R09-301

    Post-Training (SFT, RLHF, DPO) and Interpretability

    The student can implement the exact DPO loss function and an activation-patching hook in PyTorch that shifts preference probabilities on a toy model and isolates the target attention head responsible for a seeded circuit behavior.

    28 h · Prerequisites: R09-201 · first lesson open

  4. R09-401

    Reading and Reproducing a Machine Learning Paper

    The student can implement the core algorithm and ablation experiment from a supplied research paper specification and reproduce its target empirical metrics within a declared tolerance envelope.

    35 h · Prerequisites: R09-301 · first lesson open

What has to be passed

Every course ends with a task marked against a fixed answer key.

  • R09-101 Submit a pure-NumPy autograd and optimiser module (micrograd_np.py) that passes 30 fixed unit tests comparing forward outputs, backward gradients, and AdamW weight updates against reference tensors within 1e-6 tolerance.
  • R09-201 Submit bpe.py and transformer.py tested by 35 fixed unit tests verifying: exact BPE merge reproduction, causal mask zero-leakage of future tokens, exact tensor match against reference weights (< 1e-5), and identical logits with and without KV-cache enabled.
  • R09-301 Submit dpo_loss.py and activation_patch.py that pass 25 fixed unit tests verifying exact DPO loss/gradient agreement against reference equations and deterministic identification of the seeded induction head in a frozen tiny transformer.
  • R09-401 Complete a 20-item keyed methodological audit of a supplied paper packet and submit a reproduction script (reproduce.py) that runs on a frozen dataset in the test container and reproduces the keyed baseline and ablation metrics within declared tolerances. (Optional Portfolio item: full replication report).
Lessons coming

The lessons for this course are being written. Join the waitlist and we will email you when it opens. Join the waitlist