Domain 4: Serving and Scaling Models (Part 2 of 2)
This lesson covers 4 exam topics: Inference Pre- and Postprocessing, Serving Features and Endpoints, Serving Hardware and Autoscaling, Optimizing Models for Production. Each topic has a short video, then the notes: key facts, exam traps and what to check in the official docs.
1. Inference Pre- and Postprocessing
Central question: Where should inference preprocessing and postprocessing run?
Facts (general practice, Google Cloud products verified)
- Preprocessing must match training exactly; package it with the model (BigQuery ML TRANSFORM, the same code in a CPR container, or a shared feature pipeline / Feature Store).
- Postprocessing turns raw outputs into business answers: thresholds, label mapping, calibration, formatting.
- Options: custom inference routines, a custom container, or a service in front of the endpoint (Cloud Run).
Exam traps
- Re-implementing preprocessing in the client app. Causes skew.
- Fixed 0.5 threshold for an imbalanced problem. Tune thresholds to business cost.
2. Serving Features and Endpoints
Central question: How do you serve features and choose endpoint networking?
Facts
| Endpoint type | Use |
|---|---|
| Dedicated public endpoint (recommended) | Public internet; production isolation, larger payloads, longer timeouts |
| Shared public endpoint | Public internet, shared; tuned Gemini models deploy here |
| Dedicated private endpoint with Private Service Connect (recommended) | Private, low-latency enterprise traffic |
| Private endpoint (VPC Network Peering) | Private access through private services access |
- Online models read the latest feature values from Feature Store feature views at low latency, so serving uses the same definitions as training.
- Endpoint types and recommendations are from Choose an endpoint type (checked 2026-10-26).
Exam traps
- Public endpoint when traffic must stay private. Private Service Connect.
- Features computed differently in the app. Serve from Feature Store.
3. Serving Hardware and Autoscaling
Central question: What hardware serves the model, and how does it scale?
Facts
- Serving hardware: CPU for small or classical models, GPU or TPU for large deep models and LLMs, edge devices for offline use.
- Autoscaling uses minReplicaCount and maxReplicaCount; by default replicas scale so CPU (or GPU, whichever is higher) usage matches a 60% target; Scale To Zero allows minReplicaCount 0 (autoscaling docs).
- Quota is counted per CPU and GPU of each replica's machine type.
- Agent Platform Inference also supports containerized serving stacks (for example vLLM or Triton) and Spot VMs or reservations for serving.
Exam traps
- minReplicaCount 0 for a latency-critical API. Cold starts; keep warm replicas.
- Scaling on CPU when the GPU is the bottleneck. Agent Platform scales on whichever is higher.
4. Optimizing Models for Production
Central question: How do you make models cheaper and faster in production?
Facts (general practice)
- Serving optimizations: quantization (lower precision such as int8), distillation (train a smaller student model), pruning, batching requests, caching frequent results, choosing the right accelerator.
- For gen AI: smaller model tiers, tuning to shorten prompts, context caching, batch inference for offline work.
- Training optimizations: mixed precision, efficient input pipelines, early stopping, checkpointing to resume on Spot VMs.
Exam traps
- Bigger hardware first. Optimize the model and batching before scaling hardware.
- Distillation without re-evaluating quality.
References
- PMLE exam guide — checked Oct 26, 2026
- Custom inference routines — checked Oct 26, 2026
- Choose an endpoint type — checked Oct 26, 2026
- Feature Store overview — checked Oct 26, 2026
- Autoscaling — checked Oct 26, 2026
Check your understanding
Ship preprocessing with the model?Show answerHide answer
Answer
CPR / TRANSFORM / Feature Store.Private, recommended endpoint?Show answerHide answer
Answer
Dedicated private endpoint with PSC.Default autoscaling target?Show answerHide answer
Answer
60% utilization.Smaller model mimicking a large one?Show answerHide answer
Answer
Distillation.Map scores to approve or review?Show answerHide answer
Answer
Postprocessing with thresholds.