PROFESSIONAL-MACHINE-LEARNING-ENGINEER · Question #156
You have trained a DNN regressor with TensorFlow to predict housing prices using a set of predictive features. Your default precision is tf.float64, and you use a standard TensorFlow estimator: Your…
The correct answer is B. Apply quantization to your SavedModel by reducing the floating point precision to tf.float16. To quickly reduce serving latency for a TensorFlow model on CPUs while accepting a minor performance drop, reducing the model's floating-point precision through quantization (e.g., to tf.float16) is a highly effective first step.
Question
Options
- ASwitch from CPU to GPU serving.
- BApply quantization to your SavedModel by reducing the floating point precision to tf.float16.
- CIncrease the dropout rate to 0.8 and retrain your model.
- DIncrease the dropout rate to 0.8 in _PREDICT mode by adjusting the TensorFlow Serving
How the community answered
(65 responses)- A9% (6)
- B83% (54)
- C5% (3)
- D3% (2)
Why each option
To quickly reduce serving latency for a TensorFlow model on CPUs while accepting a minor performance drop, reducing the model's floating-point precision through quantization (e.g., to tf.float16) is a highly effective first step.
Switching to GPU serving might reduce latency, but the question implies finding a solution for CPU serving or one that improves CPU performance; also, GPUs come with higher cost and complexity not explicitly stated as acceptable.
Applying quantization to reduce floating-point precision (e.g., from tf.float64 to tf.float16 or int8) directly reduces the model size and the computational intensity of inference operations. This leads to faster execution on CPUs, lower memory bandwidth requirements, and subsequently, a significant reduction in serving latency, often with only a negligible impact on prediction accuracy.
Increasing the dropout rate and retraining would alter the model's architecture and training process, which is a much more involved and time-consuming change than post-training quantization, and primarily affects model generalization rather than directly optimizing serving latency for an already trained model.
Dropout is a training-time regularization technique and should typically be disabled or significantly reduced during prediction (`_PREDICT` mode) to obtain deterministic and optimal model outputs; applying it at inference time would generally worsen performance and accuracy, not improve latency.
Concept tested: Model optimization for serving latency (quantization)
Source: https://www.tensorflow.org/guide/mixed_precision
Topics
Community Discussion
No community discussion yet for this question.