← LinkedIn Interview InsightsMachine Learning Engineer
I knew the mechanics but writing it out cleanly under pressure was a different story.
Start by outlining the overall structure of mini-batch gradient descent, then walk through each component: data splitting, forward/backward pass, parameter update, and epoch loop with convergence check. Finally, compare it to full-batch GD and SGD, highlighting trade-offs in computation, memory, and convergence behavior.
Pro tip: Emphasize that mini-batch size is a hyperparameter that balances the variance of SGD and the efficiency of full-batch GD; mention that shuffling before splitting is crucial to avoid biased batches.
Explain how to shuffle the training data and split it into mini-batches of a chosen size, handling the last batch if it's smaller.
Describe the forward pass to compute predictions and loss for a batch, then the backward pass to compute gradients of the loss with respect to parameters.
State the update rule: parameters -= learning_rate * gradients, and mention that this is applied per batch.
Outline the epoch loop that iterates over batches, and include a convergence check (e.g., loss change below threshold or validation performance) to stop training early.
Contrast mini-batch with full-batch (uses entire dataset per update) and SGD (uses one sample per update), focusing on computational efficiency, memory usage, and convergence stability.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.