Book TOC · Previous · Chapter 7 of 7
Chapter 7: Master Look-Alike Tool Comparison & Decision Playbook
Chapter Focus: Side-by-side comparison of look-alike PMLE services, a 5-Step Architecture Decision Framework, cross-domain production patterns, and the Top 25 Golden Rules.
1. The PMLE Look-Alike Service Disambiguation Matrix
In complex Google Cloud Certified Professional Machine Learning Engineer architectures, multiple Google Cloud services often appear to solve similar problems. Use the matrix below to distinguish between closely related services based on latency, scale, security boundaries, and operational overhead.
# | Look-Alike Pair / Triad | Choose Option A When... | Choose Option B / C When... | Classic Common Mistakes to Avoid |
|---|---|---|---|---|
1 | BigQuery ML ( BQML) vs. Agent Platform AutoML vs. Custom Training | BQML: Data is structured in BigQuery, team knows SQL, need fastest baseline or in-warehouse ML.PREDICT / ARIMA_PLUS / KMEANS. | AutoML: Need maximum accuracy on Tabular/Image/Text/Video with custom labels & no code. Custom Training: Need custom neural architecture, custom loss, or C++ libs. | Exporting 20 TB from BigQuery to GCS CSVs just to train a simple logistic regression model in custom Python. |
2 | Prebuilt AI APIs ( Document AI, Vision API) vs. AutoML Vision / Text | Prebuilt API: Task uses generic pre-trained schemas (OCR, invoices, receipts, W-2s, faces, landmarks, translation, speech). | AutoML: Task requires custom, domain-specific labels (e.g., classifying 5 proprietary manufacturing scratch types on car parts). | Calling pre-trained Vision API to classify proprietary assembly-line defect codes it was never trained on. |
3 | Prompt Engineering vs. RAG (Agent Builder / Vector Search) vs. Fine-Tuning (SFT / PEFT) | Prompting: <50 examples, quick formatting. RAG: Rapidly changing enterprise facts, strict source citations, document ACLs. | Fine-Tuning (SFT / LoRA): Teaching consistent domain tone, complex output format, or replacing a costly 50-shot prompt on a smaller model. | Using Supervised Fine-Tuning to memorize daily changing inventory prices (causes stale hallucinations). |
4 | BigQuery SQL vs. Dataflow ( Apache Beam) vs. Dataproc (Apache Spark) | BigQuery: Petabyte batch SQL pushdown on warehouse data. | Dataflow: Unified batch + streaming ( Sliding Windows / Watermarks) + tf.Transform. Dataproc: Existing PySpark / Hadoop code. | Running a single-node Pandas script in a notebook on a 2 TB dataset (crashes with OOM). |
5 | tf.Transform (TFT) vs. Agent Platform Feature Store vs. BQML TRANSFORM | tf.Transform: Embeds global training stats (μ, σ, vocab) as a hermetic graph inside a TensorFlow SavedModel. | Feature Store: Shares features across teams and serves time-windowed streaming features ( tx_last_5_min) with point-in-time training joins. BQML TRANSFORM: SQL-native models. | Using tf.Transform alone for a stateless online request that needs a 30-minute historical rolling count not passed by the client. |
6 | Colab Enterprise vs. Agent Platform Workbench Instances vs. Dataproc Hub | Colab Enterprise: Real-time live-cursor co-authoring, inline comments, zero-setup serverless runtimes in BigQuery Studio. | Workbench Instances: Custom containers, OS/root access, No Public IP + Private Google Access, single-user IAM. Dataproc Hub: Governed Spark templates. | Choosing Workbench Instances when the prompt explicitly asks for simultaneous multi-user cursor editing and cell comments. |
7 | Agent Platform Experiments vs. TensorBoard Profiler vs. ML Metadata | Experiments: Logging & comparing hyperparameters/metrics across runs ( Parallel Coordinates Plot). | TensorBoard Profiler: Debugging slow GPU/TPU step times & CPU I/O bottlenecks. ML Metadata: Auditing artifact lineage ( Dataset → Model → Endpoint). | Using ML Metadata to profile GPU kernel utilization, or using TensorBoard to compare 50 Scikit-learn runs. |
8 | PR-AUC (AUC-PR) vs. ROC-AUC vs. RMSE / MAE vs. ROUGE / BLEU | PR-AUC: Highly imbalanced classification (<1% fraud/defects). RMSE: Regression penalizing outliers heavily. ROUGE: Summarization recall. | ROC-AUC: Balanced binary classification. MAE: Regression robust to extreme outliers. BLEU: Machine translation precision. | Evaluating a 0.1% fraud detection model with raw Accuracy or ROC-AUC (masks terrible minority-class precision/recall). |
9 | CPU VMs vs. NVIDIA GPUs vs. Google Cloud TPUs ( TPU VM) | CPU: Scikit-learn, tabular XGBoost. GPU: Custom C++ CUDA kernels, strict float64 math, dynamic control flow, Horovod. | Cloud TPU ( TPU VM): Massive TensorFlow/JAX/PyTorch-XLA Transformers & CNNs using bfloat16 (BF16) and optical Pod slices. | Choosing Cloud TPUs for a model with custom C++ CUDA kernels or strict 64-bit float64 financial precision requirements. |
10 | Data Parallelism ( Mirrored / MultiWorkerMirrored / DDP) vs. Model Parallelism (FSDP / ZeRO / ParameterServer) | Data Parallelism: Full model fits in 1 chip's VRAM; replicate model & shard batch (add Reduction Server for multi-node GPU bandwidth). | Model Parallelism ( FSDP, DeepSpeed ZeRO, Tensor/Pipeline): Model weights/activations exceed single-chip memory (e.g., 500B LLM or 200GB embedding table). | Using MirroredStrategy or MultiWorkerMirroredStrategy when a single copy of the model exceeds GPU VRAM. |
11 | Prebuilt Serving Container vs. Custom Prediction Routine ( CPR) vs. Custom Container | Prebuilt: Standard model.joblib, model.bst, saved_model.pb, TorchServe .mar. | CPR: Prebuilt framework + custom Python preprocess() / postprocess(). Custom Container: Custom C++ apt libs or custom HTTP server ($AIP_HTTP_PORT). | Building a full custom Docker web server from scratch just to map output probabilities to class label strings in Scikit-learn. |
12 | Quantization ( FP32 → INT8) vs. Knowledge Distillation vs. TensorRT (TF-TRT) | Post-Training Quantization: Shrinks model 4x ( FP32 → INT8) for Edge/Mobile without retraining. | Knowledge Distillation: Trains a small fast Student model to mimic a massive Teacher ( BERT). TensorRT: Fuses layers for NVIDIA GPU serving. | Increasing max_replica_count when a single sequential forward pass of a giant BERT model violates a 20ms latency SLA. |
13 | Agent Platform Pipelines ( KFP / TFX) vs. Cloud Composer (Airflow) vs. Cloud Build | Agent Platform Pipelines: Serverless ML DAGs ( TFDV → TFT → Trainer → TFMA → InfraValidator → Pusher). | Cloud Composer: Cross-system multi-cloud ETL orchestration. Cloud Build: Git-triggered CI (unit tests, Docker build, KFP YAML compilation). | Using Cloud Build to orchestrate a 10-step ML training & TFDV validation DAG, or using KFP to run Git pull-request unit tests. |
14 | Sampled Shapley vs. Integrated Gradients vs. XRAI (Explainable AI) | Sampled Shapley: Non-differentiable tree/tabular models ( XGBoost, Random Forest, sklearn). | Integrated Gradients: Differentiable neural networks ( DNNs) on tabular/text data. XRAI: Differentiable Computer Vision / Image models (superpixel regions). | Configuring Integrated Gradients or XRAI on a non-differentiable XGBoost decision tree model. |
15 | Training-Serving Skew vs. Data Drift vs. Concept Drift vs. Feature Attribution Drift | Training-Serving Skew: Live $P_{\text{serve}}(X) \neq P_{\text{train}}(X)(requires **Training Dataset URI baseline**!). **Data Drift:** Live @@CODE1@@{t2}(X) ≠q Pt1(X) over time. | Concept Drift: $P(Y | X)$ changes while $P(X)$ is stable. Feature Attribution Drift: Shapley/IG feature importances shift over time (early warning when labels are delayed!). |
2. The 5-Step Architecture Decision Framework
When evaluating a multi-service Google Cloud design, apply this structured 5-step architectural review:
- Step 1 — Pinpoint Core Workload & Non-Functional Requirements: Identify the primary workload driver (e.g., sub-10ms OLTP vs. petabyte OLAP, synchronous REST vs. asynchronous event streaming, strict regional data residency vs. global active-active availability).
- Step 2 — Prefer Managed, Cloud-Native Services First: Default to fully managed, serverless, or Google-curated services before introducing self-managed VMs, custom glue scripts, or unscalable manual operations.
- Step 3 — Enforce Zero-Trust Identity & Keyless Authentication: Replace static credentials, long-lived service account JSON keys, and broad basic roles (
Owner/Editor) with Workload Identity Federation, attached service accounts, and predefined IAM roles. - Step 4 — Verify Network Isolation & Data Perimeter Guardrails: Combine private connectivity (Private Service Connect, Private Google Access, IAP TCP forwarding) with VPC Service Controls and Organization Policy constraints.
- Step 5 — Optimize for Cost, Observability, and Day-2 Reliability: Validate autoscaling boundaries, SLO burn-rate alerting, sink-level log filtering, and automated rollback pipelines before production rollout.
3. Review: Architecture Decision List
- Use Cloud Vision API for generic, common object detection.
- Use Vertex AI AutoML when you have custom data and need to detect specific, non-generic items or patterns.
- AutoML provides a low-code environment suitable for users with limited ML coding experience.
- TPUs are optimized for bfloat16 and float32 operations and lack native hardware support for float64.
- GPUs (specifically data center models like A100) support float64 (double precision) natively.
- Use TPUs for high-throughput deep learning training where lower precision is acceptable.
- Use GPUs for workloads requiring high numerical precision, such as scientific computing or financial modeling.
- Accuracy is misleading for imbalanced datasets (e.g., fraud, rare diseases).
- AUC-ROC is good for balanced data but can be optimistic for imbalanced data.
- AUC-PR is the preferred metric for highly imbalanced classification problems where the positive class is rare.
- Vertex AI AutoML allows you to explicitly select the optimization objective based on your business goal.
- Vertex AI Endpoints support multiple deployed models simultaneously.
- Traffic splitting is configured at the Endpoint level using percentages that sum to 100.
- This feature enables A/B testing and canary deployments without client-side changes.
- Machine types determine capacity, not traffic distribution.
- Real-time requirements (sub-second latency) demand streaming architectures, not batch.
- Vertex AI Feature Store has distinct APIs for Batch Import (high throughput) and Streaming Ingestion (low latency).
- Dataflow streaming jobs bridge the gap between event sources like Pub/Sub and the Feature Store Online serving node.
- Training-Serving Skew occurs when the data or logic used in production differs from training.
- Never calculate normalization statistics (mean/std) on the serving batch if the batch size is small or 1.
- Use tf.Transform to compute global statistics over the full training set.
- Embed preprocessing logic into the SavedModel graph to guarantee consistency.
- Embed Preprocessing: Always try to include preprocessing logic inside the model graph to ensure consistency between training and serving.
- Use Analyzers: Operations that require a full pass over data (like mean, vocabularies, or quantiles) should use
tf.transformanalyzers. - Avoid Client Logic: Minimizing preprocessing logic in the client application reduces the risk of skew.
- Vertex AI Endpoints support hosting multiple models simultaneously to enable gradual rollouts.
- Use the
trafficSplitconfiguration to define how traffic is distributed between deployed models. - Avoid client-side routing for deployment strategies; use server-side controls to keep clients decoupled.
- Traffic splitting is distinct from autoscaling (replica counts); replica counts ensure capacity, while traffic split ensures routing logic.
- Vertex AI AutoML Forecasting requires data to have a constant time granularity (e.g., hourly, daily).
- Irregular event logs must be aggregated or resampled into fixed intervals before training.
- Timestamps should be preserved as time data types, not converted to strings or indices, to maintain seasonality signals.
- Training-Serving Skew often results from dual implementations of feature logic.
- Vertex AI Feature Store eliminates skew by serving the exact same feature values for both training and inference.
- Use Batch Serving for fetching large historical datasets for model training.
- Use Online Serving for low-latency retrieval of the latest feature values during prediction.
- Use Vision API for general object detection (e.g., "this is a car").
- Use AutoML Vision when you need to detect custom labels specific to your business domain (e.g., "this is a 2022 model car with a scratch").
- BigQuery ML is typically used for structured data, not raw image analysis.
- Use Vertex AI Online Prediction when you need immediate results (low latency) for individual requests.
- Use Vertex AI Batch Prediction when you have a large dataset, results are not needed instantly (asynchronous), and you want to optimize for cost and throughput.
- Batch Prediction natively supports reading from and writing to BigQuery or Cloud Storage.
- Windowing: Essential for aggregating unbounded data streams in Dataflow.
- Sliding Windows: Use these when you need overlapping windows to calculate moving averages or rolling counts.
- Fixed Windows: Use these for standard periodic reporting where overlaps are not needed.
- Dataflow & Pub/Sub: The standard pattern for real-time data ingestion and processing on GCP.
- Small files (KB size) stored individually in object storage cause high I/O latency due to request overhead.
- I/O starvation occurs when the training hardware (GPU/TPU) processes data faster than the storage system can deliver it.
- TFRecord is the recommended format for TensorFlow to aggregate small data items into larger files (shards) to maximize read throughput.
- Optimizing the input pipeline is often more effective than upgrading hardware when the bottleneck is data ingestion.
- Time-series data must never be split randomly; doing so causes data leakage.
- Look-ahead bias occurs when a model trains on future data to predict past events, inflating validation metrics.
- Always use a temporal (chronological) split for time-series models: train on the past, validate on the future.
- A massive gap between validation accuracy and production performance is a strong indicator of data leakage.
- Lightweight Python Components are best for simple, self-contained code with minimal dependencies.
- Containerized Components are required when you need custom dependencies, specific OS libraries, or conflicting package versions.
- Always prefer containerization for legacy migrations to ensure the runtime environment matches the original requirements.
- RMSE optimizes for the mean and assumes symmetric error costs (over-prediction cost equals under-prediction cost).
- Quantile Loss is used for probabilistic forecasting and handling asymmetric costs.
- Target a low quantile (e.g., p10) to minimize over-predictions (reduce spoilage).
- Target a high quantile (e.g., p90) to minimize under-predictions (avoid stockouts).
- MirroredStrategy is for single-host, multi-GPU training where the model fits in memory.
- MultiWorkerMirroredStrategy is for multi-host training where the model fits in memory on each device.
- ParameterServerStrategy is best for models with large variables (like embeddings in recommendation systems) that need to be sharded across servers.
- AutoML Forecasting is the correct choice for time-series predictions involving future horizons (e.g., stock planning, weather, financial forecasting).
- AutoML Regression is for predicting numbers where time is not the primary dimension or structural component.
- AutoML Classification is for predicting categories, not continuous numbers.
- Always look for constraints like 'low-code' or 'no data science expertise' to favor AutoML over custom training.
- Vertex AI Data Labeling Service allows you to offload the labor-intensive task of annotation to human labelers.
- A labeling task requires a defined Label Set and a PDF of Instructions to ensure quality.
- Supervised learning models (like Object Detection) cannot be trained on completely unlabeled data.
- Use model_type='ARIMA_PLUS' for time-series forecasting in BigQuery ML.
- Use the time_series_id_col option to forecast multiple items (e.g., products, stores) in a single query.
- Avoid training individual models for each item in a large dataset; let BigQuery handle the partitioning.
- Schemas are contracts: They define what valid data looks like.
- Update schemas for valid changes: If data changes intentionally (evolution), update the schema, do not suppress the error.
- Distinguish errors from evolution: Real errors (drift/skew) require fixing the data; evolution requires fixing the schema.
- Vertex AI Workbench instances are Compute Engine VMs that adhere to standard VPC networking rules.
- To secure instances, disable external IP addresses.
- Use Private Google Access to allow private instances to reach Google APIs (like GCS and BigQuery).
- Avoid Cloud NAT if strict 'no public internet' is a requirement, as NAT allows broader outbound access.
- Use Cloud DLP to detect and mask PII in unstructured data.
- Integrate Cloud DLP with Dataflow for real-time streaming transformations.
- Always sanitize sensitive data before writing it to permanent storage to minimize risk.
- Pub/Sub schemas validate structure, not content; they cannot redact text.
- Linear models treat features independently by default.
- Feature Crossing combines two or more features to capture non-linear interactions.
- In BigQuery ML, use
ML.FEATURE_CROSSwithin theTRANSFORMclause to create these interactions. - Feature crosses are especially useful for categorical features in linear algorithms like Logistic Regression.
- Vertex AI Endpoints support deploying multiple models to a single endpoint ID.
- Traffic splitting allows you to route requests by percentage between deployed models without changing client code.
- Canary deployments minimize risk by exposing new models to a small subset of traffic first.
- Blue/Green deployments involve switching traffic fully but allow for quick rollbacks.
- Vertex AI Feature Store preserves the history of feature values using timestamps.
- Training data for historical events requires point-in-time correctness to prevent data leakage.
- Use the batch serving API with a
read_instanceslist containing timestamps to perform time-travel lookups. - Domain Expertise Matters: For specialized fields (medical, legal), standard crowdsourced labeling is insufficient. Use specialized pools.
- Guidance is Key: Always provide comprehensive instruction guides to human labelers to ensure consistency and accuracy.
- Garbage In, Garbage Out: High-quality models start with high-quality labels. Do not compromise on labeling accuracy for cost in critical domains.
- Jupyter Notebooks are JSON files that store both code and output results.
Book TOC · Previous · Chapter 7 of 7
AwesomeGCP.com Learning
The approach taken is a question-led learning approach: you explore realistic project scenarios where you need to make decisions or take actions to achieve business goals within specific constraints. Instead of passive learning, you are challenged to think and work through the options to master the Professional Machine Learning Engineer (PMLE) certification!