Practice track

Papers to code

Implement the core method of a research paper and test it against the paper's equations. 10 problems, about 295 minutes. Do them in order: each problem uses ideas from the problems before it.

0 / 10 solved

  1. 01
    Focal loss

    Binary and multi-class focal loss with gamma and alpha, from logits and without overflow, plus the binary gradient.

    From Loss Functions

    ResearchEasy20 min
  2. 02
    CLIP symmetric contrastive loss

    Normalize image and text embeddings, build the temperature-scaled similarity matrix, and compute the symmetric InfoNCE loss and its gradient.

    From Open-Vocabulary Vision — CLIP

    ResearchMedium30 min
  3. 03
    Grouped-query attention

    GQA forward with H query heads and G shared key and value groups, plus mean pooling of a multi-head checkpoint into groups.

    From Multi-Head Attention

    ResearchMedium30 min
  4. 04
    Top-k MoE gating and the Switch load-balancing loss

    Route tokens to the top k experts with renormalized softmax gates, and compute the Switch Transformer auxiliary loss E times sum f_i P_i.

    From Mixture of Experts (MoE)

    ResearchMedium30 min
  5. 05
    Rectified flow loss and Euler sampler

    Interpolate along straight paths, regress the velocity x1 - x0 with the flow matching loss, and integrate a velocity field with Euler steps.

    From Flow Matching & Rectified Flows

    ResearchMedium25 min
  6. 06
    DDPM noise schedule, closed form noising and posterior

    Build the linear beta schedule and alpha bars, sample x_t from x_0 in closed form, and compute the mean and variance of q(x_{t-1} | x_t, x_0).

    From Diffusion Models — DDPM from Scratch

    ResearchMedium30 min
  7. 07
    GRPO group advantages and clipped objective

    Normalize rewards within each group, estimate the KL with k3, and compute the clipped GRPO objective averaged per answer over valid tokens.

    From RL for Games — AlphaZero, MuZero, and the LLM-Reasoning Era

    ResearchMedium30 min
  8. 08
    DPO loss and implicit rewards

    The direct preference optimization loss, its implicit rewards and its gradient, from policy and reference log probabilities.

    From DPO: Direct Preference Optimization

    ResearchMedium25 min
  9. 09
    Speculative decoding: accept, reject and resample

    The min(1, p/q) acceptance rule and the residual distribution that keep speculative decoding exactly equal to the target model.

    From Speculative Decoding — Draft, Verify, Repeat

    ResearchHard35 min
  10. 10
    Tiled attention with an online softmax

    FlashAttention in numpy: a running max and a running sum over key blocks give exact attention for any block size.

    From KV Cache, Flash Attention & Inference Optimization

    ResearchHard40 min