PMLE Scaling Prototypes into ML Models Practice Question
An engineer is using TensorFlow Transform (tf.Transform) to preprocess training data. They want to ensure that the same preprocessing logic is applied during inference without code duplication. Which approach should they take?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use tf.Transform to generate a transform_fn and save it as a SavedModel; then use tf.saved_model.load to apply it in the serving pipeline
TensorFlow Transform outputs a SavedModel that contains the preprocessing graph. This can be exported as a transform_fn and embedded in the serving model, ensuring consistency between training and serving.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use tf.Transform at prediction time by running a separate Beam pipeline
Why it's wrong here
Running a separate Beam pipeline at prediction time adds latency and infrastructure, and Beam is a batch processing runner, not a serving path. The exported TransformGraph is loaded directly into the serving graph. It is tempting because Beam executes the training preprocessing, but reusing it online duplicates the pipeline rather than the logic.
- ✗
Use Dataflow to preprocess data for both training and serving
Why it's wrong here
Dataflow is a managed Beam runner for batch and streaming pipelines, not an inference component; using it for serving adds a network hop and cannot embed transformations in the model graph. The exported TransformGraph is applied in-process. It is tempting because Dataflow already executes the training pipeline, but serving needs the graph, not the runner.
- ✓
Use tf.Transform to generate a transform_fn and save it as a SavedModel; then use tf.saved_model.load to apply it in the serving pipeline
Why this is correct
Saving the transform_fn as a SavedModel exports the full preprocessing graph, including constants such as vocabulary and mean values computed during training. Loading it with tf.saved_model.load in the serving pipeline applies identical logic at inference, satisfying the no-duplication constraint without reimplementing feature engineering.
- ✗
Write separate preprocessing code for training and serving in Python
Why it's wrong here
Duplicating preprocessing in Python lets training and serving drift, since transformations are reimplemented rather than shared. tf.Transform exports a saved TransformGraph that serving applies identically. It is tempting because hand-written Python is familiar and works for simple feature engineering, but it cannot guarantee train-serve consistency.
Go deeper
Related to this question
About these practice questions
Courseiva writes every PMLE question from scratch — 775 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This PMLE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PMLE exam.