Started fine, got through the mechanics okay.
Start by defining each method in terms of how many samples are used per gradient computation, then compare their per-step compute and memory costs, and finally discuss how update noise affects convergence and practical trade-offs. Use a structured comparison to highlight when each method is preferred.
Pro tip: Emphasize that mini-batch SGD is the de facto standard in deep learning because it balances computational efficiency with the benefits of noisy updates, and mention that noise can help escape sharp minima and improve generalization.
Clearly state that batch GD uses the entire training set, SGD uses one sample, and mini-batch SGD uses a small subset (e.g., 32-256 samples) to compute the gradient.
Explain that all three compute the gradient of the loss with respect to parameters and update via θ ← θ - η∇L, but the gradient is estimated over different numbers of samples.
Batch GD: O(N) compute and O(N) memory per step; SGD: O(1) compute and O(1) memory; mini-batch: O(B) compute and O(B) memory, where B is batch size.
Batch GD gives deterministic updates with low noise but can get stuck in sharp minima; SGD has high noise, which can help escape local minima but causes fluctuation; mini-batch SGD balances noise and stability.
Conclude that batch GD is rarely used for large datasets due to cost, SGD is efficient but noisy, and mini-batch SGD is the standard choice for deep learning due to hardware efficiency and good convergence.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
This is where the interview got interesting and also where I probably lost points.
Start by directly stating that larger batch size is not always better, then systematically discuss the trade-offs across the four dimensions. Use concrete examples and connect to practical implications for training and deployment.
Pro tip: Mention that the optimal batch size often depends on the specific hardware, model, and dataset, and that techniques like learning rate scaling and gradient accumulation can help balance trade-offs.
Acknowledge that batch size affects multiple aspects of training and that there is no one-size-fits-all answer. State that you will analyze each dimension.
Explain that larger batches improve parallelism and hardware efficiency up to a point, but can lead to diminishing returns and memory constraints.
Discuss how larger batches reduce gradient noise, allowing higher learning rates and fewer updates, but may require more epochs and can hurt convergence due to reduced stochasticity.
Highlight that very large batches often lead to worse generalization, as the noise from small batches acts as a regularizer. Mention research like Keskar et al. (2017).
Summarize that the optimal batch size is a trade-off and suggest strategies like learning rate warmup, scaling, and gradient accumulation to mitigate issues.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.