Domain 2: ML Model and Foundation Model (FM) Development (Part 1 of 2)
This lesson covers 5 exam topics: Choosing Models: ML, FMs and AWS AI Services, Performance, Latency and Cost Tradeoffs, RAG Patterns and Retrieval Optimization, SageMaker Built-in Algorithms and Script Mode, Hyperparameter Tuning and Faster Training. Each topic has a short video, then the notes: key facts, exam traps and what to check in the official docs.
1. Choosing Models: ML, FMs and AWS AI Services
Central question: Managed AI service, foundation model, pre-trained model or custom model?
The options (verified where linked; ordering is design guidance)
| Option | Example | Effort | Use when |
|---|---|---|---|
| AWS AI service | Textract (documents), Rekognition (images), Comprehend (NLP), Transcribe (speech) | Lowest | The task matches the service |
| Foundation model on Bedrock | Summaries, extraction, chat, agents | Low | Language/multimodal tasks; little labelled data |
| Pre-trained model | SageMaker JumpStart open models | Medium | Need hosting control or open weights |
| Custom model | XGBoost churn model in SageMaker AI | Highest | Narrow prediction on your structured data; interpretability |
Selecting an FM on Bedrock (skill 2.1.1)
Shortlist by modality, context length, languages, latency and price; evaluate candidates on your own data with Bedrock evaluations; pick the smallest model that meets the bar.
Selecting ML models (skill 2.1.3)
Weigh interpretability (linear models, trees vs deep nets), domain-specific performance, latency and data size. SageMaker solution templates (JumpStart) speed common use cases.
Exam traps
- Training a custom OCR model when Textract fits.
- An FM for a regulated tabular decision that needs feature-level reasons.
- Choosing an FM on benchmarks alone.
2. Performance, Latency and Cost Tradeoffs
Central question: How much accuracy is worth how much training time, latency and money?
Traditional ML (skill 2.1.6; general background plus verified items)
| Lever | Trade |
|---|---|
| Bigger model / more features | Accuracy up; training time, cost, latency up |
| More data, more epochs | Accuracy up (to a point); cost up |
| Managed Spot Training | Up to 90% lower training cost; jobs can be interrupted (use checkpoints) (verified) |
| Early stopping | Less time and cost; less overfitting |
| Distributed training | Faster wall-clock; more instances |
AI / FMs (skill 2.1.7)
| Lever | Trade |
|---|---|
| Larger FM | Quality up; latency and token cost up |
| Smaller or distilled model | Faster, cheaper; validate quality |
| Longer prompts / more retrieved chunks | Context up; tokens and latency up |
| Batch inference | ~50% cheaper; not interactive (verified, Bedrock pricing) |
| Provisioned throughput | Guaranteed capacity; paid hourly |
Decide with numbers: plot quality against cost and latency for each candidate and pick the point that meets the requirement (design guidance).
Exam traps
- Maximum accuracy at any cost when the requirement is "good enough, cheap and fast".
- Spot without checkpoints for long jobs.
- Ignoring inference cost when choosing a bigger model.
3. RAG Patterns and Retrieval Optimization
Central question: Which RAG architecture fits, and how do you make retrieval better?
RAG patterns (design guidance; Bedrock features verified)
| Pattern | Use when |
|---|---|
| Managed Knowledge Base (retrieve-and-generate) | Standard Q&A over documents; least to build |
| Retrieve-only + your own generation | Custom prompts, multiple models |
| Hybrid search (vectors + keywords) | Exact terms such as product codes |
| Structured-data retrieval (text-to-SQL KB) | Answers live in tables |
| Graph RAG (Neptune Analytics) | Relationships between entities matter |
| Agentic retrieval | Multi-hop questions across sources |
Optimizing retrieval (skill 2.2.9)
- Chunking: tune size and overlap; hierarchical for precision plus context.
- Embedding model: test domain fit and dimensions; same model for queries.
- Reranking with a Bedrock reranker model.
- Metadata filters to narrow the search.
- Query reformulation / decomposition for complex questions.
- Measure with a retrieval test set (relevance, context recall) after each change.
Exam traps
- Changing the generation model to fix poor retrieval.
- Semantic-only search for exact identifiers.
- Tuning without a retrieval test set.
4. SageMaker Built-in Algorithms and Script Mode
Central question: Which built-in algorithm fits the problem, and when do you bring your own training script?
Built-in algorithms (verified names; use cases are general background)
| Problem | Algorithms |
|---|---|
| Tabular classification/regression | XGBoost, LightGBM, CatBoost, Linear Learner, AutoGluon-Tabular, TabTransformer, k-NN, Factorization Machines (sparse data, recommendations) |
| Clustering / dimensionality reduction | K-Means, PCA |
| Anomaly detection | Random Cut Forest (RCF), IP Insights (unusual IP usage) |
| Time series forecasting | DeepAR |
| Text | BlazingText (Word2Vec, text classification), Text Classification - TensorFlow, Sequence-to-Sequence, LDA and Neural Topic Model (topics), Object2Vec (embeddings) |
| Vision | Image Classification, Object Detection, Semantic Segmentation |
Script mode (skill 2.2.2)
Bring your own training script for a supported framework (PyTorch, TensorFlow, scikit-learn, XGBoost, Hugging Face) and run it in an AWS-managed framework container: SageMaker provides the container, you provide the code and dependencies (general background). It's simpler than building your own container and keeps managed features (spot, distributed training, metrics).
Exam traps
- K-Means for labelled classification.
- Linear Learner for a time-series forecast that DeepAR handles.
- Building a custom container when script mode with a framework container works.
5. Hyperparameter Tuning and Faster Training
Central question: How do you find good hyperparameters without burning budget, and train faster?
SageMaker AI automatic model tuning (AMT) strategies
| Strategy | How | Notes |
|---|---|---|
| Grid search | Every combination of categorical values | Only categorical parameters |
| Random search | Random combinations; independent of past jobs | Max parallelism without hurting results |
| Bayesian optimization | Treats tuning as regression; picks next values from past results | Efficient for expensive jobs; less parallel |
| Hyperband | Multi-fidelity; reallocates epochs to promising configs and stops weak ones | Fastest for iterative algorithms that report per epoch |
Early stopping (verified): stop training jobs that aren't improving on the objective metric (TrainingJobEarlyStoppingType = AUTO): saves compute and reduces overfitting.
Training time reduction (skill 2.2.4)
- Distributed training (verified): data parallel (replicas of the model, split batches; global batch = replicas × per-replica batch) or model parallel (split a model too big for one GPU).
- Early stopping, Spot with checkpoints, faster input (fast file mode, FSx for Lustre).
Fundamental hyperparameters (skill 2.2.7; general background)
| Hyperparameter | Effect |
|---|---|
| Epochs | Passes over the data; too many → overfit |
| Batch size | Larger = faster per epoch, more memory, may generalise worse |
| Steps | Updates per run (= samples × epochs ÷ batch) |
| Learning rate | Too high → diverges; too low → slow |
Exam traps
- Grid search over continuous ranges. Grid supports categorical only.
- Hyperband for non-iterative algorithms.
- Data parallelism when the model doesn't fit one GPU. That needs model parallelism.
References
- MLA-C02 Domain 2 — checked Oct 19, 2026
- Bedrock evaluations — checked Oct 19, 2026
- SageMaker JumpStart — checked Oct 19, 2026
- Managed Spot Training — checked Oct 19, 2026
- Bedrock pricing — checked Oct 19, 2026
- Bedrock Knowledge Bases — checked Oct 19, 2026
- Reranking — checked Oct 19, 2026
- KB query configuration — checked Oct 19, 2026
- SageMaker built-in algorithms — checked Oct 19, 2026
- AMT strategies — checked Oct 19, 2026
- Early stopping — checked Oct 19, 2026
- Distributed training — checked Oct 19, 2026
Check your understanding
Extract fields from invoices with no training?Show answerHide answer
Answer
Amazon Textract.Cut training cost up to 90%, tolerate interruptions?Show answerHide answer
Answer
Managed Spot Training with checkpoints.Questions mix product codes and natural language?Show answerHide answer
Answer
Hybrid search.Forecast demand across many related products?Show answerHide answer
Answer
DeepAR.Expensive training, want fewest jobs to a good result?Show answerHide answer
Answer
Bayesian optimization.