Google Professional Machine Learning Engineer Question 248
Single answerGoogle Cloud PlatformYou are training a machine learning model on Google Cloud using AI Platform Training. The training job repeatedly fails with an 'out-of-memory' error while processing large batches of data. What is the most appropriate action to address this issue?
- A
Reduce the batch size used during training.
- B
Switch to a smaller machine type to conserve resources.
- C
Use Google Cloud's Vertex AI TensorFlow Profiler to optimize the model architecture.
- D
Enable distributed training with multiple GPUs or TPUs.
Show answer and explanation
Correct answer: A
Explanation
Out-of-memory errors during training are often caused by excessive memory usage, which is directly influenced by batch size. Reducing the batch size is a straightforward and effective way to lower memory consumption. While other options like distributed training or model optimization tools can be useful, they are not the most direct or simplest solution for this specific problem.
- A. Correct.
Reducing the batch size decreases the memory requirements for each training step, which is a common solution to resolve out-of-memory errors.
- B. Incorrect.
Switching to a smaller machine type would reduce available memory and likely worsen the problem, not solve it.
- C. Incorrect.
While the TensorFlow Profiler can help optimize performance, it is not directly relevant for resolving out-of-memory errors caused by large batch sizes.
- D. Incorrect.
Enabling distributed training could help in some cases but is a more complex solution that may not be necessary. Reducing the batch size is a simpler and often sufficient first step.