nerdexam
Google

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.

Submitted by olafpl· Apr 18, 2026Monitoring, optimizing, and maintaining ML solutions

Question

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 model performs well, but just before deploying it to production, you discover that your current serving latency is 10ms @ 90 percentile and you currently serve on CPUs. Your production requirements expect a model latency of 8ms @ 90 percentile. You're willing to accept a small decrease in performance in order to reach the latency requirement. Therefore your plan is to improve latency while evaluating how much the model's prediction decreases. What should you first try to quickly lower the serving latency?

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)
  • A
    9% (6)
  • B
    83% (54)
  • C
    5% (3)
  • D
    3% (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.

ASwitch from CPU to GPU serving.

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.

BApply quantization to your SavedModel by reducing the floating point precision to tf.float16.Correct

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.

CIncrease the dropout rate to 0.8 and retrain your model.

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.

DIncrease the dropout rate to 0.8 in _PREDICT mode by adjusting the TensorFlow Serving

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

#Model optimization#Quantization#Inference latency#TensorFlow serving

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-MACHINE-LEARNING-ENGINEER Practice