11 / 16
ML Foundations
The classical ML every ML system-design round still assumes you own.
Supervised learning fits a function from labeled examples; what matters is error on unseen data, so you hold data out to measure it and balance underfitting (high bias) against overfitting (high variance).
Training means minimizing a loss: compute the gradient on a mini-batch and step weights the opposite way, scaled by the learning rate. Cross-entropy for classification, MSE for regression, AdamW with warmup for transformers.
Regularization trades a little training fit for better generalization: penalize large weights (L2/L1), inject noise (dropout, augmentation, label smoothing) or stop before the model memorizes (early stopping).
A neural network stacks linear layers with nonlinear activations; backpropagation runs the chain rule backward from the loss to get every weight's gradient in one pass, which gradient descent then uses.
Build hundreds of small decision trees in sequence, each one fitting the errors the ensemble still makes; on tabular data XGBoost and LightGBM remain the default to beat.
Turn raw events into signals a model can use (scaled numbers, encoded categories, crosses, time-window aggregates) while making sure no feature peeks at the label or the future.
When positives are rare, fix the metric and the threshold before the data; when decisions use the probability itself (auctions, expected loss), calibrate it so a score of 0.02 really means 2%.
Train a model to order candidates for a query or user so the best land on top: pointwise, pairwise or listwise losses, LambdaMART as the workhorse, NDCG@k to measure, debiased clicks as labels.
Choose among options one request at a time, shifting traffic toward the winners as evidence arrives, so you learn which is best while losing as little reward (regret) as possible.
A backbone (a CNN sliding small filters, or a ViT attending over image patches) turns pixels into features; task heads turn them into labels, boxes or masks. Start from a pretrained backbone.
Learn embeddings from pairs: pull matching items (image and caption, query and answer) together and push everything else in the batch apart. CLIP did this for images and text, enabling zero-shot classification and cross-modal search.
Train a network to predict the noise added to real data; generate by starting from pure noise and removing predicted noise step by step. Quality, steps and latency trade off directly.