SkillHack

How to become an AI Research Engineer

Step by step and free: 12 phases, 90 topics and 285 graded practice questions.

Practise this roadmap free

What is an AI Research Engineer?

An AI Research Engineer turns research ideas into experiments that run, scale and give a trustworthy answer. They implement methods from papers, write and debug training code in PyTorch or JAX, design ablations and sweeps within a compute budget, and diagnose runs that diverge or stall. They work alongside research scientists, help decide which results are real, and carry the ones that hold up toward a product.

Who this roadmap is for

Machine learning engineers and strong software engineers who already train models in PyTorch or JAX and want to join research teams, and PhD students who want production-grade engineering habits. You need linear algebra, probability and solid Python. It is not a starting point for people new to machine learning.

What you will be able to do

You will be able to implement a paper and prove numerical parity with a reference, build and debug a training loop and its data pipeline, design experiments with honest baselines and statistics, choose a distributed training layout, profile and speed up a run, and run fine-tuning and RL experiments on language models.

The AI Research Engineer roadmap

AI Research Engineer

  1. Phase 1 Foundations and the research loop

  2. Phase 2 Deep learning internals for research engineers

  3. Phase 3 Research code and tooling

  4. Phase 4 Implementing from papers

  5. Phase 5 The training loop and its data

  6. Phase 6 Debugging training runs

  7. Phase 7 Experiment design and infrastructure

  8. Phase 8 Evaluation and analysis for research

  9. Phase 9 Distributed training

  10. Phase 10 Performance and efficiency

  11. Phase 11 Post-training and RL experiments

  12. Phase 12 Research to production and the craft

All topics, in order

Mark each topic Learning, Done or Skip, and sign in to save your place to your account. Done is your own word, not passing: a topic is passed when you score 50 or more on its questions. This order is the study plan.

  1. Phase 1 · Foundations and the research loop

    1. What a research engineer does

      A research engineer makes research ideas cheap to test and their results trustworthy. Scientists own the hypothesis; you own the harness that runs it: the training code, configs, tracking and evals, so a question asked on Monday has a believable answer by Friday. Your leverage is in what you make reusable and in refusing to report a number you cannot trace. Harden what the team reruns often, not every script, and say plainly when a result is not ready.

      Test yourself on this topic

      4 graded questions · scored out of 100 with feedback · free

      Start the 4 questions
    2. The research loop and time to signal

      Research speed is set by time to signal: how long it takes from a change in code to a number you trust. Keep an inner loop of minutes (a tiny model, a small data slice, a test that must pass) and an outer loop of hours or days for runs at scale, and push as many questions as you can into the inner one. When the team slows down, measure where the hours go, because queue time, flaky jobs and manual analysis often cost more than the GPUs.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    3. From an idea to a runnable experiment

      Scientists often arrive with a direction, not a test. Before writing code, pin down the question in one sentence, the smallest experiment that could answer it, the metric and baseline, and the result that would change the plan. Write the decision rule down before you see the numbers, so a weak or mixed result becomes a decision rather than a reason to keep tuning. If no outcome would change what the team does next, the run is not worth its compute.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    4. Reading papers as an engineer

      Read a paper as a claim about one setup, not a fact about the world. Find the exact baseline and whether it was tuned as hard as the method, the model size, data and token count, the eval protocol, and how many seeds sit behind each number. Many gains come from details left out of the text, such as a schedule or a data filter. Use the first pass to decide whether the claim is relevant and credible at your scale before spending a week reproducing it.

      Test yourself on this topic

      4 graded questions · scored out of 100 with feedback · free

      Start the 4 questions
    5. Reading reference code and configs

      When a paper ships code, the code is the method: initialisation, schedules, normalisation placement, data filtering and loss tricks often live only in a config file or a helper function. Read the training entry point first, then the config that produced the headline number, then diff both against your own setup. Treat every unstated default as a possible cause of the gain, and record which ones you copied so a later gap can be traced back to them.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    6. Reproducing results

      Reproducing a result is diagnosis. First check that your evaluation matches the paper's exactly, then reproduce the paper's baseline in your own harness: if your baseline is also low, the gap is in your pipeline, and if it matches, the gap is in the method or a missing detail. Change one suspected cause at a time rather than tuning until the target number appears, and when the paper is simply underspecified, say so and report what you could and could not match.

      Test yourself on this topic

      4 graded questions · scored out of 100 with feedback · free

      Start the 4 questions

    Chapter 1 lab

    Write the instruction for an agent that diagnoses a reproduction gap

    A prompt lab that closes the chapter: you write the instruction, and it is graded on a rubric.

    Start the lab
  2. Phase 2 · Deep learning internals for research engineers

    1. Tensors, shapes and broadcasting

      Many silent bugs in research code are shape bugs that broadcasting hides. Adding a tensor of shape (batch,) to one of shape (batch, 1) gives a (batch, batch) result with no error, and a reduction over the wrong axis still returns a number. Name your dimensions in comments or with einops, assert shapes at module boundaries, and test with distinct sizes for batch, sequence and hidden so a swapped axis fails loudly instead of training on garbage.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    2. Autograd in practice

      Autograd records operations on tensors that require gradients and walks them backwards when you call backward. Gradients accumulate until you zero them, detach cuts a tensor out of the graph, no_grad skips recording entirely, and an in-place edit to a saved tensor can raise an error or corrupt a gradient. When a parameter's gradient is missing or zero, check whether its path to the loss was cut, usually by a detach, a trip through NumPy or an integer operation.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    3. Losses and their numerics

      Compute cross-entropy from raw logits with the library's fused function, which uses the log-sum-exp trick, rather than taking the log of a softmax you computed yourself, which can underflow. Know how the loss is reduced: a mean over all tokens and a mean of per-sequence means weight long and short examples differently, and padding must be excluded with an ignore index or a mask. Two runs whose losses are averaged differently cannot share a plot.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    4. Optimizers: SGD, Adam and AdamW

      SGD with momentum stores one buffer per parameter; Adam stores two (running means of gradients and of squared gradients), which is why optimizer state often outweighs the weights. AdamW decouples weight decay from the adaptive update, so decay acts on the weights directly instead of being rescaled away. Betas, epsilon and which parameters get decay (usually not norms or biases) all change results, so set them in the config and never let a library default decide silently.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    5. Learning rate schedules and warmup

      The learning rate schedule is part of the method, and changing it can move results as much as an architecture tweak. Warmup protects the early steps while Adam's statistics are unreliable, cosine decay ties the schedule to a fixed run length, and warmup-stable-decay holds the rate flat and decays at the end, so one long run can be branched into several lengths. Compare methods only under schedules tuned for each, and never compare a mid-decay checkpoint with a fully decayed one.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    6. Initialisation and normalisation

      Initialisation and normalisation decide whether activations and gradients stay in a usable range as depth grows. Pre-norm transformers normalise each block's input and keep a clean residual path, which trains more stably at depth than post-norm; RMSNorm drops the mean subtraction and is cheaper. Residual branches are often scaled down at init so their sum does not grow with layer count. If a deeper model trains worse than a shallow one, check activation scales per layer before blaming the idea.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    7. The transformer as code

      A decoder-only transformer is a stack of identical blocks writing into a residual stream. Each block reads the stream through a norm, adds an attention output (tokens mixing information, masked so none sees the future), then adds an MLP output (per-token computation). Embeddings map tokens in and an unembedding maps the final stream to logits. Write one block yourself from the equations at least once: it is the fastest way to read papers that change one part and to spot what a codebase does differently.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    8. Tokenizers and what they do to experiments

      The tokenizer decides what the model sees, so it is part of the experiment. Byte-pair encoding merges frequent byte sequences into a fixed vocabulary, special tokens mark documents and turns, and the same word can tokenise differently with or without a leading space. Per-token loss is not comparable across tokenizers because the tokens differ, so compare in bits per byte or on downstream evals, and pin the tokenizer version with every dataset you build.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
  3. Phase 3 · Research code and tooling

    1. PyTorch for research code

      PyTorch runs eagerly, so you can print, step through and assert anywhere, which is why so much research code is written in it. A module holds parameters and buffers and exposes them through its state dict, which is what you save and load; forward and backward hooks let you read or edit activations without touching model code. Register non-trainable tensors as buffers so they move devices and get saved, and keep model, optimizer and data state separate so each can be restored.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    2. JAX for research code

      JAX treats a model as a pure function of parameters and inputs, transformed by grad, jit and vmap. Randomness is explicit: you split and pass PRNG keys, so reusing a key silently repeats the same dropout mask. Jit traces your Python once per input shape, so Python side effects run only at trace time and changing shapes forces recompiles. In return you get whole-program compilation and sharding annotations that scale the same code across many accelerators.

      Reading

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    3. Structuring a research codebase

      A research codebase should make the common change easy and the baseline hard to break. Use one training entry point driven by config, put each new idea behind a flag that defaults off, and leave the baseline code path unchanged so old results stay reproducible. Prefer a little copied code over a deep class hierarchy every experiment must bend. Delete dead experiments once their results are written up, because unused flags become traps for the next person.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    4. Configs as the experiment record

      The config is the record of what an experiment was. Use typed configs that fail on an unknown key, apply command-line overrides on top of a named base, and save the fully resolved config with every run. A typo that silently creates a new field, or a default changed in code, can make two runs differ in a way nobody notices. If a result cannot be rerun from its saved config and commit alone, the config is incomplete.

      Reading

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    5. Testing research code

      Research code needs tests because its bugs rarely crash; they make results slightly wrong. Unit test each component against a reference with small, odd shapes, check that a tiny model can overfit one batch, and keep a short golden run whose loss at a fixed step must match within tolerance after every change. Run them in CI on CPU or a small GPU. Tests that take seconds get run and tests that take an hour get skipped, so keep most of them tiny.

      Reading

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    6. Seeds and determinism

      A seed fixes the random streams for initialisation, data order and dropout, but GPU kernels that use atomic adds can still give slightly different sums from run to run. Seed every library, record the seeds, and give data order and model init separate seeds so you can vary one without the other. Turn on deterministic algorithms when debugging a divergence, leave them off for big runs if they cost speed, and measure seed variance instead of assuming it is small.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    7. Environments and dependency pinning

      Two machines running the same code can train differently because a library, CUDA or driver version moved. Lock exact dependency versions in a lock file, build runs from a container image whose tag is logged with each run, and record the driver and CUDA runtime next to the commit. Upgrade the framework deliberately, on a branch, with the golden run as the check, rather than letting a fresh install pick up whatever is newest that day.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
  4. Phase 4 · Implementing from papers

    1. Implementing from papers

      Big models train through many bugs, so a run that learns is weak evidence that a new component is right. Build the novel piece on its own, test it against a slow, obviously correct reference and with gradient checks, then integrate it and run a short comparison against the baseline. Copying a similar operator from another repository is risky, because masking, scaling and normalisation details are exactly where lookalikes differ. A run that starts only proves the shapes line up.

      Test yourself on this topic

      4 graded questions · scored out of 100 with feedback · free

      Start the 4 questions
    2. Writing a slow reference implementation

      Before writing the fast version of anything, write the slow one: plain loops instead of fused ops, fp32 instead of bf16, the paper's equation line by line. That version is your oracle. Every optimised variant, kernel or sharded version is then tested by feeding both the same inputs and comparing outputs and gradients. Keep the reference in the repository beside its tests rather than deleting it, because the next optimisation will need it too.

      Reading

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    3. Numerical parity testing

      Two correct implementations rarely agree to the last bit, so parity tests need tolerances that mean something. Compare in fp32 first, where relative differences near 1e-6 are rounding; in bf16 expect differences around 1e-2, and check forward outputs, loss and gradients separately. A difference that grows with sequence length or depth is a bug, not noise. When a check fails, find the first layer where outputs diverge instead of loosening the tolerance until it passes.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    4. Attention masks and positional encodings

      Attention bugs leak the future or ignore the past without crashing. A causal mask must stop position i attending to anything after i, padding masks must stop real tokens attending to padding, and packed documents need masks that stop attention across a document boundary. Rotary embeddings rotate queries and keys by position, so an off-by-one in positions after packing or caching changes every score. Test masks directly: change a future token and assert earlier outputs stay the same.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    5. Loading and converting pretrained weights

      Loading a released checkpoint into your code means mapping every tensor name, shape and layout: fused or separate query, key and value weights, transposed linear layers, tied embeddings and differing norm epsilons. Convert, then prove it: run both implementations on the same tokens and compare logits within a tight fp32 tolerance, and check that a standard eval matches the published score. A converted model that generates fluent text can still be subtly wrong.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    6. Adding a component to an existing model

      Add a new idea to a shared model so that turning it off gives exactly the old model. Put it behind a config flag that defaults off, keep the baseline path untouched, and add a test that the flag-off model produces outputs identical to the previous commit. Then the comparison between baseline and idea differs only by the idea, and every older result in the tracker stays reproducible from its saved config.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    7. Mixture-of-experts layers

      A mixture-of-experts layer replaces one MLP with many experts and a router that sends each token to a few of them, so parameters grow faster than per-token compute. Routers tend to collapse onto a few experts, so training adds a load-balancing loss or a bias adjustment, and a capacity limit per expert means overflow tokens can be dropped. Log expert load and dropped-token rate every step: a model can look fine on loss while half its experts sit idle.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions

    Chapter 4 lab

    Write the brief for building a numerical parity suite against a paper

    A prompt lab that closes the chapter: you write the instruction, and it is graded on a rubric.

    Start the lab
  5. Phase 5 · The training loop and its data

    1. Anatomy of a training step

      One training step runs in a fixed order: forward pass, loss, backward pass, optional gradient clipping, optimizer step, zeroing gradients, then the scheduler step. Getting the order wrong causes quiet bugs, such as clipping before mixed-precision gradients are unscaled or stepping the scheduler per micro-batch instead of per optimizer step. Log loss, learning rate, gradient norm and throughput from one place each step, so every curve lines up with the step that produced it.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    2. Effective batch size and gradient accumulation

      The batch the optimizer sees is micro-batch size times accumulation steps times data-parallel ranks, and learning rate and warmup are tuned for that number. When you accumulate, scale each micro-batch's loss so the summed gradient equals the full-batch mean; with variable-length sequences that means normalising by the total tokens across all micro-batches, not averaging per-micro-batch means. Change any of the three factors and you have changed a hyperparameter.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    3. Training infrastructure: keeping a long run productive

      A long run's real output is goodput: useful training steps per hour of reserved hardware. It leaks two ways. Time spent waiting, when the input pipeline or a slow collective leaves GPUs idle, which a high utilisation reading can hide because it only shows that some kernel was running; and work lost to preemption or crashes, which checkpoint cadence and exact resumption control. A resumable checkpoint holds weights, optimizer, scheduler, step, RNG states and data loader position.

      Test yourself on this topic

      4 graded questions · scored out of 100 with feedback · free

      Start the 4 questions
    4. Data pipelines for pretraining

      Pretraining data is tokenised ahead of time into shards so the training job only reads and batches. Shuffle at two levels, shard order and a buffer within shards, so batches do not inherit the order sources were written in, and make the loader's position part of the checkpoint so a resumed run neither repeats nor skips data. Benchmark the loader on its own: if it cannot outrun a training step on one node, it will starve every node.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    5. Sequence packing and document masks

      Packing concatenates documents into fixed-length sequences so no compute is wasted on padding. Without a document mask, tokens attend to unrelated documents earlier in the same sequence, which leaks context and can hurt quality; with a per-document mask and positions reset at each boundary, a packed batch behaves like separate sequences. Count real tokens rather than sequences when you report how much data a run saw, and test the mask the same way you test a causal one.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    6. Data mixtures and sampling weights

      A pretraining dataset is a mixture of sources such as web, code, books and maths, and the sampling weights matter as much as the sources. Weights decide how many times each source repeats, and repeating a small source for many epochs can overfit it. Tune mixtures on small models with short runs, check that the ranking holds at a second size, and log per-source loss so you can see which part of the mixture a change helped or hurt.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    7. Data filtering and deduplication experiments

      A data filter or deduplication step is a hypothesis about quality, so test it like one. Train small models on filtered and unfiltered data with the same token budget, compare them on evals chosen before the run, and read samples of what was removed. Deduplication cuts memorisation and wasted compute, but an aggressive quality classifier can strip whole domains, and a filter tuned toward a benchmark's style can quietly inflate the comparison you meant to make.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    8. Weight averaging and EMA

      Averaging weights smooths out the noise of the last steps. An exponential moving average keeps a running copy of the weights updated every step, and checkpoint averaging takes the mean of several saved checkpoints; both often evaluate better than the raw final weights, especially before the learning rate has fully decayed. Keep the average in fp32, record which weights each eval used, and never compare an averaged model with a raw one as if the method made the difference.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
  6. Phase 6 · Debugging training runs

    1. Diagnosing a failing training run

      Debug a failing run by narrowing, not guessing. Reproduce the failure from the last good checkpoint with more logging, decide whether it is the data, the optimisation or the code by swapping one at a time for a known good version, then shrink the setup (fewer GPUs, a smaller model, fewer steps) until it fails fast. Lowering the learning rate or clamping NaNs can hide the cause without removing it, and the model may already be damaged.

      Test yourself on this topic

      4 graded questions · scored out of 100 with feedback · free

      Start the 4 questions
    2. Sanity checks before a real run

      Before any real run, do the cheap checks that catch most bugs. A fresh language model's first loss should be near the log of the vocabulary size; a tiny model should drive the loss on a single batch close to zero; and loss should fall on a short run with the real data pipeline. Decode a batch back to text and read it. If a sanity check fails, no amount of scale will fix it, and each one takes minutes.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    3. Reading loss curves

      A loss curve is a diagnostic. A long flat start can mean a learning rate that is too low or a broken signal; training loss rising steadily means divergence; sudden drops often line up with schedule changes or new data; and a growing gap between training and held-out loss means overfitting or a data mismatch. Plot against tokens rather than steps when batch sizes differ, use a log axis for the tail, and smooth lightly so you do not hide the spikes that matter.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    4. Loss spikes and divergence

      Large transformers can spike or diverge even when small ones train smoothly. Common causes are attention logits growing until softmax saturates, output logits drifting large, and a bad batch meeting a high learning rate. Fixes that target a cause include normalising queries and keys (QK-norm), a small z-loss on the softmax normaliser, gradient clipping, and checking Adam's epsilon and beta2. Reproduce an instability on a small model with a raised learning rate, where fixes are cheap to test.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    5. Monitoring gradients and activations

      Loss tells you something is wrong late; per-layer statistics tell you early. Log the gradient norm overall and per layer, the ratio of each update to the weights it changes (Karpathy's rule of thumb is around 1e-3), activation norms and maximum values, and attention entropy. A single layer whose numbers drift away from the rest usually points to the cause of a later spike. Sample these every few hundred steps so logging does not slow the run.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    6. Precision and overflow bugs

      Low precision loses information in predictable places. bf16 keeps fp32's range but only about three significant decimal digits, so long sums, softmax normalisers, losses and optimizer state should stay in fp32; fp16 has more precision but a narrow range, so it needs loss scaling to stop small gradients underflowing to zero. A bug that appears only at large batch, long sequence or great depth often comes from an accumulation done in low precision.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    7. Data bugs that look like model bugs

      Many model bugs are data bugs. Padding or prompt tokens counted in the loss, labels shifted by the wrong offset, the same shard read twice, a shuffle that leaves sources in long blocks, or eval data inside the training set all train without error. Decode real batches back to text, check token counts per source against what you expected, and hash eval examples against training shards before trusting a result that looks too good.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    8. Bisecting a regression

      When a metric gets worse and nobody knows why, a golden run helps: a short, fixed config whose loss curve is saved. Rerun it at the last good commit and the current one to confirm the regression, then let git bisect choose the commits to test, using the golden run's loss at a fixed step as the pass test. Check that the environment did not change too, because a library upgrade can produce the same symptoms as a code change.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
  7. Phase 7 · Experiment design and infrastructure

    1. Experiment design

      A clean comparison changes one thing. Hold code version, data, compute and evaluation fixed, vary only the factor under test, and run more than one seed per arm so you know the noise floor. Rerun the baseline on the current stack rather than reusing a number from last month, because library and data drift would become part of your effect. Write the run spec (question, arms, metric, seeds, decision rule) before launch, while mistakes are still cheap to fix.

      Test yourself on this topic

      4 graded questions · scored out of 100 with feedback · free

      Start the 4 questions
    2. Baselines run in the same harness

      A new method looks better against a weak baseline, so the baseline deserves the same care. Run it in your harness, on the same data, token budget and eval, and tune its learning rate and schedule as hard as the method's; many published gains shrink when the baseline is tuned properly. If the method gets extra compute or parameters, give the baseline a matched version, or state clearly that the comparison is not matched.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    3. Experiment tracking

      A number without provenance cannot be reproduced. Log every run's commit and uncommitted diff, resolved config, data version, seeds, environment and metrics to a tracker at launch, not after the run starts looking interesting. Link checkpoints and eval outputs to the run that made them, and name and tag runs so a sweep of thousands stays searchable. A spreadsheet of final numbers loses the context you will need when someone asks how a result was produced.

      Test yourself on this topic

      4 graded questions · scored out of 100 with feedback · free

      Start the 4 questions
    4. Estimating compute before you launch

      Estimate before you launch. Training a dense transformer costs about 6 FLOPs per parameter per token (2 forward, 4 backward), so a 1B model on 20B tokens needs about 1.2e20 FLOPs; divide by the hardware's peak times a realistic utilisation to get GPU-hours. Do the same for memory: weights, gradients and optimizer state cost a fixed number of bytes per parameter before activations. If the estimate does not fit the budget, change the plan before you queue the job.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    5. Spending a compute budget on a sweep

      With a fixed budget, the goal is information per GPU-hour. Screen a large search space with cheap proxies (smaller models, data subsets, shorter schedules), stop clearly losing runs early, and spend full-length runs only on the survivors. Know where proxies fail: a setting that wins small can lose at scale, especially learning rate and anything tied to width. Balance new configurations against repeat seeds, because a winner chosen from one seed each may simply be the luckiest.

      Test yourself on this topic

      4 graded questions · scored out of 100 with feedback · free

      Start the 4 questions
    6. Hyperparameter search methods

      Pick the search method to fit the question. Grid search is clear for one or two knobs but wastes trials when only one of them matters; random search covers the important dimensions better for the same budget; Bayesian methods help when trials are expensive and the space is smooth; and successive halving (Hyperband, ASHA) kills weak trials early. Search learning rate and weight decay on a log scale, and always report how many trials the winner was chosen from.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    7. Hyperparameter transfer across scale

      Under standard parameterisation the best learning rate shifts as a model gets wider, so values tuned on a small model are wrong for the large one. The maximal update parameterisation (muP) rescales initialisation, learning rates and output multipliers per layer so the optimum stays roughly fixed across width, letting you tune small and transfer. Implement it exactly, including the attention scale and output layer, and check it by sweeping learning rate at two widths and confirming the optima line up.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    8. Scaling ladders

      A scaling ladder is a set of small runs at several sizes, each trained compute-efficiently, used to predict a larger run before paying for it. Fit loss against compute on log axes, check that the fit predicts a held-out rung, and compare methods by their whole ladder rather than at one size. Watch for the line bending: a change that helps small models can stop helping, and downstream evals are noisier and less smooth than loss.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    9. Launching many runs on a shared cluster

      Launching hundreds of runs on a shared cluster is its own skill. Use job arrays or a launcher that reads one config per job, make launch scripts idempotent so a resubmitted job resumes rather than restarts, and have jobs requeue themselves after preemption. Tag every job with its sweep and owner, release reservations you are not using, and delete checkpoints from dead runs, because storage and queue time are shared with everyone else.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions

    Chapter 7 lab

    Write the instruction for an agent that audits a comparison for confounds

    A prompt lab that closes the chapter: you write the instruction, and it is graded on a rubric.

    Start the lab
  8. Phase 8 · Evaluation and analysis for research

    1. Benchmarks

      A benchmark score means little until you know what produced it. Check for contamination (the test set or close copies in the training data), whether the benchmark measures the capability you claim, and whether your protocol matches the models you compare against: prompt format, few-shot examples, decoding settings and answer extraction. When the top models all score inside the label noise, the benchmark is saturated and further gains there are not evidence of progress.

      Test yourself on this topic

      4 graded questions · scored out of 100 with feedback · free

      Start the 4 questions
    2. Building an eval harness

      Research evals are code and deserve the same care as training code. A good harness pins each task's version, prompt template and few-shot examples, fixes decoding settings, caches model outputs so rescoring is free, and writes per-example results rather than only the average, so you can read failures and compute intervals. Run it on a released model with a known score before trusting it on yours, and log the harness version with every number it produces.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    3. Likelihood and generative evals

      There are two ways to score a model on a multiple-choice task. Likelihood scoring compares the log-probability the model gives each answer and needs no generation; generative scoring lets the model write an answer and parses it. They can rank models differently, and small or base models often look far better under likelihood scoring. Decide deliberately whether to normalise by answer length, and report the method, because the choice can move a number more than the change you are testing.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    4. Evals during training

      Evals during training tell you whether a run is on track before it ends. Score checkpoints on a schedule with a fast suite, choose evals that give signal at your scale (held-out loss and likelihood-scored tasks move smoothly, while many generative benchmarks sit at chance for small models), and measure checkpoint-to-checkpoint noise so a dip is not read as a trend. Keep the in-loop suite small enough that it never slows the run it is watching.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    5. Sampling-based metrics and pass@k

      pass@k is the chance that at least one of k samples solves a task. Estimate it by drawing n samples, with n larger than k, counting the c that pass, and using the unbiased formula, rather than drawing exactly k samples, which gives a high-variance estimate. Temperature changes the result, so report it alongside k and n, and give an interval over tasks. A method that raises pass@100 may not raise pass@1, which is what a single user actually experiences.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    6. Model-graded evals

      A model grader can score open-ended outputs at scale, but it is a measuring instrument that needs calibrating. Check it against human labels on a sample, look for known biases (favouring the first option shown, longer answers or its own outputs), randomise answer order, and keep the grader model and prompt fixed across every run you compare. If the grader changes, earlier numbers are no longer comparable and have to be rescored.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    7. Ablations

      When a method bundles several changes, only ablations say which ones matter. Start from one base, remove or toggle one component at a time, and keep everything else fixed, including token budget and tuned settings; then test the combinations your budget allows, since parts can interact. Spend scarce runs on the components most likely to carry the gain, and report ablations that show nothing, because a part that does not help should be removed.

      Test yourself on this topic

      4 graded questions · scored out of 100 with feedback · free

      Start the 4 questions
    8. Statistical rigor

      One run per arm has no estimate of noise, so a small gap is not a result. Run several seeds per arm, report the mean with an interval, and pair the comparison where you can (same seeds, data order and eval examples) so shared noise cancels. A shaded band means something specific, standard deviation, standard error or a confidence interval, so say which. Picking the best of many sweep configurations overstates it; confirm the winner on fresh seeds.

      Test yourself on this topic

      4 graded questions · scored out of 100 with feedback · free

      Start the 4 questions
    9. Writing up an experiment

      An experiment is not finished until someone else can act on it. State the question, the setup (with links to runs and configs), the numbers with uncertainty, what you conclude and how sure you are. Report null and negative results as plainly as wins: the team needs to know which idea did not work and at what scale it was tested. Lead with the figure that answers the question, and cut any claim the data does not back.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions

    Chapter 8 lab

    Write the instruction for drafting an ablation section whose headline component did nothing

    A prompt lab that closes the chapter: you write the instruction, and it is graded on a rubric.

    Start the lab
  9. Phase 9 · Distributed training

    1. Scaling out without changing the result

      Data-parallel training done correctly gives the same model as one GPU seeing the same tokens in the same batches, so an accuracy gap after scaling out is a bug or a changed hyperparameter, not a cost of scale. Check the global batch (it grew with the number of ranks, so learning rate and warmup may need retuning), that every rank reads different data, that gradients are averaged rather than summed, and that the loss is reduced the same way as before.

      Test yourself on this topic

      4 graded questions · scored out of 100 with feedback · free

      Start the 4 questions
    2. Collectives and what they cost

      Distributed training is built from a few collective operations. All-reduce sums a tensor across ranks and gives everyone the result; reduce-scatter sums and leaves each rank one slice; all-gather collects slices into the whole; all-to-all swaps pieces between every pair of ranks. Know which ones your parallelism issues each step and how large they are, because communication time grows with bytes moved and the slowest link, and overlapping it with compute is often the biggest speedup available.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    3. Sharded data parallelism: FSDP and ZeRO

      Plain data parallelism keeps a full copy of weights, gradients and optimizer state on every GPU. Sharded data parallelism (ZeRO, FSDP) splits them across ranks and gathers each layer's weights just before use, trading extra communication for memory: sharding optimizer state saves the most for the least cost, then gradients, then parameters. Choose the sharding group (all ranks or within a node) by where your links are fast, and check that results match unsharded training.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    4. Tensor parallelism

      Tensor parallelism splits a layer's weight matrices across GPUs so each computes part of every matrix multiply. In a transformer MLP the first matrix is split by columns and the second by rows, so the block needs one all-reduce in the forward pass and one in the backward; attention splits by heads. It communicates every layer, so it belongs inside a node on fast links, and it changes the order of sums slightly, so parity-test it against the unsplit model.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    5. Pipeline parallelism

      Pipeline parallelism puts groups of layers on different GPUs and streams micro-batches through them. The bubble, the time stages sit idle while the pipeline fills and drains, shrinks as the number of micro-batches grows relative to the number of stages, and interleaved schedules cut it further at the cost of more communication. It needs only point-to-point sends between neighbouring stages, so it suits slower links between nodes, but balancing layers across stages is your job.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    6. Expert parallelism

      Expert parallelism places different experts of a mixture-of-experts layer on different GPUs. Each step, tokens are sent to the GPUs holding their chosen experts and the results are sent back, using all-to-all communication whose cost depends on how evenly the router spreads the load. One overloaded expert slows every rank, so expert placement, capacity limits and load balance are performance settings as much as modelling ones, and you should log them per step.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    7. Context parallelism for long sequences

      At long sequence lengths, activations rather than weights run out of memory, because per-token activations and attention grow with length. Context parallelism splits the sequence across GPUs, and ring attention passes key and value blocks around the ring so each GPU attends over the whole sequence while holding only its share. Causal masking makes a naive split unbalanced, since later chunks attend to more tokens, so implementations reorder chunks to even out the work.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    8. Choosing a parallelism layout

      Real runs combine parallelisms: tensor parallelism inside a node, pipeline parallelism across nodes when the model is too deep for one, expert parallelism for MoE layers, and sharded data parallelism over everything else. Start from memory (does one replica fit?), then communication (put the chattiest split on the fastest link), and test a few layouts on a short run, measuring tokens per second per GPU. The best layout shifts with model size, sequence length and cluster, so do not copy one blindly.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
  10. Phase 10 · Performance and efficiency

    1. Profile before you optimise

      Optimise from a profile, not a hunch. Capture a trace of a few steady-state steps, find where time goes (data waits, compute, communication, host overhead or idle gaps), and apply the change that targets that bottleneck. Make one change at a time, measure throughput again, and confirm the loss curve matches the unoptimised run, because some speedups change the numerics. Stacking every trick at once hides which one helped and whether another hurt quality.

      Test yourself on this topic

      4 graded questions · scored out of 100 with feedback · free

      Start the 4 questions
    2. Throughput and MFU

      Tokens per second is the number you watch; model FLOPs utilisation (MFU) tells you how good it is. MFU is the FLOPs the model needs per second (about 6 times parameters times tokens per second, for training) divided by the hardware's peak, and it ignores recomputation, so it compares fairly across codebases. Published large dense runs report roughly 35 to 50 percent. If you sit far below what others report for similar hardware and size, profile before scaling up.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    3. The memory budget of training

      Training memory is mostly arithmetic you can do before launch. With mixed precision and Adam, each parameter costs about 16 bytes: 2 for bf16 weights, 2 for gradients and 12 for the fp32 master weights and two optimizer moments, before any activations. Activations grow with batch, sequence length, width and depth and often dominate. Work out both, then take a memory snapshot of a real step to find what you missed, such as temporary buffers and fragmentation.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    4. Mixed precision training

      Mixed precision runs the heavy matrix multiplies in a 16-bit format and keeps what needs precision in fp32: master weights, optimizer state, reductions and the loss. bf16 has the same range as fp32 and usually needs no loss scaling; fp16 needs loss scaling so small gradients do not underflow. fp8 training goes further but needs per-tensor or finer scaling factors and care with outliers. After any precision change, compare the loss curve against a higher-precision run.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    5. Activation checkpointing

      Activation checkpointing saves memory by keeping only some activations in the forward pass and recomputing the rest during backward. Recomputing every block costs roughly one extra forward pass, about a third more compute, so checkpoint selectively: recompute cheap operations with large outputs, such as attention internals and elementwise ops, and keep the results of expensive matrix multiplies. Use it when memory, not compute, is what stops you raising batch size or sequence length.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    6. Compilers: torch.compile and XLA

      A compiler captures your model as a graph and fuses and schedules its operations, often speeding up a step without code changes. torch.compile traces Python, falls back at graph breaks (data-dependent control flow, unsupported calls) and recompiles when shapes or guards change; JAX with XLA compiles the whole function up front. Check the logs for graph breaks and recompiles, warm up before timing, and parity-test outputs, since fusion can change rounding.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    7. Fused kernels and FlashAttention

      Many operations in a model are memory-bound: the GPU spends more time moving data than computing. Fusing them into one kernel cuts memory traffic, which is why fused attention such as FlashAttention is faster and lighter: it computes attention in tiles without ever writing out the full score matrix. Use your framework's fused attention path, check which backend it actually picked, and confirm your mask and dropout settings are supported rather than silently falling back to a slow path.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    8. When to write a custom kernel

      Write a custom kernel only when a profile shows that an operation your research needs is slow and no library or compiler covers it. Triton lets you write GPU kernels in Python at the level of blocks rather than threads, which is usually enough for a fused or unusual operation. Keep the slow reference, test forward and backward against it across shapes and dtypes, and register the kernel as a custom op so autograd and the compiler can use it.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
  11. Phase 11 · Post-training and RL experiments

    1. Supervised fine-tuning code

      Supervised fine-tuning on conversations looks like pretraining with two differences that are easy to get wrong. The chat template must match exactly what the model will see at inference, including special tokens and the end-of-turn marker, and the loss should usually cover only the assistant's tokens, with the prompt masked out. Packing conversations needs per-conversation attention masks. Decode a batch with its loss mask shown before the first run.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    2. Preference optimisation in code

      Direct preference methods such as DPO train on pairs of a chosen and a rejected response, using log-probabilities from both the model being trained and a frozen reference model. Compute those as sums over response tokens only, with the same template and masking for both models, and precompute the reference log-probs once to save memory. Log chosen and rejected log-probs separately: a falling chosen likelihood is a common failure the loss alone hides.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    3. The RL loop for language models

      RL for language models repeats a loop: generate rollouts from the current policy, score them with a reward, compute advantages, update the policy, and push the new weights to the generator. Generation usually dominates the time, so it runs on a fast inference engine, which means two copies of the model whose weights and numerics must stay in sync. Log reward, response length, entropy and KL to the reference, and measure any gap between generator and trainer log-probs.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    4. Rewards and verifiers as code

      In RL the reward function is the specification, and the policy will find every gap in it. Verifiable rewards (unit tests, exact answers, checkers) are the most robust, but they still need tests of their own: correct answers must pass, near misses must fail, and malformed output must neither crash the grader nor score. Read samples from the highest-reward rollouts regularly, because reward hacking first shows up as behaviour that scores well and looks wrong.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    5. Environments for agentic RL

      Training agents with RL needs environments: tasks with tools, state and a grader, run in sandboxes. A good environment resets to a known state, is deterministic given a seed, isolates each episode from the others and from the host, and records full transcripts. Running thousands at once makes environment latency and flakiness a training problem, so track environment failures separately from model failures and never let an infrastructure error count as a zero reward.

      Reading

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    6. LoRA as a cheap experiment

      Low-rank adapters train a small update on top of frozen weights, so an experiment costs a fraction of full fine-tuning in memory and storage. That makes LoRA a fast way to run post-training ablations, but its conclusions can differ from full fine-tuning: the best learning rate is usually much higher, a low rank can limit what is learned, and which layers get adapters matters. Confirm an important LoRA result with a full fine-tune before it decides the plan.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
  12. Phase 12 · Research to production and the craft

    1. Coding agents in research engineering

      AI coding agents can write a training script, a sweep launcher or a new layer quickly, and they can make research-code mistakes just as quickly: wrong axes, missing masks, silently changed defaults. Treat their output like a new colleague's: give them the tests, the reference implementation and the codebase's conventions, require parity tests to pass, and read every diff that touches the model, the loss or the data path. Speed only helps if the result is still right.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    2. Working with research scientists

      You and the scientists you support share one goal: correct answers to research questions, fast. Agree what each experiment is for before building it, send short regular updates with links to runs, and say early when a result is not ready to present, along with what is missing. Own the shared code: review changes, keep the main branch working and write down how things work, so the team is never blocked on one person.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    3. Securing models, data and experiments

      Research artefacts are valuable and some are hazardous. Restrict who can read frontier weights and unreleased datasets, keep credentials out of code and logs, and run model-written code (in RL environments, agent evals or code-generation tasks) in sandboxes with no network or secrets by default. If an experiment surfaces a capability that could cause harm, follow your organisation's reporting process before sharing the result widely.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    4. Releasing research code and models

      Releasing code or a model turns your research into something others depend on. Ship the exact configs and commands behind the reported numbers, pinned dependencies, a model card covering training data, intended use, evaluations and known limits, and a licence chosen deliberately, and separately, for the code, the weights and the data. Before release, rerun the reported results from the public package on a clean machine.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    5. Inference for research models

      Research needs a lot of sampling: evals, synthetic data and RL rollouts. A serving engine with continuous batching and paged attention generates far faster than a training-code loop, but it is a second implementation of your model. Check that its log-probs match your training code on the same inputs, that sampling settings and stop tokens are the ones you meant, and that the new checkpoint actually loaded, before trusting anything it generates.

      Test yourself on this topic

      3 graded questions · scored out of 100 with feedback · free

      Start the 3 questions
    6. Research to product

      A research model that wins offline still has to win on real traffic. Before launch, check that every feature or piece of context it uses exists at serving time, measure latency and cost against the product's budget, and evaluate it in shadow mode on production-like traffic before users see it. Hand the owning team the model, its eval suite, known failure cases, monitoring and a rollback plan. Offline numbers usually overstate live gains, so plan for the gap.

      Test yourself on this topic

      4 graded questions · scored out of 100 with feedback · free

      Start the 4 questions

    Chapter 12 lab

    Write the instruction for planning a shadow evaluation before launch

    A prompt lab that closes the chapter: you write the instruction, and it is graded on a rubric.

    Start the lab

Practise the AI Research Engineer roadmap

285 questions, each graded on the server out of 100. Free · no card.

All career paths