PROFESSIONAL-MACHINE-LEARNING-ENGINEER practice question 11 of 35

You are training an object detection machine learning model on a dataset that consists of three million X-ray images, each roughly 2 GB in size. You…

Full set: 283 questions
You are training an object detection machine learning model on a dataset that consists of three million X-ray images, each roughly 2 GB in size. You are using Vertex AI Training to run a custom training application on a Compute Engine instance with 32-cores, 128 GB of RAM, and 1 NVIDIA P100 GPU. You notice that model training is taking a very long time. You want to decrease training time without sacrificing model performance. What should you do?
Answer options
A: Increase the instance memory to 512 GB and increase the batch size.
B: Replace the NVIDIA P100 GPU with a v3-32 TPU in the training job.
C: Enable early stopping in your Vertex AI Training job.
D: Use the tf.distribute.Strategy API and run a distributed training job. Correct answer
Correct Answer:
D. Use the tf.distribute.Strategy API and run a distributed training job.
Explanation

The core issue is a computational bottleneck: a single GPU is insufficient for training on a massive dataset of 3 million large images. The most effective way to reduce training time for such a large-scale task is to parallelize the workload. Distributed training allows the model training process to be spread across multiple processing units (workers with GPUs or TPUs). The tf.distribute.Strategy API is the standard, high-level TensorFlow framework for implementing various distributed training paradigms (e.g., data parallelism) on Google Cloud with minimal code modification. This directly addresses the scaling problem and accelerates training without altering the model's final performance potential.

Why Incorrect

A. Increasing instance memory does not increase the GPU's VRAM, which is the primary memory constraint for batch size. The bottleneck is compute power, not system RAM.
B. While a TPU is faster, using a multi-core TPU effectively requires a distributed strategy. Therefore, adopting a distributed strategy is the fundamental step, of which using TPUs is one possible implementation.
C. Early stopping is a regularization technique to prevent overfitting. It might terminate training sooner but can do so before the model reaches optimal performance, thus violating the prompt's constraint.

References

1. Google Cloud Documentation, "Overview of distributed training": "To use distributed training for your custom training jobs, you can specify multiple machines in a training pipeline... Google Cloud supports several distributed training strategies for different ML frameworks and use cases... For TensorFlow, we recommend that you use the tf.distribute.Strategy API." This source directly recommends tf.distribute.Strategy for scaling training on Vertex AI.

2. TensorFlow Core Documentation, "Distributed training with TensorFlow": "The tf.distribute.Strategy API is a high-level API for distributing training across multiple GPUs, multiple machines or TPUs. Using this API, you can distribute your existing models and training code with minimal code changes." This confirms that tf.distribute.Strategy is the designated tool for the task described.

3. Stanford University, CS230 Deep Learning Courseware, "Distributed Training": "When training on a very large dataset, it can be useful to parallelize the gradient computation on several workers. This is called data parallelism." This academic source establishes data parallelism, a key method implemented via distributed training, as the standard approach for large datasets.

Scroll to Top