SkillHack

How to become an ML Engineer

Step by step and free: 12 phases, 89 topics and 314 graded practice questions.

Practise this roadmap free

What is an ML Engineer?

An ML engineer builds, trains and ships models that make predictions from data, and answers for whether they work. They frame the problem and the label, prepare features without leakage, choose between gradient-boosted trees, neural networks and fine-tuned pretrained models, run and compare experiments, evaluate against baselines with the right metric, and put models into serving with monitoring, drift detection and retraining. They work with data engineers, product teams and platform engineers.

Who this roadmap is for

Software engineers, data scientists and analysts who already write Python, know some linear algebra and probability, and want to build models that run in production. Comfort with NumPy or pandas helps. It is not for people who only want to call a hosted LLM API; prompt and agent work have their own roadmaps.

What you will be able to do

You will be able to set up a sound train, validation and test split, train classical and deep models in PyTorch, debug and tune a training run, judge whether an improvement is real, scale training with mixed precision and sharding, fine-tune foundation models, build ranking systems, and ship models with monitoring and fairness checks.

The ML Engineer roadmap

ML Engineer

  1. Phase 1 Machine learning foundations

  2. Phase 2 Math and code for ML

  3. Phase 3 Training data and features

  4. Phase 4 Classical models

  5. Phase 5 Deep learning foundations

  6. Phase 6 Training models well

  7. Phase 7 Evaluating models

  8. Phase 8 Training at scale

  9. Phase 9 Foundation models and fine-tuning

  10. Phase 10 Ranking and recommendation

  11. Phase 11 Shipping and running models

  12. Phase 12 Responsible ML

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 · Machine learning foundations

    1. What an ML engineer does

      As an ML engineer you own a model end to end: the prediction it makes, the data it learns from, the training code, the evidence that it works and how it behaves once real traffic reaches it. Data scientists answer questions with data, MLOps engineers run the platform your model ships on, and AI engineers build on models someone else trained. You are judged by a model that keeps making good decisions in production, not by a notebook score.

      Test yourself on this topic

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

      Start the 3 questions
    2. When ML is the right tool

      Machine learning pays off when the pattern is too complex to write as rules, labelled examples exist or can be collected, the decision repeats often enough to justify the upkeep, and an occasional wrong answer is tolerable. If a dozen rules get you most of the way, ship the rules first: they are a baseline, they generate data and they set the bar a model must clear. A model adds training, serving, monitoring and retraining costs that never go away.

      Test yourself on this topic

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

      Start the 3 questions
    3. Supervised learning and the label

      Supervised learning fits a mapping from features to a label you already hold, so the label definition is the most important decision you make. Write it as one sentence: what is predicted, for which entity, at what moment, over what horizon, using only data available at that moment. Then pick the output the downstream decision needs (a class, a number or a ranking), because that choice fixes your loss, your metric and how a threshold gets set.

      Reading

      Test yourself on this topic

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

      Start the 5 questions
    4. Loss functions

      The loss is the number training actually pushes down, and it is rarely the metric you report. Squared error chases the mean and is dragged by outliers, absolute error chases the median, log loss rewards honest probabilities, and pinball loss fits a chosen quantile. Pick the loss whose best answer is the quantity your decision needs, then track the reported metric separately, because a lower loss does not always mean a better metric.

      Test yourself on this topic

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

      Start the 3 questions
    5. Overfitting and the bias-variance trade-off

      A model that scores well on its training data and badly on new data is overfitting; one that is poor on both is underfitting. Before you change anything, plot training and validation error against training set size: a wide gap that narrows with more data says collect more or regularise, while two high, flat curves say add capacity or better features. Every choice made by looking at the validation set leaks into it a little, so keep a final test set you score once.

      Test yourself on this topic

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

      Start the 5 questions
    6. Baselines first

      Before any real model, score the simplest honest predictor: the majority class, the mean, the same day last week, or the rule the business already runs. Use the same split and the same metric you will use later, so the comparison is fair. A complex model has to beat the strongest simple baseline by enough to pay for its training, serving and upkeep. If it does not, ship the baseline and spend the time on data.

      Test yourself on this topic

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

      Start the 6 questions

    Chapter 1 lab

    Instruct a coding agent to build a first forecast and an honest baseline report

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

    Start the lab
  2. Phase 2 · Math and code for ML

    1. Vectors, matrices and shapes

      Almost every model is a stack of matrix multiplies, so you need to read them fluently. A dot product scores how aligned two vectors are, a matrix multiply runs many dot products at once, and a batch of inputs is one more leading dimension. Most bugs you will meet are shape bugs: write the expected shape beside each tensor, assert it in code, and distrust any operation that silently combines two shapes you did not mean to combine.

      Test yourself on this topic

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

      Start the 3 questions
    2. Probability for model outputs

      A classifier that outputs probabilities is a model of a distribution, and training it means making the observed labels as likely as possible. Minimising cross-entropy is exactly maximising that likelihood, and squared error is the same idea under Gaussian noise. Knowing which distribution your loss assumes tells you what the output means: a softmax gives one distribution over exclusive classes, while a sigmoid per label gives independent yes or no chances.

      Test yourself on this topic

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

      Start the 3 questions
    3. Gradient descent

      Gradient descent improves the parameters by stepping against the gradient of the loss, and the learning rate sets the size of each step. Too large and the loss bounces or explodes; too small and training crawls. In practice you compute the gradient on a minibatch, which is cheaper and adds noise that often helps the model generalise. Batch size and learning rate interact, so when you change one, retune the other.

      Test yourself on this topic

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

      Start the 3 questions
    4. Numerical stability

      Floating point numbers have limited range and precision, so exp of a large logit overflows, the log of a tiny probability becomes minus infinity, and the resulting NaN spreads through every weight. Library losses avoid this by working on raw logits with the log-sum-exp trick, so pass them logits, not softmax outputs. When a NaN appears, find the first operation that produced it before you reach for a lower learning rate.

      Test yourself on this topic

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

      Start the 3 questions
    5. Vectorised array code

      A Python loop over a million rows runs one interpreted step at a time; the same work as one NumPy or PyTorch array operation runs in compiled code, often a hundred times faster. Broadcasting stretches arrays of compatible shapes so you can combine a batch with a vector without copying. Learn its rules, because it also turns a shape mistake into a wrong answer instead of an error: an array of shape (n,) minus one of shape (n, 1) quietly becomes n by n.

      Reading

      Test yourself on this topic

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

      Start the 3 questions
    6. Testing ML code

      ML code fails quietly: a wrong transform still trains, it just trains worse. Unit test the deterministic parts (feature transforms, label construction, metric code) on tiny hand-checked inputs, assert shapes and value ranges at boundaries, and keep a smoke test that trains a few steps on one small batch and checks that the loss falls. Seed everything in tests so a failure reproduces, and run the serving path on the same examples as training.

      Test yourself on this topic

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

      Start the 3 questions
  3. Phase 3 · Training data and features

    1. Labels and annotation quality

      A model can only be as good as its labels, and labels made by people disagree more than you expect. Write annotation guidelines with worked edge cases, have a sample labelled twice and measure agreement with a statistic such as Cohen's kappa, and read low agreement as a task definition that is unclear, not as careless annotators. Audit a slice of labels yourself before training, and record which guideline version produced each label.

      Test yourself on this topic

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

      Start the 3 questions
    2. Checking data before you train

      Upstream data changes without warning: a column switches units, a join drops half the rows, a category gets renamed. Put checks between the raw snapshot and training: the schema, null rates, value ranges, row counts against the last snapshot, and the distribution of key features and the label. Fail the run loudly when a check breaks, because a model trained on broken data still produces a confident score and a plausible artefact.

      Reading

      Test yourself on this topic

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

      Start the 3 questions
    3. Train, validation and test splits

      Your split has to copy how the model will meet new data. Rows from the same customer, patient or device belong on one side only, and when you predict the future, train on the past and test on a later window. Leakage is any route by which test or future information reaches training: a scaler fitted on all rows, a duplicate, a feature computed after the label. Its signature is an offline score too good to be true, so investigate before you celebrate.

      Test yourself on this topic

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

      Start the 7 questions
    4. Cross-validation

      Cross-validation trains and scores the model on several folds so you see both the average score and how much it moves between folds. Build folds the way you built the split: group folds keep an entity together, and time series folds always train on earlier data than they test. If you tune hyperparameters on the same folds you report, the score is optimistic, so use nested cross-validation or an untouched test set for the final number.

      Test yourself on this topic

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

      Start the 3 questions
    5. Feature engineering

      Features turn raw records into signals a model can use: ratios, counts over a window, time since an event. The same code must compute them in training and in serving, or the model meets inputs it never saw. Treat missing values on purpose, because missingness often carries signal: impute and add a flag. Most gaps between offline and online scores trace back to features rather than models, so test feature code as carefully as model code.

      Test yourself on this topic

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

      Start the 6 questions
    6. Point-in-time feature joins

      Each training row must see feature values as they stood when the prediction would have been made, not as they stand today. A plain join on customer id pulls in the current balance or latest status, which may have been caused by the very outcome you are predicting. Join on the entity and an as-of timestamp, taking the latest value at or before the prediction time, and allow for the delay before a value really lands in your systems.

      Reading

      Test yourself on this topic

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

      Start the 3 questions
    7. Encoding categorical features

      Categories need numbers before most models can use them. One-hot encoding suits a few dozen values; for thousands, use hashing, a learned embedding, or target encoding, which replaces each category with its average label. Target encoding leaks the label unless you compute it out of fold and pull rare categories towards the overall mean. Always decide what a category the model never saw in training turns into at serving time.

      Test yourself on this topic

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

      Start the 3 questions
    8. Class imbalance

      When positives are rare, accuracy rewards a model that never predicts them. Stratify splits and folds so each keeps some positives. If you resample or reweight, do it on training folds only and evaluate at the real rate with precision, recall or PR-AUC. Undersampling negatives inflates predicted probabilities, so correct or recalibrate them before anyone reads a score as a real chance. Often a well-chosen threshold on an unresampled model is all you need.

      Test yourself on this topic

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

      Start the 5 questions

    Chapter 3 lab

    Instruct an agent to audit a feature pipeline for leakage

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

    Start the lab
  4. Phase 4 · Classical models

    1. Linear and logistic regression

      Linear regression predicts a number as a weighted sum of features; logistic regression passes that sum through a sigmoid to predict a probability. They train in seconds, hold up well with regularisation and are easy to inspect, which makes them the first real model to fit after a baseline. Read coefficients with care: they only compare across features on the same scale, and correlated features split credit between them unpredictably.

      Test yourself on this topic

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

      Start the 3 questions
    2. Decision trees

      A decision tree splits the data on one feature at a time, choosing each split to make the groups below it purer, until it reaches a leaf that predicts. Trees handle mixed types and interactions without scaling, and a shallow one can be read by anyone. A deep tree memorises its training data, so limit depth, minimum leaf size or both, and expect a single tree's predictions to jump when the data changes slightly.

      Test yourself on this topic

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

      Start the 3 questions
    3. Bagging and random forests

      Bagging trains many trees on bootstrap samples and averages them, which cancels much of each tree's variance. A random forest also limits each split to a random subset of features, so the trees make different mistakes and their average improves further. Forests need little tuning and give a free validation score from the rows each tree never saw, the out-of-bag estimate. They rarely beat well-tuned boosting, but they are very hard to break.

      Test yourself on this topic

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

      Start the 3 questions
    4. Gradient-boosted trees

      Gradient boosting adds small trees one at a time, each fitted to the errors the ensemble still makes, and on tabular data it is usually the strongest model you can train. The settings that matter most are the learning rate, the number of trees (found by early stopping on validation data), tree depth or leaf count, and row and column subsampling. XGBoost, LightGBM and CatBoost differ more in speed and category handling than in accuracy.

      Test yourself on this topic

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

      Start the 4 questions
    5. Clustering

      Clustering groups rows by similarity without labels, and the result depends almost entirely on the features you choose and how you scale them. K-means finds round clusters of similar size and needs the count up front; density-based methods such as DBSCAN and HDBSCAN find odd shapes and leave noise unassigned. With no ground truth to score against, judge clusters by whether they stay stable across resamples and help the people who will act on them.

      Reading

      Test yourself on this topic

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

      Start the 3 questions
    6. Anomaly detection

      Anomaly detection flags rows unlike the rest, usually because real anomalies are too rare or too varied to train a classifier on. Isolation forests separate outliers in a few random splits; autoencoders flag inputs they reconstruct badly. The hard part is the threshold: set it from how many alerts a person can review a day, and keep every confirmed case, because once you have enough labelled anomalies a supervised model usually wins.

      Test yourself on this topic

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

      Start the 3 questions
    7. Time series forecasting

      A forecast predicts future values from the past, so every feature must be known at forecast time and every test must run forward in time. Lags, rolling statistics and calendar effects turn a series into a table, and one global gradient-boosted model trained across many related series often beats a separate model per series. Evaluate with a rolling backtest over several cut-off dates, always against a seasonal naive baseline.

      Test yourself on this topic

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

      Start the 3 questions
  5. Phase 5 · Deep learning foundations

    1. Neural networks and backpropagation

      A neural network is a chain of layers, each a linear map followed by a non-linear activation such as ReLU or GELU; without the non-linearity the whole stack collapses into one linear model. Backpropagation applies the chain rule from the loss backwards, reusing each layer's saved intermediate values to get every gradient in one pass. That reuse is why training stores activations, and why activation memory, not weights, often limits your batch size.

      Test yourself on this topic

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

      Start the 3 questions
    2. PyTorch tensors and autograd

      A PyTorch tensor carries a shape, a dtype and a device, and mixing devices or dtypes is the most common first error. When a tensor requires gradients, autograd records every operation on it, and backward walks that record to fill in each parameter's gradient. Run evaluation under torch.no_grad or inference_mode so nothing is recorded, and log a loss with item or detach, or you keep its whole graph alive in memory.

      Test yourself on this topic

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

      Start the 3 questions
    3. The PyTorch training loop

      Every PyTorch training loop repeats the same moves: take a batch from the DataLoader, run the forward pass, compute the loss, call backward, step the optimizer and clear the gradients. Gradients add up across backward calls, so forgetting to zero them silently trains on stale ones. Call model.train before training and model.eval before validation, because dropout and batch normalisation behave differently in each mode and a forgotten switch skews every score.

      Test yourself on this topic

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

      Start the 4 questions
    4. Optimizers: SGD, momentum and AdamW

      Plain SGD moves each weight by its gradient times the learning rate; momentum keeps a running average of past gradients so steps build speed in consistent directions. Adam also scales each weight's step by its recent gradient size, which makes it forgiving across very different layers, and AdamW applies weight decay separately from that scaling, the version you almost always want. Adam keeps two extra values per parameter, which you pay for in memory.

      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 is the setting most worth getting right, and it rarely should stay fixed. A short warmup ramps it up from near zero so early, badly scaled updates do not wreck the weights, especially with Adam and large batches; a decay, such as cosine or step, then lowers it so the model settles. To find a starting value, sweep it on a log scale over short runs and pick one somewhat below the point where the loss starts to blow up.

      Test yourself on this topic

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

      Start the 3 questions
    6. Initialisation and normalisation

      If activations grow or shrink a little at every layer, a deep network's signal explodes or vanishes before training even starts. Initialisation schemes such as Xavier and Kaiming scale the starting weights to keep the spread steady, normalisation layers rescale activations as training runs, and residual connections give gradients a direct path back. BatchNorm relies on batch statistics and suits large image batches; LayerNorm works per example, which is why transformers use it.

      Test yourself on this topic

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

      Start the 3 questions
    7. Convolutional networks

      A convolution slides one small filter across an image, so the same weights detect an edge or a texture wherever it appears, with far fewer parameters than a dense layer. Stacking convolutions with downsampling grows each unit's view from pixels to parts to whole objects. In practice you rarely design one: start from a pretrained backbone such as a ResNet or ConvNeXt, and weigh vision transformers when data and compute are plentiful.

      Test yourself on this topic

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

      Start the 3 questions
    8. Attention and the transformer

      Attention lets every position in a sequence build its output from a weighted mix of all the others, with the weights set by how well that position's query matches each key. A transformer block stacks multi-head attention and a feed-forward layer, each wrapped in a residual connection and normalisation, and adds position information because attention alone ignores order. Attention's cost grows with the square of sequence length, which is why long inputs are expensive.

      Test yourself on this topic

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

      Start the 4 questions
    9. Embeddings and learned representations

      An embedding maps a discrete thing, such as a word, a user or a product id, to a dense vector learned in training, so things that behave alike end up close together. Embeddings replace huge one-hot inputs, let a model share what it learns across related items, and can be reused by other models as features. A table for millions of ids can dominate model size, and ids never seen in training need a shared fallback vector or hashing.

      Test yourself on this topic

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

      Start the 3 questions
  6. Phase 6 · Training models well

    1. Choosing a model

      Choose the model from the data and the constraints, not from fashion. On tabular data of moderate size, gradient-boosted trees are the strong default; deep networks earn their cost on images, audio, text and very large datasets, usually starting from a pretrained model. Latency budgets, hardware, the need to explain a decision and the amount of labelled data can each rule a model in or out before accuracy is even compared, so list them first.

      Test yourself on this topic

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

      Start the 6 questions
    2. Transfer learning from pretrained models

      Starting from weights trained on a large dataset lets you reach good accuracy with a fraction of the labelled data. With little data, freeze the backbone and train only a new head; with more, unfreeze and fine-tune everything at a lower learning rate than the head, so you adapt the features without erasing them. Match the preprocessing the pretrained model expects, such as its resizing, normalisation or tokenizer, or its features are worth far less.

      Test yourself on this topic

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

      Start the 3 questions
    3. Data augmentation

      Augmentation creates new training examples by changing inputs in ways that should not change the label: flips, crops and colour shifts for images, noise and time shifts for audio, paraphrases for text. It teaches the model which variations to ignore and acts as strong regularisation when data is scarce. Check every transform against the label, because a rotated 6 becomes a 9 and a tight crop can cut out the finding. Augment training data only, never the evaluation sets.

      Test yourself on this topic

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

      Start the 3 questions
    4. Regularization

      Regularisation trades a little bias for less variance. Penalties such as L2 and L1, weight decay, early stopping, dropout, shallower trees and subsampling all limit how closely a model can fit noise. Penalties assume features share a scale, so standardise first, and treat the strength as a hyperparameter: if the best value sits at the edge of the range you searched, widen the range before you trust it. More real data is still the strongest regulariser.

      Test yourself on this topic

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

      Start the 5 questions
    5. Hyperparameter tuning

      Hyperparameters set a model's capacity and how it trains. Search them with random or Bayesian methods rather than a full grid, on scales that match them, such as a log scale for learning rate and regularisation strength, and judge every trial on validation folds, never on the test set. Read the loss curves as well as the final score: they show a learning rate that is too high or a run stopped too early. Tune the few settings that matter most first.

      Test yourself on this topic

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

      Start the 5 questions
    6. Debugging a training run

      When a model will not learn, shrink the problem until it must. Look at a batch of inputs and labels after every transform, check the loss at step zero matches random guessing, then overfit one small batch: if the loss cannot reach near zero, the bug is in the code. A NaN loss points to the learning rate, bad inputs or an unstable operation; a flat loss points to broken labels, gradients that never reach the weights, or a learning rate far too low.

      Test yourself on this topic

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

      Start the 4 questions
    7. Tracking and comparing runs

      Within a week you will not remember which run used which data, so log everything from the first experiment: the code commit, data snapshot, full configuration, seeds, environment, metrics over time and the final artefact. A tracker such as MLflow or Weights and Biases makes runs searchable and comparable side by side. Only compare runs that differ in the one change you are testing, and keep failed runs too, because they record what did not work.

      Reading

      Test yourself on this topic

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

      Start the 3 questions

    Chapter 6 lab

    Instruct a coding agent to run an honest, bounded tuning study

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

    Start the lab
  7. Phase 7 · Evaluating models

    1. Choosing the metric and threshold

      A metric should price mistakes the way the business does. Ranking metrics like ROC-AUC say how well a model orders cases, not whether a predicted 0.3 means a 30 percent chance, so when a probability drives a price or a cost, check calibration too. Set the decision threshold from the cost of each kind of error and from capacity, such as how many cases a team can review a day, never by default at 0.5, and report the metric at that threshold.

      Test yourself on this topic

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

      Start the 6 questions
    2. Metrics for regression and forecasts

      Each regression metric punishes a different error. RMSE squares errors and so is dominated by the biggest misses; MAE weighs every unit of error alike and is best served by predicting the median; MAPE divides by the actual value, so it explodes near zero and is lopsided between over and under forecasts. When shortfalls and surpluses cost different amounts, forecast a quantile and score it with pinball loss. Always report the metric beside a naive baseline.

      Test yourself on this topic

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

      Start the 3 questions
    3. Calibration

      A model is calibrated when, among cases it scores at 0.3, about 30 percent turn out positive. Boosted trees, deep networks and anything trained on resampled data are often miscalibrated even when they rank well. Measure it on held-out data with a reliability curve and the Brier score or expected calibration error, then fix it with Platt scaling, isotonic regression or temperature scaling, fitted on data the model never trained on. Recheck it after every retrain.

      Test yourself on this topic

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

      Start the 4 questions
    4. Is the improvement real

      A small gain on one test set may be noise. Compare models on the same examples with a paired test or a bootstrap interval on the difference, and train each with several seeds so you know how far the score moves on its own. Fix the comparison before you look, so you do not keep slicing until something wins. An offline win is a hypothesis: confirm it online, and when offline and online disagree, look for a mismatch in metric, data or features.

      Test yourself on this topic

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

      Start the 6 questions
    5. Error analysis

      One overall score hides where a model fails. Pull a sample of real mistakes, tag each with a cause and count the tags, so you know which fix could move the metric most and which would barely register. Slice metrics by segment, input type and data source to find groups that do far worse than average. Have people relabel a sample as well: if they disagree with each other as often as with the model, label noise sets a ceiling no model can pass.

      Test yourself on this topic

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

      Start the 7 questions
    6. Behavioural tests for models

      A held-out score tells you how often a model is right, not whether it learned the behaviour you need. Behavioural tests check it like software: minimum functionality tests on simple cases it must get right, invariance tests that a change which should not matter (a name, a typo, a brightness shift) leaves the prediction alone, and directional tests that a change which should matter moves it the right way. Run them on every retrain.

      Test yourself on this topic

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

      Start the 3 questions
    7. Online tests for model launches

      An offline metric is a guess about what users will do; an online test checks it. In an A/B test, randomise by user rather than by request so each person's experience stays consistent, fix the success metric and guardrails such as latency, revenue and complaints before you start, and size the test to detect the effect you care about. For rankers, interleaving shows each user a mix of both models' results and finds a preference with far less traffic.

      Test yourself on this topic

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

      Start the 4 questions

    Chapter 7 lab

    Write the instruction for a ship or no-ship model comparison

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

    Start the lab
  8. Phase 8 · Training at scale

    1. Where training memory goes

      Training memory has four parts: the weights, a gradient for each weight, the optimizer's state and the activations saved for the backward pass. With Adam in mixed precision the first three come to about 16 bytes per parameter, so a 7 billion parameter model needs over 100 GB before a single activation. Activations grow with batch size and sequence length. Do this arithmetic before launching and you know which fix you need: sharding, offloading, checkpointing or a smaller batch.

      Test yourself on this topic

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

      Start the 3 questions
    2. Mixed precision training

      Mixed precision runs most matrix multiplies in 16-bit floats, which roughly halves activation memory and uses the GPU's fast tensor cores, while keeping sensitive steps such as reductions and the weight update in 32-bit. bf16 has the same range as fp32 and usually just works on recent GPUs; fp16 has a narrow range, so small gradients underflow unless the loss is scaled up first, which PyTorch's GradScaler does. Compare a short run against fp32 before you trust it.

      Test yourself on this topic

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

      Start the 3 questions
    3. Gradient accumulation and activation checkpointing

      Gradient accumulation runs several small batches, adds up their gradients and steps the optimizer once, so you get the effective batch size you want on a GPU that cannot hold it. Divide each loss by the number of steps, and remember batch normalisation still sees only the small batch. Activation checkpointing saves only some layers' outputs and recomputes the rest in the backward pass, trading roughly a third more compute for much less activation memory.

      Test yourself on this topic

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

      Start the 3 questions
    4. Input pipeline throughput

      If the GPU waits for the next batch, a faster model changes nothing. Check by timing the data loader alone against a full training step, or by looking for idle gaps in a profiler trace. The usual fixes are more DataLoader worker processes, pinned memory with non-blocking copies to the GPU, prefetching, moving heavy decoding out of the loop into a preprocessed format, and packing many small files into larger shards that read sequentially.

      Test yourself on this topic

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

      Start the 3 questions
    5. Profiling a training step

      Before you optimise, find out where a step's time goes. The PyTorch Profiler records every operator and kernel on the CPU and GPU and lays them on a timeline: gaps on the GPU mean it waits on data, the CPU or a synchronisation; long communication kernels mean the network is the limit; many tiny kernels suggest fusion or compilation would help. Profile a few steps after warmup, change one thing, then profile again to confirm the gain.

      Test yourself on this topic

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

      Start the 3 questions
    6. Compiling models with torch.compile

      torch.compile captures your model's Python into graphs and generates fused kernels, so chains of small operations stop round-tripping through GPU memory, often a solid speed-up for one line of code. The first steps are slow while it compiles. Code it cannot trace, such as data-dependent Python branches or printing tensors, causes graph breaks that cost speed, and changing input shapes can force recompiles, so check its logs for both before you trust the gain.

      Test yourself on this topic

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

      Start the 3 questions
    7. Data parallel training (DDP)

      Distributed data parallel runs one full copy of the model per GPU, gives each a different slice of every batch, and averages gradients across the copies with an all-reduce during the backward pass, so every copy takes the same step. The code changes are small: launch with torchrun, wrap the model in DDP, give the DataLoader a DistributedSampler and save checkpoints from one rank only. The effective batch grows with the GPU count, so revisit the learning rate.

      Test yourself on this topic

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

      Start the 3 questions
    8. Sharded training (FSDP and ZeRO)

      When a model's weights, gradients and optimizer state no longer fit on one GPU, sharded data parallel splits all three across the GPUs and gathers each layer's full weights only while that layer runs. PyTorch's FSDP and DeepSpeed's ZeRO stages implement the idea, and sharding per transformer block keeps each gathered piece small. You trade memory for extra communication; beyond that, tensor and pipeline parallelism split the layers themselves.

      Test yourself on this topic

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

      Start the 3 questions
    9. Scaling laws and compute budgets

      Scaling laws describe how loss falls smoothly and predictably as parameters, data and compute grow, which lets you plan a large run from small ones. The Chinchilla study found that for a fixed compute budget, parameters and training tokens should grow together, roughly 20 tokens per parameter, though models meant for heavy traffic are often trained far longer because a smaller model is cheaper to serve. Fit the curve on small runs before committing to a big one.

      Test yourself on this topic

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

      Start the 3 questions
  9. Phase 9 · Foundation models and fine-tuning

    1. Self-supervised pretraining

      Self-supervised learning makes its own labels from raw data: predict the next token, fill in a masked word or image patch, or tell matching views of the same thing from mismatched ones. Because nothing needs annotating, a model can learn from far more data than any labelled set, and what it learns transfers to many tasks. That is why most work now starts from a pretrained model, and why you fine-tune rather than train from scratch unless your data is unlike anything public.

      Test yourself on this topic

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

      Start the 3 questions
    2. Tokenizers

      Language models read tokens, not characters: a tokenizer such as BPE or SentencePiece splits text into subword pieces from a fixed vocabulary learned on its training corpus. The vocabulary sets how many tokens a sentence costs, so languages, code or jargon it saw little of become long and expensive. A model only works with the exact tokenizer and special tokens it was trained with, and a mismatch rarely raises an error: it quietly degrades every output.

      Test yourself on this topic

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

      Start the 3 questions
    3. Full fine-tuning or LoRA

      Full fine-tuning updates every weight, which gives the most room to adapt but needs gradient and optimizer memory for all of them and a full model copy per task. LoRA freezes the base and trains small low-rank matrices added to chosen layers, cutting trainable parameters by orders of magnitude, and QLoRA also holds the frozen base in 4-bit. Adapters are small enough to keep one per task over a shared base. Start with LoRA and move to full tuning if it plateaus on your evals.

      Test yourself on this topic

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

      Start the 4 questions
    4. Supervised fine-tuning data

      Supervised fine-tuning teaches a model to answer the way your examples do, so the data is the product. Format every example with the model's own chat template, compute the loss only on the response tokens so the model is not trained to write prompts, and when you pack short examples into full sequences, stop attention crossing between them. A few thousand clean, varied, correct examples usually beat a large noisy set; deduplicate them and keep evaluation prompts out.

      Test yourself on this topic

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

      Start the 3 questions
    5. Preference tuning (DPO and RLHF)

      Preference tuning learns from pairs: for one prompt, a response people preferred and one they rejected. RLHF trains a reward model on those pairs, then optimises the language model against it with reinforcement learning; DPO skips the reward model and raises the likelihood of preferred over rejected responses relative to a frozen reference model. In both, a penalty for drifting from the reference stops the model gaming the signal and losing general skill.

      Test yourself on this topic

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

      Start the 3 questions
    6. Training embedding models

      An embedding model is trained so that matching pairs, such as a query and the passage that answers it, land close together while everything else lands far apart. Contrastive losses use the other examples in a batch as negatives, so bigger batches help, and hard negatives, near misses that look relevant but are not, teach the fine distinctions. Fine-tuning a general embedder on a few thousand of your own pairs often lifts retrieval clearly; measure recall at k on held-out queries.

      Test yourself on this topic

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

      Start the 3 questions
    7. Knowledge distillation

      Distillation trains a small student model to match a large teacher, usually on the teacher's full probability distribution rather than hard labels alone, because those soft targets show which wrong answers are nearly right. The student can approach the teacher's accuracy at a fraction of the serving cost. For language models you can also fine-tune the student on the teacher's generated outputs. Check the teacher's licence allows it, and evaluate the student on your task, not the teacher's benchmarks.

      Test yourself on this topic

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

      Start the 3 questions
    8. Evaluating fine-tuned language models

      A fine-tune is only better if a held-out set built from your real task says so. Score outputs with exact checks where you can and with rubrics graded by people or a validated model judge where you cannot, and compare against the base model and a prompted baseline. Rerun a few general benchmarks too, since fine-tuning can erase skills you did not train for. Public benchmark scores may be inflated by test data that leaked into pretraining, so trust your own sets first.

      Test yourself on this topic

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

      Start the 3 questions
  10. Phase 10 · Ranking and recommendation

    1. Retrieval, then ranking

      You cannot run a heavy model on millions of items for every request, so recommendation and search systems work in stages. Cheap candidate generators, such as embedding lookup, popularity and co-occurrence, pull a few hundred items; a richer ranking model scores those with full features; a final pass applies business rules, diversity and filters. Each stage caps the next, because an item the retriever misses can never be ranked, so measure recall at the retrieval stage on its own.

      Test yourself on this topic

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

      Start the 3 questions
    2. Two-tower retrieval models

      A two-tower model encodes users (or queries) and items with separate networks into one vector space, and scores a pair by the dot product of their vectors. Because item vectors do not depend on the user, you precompute them all and find each user's best matches with approximate nearest neighbour search in milliseconds. Train with in-batch or sampled negatives, correct for popular items turning up as negatives far more often, and rebuild the item index whenever the item tower changes.

      Test yourself on this topic

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

      Start the 3 questions
    3. Learning-to-rank losses

      A ranker only needs to put items in the right order, and its loss can say so directly. Pointwise losses score each item alone, as regression or classification on a relevance label; pairwise losses penalise each pair placed in the wrong order; listwise losses such as LambdaRank weight those mistakes by how much they hurt a metric at the top of the list. Gradient-boosted rankers such as LambdaMART remain strong baselines for search with rich features.

      Test yourself on this topic

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

      Start the 3 questions
    4. Ranking metrics

      Ranking metrics weight the top of the list, because that is what people see. Recall at k asks whether the relevant items made the first k at all and suits the retrieval stage; MRR rewards putting the first relevant item high and suits tasks with one right answer; NDCG uses graded relevance discounted by position and suits feeds and search results. Set k to what the screen shows, and average per query or user so heavy users do not dominate.

      Reading

      Test yourself on this topic

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

      Start the 3 questions
    5. Position bias in implicit feedback

      Clicks are the cheapest labels you have, and they are biased: people click top results more simply because they are on top, so a model trained on raw clicks learns to repeat the old ranking. Estimate how attention falls with position, from small randomised swaps or from logs where the same item appeared in different spots, then weight clicks by the inverse of that propensity, or feed position in as a training feature and fix it to one value at serving time.

      Test yourself on this topic

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

      Start the 3 questions
    6. Cold start

      A new user or item has no interaction history, so a model that leans on learned id embeddings has nothing to say about it. Fill the gap with content: an item's text, images, category and price, or a new user's context and sign-up answers, encoded by a model that generalises from those features. Give new items some guaranteed exposure through exploration so they can earn data, and fall back to items popular in the user's context until history builds up.

      Test yourself on this topic

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

      Start the 3 questions
    7. Offline evaluation from logged data

      Logs only show how users reacted to what the old system chose, so replaying them to score a new ranker is biased towards whatever the old one liked. Off-policy estimators weight each logged outcome by how likely the new policy is to make that choice compared with the old one, which means you must log the old policy's probability for every choice. Inverse propensity scoring is unbiased but noisy; doubly robust estimators add a model to cut the noise. Use the result to filter candidates before an online test.

      Test yourself on this topic

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

      Start the 3 questions
  11. Phase 11 · Shipping and running models

    1. Serving models

      Serving puts a model behind a latency, throughput and cost budget. Decide first whether predictions can be computed in batch ahead of time or must be made per request, because batch is simpler, cheaper and easier to check. Ship the preprocessing, pinned library versions, feature schema and threshold with the model as one versioned artefact. Then profile the whole request path at p99, because feature lookups and network calls often cost more than the model itself.

      Test yourself on this topic

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

      Start the 5 questions
    2. Exporting a model for inference

      Training code is the wrong thing to ship: it drags in the training framework, Python control flow and pickled objects that can run arbitrary code when loaded. Export the trained network to a stable format instead, such as a torch.export program or ONNX for runtimes like ONNX Runtime and TensorRT, and store weights as safetensors. Then run the same inputs through the original and the export and check they agree within a tolerance, including at batch sizes you did not trace with.

      Reading

      Test yourself on this topic

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

      Start the 3 questions
    3. Quantising your model

      Quantisation stores weights, and sometimes activations, as 8-bit or smaller integers instead of 32-bit floats, cutting memory and often latency several times over. Post-training quantisation needs only a small calibration set to pick value ranges; if accuracy drops too far, quantisation-aware training simulates the rounding during training so the model learns around it. The loss is uneven across inputs, so rerun your full evaluation, worst slices included, on the quantised model before shipping.

      Test yourself on this topic

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

      Start the 3 questions
    4. Shadow and canary launches

      In shadow mode the new model scores live traffic beside the old one, but only the old one's answers are used, so you compare predictions, latency and errors on real inputs at no risk to users. A canary then lets the new model decide for a small share of traffic, watched against guardrails, before you widen it step by step. Agree beforehand what difference counts as a problem and who can roll back, and keep the old model running until the new one has seen a full business cycle.

      Test yourself on this topic

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

      Start the 3 questions
    5. Logging predictions

      When someone asks why the model made a decision last Tuesday, you can only answer if you logged it. Record each prediction with a request id, timestamp, model version, the exact feature values the model saw (not values recomputed later), the output and the threshold, then join outcomes to it as they arrive. That log is your debugging tool, your monitoring source and your next training set, so keep it consistent, and protect personal data in it as carefully as in the source.

      Test yourself on this topic

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

      Start the 3 questions
    6. Detecting data and concept drift

      Production data changes. Covariate drift changes the inputs; concept drift changes what the inputs mean for the label, and only labels can confirm it. Since labels often arrive weeks late, watch data quality, feature distributions and the distribution of predictions as early signals, compared against a reference window from training. Alert on the features that matter most to the model, with thresholds tuned on past data, so a real problem is not lost in noise.

      Test yourself on this topic

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

      Start the 5 questions
    7. Feedback loops

      Once a model acts, it shapes the data it will later learn from. A fraud model that blocks a payment never learns whether it was fraud; a recommender that shows only what it already favours never learns about anything else; a model that directs inspections finds problems mainly where it already looks. Break the loop on purpose: keep a small random holdout the model does not control, log what the model decided, and train on data that records that decision.

      Test yourself on this topic

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

      Start the 3 questions
    8. Retraining

      Retraining is a release, so make every run reproducible: record the code commit, data snapshot, configuration, seeds and environment. Retrain on a schedule matched to how fast the world changes, or on a trigger such as drift, but promote a candidate only when it beats the current model on a recent held-out window and on the slices you cannot afford to lose. Roll it out gradually, with the previous model kept ready as a fast way back.

      Reading

      Test yourself on this topic

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

      Start the 5 questions
    9. ML system design

      Designing an ML system starts from the decision, not the model: what is predicted, how fast, how often, what a wrong answer costs and how success is measured. Then sketch the loop end to end: data sources and labels, features at training and serving time, the model and its baseline, the serving path, logging, monitoring and retraining. Most lasting cost lives in that glue rather than the model code, so prefer the simplest design that meets the need and say what you would add next.

      Test yourself on this topic

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

      Start the 4 questions

    Chapter 11 lab

    Write the instruction for an on-call drift runbook with delayed labels

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

    Start the lab
  12. Phase 12 · Responsible ML

    1. Fairness across groups

      A model can be accurate overall and still fail one group badly, so measure performance per group whenever a decision affects people. Common criteria compare selection rates, error rates or calibration across groups, and when base rates differ they cannot all hold at once, so you must choose the one that fits the harm at stake. Check whether a proxy such as postcode stands in for a protected trait, and fix data and thresholds before adding constraints to training.

      Test yourself on this topic

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

      Start the 3 questions
    2. Explaining predictions

      Explanation tools answer two questions: which features matter to the model overall, and why it made one prediction. Permutation importance measures how far the score drops when a feature is shuffled; SHAP splits one prediction into per-feature contributions; partial dependence shows how the output moves with one feature. All of them describe the model, not the world: high importance is not a cause, and correlated features share or swap credit, so check with domain experts before acting.

      Test yourself on this topic

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

      Start the 3 questions
    3. Model cards and datasheets

      A model card records what a model is for and not for, how it was trained and evaluated, how it performs on the slices that matter, and its known limits. A datasheet does the same for a dataset: where it came from, who is in it, how it was labelled and what it should not be used for. Write both while you build, when the facts are at hand, and update them on every retrain, because the next team, a reviewer or an auditor will read them before your code.

      Test yourself on this topic

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

      Start the 3 questions
    4. Privacy and memorisation

      Models can memorise rare training examples and repeat them: language models have reproduced names, phone numbers and addresses verbatim, and membership inference can reveal whether a person's record was in the training set. Remove personal data the task does not need before training, and deduplicate, which also cuts memorisation. When the risk is high, differentially private training such as DP-SGD bounds what any one record can change, at an accuracy cost you must measure.

      Test yourself on this topic

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

      Start the 3 questions
    5. Attacks on models

      Models have attack surfaces of their own. Poisoning slips crafted examples into training data to plant a backdoor or skew decisions; evasion nudges an input just enough that the model gets it wrong; extraction queries a model until it can be copied or its training data recovered. Loading weights is a risk too, since pickle-based checkpoints can run code when opened, so prefer safetensors. Control who can write to training data, and rate-limit and watch prediction APIs.

      Test yourself on this topic

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

      Start the 3 questions
    6. Models in regulated decisions

      When a model helps decide credit, hiring, insurance or care, regulators expect more than a good score. Model risk management, as in US banking guidance (SR 26-2, which replaced SR 11-7 in April 2026), asks for documented development, independent validation, ongoing monitoring and an inventory of models in use. Laws such as the EU AI Act add risk management, data governance, logging and human oversight for high-risk uses. Build that evidence as you go: it is far cheaper than reconstructing it for an audit.

      Test yourself on this topic

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

      Start the 3 questions

Practise the ML Engineer roadmap

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

All career paths