PROFESSIONAL-MACHINE-LEARNING-ENGINEER · Question #112
You are developing an ML model intended to classify whether X-ray images indicate bone fracture risk. You have trained a ResNet architecture on Vertex AI using a TPU as an accelerator, however you…
The correct answer is D. Configure your model to use bfloat16 instead of float32. Switching the model's precision from float32 to bfloat16 is the optimal first choice when training on TPUs. TPU hardware is natively optimized for bfloat16 arithmetic, so this change reduces memory consumption by approximately 50%, speeds up matrix operations, and requires only…
Question
Options
- AReduce the number of layers in the model architecture.
- BReduce the global batch size from 1024 to 256.
- CReduce the dimensions of the images used in the model.
- DConfigure your model to use bfloat16 instead of float32.
How the community answered
(31 responses)- A3% (1)
- B10% (3)
- C6% (2)
- D81% (25)
Explanation
Switching the model's precision from float32 to bfloat16 is the optimal first choice when training on TPUs. TPU hardware is natively optimized for bfloat16 arithmetic, so this change reduces memory consumption by approximately 50%, speeds up matrix operations, and requires only a single-line dtype change in code - minimal impact on the codebase. The accuracy impact is typically negligible because bfloat16 preserves the same 8-bit exponent range as float32. Reducing batch size (B) actually hurts TPU efficiency since TPUs benefit from large batches. Reducing image dimensions (C) degrades model accuracy directly. Reducing the number of layers (A) requires architectural redesign and also hurts accuracy.
Topics
Community Discussion
No community discussion yet for this question.