← LinkedIn Interview InsightsMachine Learning Engineer

LinkedIn·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

LinkedIn ML engineer interview, technical phone screen focused on optimization fundamentals. One meaty pseudocode question that sounds straightforward until you're actually writing it out live.

Questions Asked (1)

Q1

Write pseudocode for mini-batch gradient descent, covering how you'd split training data into batches, the forward and backward pass logic, the parameter update rule with a learning rate, and how you'd structure the epoch loop with a convergence check. Also explain how this differs from full-batch gradient descent and plain SGD.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I knew the mechanics but writing it out cleanly under pressure was a different story.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

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.

1. Data Splitting and Shuffling

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.

2. Forward and Backward Pass

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.

3. Parameter Update

State the update rule: parameters -= learning_rate * gradients, and mention that this is applied per batch.

4. Epoch Loop and Convergence Check

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.

5. Comparison with Full-Batch GD and SGD

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.

Key Points to Mention

  • Shuffling before splitting to ensure random batches
  • Batch size as a hyperparameter affecting variance and efficiency
  • Forward pass: compute predictions and loss for the batch
  • Backward pass: compute gradients using backpropagation
  • Update rule: parameters -= learning_rate * gradients
  • Convergence check: monitor loss or validation metric, with patience or threshold
  • Comparison: full-batch uses all data per update (stable but slow), SGD uses one sample (noisy but fast), mini-batch balances both

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.