Google Cloud Professional Machine Learning Engineer — Question 123
You recently developed a deep learning model using Keras, and now you are experimenting with different training strategies. First, you trained the model using a single GPU, but the training process was too slow. Next, you distributed the training across 4 GPUs using tf.distribute.MirroredStrategy (with no other changes), but you did not observe a decrease in training time. What should you do?
Answer options
- A. Distribute the dataset with tf.distribute.Strategy.experimental_distribute_dataset
- B. Create a custom training loop.
- C. Use a TPU with tf.distribute.TPUStrategy.
- D. Increase the batch size.
Correct answer: D
Explanation
Increasing the batch size allows for more efficient use of the multiple GPUs, potentially leading to faster training due to better parallelism. The other options, such as creating a custom training loop or using a TPU, may not address the underlying issue of training speed as effectively as increasing the batch size would in this scenario.