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

Your team is building a convolutional neural network (CNN)-based architecture from scratch. The preliminary experiments running on your on-premises…

Full set: 283 questions
Your team is building a convolutional neural network (CNN)-based architecture from scratch. The preliminary experiments running on your on-premises CPU-only infrastructure were encouraging, but have slow convergence. You have been asked to speed up model training to reduce time-to- market. You want to experiment with virtual machines (VMs) on Google Cloud to leverage more powerful hardware. Your code does not include any manual device placement and has not been wrapped in Estimator model-level abstraction. Which environment should you train your model on?
Answer options
A: AVM on Compute Engine and 1 TPU with all dependencies installed manually.
B: AVM on Compute Engine and 8 GPUs with all dependencies installed manually.
C: A Deep Learning VM with an n1-standard-2 machine and 1 GPU with all libraries pre-installed. Correct answer
D: A Deep Learning VM with more powerful CPU e2-highcpu-16 machines with all libraries pre- installed.
Correct Answer:
C. A Deep Learning VM with an n1-standard-2 machine and 1 GPU with all libraries pre-installed.
Explanation

The primary goal is to accelerate the training of a Convolutional Neural Network (CNN) with minimal initial effort for experimentation. A Deep Learning VM is ideal as it comes pre-configured with necessary drivers (NVIDIA drivers, CUDA) and ML frameworks, eliminating manual setup time. Using a single GPU provides a significant performance boost for CNNs over CPUs without requiring code modifications for distribution strategies. TensorFlow and PyTorch automatically prioritize an available GPU for operations, fitting the "no manual device placement" constraint. This option represents the fastest and most direct path to achieving the desired training speedup for an initial experiment.

Why Incorrect

A. AVM on Compute Engine and 1 TPU with all dependencies installed manually. Training on TPUs requires significant, specific code changes (e.g., using tf.distribute.TPUStrategy), which contradicts the desire for a quick experiment with the existing codebase.
B. AVM on Compute Engine and 8 GPUs with all dependencies installed manually. Effectively using multiple GPUs requires code modifications to implement a distribution strategy (e.g., tf.distribute.MirroredStrategy). Without this, only one GPU would be used.
D. A Deep Learning VM with more powerful CPU e2-highcpu-16 machines with all libraries pre-installed. While a faster CPU helps, the performance gain for CNN training is marginal compared to the orders-of-magnitude speedup provided by a GPU, which is designed for parallel computations.

References

1. Google Cloud Documentation, "Deep Learning VM overview": "Deep Learning VM Image makes it easy and fast to instantiate a virtual machine image containing the most popular AI frameworks... It includes NVIDIA® drivers and the CUDA-X AI stack for GPU instances to accelerate your tasks." This supports the choice of a pre-configured environment to save time.

2. TensorFlow Official Documentation, "Use a GPU": Under the section "Manual device placement," it states: "If a TensorFlow operation has both CPU and GPU implementations, the GPU device is prioritized when the operation is assigned." This confirms that with a single GPU instance and no explicit placement, the code will automatically leverage the GPU, making option C viable without code changes.

3. TensorFlow Official Documentation, "Distributed training with TensorFlow": This guide details the necessity of using tf.distribute.Strategy subclasses like TPUStrategy (for TPUs) and MirroredStrategy (for multi-GPU on one machine). This confirms that options A and B would require code modifications, which the user is trying to avoid in this initial experimental phase.

4. Stanford University, CS231n Convolutional Neural Networks for Visual Recognition, "Hardware and Software": The course notes explain: "Training Neural Networks is a very computationally expensive task... The fact that GPUs are very good at matrix/vector operations makes them ideal for training Neural Networks." This academic source validates prioritizing a GPU (Option C) over a more powerful CPU (Option D) for CNNs.

Scroll to Top