Machine Learning Engineer question bank
568 questions. Filter by level and skill, track what you've solved, and see how many people get each one right.
- Big gap between train and validation accuracy
- Why keep a separate test set
- Which model needs feature scaling
- Definition of precision
- Symptom of a learning rate that is too high
- Encoding a city feature
- Bias and variance as complexity grows
- Accuracy on imbalanced data
- Shape of a matrix product
- Cosine similarity by hand
- Chain rule on a squared term
- What sampling temperature does
- Standard error of a sample mean
- What logistic regression outputs
- k-nearest neighbours vote
- What k-means minimises
- Variance kept by two components
- Gini impurity of a node
- Why random forests average trees
- ReLU applied to a vector
- Recall from confusion counts
- RMSE from four errors
- Broadcasting a column and a row
- Dropout after eval()
- Why export a model to ONNX
- Why LLMs use subword tokens
- What text embeddings capture
- Standardising a single value
- When early stopping triggers
- Optimizer steps in one epoch
- Expected starting loss, 10 classes
- What retrieval-augmented generation adds
- What data drift means
- What prompt injection is
- Parameters in nn.Linear(10, 5)
- Why sigmoid slows deep training
- Range of tanh
- Cross-entropy loss by hand
- Telling autograd to track a tensor
- Why wrap inference in no_grad
- Logging loss without leaking memory
- Feeding a single image to a CNN
- Tensors on different devices
- model(x) versus model.forward(x)
- Methods a map-style Dataset needs
- Where to set shuffle=True
- Default betas in Adam
- Saving a trained model
- Adding weight decay to an optimiser
- Size after nn.Flatten
- Padding that keeps image size
- Shape after max pooling
- Global average pooling
- Preprocessing for a pretrained ResNet
- What ToTensor does to pixels
- Where random flips belong
- What an RNN carries between steps
- The attention formula
- Size of each attention head
- How BERT is pretrained
- Size of an embedding table
- Patches in a Vision Transformer
- Purpose of an autoencoder bottleneck
- Model type for ticket classification
- Slope of the sigmoid at zero
- ReLU gradient below zero
- Chain rule through two linear steps
- Entropy of a fair four-way choice
- Shape of a cosine LR schedule
- Every weight set to zero
- Loss crawls down very slowly
- Spotting vanishing gradients
- Up-weighting a rare class
- 800 labelled images
- NaN from a hand-written log loss
- Dropout set to 0.9
- What DDP syncs between GPUs
- DataParallel or DistributedDataParallel
- What full fine-tuning changes
- Why begin from a pretrained model
- Training only a new head
- Learning rate for fine-tuning
- Shape of SFT training data
- Reading train and validation loss
- Meaning of PEFT
- What the LoRA rank r sets
- Merging a LoRA adapter
- What QLoRA adds to LoRA
- Choosing the tokenizer
- Prompt format after SFT
- Purpose of instruction tuning
- First step before fine-tuning
- Role of lora_dropout
- Order of classic RLHF stages
- What a reward model returns
- Format of preference data
- Basic idea of distillation
- Why soft targets help a student
- Temperature in distillation
- Training on a bigger model's answers
- Using another provider's outputs
- Labellers disagree on answers
- Meaning of RLAIF
- Teaching safe refusals
- What reward hacking means
- Purpose of the KL penalty
- Meaning of the alignment tax
- Picking a student model
- Library for SFT and DPO runs
- Adding LoRA with the PEFT library
- Splitting a skewed label set
- Why save checkpoints
- Fine-tuning BERT for classification
- Data for tuning an embedding model
- Speech model misses local accents
- Teaching a domain vocabulary
- Customer data in training sets
- File format for hosted fine-tuning
- How many epochs for LLM SFT
- Comparing many training runs
- Making runs repeatable
- New classes for an image model
- Small data for a narrow task
- What to record for each adapter
- Early stopping patience
- What BitFit trains
- Predicting a flat price in rupees
- One gradient descent step
- Sigmoid at zero
- Logistic regression with five classes
- The naive part of Naive Bayes
- Entropy of a 50/50 node
- Tree with no depth limit
- Prediction after one boosting round
- Which points shape an SVM
- Label -1 in DBSCAN output
- Imputing missing income
- Scaling a feature with big outliers
- Encoding education level
- Spot the bug in training code
- Parameter or hyperparameter
- Degree-15 curve on 16 points
- What bag-of-words throws away
- Learning from rewards
- 5,000 features, 300 rows
- A movie that is several genres
- Logistic regression on XOR
- Baseline for a tabular dataset
- How KNNImputer fills a gap
- What the intercept means
- A column with one value
- Batch, stochastic or mini-batch
- How often a row is validated in k-fold
- Why stratify the folds
- Specificity by hand
- The x-axis of an ROC curve
- MAE of three errors
- MAPE by hand
- R-squared by hand
- Lowering the decision threshold
- Top-5 accuracy
- First number to compare against
- Recall at 10 by hand
- Score versus tree depth
- Accuracy from confusion counts
- Reporting cross-validation results
- Test set from a later period
- Checking a 90% prediction interval
- Scaling before splitting
- Validating a forecasting model
- Different results every inference run
- Handling class imbalance
- Which regularisation gives sparse weights
- Early layers stop learning
- Probabilities that cannot be trusted
- Millions of product IDs as a feature
- F1 score from a confusion matrix
- Log loss of a poor prediction
- Positive test for a rare condition
- AUC from four scores
- Conv output size with stride 2
- Parameters in a conv layer
- Reading a logistic regression weight
- Gradient of a sum of squares
- Training loop without zero_grad
- Softmax before CrossEntropyLoss
- Shape after a batched matmul
- Rows after a merge on duplicate keys
- Precision at 5 for a ranked list
- NDCG for a three-item ranking
- Effective batch size across GPUs
- Why use learning rate warmup
- Random search versus grid search
- Initialisation for a deep ReLU network
- Raising C in a soft-margin SVM
- Loss turns NaN in an RNN
- Scaling factor in attention
- Trainable parameters in a LoRA adapter
- Memory for 4-bit weights
- RAG misses exact part numbers
- Target encoding without leakage
- Several scans per patient
- Parameters in a small MLP
- Neurons that always output zero
- Activation in BERT and GPT feed-forwards
- Softmax by hand
- Adding 100 to every logit
- backward() on a vector
- What detach() does
- torch.cat or torch.stack
- Converting an HWC image
- Double versus float error
- Forgetting super().__init__()
- GPU waits on data
- Where scheduler.step() goes
- BatchNorm statistics at test time
- What LayerNorm normalises over
- Overfit one batch first
- Where gradient clipping goes
- Why skip connections help
- Loss for a single-logit classifier
- Target format for CrossEntropyLoss
- Two runs give different losses
- Freezing a pretrained backbone
- torch.inference_mode
- Slow first step after torch.compile
- Receptive field of three 3×3 convs
- What a 1×1 convolution does
- Learning rates when fine-tuning
- Role of the LSTM forget gate
- Output size of a bidirectional LSTM
- Doubling the context length
- Why GPT uses a causal mask
- Attention without position information
- What the KV cache stores
- Where cross-attention gets keys
- How contrastive pretraining works
- Quantising weights to int8
- Active parameters in a mixture of experts
- Skip connections in U-Net
- Upsampling with a transposed conv
- Shifting an image under a conv layer
- IoU of two boxes
- Many boxes on one car
- GRU compared with LSTM
- Beam search in decoding
- What skip-gram learns from
- tanh slope from its output
- Computing log of a sum of exponentials
- exp of a large logit in float32
- Perplexity from cross-entropy
- Order of arguments in KL divergence
- Learning rate when batch size grows
- The one-cycle learning rate policy
- Reading an LR range test
- Loss jumps at each epoch start
- Training loss higher than validation
- Checking a gradient numerically
- What universal approximation promises
- Loss suddenly jumps to inf
- Setting cudnn.benchmark = True
- Loss jumps after resuming training
- Keeping an exponential moving average of weights
- Reading a layer's output
- Gradient noise and batch size
- Tokens for a compute-optimal model
- Using argmax inside a loss
- Gradient size of L1 and L2 losses
- Same data order every epoch
- How tensor parallelism splits a layer
- DDP error about unused parameters
- Raising GPU throughput when serving
- What lora_alpha does
- How LoRA is initialised
- Choosing LoRA target modules
- Training only on the response
- Label value -100 in Hugging Face
- Packing short examples together
- Batch size with accumulation
- Why use learning-rate warmup
- Why QLoRA uses NF4
- Double quantisation in QLoRA
- What paged optimizers solve
- Adding special tokens
- Model never stops after SFT
- Quality versus quantity of SFT data
- Duplicates in training data
- Typical LoRA learning rate
- What prompt tuning trains
- Adapters versus LoRA at inference
- Cosine learning-rate schedule
- Evaluating a new fine-tune
- Loss for training a reward model
- Win probability from a reward gap
- Effect of beta in DPO
- Choosing the DPO reference model
- What makes ORPO different
- Training on thumbs up and down
- Why GRPO is cheaper than PPO
- Rewards from automatic checks
- Clipping in the PPO objective
- Answers grow longer after RL
- Distillation loss on logits
- Combining label and teacher losses
- Distilling without teacher logits
- Why on-policy distillation helps
- Best-of-n then fine-tune
- Optimising a proxy reward too hard
- Building preference pairs
- Chosen and rejected almost equal
- Starting point for a reward model
- Fair pairwise LLM-as-judge
- Different rates for different layers
- Gradual unfreezing
- Classifier ignores the rare class
- Hard negatives for embeddings
- Batch size in contrastive tuning
- DreamBooth forgets the general class
- Choosing a metric for free text
- Releasing a new adapter version
- Hindi and Arabic use more tokens
- Synthetic examples all look alike
- Reliable JSON from a small model
- Training a model to call tools
- Cost of a hosted fine-tune
- Time for a self-hosted run
- Long examples cut at max length
- OOM after doubling sequence length
- Making LLM-judge scores reliable
- Training data sorted by category
- Order of domain training steps
- Is the fine-tune worth it
- How IA3 adapts a model
- Removing a 3,000-token system prompt
- Adding tokens for an Indic script
- LoRA cannot learn new tokens
- Closed-form least squares
- Ridge penalty pushed very high
- When elastic net beats lasso
- Loss for logistic regression
- Shape of a logistic regression boundary
- Why add-one smoothing is used
- kNN with k = 1
- Feature sampling at each split
- Rows left out of a bootstrap
- What each boosting tree learns
- Missing values in XGBoost
- What bagging and boosting each reduce
- Why k-means++ is used
- Clusters shaped like rings
- Soft clusters for customers
- What PCA components are
- Encoding hour of day
- Helping a linear model with a ratio
- How recursive feature elimination works
- Preprocessing inside a pipeline
- Tuning with Optuna-style search
- Loss that tolerates a few wild labels
- Predicting daily order counts
- Changing the 0.5 cut-off
- Soft voting in an ensemble
- How Extra Trees differ from a forest
- IDF of a fairly rare word
- Using text embeddings in a tabular model
- Building a lag feature
- Using a pile of unlabelled data
- Choosing what to label next
- Training on data that never fits in RAM
- Same inputs, different meaning
- How permutation importance works
- Reading a partial dependence plot
- A silhouette score near zero
- Different seeds, same logistic model
- Labels that are 10% wrong
- All one-hot columns plus an intercept
- Leave-one-out on a big dataset
- Test split for ten million rows
- MAPE on low-selling products
- Why use adjusted R-squared
- ROC-AUC looks great, alerts are useless
- Weighted F1 on imbalanced classes
- Choosing F2 instead of F1
- Which class gets confused
- Points below the diagonal
- Accuracy after temperature scaling
- Test accuracy that is too high
- Error bars on a test metric
- Hundreds of runs on one validation set
- MRR across three queries
- Better offline, flat online
- Validation error still falling
- Good overall, bad for one city
- RMSLE versus RMSE
- Negative scores from cross_val_score
- What best_score_ means
- Precision and recall at 0.6
- Balanced accuracy
- Gini coefficient in credit scoring
- Reading a MASE of 0.8
- Running a model in shadow mode
- Picking a threshold with a recall floor
- Scoring clusters against known labels
- Scoring invoice field extraction
- Great offline, bad in production
- Why fp16 needs loss scaling but bf16 usually does not
- Model does not fit in GPU memory
- ROC-AUC after calibration
- Better offline metric, worse A/B test
- L2 penalty versus AdamW
- A feature that is too good
- Tuning an HNSW vector index
- KV cache size for one sequence
- Parameters in a multi-head attention block
- view() after a transpose
- Fine-tuning a CNN with batch size 2
- Why Adam divides by 1 - beta^t
- What ZeRO stage 3 shards
- Activation checkpointing trade-off
- Why RoPE encodes relative position
- What FlashAttention changes
- Speculative decoding and output quality
- Why serving engines page the KV cache
- INT8 activations hurt accuracy
- Why scale distillation loss by T squared
- How DPO differs from PPO-based RLHF
- Fine-tuned model forgets general skills
- Filtered vector search returns too few
- Inputs stable but accuracy falls
- Retraining on your own recommendations
- Random ID tops feature importance
- SMOTE applied before cross-validation
- LLM judge prefers the first answer
- Instructions hidden in a retrieved page
- Daily cost of an LLM feature
- Negative R-squared on test data
- Layers in a plain Python list
- Momentum update by hand
- Scaling inside dropout
- Gradient shrink through ten sigmoids
- Initialising a tanh network
- Target after label smoothing
- Keys prefixed with module.
- Error from an in-place operation
- Why .grad is None for an intermediate
- Calling backward twice
- Parameters in a depthwise separable conv
- An augmentation that changes the label
- Padding in a batch of sentences
- Downside of teacher forcing
- Pre-norm transformer blocks
- Sharing embedding and output weights
- The reparameterisation trick
- A GAN that draws one face
- What a diffusion model learns
- Pruning that actually runs faster
- Reach of sliding-window attention
- Area covered by a dilated kernel
- Why detectors use focal loss
- Attention to padding tokens
- Triplet loss for one example
- Gradient of softmax cross-entropy
- Gradient of a linear layer's weights
- BatchNorm on three values
- Long-run step size with momentum
- Adam and a scaled-up loss
- Memory for fp32 Adam training
- Very large batches hurt test accuracy
- Validation loss and accuracy both rise
- Test error falls again with more parameters
- Where gradient descent gets slow
- Fitting completely random labels
- Gradient accumulation with BatchNorm
- Backpropagating through a gradient
- Writing a custom autograd Function
- Parameters often excluded from weight decay
- Compute to train a 1B-parameter model
- MSE loss that never improves
- Idle time in pipeline parallelism
- Multi-GPU job that hangs forever
- Base weights for 13B in 4-bit
- Adam state for a LoRA adapter
- Merging a QLoRA adapter
- Rank 256 on 800 examples
- What DoRA changes
- Why rank-stabilised LoRA exists
- Counting optimizer steps
- Loss on multi-turn chats
- NaN loss in fp16 fine-tuning
- Loss jumps then output is gibberish
- One base, several tasks
- Checkpointing with frozen inputs
- Training loss of 0.02
- Weight decay on LoRA
- Averaging loss with accumulation
- DPO loss for one pair
- Chosen likelihood falls during DPO
- Policy writes nonsense that scores well
- Teacher and student tokenizers differ
- Softmax at T = 2
- Off-policy preference data
- Advantages in a GRPO group
- Distilling step-by-step reasoning
- Safety after a small fine-tune
- Process and outcome reward models
- Less varied answers after RLHF
- Running DPO in rounds
- DPO directly on a base model
- Pairs where both answers are equal
- Reward model held-out accuracy
- Merging two fine-tunes of one base
- Why TIES merging trims and elects signs
- Averaging several fine-tuned runs
- Memory for full-vocabulary logits
- Fine-tuning with differential privacy
- Better perplexity, worse task score
- Works only with one exact wording
- Rank sweep results
- Balancing a multilingual data mix
- Finding mislabelled rows
- Accuracy loss at 4-bit for serving
- Model repeats a customer record
- Exponential moving average of weights
- Extending context during fine-tuning
- Splitting chat logs for evaluation
- Fine-tuned small model versus API
- Offline win, online question
- LoRA on a mixture-of-experts model
- Why least squares is maximum likelihood
- Spam probability from one word
- kNN with 2,000 features
- Information gain by hand
- Overfitting in leaf-wise trees
- RBF kernel with a huge gamma
- Margin width of a linear SVM
- One long straggly cluster
- Reading a t-SNE plot
- Both errors high and close together
- How Isolation Forest scores anomalies
- New user in collaborative filtering
- Weight given by class_weight balanced
- Coefficient on a log-price model
- Promising a delivery time to customers
- Training a stacking meta-model
- Forest forecast that goes flat
- How CatBoost encodes categories
- A rolling mean that peeks ahead
- Adding up SHAP values
- Dropping gender is not enough
- Training a search ranking model
- Kernel SVM on ten million rows
- When nested cross-validation is needed
- Macro F1 with a weak minority class
- A metric using all four cells
- Agreement beyond chance
- Expected calibration error by hand
- Calibrating with only 300 rows
- Choosing features before cross-validating
- A gap between train and test windows
- Comparing two models on one test set
- Is a 1-point gain real?
- Threshold from error costs
- Quantile loss of one forecast
- Only approved loans have outcomes
- What the KS statistic measures
- Fraud labels that arrive late
- Twenty metrics, one significant
- Which metric is stable when base rate shifts
- Average prediction versus observed rate