Domain 3: Scaling Prototypes into ML Models (Part 2 of 2)
This lesson covers 4 exam topics: Hyperparameter Tuning, Fine-Tuning Foundation Models, Choosing Training Hardware, Distributed Training. Each topic has a short video, then the notes: key facts, exam traps and what to check in the official docs.
1. Hyperparameter Tuning
Central question: How does hyperparameter tuning work on Agent Platform?
Facts
- Tuning runs many trials of your training code with different hyperparameter values and returns the best configuration for the metric you maximize or minimize (hyperparameter tuning overview).
- Default algorithm: Bayesian optimization (Gaussian process bandits and related methods); alternatives are GRID_SEARCH and RANDOM_SEARCH.
- Report the metric from your code (the hypertune helper library); metrics must be numeric. Conditional parameters apply only when a parent value matches.
- Running trials in parallel finishes sooner but gives Bayesian optimization less information per step; cost depends on trial duration.
- Vizier is the black-box optimization service behind tuning, also usable directly.
Exam traps
- Grid search over many continuous parameters. Explodes in cost; use the default Bayesian search.
- Maximum parallel trials always best. It reduces what each trial learns from earlier ones.
2. Fine-Tuning Foundation Models
Central question: When and how should you fine-tune a foundation model?
Facts
| Method | Data | Use |
|---|---|---|
| Supervised fine-tuning (SFT) | Hundreds of labeled prompt-response examples | Teach a task, style or format |
| Preference tuning | Pairs of preferred and dispreferred responses | Align output with human preferences |
| Reinforcement fine-tuning (preview) | Prompts plus a reward function | Optimize for a measurable reward |
| Open-model tuning | Varies | Tune Model Garden open models such as Gemma |
- Google recommends starting with prompting, then fine-tuning if needed; tuning fits when you have labeled data (about 100+ examples) and complex or unique tasks; quality beats quantity; data should match production prompts (introduction to tuning).
- Parameter-efficient (adapter) tuning updates a small subset of parameters: cheaper and faster; full fine-tuning updates all parameters, with higher compute for tuning and serving.
- Tuning benefits: higher task quality, more consistent results, and lower inference cost and latency because shorter prompts replace long instructions and few-shot examples.
- Tuned Gemini models deploy to shared public endpoints only (endpoint types).
Exam traps
- Tuning for frequently changing facts. Use RAG.
- Full fine-tuning by default. Parameter-efficient tuning is cheaper.
- Tuning before trying prompts.
3. Choosing Training Hardware
Central question: CPU, GPU or TPU for training?
Facts (Cloud TPU docs verified; selection rules are general guidance)
| Accelerator | Fits |
|---|---|
| CPU | Small models, classical ML (linear, trees), data-bound or logic-heavy work |
| GPU | Most deep learning; broad framework and custom-op support; mixed workloads |
| TPU | Large models dominated by matrix multiplication, large batch training; code compiled with XLA (JAX, TensorFlow, PyTorch/XLA) |
- TPUs are Google's custom ASICs for the large matrix operations in ML; TPUs connect into slices; code is compiled by XLA (Cloud TPU introduction).
- TPUs may not fit models with ops unavailable on TPU or heavy custom operations; GPUs are more flexible.
- Lower cost options: Spot VMs for fault-tolerant jobs, Dynamic Workload Scheduler (flex-start) for flexible start times, reservations for guaranteed capacity.
Exam traps
- TPU for scikit-learn trees. CPU.
- TPU for a model full of custom CUDA ops. GPU.
4. Distributed Training
Central question: How do data and model parallelism scale training?
Facts
- Data parallelism: every replica holds the full model and processes a different slice of each batch; gradients are combined (all-reduce). Use when the model fits on one device.
- Model parallelism: the model is split across devices (tensor or pipeline parallelism). Use when the model is too large for one device.
- Agent Platform distributed jobs use worker pools: the first pool is the primary replica (chief), then workers, optional parameter servers and an evaluator (distributed training).
- Reduction Server speeds up all-reduce for multi-node GPU data-parallel training.
Exam traps
- Model parallelism for a small model with lots of data. Data parallelism.
- Data parallelism for a model that doesn't fit in device memory. Model parallelism.
References
- PMLE exam guide — checked Oct 26, 2026
- Hyperparameter tuning overview — checked Oct 26, 2026
- Vizier overview — checked Oct 26, 2026
- Introduction to tuning — checked Oct 26, 2026
- Preference tuning — checked Oct 26, 2026
- Reinforcement fine-tuning — checked Oct 26, 2026
- Introduction to Cloud TPU — checked Oct 26, 2026
- Distributed training — checked Oct 26, 2026
Check your understanding
Default search algorithm?Show answerHide answer
Answer
Bayesian optimization.Pairs of better and worse answers?Show answerHide answer
Answer
Preference tuning.Huge transformer, JAX?Show answerHide answer
Answer
TPU.Model too big for one GPU?Show answerHide answer
Answer
Model parallelism.Goal setting?Show answerHide answer
Answer
Maximize or minimize a numeric metric.