Domain 2: ML Model and Foundation Model (FM) Development (Part 2 of 2)
This lesson covers 5 exam topics: Overfitting, Catastrophic Forgetting and Ensembles, FM Customization: Prompts and Fine-Tuning, Experiments, Baselines and Shadow Testing, Explainability and Convergence Debugging, Evaluating ML and GenAI Models. Each topic has a short video, then the notes: key facts, exam traps and what to check in the official docs.
1. Overfitting, Catastrophic Forgetting and Ensembles
Central question: How do you keep models general, keep fine-tuned FMs capable, and combine models well?
Over- and underfitting (general background)
| Problem | Signs | Fixes |
|---|---|---|
| Overfitting | Train ≫ validation score | More/augmented data, regularization (L1/L2), dropout, early stopping, simpler model, fewer features |
| Underfitting | Both scores low | More features, bigger model, train longer, less regularization |
Catastrophic forgetting (general background)
Fine-tuning on narrow data can make a model lose general abilities it had. Mitigate with: - Parameter-efficient fine-tuning (LoRA/adapters) that leaves base weights frozen. - Mixing general data into the fine-tuning set (rehearsal). - Lower learning rates, fewer epochs; evaluate on general benchmarks as well as the target task.
Ensembles (skill 2.2.6; general background)
| Method | How | Goal |
|---|---|---|
| Bagging (e.g. random forest) | Average many models on bootstrapped data | Lower variance |
| Boosting (XGBoost, LightGBM) | Sequential models fix earlier errors | Lower bias |
| Stacking | A meta-model combines model outputs | Best of several |
| Cascades | Cheap model first, expensive model for hard cases | Lower cost |
Exam traps
- Training longer to fix overfitting.
- Full fine-tuning on a tiny dataset without checking general skills.
- Ensembles when latency budget is tight, without measuring.
2. FM Customization: Prompts and Fine-Tuning
Central question: Prompt engineering, RAG, or fine-tuning — and which fine-tuning strategy?
Customization ladder (design guidance; Bedrock facts verified)
- Task-specific prompt engineering: instructions, examples (few-shot), output schema. Cheapest.
- RAG: current or private facts without training.
- Fine-tuning when behaviour, format or style must change consistently.
Fine-tuning strategies (skill 2.1.2)
| Strategy | Data | Where |
|---|---|---|
| Supervised fine-tuning | Labelled prompt–response pairs | Bedrock; SageMaker AI |
| Reinforcement fine-tuning | Prompts + reward functions (e.g. in Lambda) | Bedrock |
| Distillation | Prompts; teacher responses train a smaller student | Bedrock |
| Continued pre-training | Unlabelled domain text | SageMaker AI (and older Bedrock docs) |
| Parameter-efficient (LoRA) | Labelled pairs; trains small adapters | SageMaker JumpStart (lora_r, lora_alpha) |
Bedrock training is billed by training tokens × epochs, plus storage; serve with provisioned throughput or on-demand custom model deployment (verified).
Exam traps
- Fine-tuning to inject changing facts. Use RAG.
- Full fine-tuning when LoRA would do.
- Skipping prompt engineering before paying for training.
3. Experiments, Baselines and Shadow Testing
Central question: Can you reproduce results, spot drift, and test a new model safely on live traffic?
Reproducible experiments
- Managed MLflow on SageMaker AI: track experiments, compare runs' parameters and metrics, MLflow Model Registry (register to SageMaker and deploy), and tracing of GenAI application steps.
- Bedrock evaluations for repeatable FM comparisons; Bedrock Prompt Management for versioned prompts.
- Version data, code, config and random seeds (design guidance).
Baselines and drift detection (skill 2.3.2)
- Record a baseline: training data statistics and model metrics at launch.
- Compare production data and predictions to the baseline (statistical distance tests; Clarify for bias drift).
- SageMaker Model Monitor offered data quality, model quality, bias drift and feature attribution drift monitoring — closed to new customers (verified). New designs build drift pipelines with Processing jobs, Clarify and CloudWatch (design guidance).
Shadow testing (skill 2.3.3; verified)
- SageMaker AI deploys a shadow variant and routes a copy of live requests to it; responses aren't returned to users.
- Compare latency, errors and outputs with the production variant before promoting a new model, container or instance type.
Exam traps
- Promoting a model on offline metrics only when shadow testing could validate it on live traffic.
- No baseline, so drift can't be measured.
- Recommending Model Monitor to a new customer without noting its status.
4. Explainability and Convergence Debugging
Central question: Why did the model predict this, and why won't training converge?
Explaining outputs
- SageMaker Clarify feature attributions with Shapley values explain individual predictions and global feature importance; reports for reviewers.
- For FMs: ask for citations (RAG), use agent/flow traces, and evaluate with LLM-as-a-judge explanations (design guidance).
Convergence problems (general background)
| Symptom | Likely cause | Fix |
|---|---|---|
| Loss explodes / NaN | Learning rate too high, bad data, no normalization | Lower LR, gradient clipping, normalize, check data |
| Loss flat | LR too low, vanishing gradients, dead units | Raise LR, better init/activations, batch norm |
| Loss oscillates | LR too high, batch too small | Lower LR, larger batch, LR schedule |
| Train good, validation bad | Overfitting | Regularize, early stopping |
Tools
- SageMaker Debugger monitored tensors in real time and detected non-converging training — no longer open to new customers.
- Alternatives: framework logging to CloudWatch, MLflow metrics and charts, profiling, TensorBoard (design guidance).
Exam traps
- Raising the learning rate when loss already explodes.
- Recommending Debugger to a new customer without noting its status.
- Model Cards to explain a single prediction. Use Clarify.
5. Evaluating ML and GenAI Models
Central question: Which evaluation method and metric fit the model type?
Traditional ML (general background)
Classification: accuracy, precision, recall, F1, ROC-AUC, PR-AUC, confusion matrix. Regression: MAE, RMSE, R². Use held-out test sets and cross-validation.
GenAI (verified where linked)
| Method | Use |
|---|---|
| Bedrock automatic evaluations | Accuracy, robustness, toxicity on built-in or your datasets |
| LLM-as-a-judge (Bedrock judge model) | Open-ended quality with explanations; custom metrics |
| Human evaluation (Bedrock human jobs; human-in-the-loop workflows) | Nuance, tone, high stakes |
| NLP metrics | BLEU (translation, n-gram precision), ROUGE (summaries, overlap), BERTScore and semantic similarity (meaning) |
| Bias detection | Paired prompts varying one attribute; Clarify for ML models |
RAG monitoring (skill 2.3.10)
- Bedrock RAG evaluations: retrieval relevance and response quality against ground truth.
- Track retrieval accuracy (context contains the answer), relevance scores and latency over time.
Exam traps
- BLEU for summaries. ROUGE fits summaries; BLEU fits translation.
- Accuracy alone on imbalanced data.
- Evaluating only generation in a RAG system.
References
- MLA-C02 Domain 2 — checked Oct 19, 2026
- Early stopping — checked Oct 19, 2026
- Bedrock customization — checked Oct 19, 2026
- JumpStart fine-tuning — checked Oct 19, 2026
- Managed MLflow — checked Oct 19, 2026
- Shadow tests — checked Oct 19, 2026
- Model Monitor — checked Oct 19, 2026
- SageMaker Clarify — checked Oct 19, 2026
- SageMaker Debugger — checked Oct 19, 2026
- Bedrock evaluations — checked Oct 19, 2026
- Evaluation metrics — checked Oct 19, 2026
- LLM as a judge — checked Oct 19, 2026
Check your understanding
Train 99%, validation 72%?Show answerHide answer
Answer
Overfitting: regularize, more data, early stopping.Responses must always follow a strict house style?Show answerHide answer
Answer
Supervised fine-tuning (after trying prompts).Test a new model on real traffic with zero user impact?Show answerHide answer
Answer
Shadow test.Loss becomes NaN after a few steps?Show answerHide answer
Answer
Lower the learning rate; check data and normalization.Compare summaries with references?Show answerHide answer
Answer
ROUGE (or BERTScore for meaning).