Professional Machine Learning Engineer · 18% of the exam

Scaling prototypes into ML models: free practice questions

5 sample questions from our 45-question bank for this domain — answers and explanations included. These are the same scenario-based style as the real Google Cloud exam.

1. You are designing a containerized custom training job for Vertex AI. Your container image is 5 GB and is stored in Artifact Registry. The training job uses 8 workers, each pulling the image. During training startup, you notice a 15-minute delay before actual training begins. What are the most efficient ways to reduce this delay? (Select TWO.)

  • A. Optimize the container image by removing unnecessary dependencies and build artifacts; aim for a smaller image size✓ Correct
  • B. Use a base image with TensorFlow/PyTorch pre-installed instead of installing from scratch in the Dockerfile✓ Correct
  • C. Enable image caching in Artifact Registry so workers reuse previously pulled images
  • D. Increase the machine type CPU cores to speed up image extraction on the worker nodes
  • E. Replace Artifact Registry with Cloud Storage for faster image pulls
  • F. Distribute the training across fewer workers (e.g., 4 instead of 8) to reduce total pull time
Explanation

Container image optimization (removing unnecessary files) and using pre-built base images are the two most effective ways to reduce image size and pull time. A 5 GB image is large; optimizing it can reduce to 1-2 GB, cutting pull time significantly. Artifact Registry caching is automatic; enabling it doesn't typically provide additional speedup. CPU cores affect extraction, not network pull time. Cloud Storage doesn't serve OCI images efficiently. Reducing workers would increase total time. Image optimization and base image selection directly address the bottleneck.

2. You are training a deep neural network on Vertex AI for a fraud detection use case. The dataset has 2 million transactions, of which only 0.1% are fraudulent. After training, precision on the fraud class is 72% but recall is only 18%. Your business requirement is to maximize recall on the fraud class with acceptable precision (>50%). Which combination of techniques should you implement FIRST to improve recall without retraining from scratch?

  • A. Lower the classification threshold from 0.5 to a value closer to 0.1 for the fraud class, so more transactions are flagged as fraudulent, then evaluate precision-recall tradeoff.✓ Correct
  • B. Retrain the model with a higher learning rate and more epochs to push training loss lower, which will improve recall.
  • C. Add more dense layers to the model to increase its capacity, allowing it to learn more subtle fraud patterns.
  • D. Switch from binary cross-entropy loss to mean squared error, which penalizes false negatives more heavily.
Explanation

Adjusting the classification threshold is the most immediate, computationally inexpensive intervention that does not require retraining. By lowering the decision threshold (e.g., from 0.5 to 0.1), the model flags more transactions as fraud, directly increasing recall. The precision-recall tradeoff can then be evaluated at multiple thresholds using a PR curve to find the operating point meeting the >50% precision requirement. Option B is incorrect because more training epochs with a higher learning rate does not specifically address the recall problem caused by class imbalance; it is more likely to overfit the majority class further. Option C is incorrect because model capacity is not the limiting factor here — the model already achieves 72% precision, indicating it has learned discriminative features; the issue is the decision boundary, not model expressiveness. Option D is incorrect because switching to MSE for classification problems is generally incorrect (MSE is not a proper loss for binary classification), and it does not selectively penalize false negatives in the way focal loss or weighted cross-entropy would.

3. You are designing a distributed training strategy for a large PyTorch model on Vertex AI. You need to choose between tf.distribute.MultiWorkerMirroredStrategy (synchronous all-reduce) and ParameterServerStrategy (asynchronous). Your dataset is 1 TB, model is 5 GB, and you have 16 workers with variable network conditions. Select TWO strategies that would be most appropriate.

  • A. Use MultiWorkerMirroredStrategy for guaranteed convergence and synchronized updates across all workers despite variable network conditions
  • B. Use ParameterServerStrategy to tolerate stragglers and variable network latency through asynchronous gradient updates✓ Correct
  • C. Use MultiWorkerMirroredStrategy because PyTorch's DistributedDataParallel is synchronous and expects synchronized gradients
  • D. Use ParameterServerStrategy because it automatically handles fault tolerance without restarting the job
  • E. Implement a hybrid approach using gradient compression with MultiWorkerMirroredStrategy to reduce network overhead✓ Correct
Explanation

Options 1 and 4 are correct. ParameterServerStrategy (option 1) is ideal for variable network conditions because asynchronous updates tolerate stragglers. Gradient compression (option 4) reduces bandwidth overhead in synchronized training. Option 0 is wrong because MultiWorkerMirroredStrategy's synchronization becomes a bottleneck with variable network conditions (workers wait for slowest). Option 2 is misleading phrasing; while DistributedDataParallel is synchronous, ParameterServerStrategy is still valid for large-scale PyTorch. Option 3 is incorrect; ParameterServerStrategy doesn't provide automatic fault tolerance—job failures require restart.

4. Your team is training a deep learning model on Vertex AI using a custom container. After several hours, the job fails unexpectedly due to a preemption event. You want to minimize lost progress on future runs. What is the MOST effective strategy?

  • A. Increase the number of GPUs per worker so each epoch completes faster, reducing exposure to preemption.
  • B. Implement periodic checkpointing in your training script that saves model weights to a Cloud Storage bucket, and add logic to resume from the latest checkpoint at job startup.✓ Correct
  • C. Use Vertex AI Pipelines instead of a custom training job so that the pipeline automatically retries from the last successful step.
  • D. Switch to a TPU v4 pod, which is not subject to preemption events on Vertex AI.
Explanation

Periodic checkpointing to Cloud Storage is the standard and most effective strategy for fault tolerance in custom training jobs. By saving model weights (and optimizer state) at regular intervals and loading from the latest checkpoint on startup, you can resume training with minimal lost progress after any failure or preemption. Option A is incorrect because adding GPUs reduces epoch time but does not protect against preemption mid-epoch; checkpointing is still needed. Option C is incorrect because Vertex AI Pipelines can retry steps, but without checkpointing inside the training step itself, the entire training run restarts from scratch. Option D is incorrect because TPU pods on Vertex AI can still be subject to infrastructure disruptions, and checkpointing is always recommended regardless of hardware type.

5. Your team is running a distributed TensorFlow training job on Vertex AI with 1 chief worker and 4 additional workers using MultiWorkerMirroredStrategy. After scaling from 1 worker to 5, you observe that training throughput (samples/second) increased by only 2.3x instead of the expected ~5x. Which THREE factors are MOST likely contributing to this sublinear scaling efficiency? (Choose THREE.)

  • A. All-reduce communication overhead for gradient synchronization increases with the number of workers.✓ Correct
  • B. Vertex AI enforces a maximum throughput cap per job that throttles multi-worker performance.
  • C. Data pipeline bottlenecks where the tf.data input pipeline cannot feed data fast enough to all workers.✓ Correct
  • D. The batch size was kept constant (not scaled linearly with worker count), causing each worker to process fewer samples per step.
  • E. MultiWorkerMirroredStrategy does not support more than 2 workers on Vertex AI.
  • F. I/O contention when multiple workers simultaneously read large training files from the same Cloud Storage bucket path.✓ Correct
Explanation

Sublinear scaling in distributed training commonly results from three sources present in this scenario: (A) All-reduce communication overhead — as worker count grows, the time spent synchronizing gradients across workers increases, reducing the fraction of time spent on actual computation. (C) Data pipeline bottlenecks — if the tf.data pipeline is not parallelized (e.g., missing prefetch, parallel_interleave) or cannot sustain the aggregate throughput required by multiple workers, GPUs sit idle waiting for data. (F) Cloud Storage I/O contention — when multiple workers read the same files concurrently from GCS without sharding or caching, read bandwidth becomes a bottleneck. Option B is incorrect because Vertex AI does not impose an artificial throughput cap on training jobs. Option D is incorrect because keeping batch size constant actually means each worker processes a full batch independently (data parallelism), and in synchronous training the effective batch size grows with worker count; the scaling issue is not caused by this. Option E is incorrect because MultiWorkerMirroredStrategy fully supports many workers on Vertex AI and is not limited to 2 workers.

40 more questions in this domain

Practice the full bank with instant grading, flashcards, and a timed mock exam.

Start practicing free