@xdev-asia/xdev-knowledge-mcp 1.0.41 → 1.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/content/series/luyen-thi/luyen-thi-aws-ai-practitioner/chapters/01-domain-1-fundamentals-ai-ml/lessons/01-bai-1-ai-ml-deep-learning-concepts.md +287 -0
- package/content/series/luyen-thi/luyen-thi-aws-ai-practitioner/chapters/01-domain-1-fundamentals-ai-ml/lessons/02-bai-2-ml-lifecycle-aws-services.md +258 -0
- package/content/series/luyen-thi/luyen-thi-aws-ai-practitioner/chapters/02-domain-2-fundamentals-generative-ai/lessons/03-bai-3-generative-ai-foundation-models.md +218 -0
- package/content/series/luyen-thi/luyen-thi-aws-ai-practitioner/chapters/02-domain-2-fundamentals-generative-ai/lessons/04-bai-4-llm-transformers-multimodal.md +232 -0
- package/content/series/luyen-thi/luyen-thi-aws-ai-practitioner/chapters/03-domain-3-applications-foundation-models/lessons/05-bai-5-prompt-engineering-techniques.md +254 -0
- package/content/series/luyen-thi/luyen-thi-aws-ai-practitioner/chapters/03-domain-3-applications-foundation-models/lessons/06-bai-6-rag-vector-databases-knowledge-bases.md +244 -0
- package/content/series/luyen-thi/luyen-thi-aws-ai-practitioner/chapters/03-domain-3-applications-foundation-models/lessons/07-bai-7-fine-tuning-model-customization.md +247 -0
- package/content/series/luyen-thi/luyen-thi-aws-ai-practitioner/chapters/03-domain-3-applications-foundation-models/lessons/08-bai-8-amazon-bedrock-deep-dive.md +276 -0
- package/content/series/luyen-thi/luyen-thi-aws-ai-practitioner/chapters/04-domain-4-responsible-ai/lessons/09-bai-9-responsible-ai-fairness-bias-transparency.md +224 -0
- package/content/series/luyen-thi/luyen-thi-aws-ai-practitioner/chapters/04-domain-4-responsible-ai/lessons/10-bai-10-aws-responsible-ai-tools.md +252 -0
- package/content/series/luyen-thi/luyen-thi-aws-ai-practitioner/chapters/05-domain-5-security-compliance/lessons/11-bai-11-ai-security-data-privacy-compliance.md +279 -0
- package/content/series/luyen-thi/luyen-thi-aws-ai-practitioner/chapters/05-domain-5-security-compliance/lessons/12-bai-12-exam-strategy-cheat-sheet.md +229 -0
- package/content/series/luyen-thi/luyen-thi-aws-ai-practitioner/index.md +257 -0
- package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/index.md +240 -0
- package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/index.md +225 -0
- package/data/categories.json +16 -4
- package/data/quizzes.json +764 -0
- package/package.json +1 -1
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: 019c9619-lt01-d3-l07
|
|
3
|
+
title: 'Bài 7: Fine-tuning & Model Customization'
|
|
4
|
+
slug: bai-7-fine-tuning-model-customization
|
|
5
|
+
description: >-
|
|
6
|
+
Pre-training vs Fine-tuning vs RLHF. PEFT & LoRA.
|
|
7
|
+
Continued Pre-training. Amazon Bedrock Custom Models.
|
|
8
|
+
Training data preparation, evaluation, deployment.
|
|
9
|
+
duration_minutes: 50
|
|
10
|
+
is_free: true
|
|
11
|
+
video_url: null
|
|
12
|
+
sort_order: 3
|
|
13
|
+
section_title: "Domain 3: Applications of Foundation Models (28%)"
|
|
14
|
+
course:
|
|
15
|
+
id: 019c9619-lt01-7001-c001-lt0100000001
|
|
16
|
+
title: 'Luyện thi AWS Certified AI Practitioner (AIF-C01)'
|
|
17
|
+
slug: luyen-thi-aws-ai-practitioner
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
<div style="text-align: center; margin: 2rem 0;">
|
|
21
|
+
<img src="/storage/uploads/2026/04/aws-aif-bai7-finetuning-spectrum.png" alt="Model Customization Spectrum" style="max-width: 800px; width: 100%; border-radius: 12px;" />
|
|
22
|
+
<p><em>Model Customization Spectrum: từ Prompt Engineering đến Pre-training từ đầu</em></p>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<h2 id="customization-spectrum"><strong>1. Model Customization Spectrum</strong></h2>
|
|
26
|
+
|
|
27
|
+
<p>Có nhiều cách để customize FM behavior, từ đơn giản đến phức tạp:</p>
|
|
28
|
+
|
|
29
|
+
<pre><code class="language-text">Least Effort Most Effort
|
|
30
|
+
──────────────────────────────────────────────────────────
|
|
31
|
+
Prompt Few-shot RAG Fine- Continued Pre-
|
|
32
|
+
Engineering Prompting tuning Pre-training training
|
|
33
|
+
──────────────────────────────────────────────────────────
|
|
34
|
+
No training ← → Full training
|
|
35
|
+
$ cheapest ← → $$$$ most expensive
|
|
36
|
+
Minutes ← → Weeks/Months
|
|
37
|
+
</code></pre>
|
|
38
|
+
|
|
39
|
+
<h2 id="fine-tuning"><strong>2. Fine-tuning</strong></h2>
|
|
40
|
+
|
|
41
|
+
<p><strong>Fine-tuning</strong> = further training an existing FM on <strong>your specific dataset</strong> to improve performance on your domain/task.</p>
|
|
42
|
+
|
|
43
|
+
<h3 id="when-fine-tune"><strong>2.1. When to Fine-tune?</strong></h3>
|
|
44
|
+
|
|
45
|
+
<table>
|
|
46
|
+
<thead><tr><th>Fine-tune When...</th><th>DON'T Fine-tune When...</th></tr></thead>
|
|
47
|
+
<tbody>
|
|
48
|
+
<tr><td>Need specific style, tone, or format</td><td>Just need factual Q&A (use RAG)</td></tr>
|
|
49
|
+
<tr><td>Domain-specific language patterns</td><td>Task works well with prompting</td></tr>
|
|
50
|
+
<tr><td>Improve accuracy on specific tasks</td><td>Don't have labeled training data</td></tr>
|
|
51
|
+
<tr><td>Reduce prompt size (internalize instructions)</td><td>Data changes frequently (use RAG)</td></tr>
|
|
52
|
+
<tr><td>Need consistent output format</td><td>Budget is limited</td></tr>
|
|
53
|
+
</tbody>
|
|
54
|
+
</table>
|
|
55
|
+
|
|
56
|
+
<h3 id="fine-tune-types"><strong>2.2. Types of Fine-tuning</strong></h3>
|
|
57
|
+
|
|
58
|
+
<table>
|
|
59
|
+
<thead><tr><th>Type</th><th>What</th><th>Data Format</th><th>Use Case</th></tr></thead>
|
|
60
|
+
<tbody>
|
|
61
|
+
<tr><td><strong>Instruction fine-tuning</strong></td><td>Train on prompt-response pairs</td><td>{"prompt": "...", "completion": "..."}</td><td>Follow instructions better</td></tr>
|
|
62
|
+
<tr><td><strong>Domain adaptation</strong></td><td>Train on domain text</td><td>Domain documents (medical, legal)</td><td>Learn domain terminology</td></tr>
|
|
63
|
+
<tr><td><strong>Task-specific</strong></td><td>Train on specific task examples</td><td>Task input-output pairs</td><td>Classification, extraction</td></tr>
|
|
64
|
+
</tbody>
|
|
65
|
+
</table>
|
|
66
|
+
|
|
67
|
+
<h2 id="peft"><strong>3. PEFT & LoRA</strong></h2>
|
|
68
|
+
|
|
69
|
+
<h3 id="peft-overview"><strong>3.1. Parameter-Efficient Fine-Tuning (PEFT)</strong></h3>
|
|
70
|
+
|
|
71
|
+
<p>Full fine-tuning updates <strong>ALL model parameters</strong> — expensive and needs lots of GPU memory. PEFT methods update only a <strong>small subset of parameters</strong>.</p>
|
|
72
|
+
|
|
73
|
+
<pre><code class="language-text">Full Fine-tuning:
|
|
74
|
+
Model: 7 billion parameters
|
|
75
|
+
Updated: 7 billion parameters (100%)
|
|
76
|
+
GPU Memory: Very high
|
|
77
|
+
Cost: $$$$
|
|
78
|
+
|
|
79
|
+
PEFT (LoRA):
|
|
80
|
+
Model: 7 billion parameters
|
|
81
|
+
Updated: ~10 million parameters (0.1%)
|
|
82
|
+
GPU Memory: Much lower
|
|
83
|
+
Cost: $$
|
|
84
|
+
</code></pre>
|
|
85
|
+
|
|
86
|
+
<h3 id="lora"><strong>3.2. LoRA (Low-Rank Adaptation)</strong></h3>
|
|
87
|
+
|
|
88
|
+
<p>LoRA thêm <strong>small trainable matrices</strong> vào model layers thay vì update toàn bộ weights:</p>
|
|
89
|
+
|
|
90
|
+
<ul>
|
|
91
|
+
<li>Freezes original model weights</li>
|
|
92
|
+
<li>Adds small "adapter" matrices (rank decomposition)</li>
|
|
93
|
+
<li>Only trains these small adapters</li>
|
|
94
|
+
<li>At inference: merge adapters with original weights</li>
|
|
95
|
+
</ul>
|
|
96
|
+
|
|
97
|
+
<blockquote>
|
|
98
|
+
<p><strong>Exam tip:</strong> "Which technique reduces the cost of fine-tuning while maintaining quality?" → <strong>LoRA / PEFT</strong>. Key concept: train a small percentage of parameters instead of all.</p>
|
|
99
|
+
</blockquote>
|
|
100
|
+
|
|
101
|
+
<h2 id="continued-pretraining"><strong>4. Continued Pre-training</strong></h2>
|
|
102
|
+
|
|
103
|
+
<p><strong>Continued Pre-training</strong> trains the FM on <strong>large amounts of unlabeled domain data</strong> — teaching the model new vocabulary and concepts <em>before</em> fine-tuning on task-specific data.</p>
|
|
104
|
+
|
|
105
|
+
<pre><code class="language-text">Workflow:
|
|
106
|
+
Base FM → Continued Pre-training → Fine-tuning → Evaluation
|
|
107
|
+
(domain corpus, (labeled (test on
|
|
108
|
+
unlabeled) task data) holdout)
|
|
109
|
+
|
|
110
|
+
Example:
|
|
111
|
+
Base Claude → Train on 100K medical papers → Fine-tune on
|
|
112
|
+
(continued pre-training) medical Q&A pairs
|
|
113
|
+
Learns: medical terminology, Learns: how to
|
|
114
|
+
drug names, procedures answer clinical questions
|
|
115
|
+
</code></pre>
|
|
116
|
+
|
|
117
|
+
<h3 id="cpt-vs-ft"><strong>Continued Pre-training vs Fine-tuning:</strong></h3>
|
|
118
|
+
|
|
119
|
+
<table>
|
|
120
|
+
<thead><tr><th>Aspect</th><th>Continued Pre-training</th><th>Fine-tuning</th></tr></thead>
|
|
121
|
+
<tbody>
|
|
122
|
+
<tr><td><strong>Data</strong></td><td>Large, unlabeled domain text</td><td>Smaller, labeled task data</td></tr>
|
|
123
|
+
<tr><td><strong>Goal</strong></td><td>Learn domain knowledge</td><td>Learn task-specific behavior</td></tr>
|
|
124
|
+
<tr><td><strong>Cost</strong></td><td>More expensive (larger data)</td><td>Less expensive</td></tr>
|
|
125
|
+
<tr><td><strong>When</strong></td><td>Model lacks domain vocabulary</td><td>Model needs to do specific tasks</td></tr>
|
|
126
|
+
</tbody>
|
|
127
|
+
</table>
|
|
128
|
+
|
|
129
|
+
<h2 id="rlhf"><strong>5. RLHF (Reinforcement Learning from Human Feedback)</strong></h2>
|
|
130
|
+
|
|
131
|
+
<p>RLHF is used to <strong>align</strong> model outputs with human preferences — making outputs more helpful, truthful, and harmless.</p>
|
|
132
|
+
|
|
133
|
+
<pre><code class="language-text">RLHF Pipeline:
|
|
134
|
+
1. Collect human feedback 2. Train reward model 3. Optimize with RL
|
|
135
|
+
"Which response is Learns: what humans FM generates →
|
|
136
|
+
better? A or B?" prefer reward model scores →
|
|
137
|
+
update FM weights
|
|
138
|
+
</code></pre>
|
|
139
|
+
|
|
140
|
+
<p>RLHF is mainly done by <strong>FM providers</strong> (Anthropic, Meta, Amazon) — not typically by end users. But you should know the concept for the exam.</p>
|
|
141
|
+
|
|
142
|
+
<h2 id="bedrock-custom"><strong>6. Amazon Bedrock Custom Models</strong></h2>
|
|
143
|
+
|
|
144
|
+
<p>Bedrock offers two customization approaches:</p>
|
|
145
|
+
|
|
146
|
+
<h3 id="bedrock-ft"><strong>6.1. Fine-tuning in Bedrock</strong></h3>
|
|
147
|
+
|
|
148
|
+
<table>
|
|
149
|
+
<thead><tr><th>Feature</th><th>Detail</th></tr></thead>
|
|
150
|
+
<tbody>
|
|
151
|
+
<tr><td><strong>Supported models</strong></td><td>Amazon Titan, Meta Llama, Cohere</td></tr>
|
|
152
|
+
<tr><td><strong>Data format</strong></td><td>JSONL with prompt-completion pairs</td></tr>
|
|
153
|
+
<tr><td><strong>Data location</strong></td><td>Amazon S3</td></tr>
|
|
154
|
+
<tr><td><strong>Output</strong></td><td>Custom model version in Bedrock</td></tr>
|
|
155
|
+
<tr><td><strong>Provisioned Throughput</strong></td><td>Required to use fine-tuned model</td></tr>
|
|
156
|
+
</tbody>
|
|
157
|
+
</table>
|
|
158
|
+
|
|
159
|
+
<h3 id="bedrock-cpt"><strong>6.2. Continued Pre-training in Bedrock</strong></h3>
|
|
160
|
+
|
|
161
|
+
<table>
|
|
162
|
+
<thead><tr><th>Feature</th><th>Detail</th></tr></thead>
|
|
163
|
+
<tbody>
|
|
164
|
+
<tr><td><strong>Supported models</strong></td><td>Amazon Titan, Meta Llama, Cohere</td></tr>
|
|
165
|
+
<tr><td><strong>Data format</strong></td><td>Plain text files (unlabeled)</td></tr>
|
|
166
|
+
<tr><td><strong>Use case</strong></td><td>Domain adaptation before fine-tuning</td></tr>
|
|
167
|
+
</tbody>
|
|
168
|
+
</table>
|
|
169
|
+
|
|
170
|
+
<h3 id="bedrock-training-data"><strong>6.3. Training Data Preparation</strong></h3>
|
|
171
|
+
|
|
172
|
+
<pre><code class="language-json">// Fine-tuning data format (JSONL):
|
|
173
|
+
{"prompt": "What is the recommended dosage of Drug X?", "completion": "The recommended dosage of Drug X is 500mg twice daily for adults."}
|
|
174
|
+
{"prompt": "List side effects of Drug X.", "completion": "Common side effects include headache, nausea, and dizziness."}
|
|
175
|
+
</code></pre>
|
|
176
|
+
|
|
177
|
+
<h3 id="bedrock-model-eval"><strong>6.4. Model Evaluation in Bedrock</strong></h3>
|
|
178
|
+
|
|
179
|
+
<p>Amazon Bedrock Model Evaluation cho phép so sánh models:</p>
|
|
180
|
+
|
|
181
|
+
<ul>
|
|
182
|
+
<li><strong>Automatic evaluation</strong>: Built-in metrics (accuracy, robustness, toxicity)</li>
|
|
183
|
+
<li><strong>Human evaluation</strong>: Human reviewers rate model outputs</li>
|
|
184
|
+
<li><strong>Compare models</strong>: Side-by-side comparison of different FMs</li>
|
|
185
|
+
</ul>
|
|
186
|
+
|
|
187
|
+
<blockquote>
|
|
188
|
+
<p><strong>Exam tip:</strong> "How to compare the quality of two foundation models for a specific use case?" → <strong>Amazon Bedrock Model Evaluation</strong>. Supports both automatic metrics and human evaluation.</p>
|
|
189
|
+
</blockquote>
|
|
190
|
+
|
|
191
|
+
<h2 id="data-prep"><strong>7. Training Data Best Practices</strong></h2>
|
|
192
|
+
|
|
193
|
+
<table>
|
|
194
|
+
<thead><tr><th>Practice</th><th>Why</th></tr></thead>
|
|
195
|
+
<tbody>
|
|
196
|
+
<tr><td><strong>High-quality data</strong></td><td>Garbage in = garbage out</td></tr>
|
|
197
|
+
<tr><td><strong>Diverse examples</strong></td><td>Prevent overfitting to narrow patterns</td></tr>
|
|
198
|
+
<tr><td><strong>Balanced classes</strong></td><td>Avoid bias toward majority class</td></tr>
|
|
199
|
+
<tr><td><strong>Clean data</strong></td><td>Remove duplicates, errors, PII</td></tr>
|
|
200
|
+
<tr><td><strong>Sufficient quantity</strong></td><td>Typically 1000+ for fine-tuning</td></tr>
|
|
201
|
+
<tr><td><strong>Train/validation split</strong></td><td>Evaluate on unseen data</td></tr>
|
|
202
|
+
<tr><td><strong>Format consistency</strong></td><td>Same structure for all examples</td></tr>
|
|
203
|
+
</tbody>
|
|
204
|
+
</table>
|
|
205
|
+
|
|
206
|
+
<h2 id="summary-table"><strong>8. Summary: When to Use What</strong></h2>
|
|
207
|
+
|
|
208
|
+
<table>
|
|
209
|
+
<thead><tr><th>Scenario</th><th>Best Approach</th></tr></thead>
|
|
210
|
+
<tbody>
|
|
211
|
+
<tr><td>Simple task, model already good at it</td><td>Prompt Engineering</td></tr>
|
|
212
|
+
<tr><td>Need model to follow a specific pattern</td><td>Few-shot Prompting</td></tr>
|
|
213
|
+
<tr><td>Need answers from company documents</td><td>RAG</td></tr>
|
|
214
|
+
<tr><td>Need specific style/tone/format</td><td>Fine-tuning</td></tr>
|
|
215
|
+
<tr><td>Model doesn't know domain vocabulary</td><td>Continued Pre-training + Fine-tuning</td></tr>
|
|
216
|
+
<tr><td>Align with human preferences</td><td>RLHF (done by FM providers)</td></tr>
|
|
217
|
+
</tbody>
|
|
218
|
+
</table>
|
|
219
|
+
|
|
220
|
+
<h2 id="practice-questions"><strong>9. Practice Questions</strong></h2>
|
|
221
|
+
|
|
222
|
+
<p><strong>Q1:</strong> A legal firm wants their AI assistant to generate legal documents in a specific firm-approved writing style. They have 5,000 examples of approved documents. Which customization approach is MOST appropriate?</p>
|
|
223
|
+
<ul>
|
|
224
|
+
<li>A) RAG with a knowledge base</li>
|
|
225
|
+
<li>B) Zero-shot prompting</li>
|
|
226
|
+
<li>C) Fine-tuning on the approved document examples ✓</li>
|
|
227
|
+
<li>D) Continued pre-training on legal textbooks</li>
|
|
228
|
+
</ul>
|
|
229
|
+
<p><em>Explanation: Fine-tuning is ideal for teaching a model a specific writing style with labeled examples. RAG is for retrieving information, not learning styles. Continued pre-training would teach legal concepts but not the firm's specific style.</em></p>
|
|
230
|
+
|
|
231
|
+
<p><strong>Q2:</strong> Which technique allows fine-tuning a large language model while updating only a small fraction of the model's parameters?</p>
|
|
232
|
+
<ul>
|
|
233
|
+
<li>A) Full fine-tuning</li>
|
|
234
|
+
<li>B) LoRA (Low-Rank Adaptation) ✓</li>
|
|
235
|
+
<li>C) Continued pre-training</li>
|
|
236
|
+
<li>D) RLHF</li>
|
|
237
|
+
</ul>
|
|
238
|
+
<p><em>Explanation: LoRA is a PEFT (Parameter-Efficient Fine-Tuning) method that adds small trainable adapter matrices while freezing the original model weights — typically updating less than 1% of total parameters.</em></p>
|
|
239
|
+
|
|
240
|
+
<p><strong>Q3:</strong> A company fine-tuned a foundation model, but the model performs well on training data and poorly on new data. What is this problem called?</p>
|
|
241
|
+
<ul>
|
|
242
|
+
<li>A) Underfitting</li>
|
|
243
|
+
<li>B) Overfitting ✓</li>
|
|
244
|
+
<li>C) High bias</li>
|
|
245
|
+
<li>D) Data drift</li>
|
|
246
|
+
</ul>
|
|
247
|
+
<p><em>Explanation: Overfitting occurs when a model memorizes training data instead of learning general patterns. Solutions include: more training data, regularization, lower learning rate, early stopping, or data augmentation.</em></p>
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: 019c9619-lt01-d3-l08
|
|
3
|
+
title: 'Bài 8: Amazon Bedrock Deep Dive'
|
|
4
|
+
slug: bai-8-amazon-bedrock-deep-dive
|
|
5
|
+
description: >-
|
|
6
|
+
Amazon Bedrock: all features. Agents, Guardrails, Model Evaluation.
|
|
7
|
+
PartyRock playground. Amazon Q Developer & Amazon Q Business.
|
|
8
|
+
Choosing the right FM. Pricing models.
|
|
9
|
+
duration_minutes: 65
|
|
10
|
+
is_free: true
|
|
11
|
+
video_url: null
|
|
12
|
+
sort_order: 4
|
|
13
|
+
section_title: "Domain 3: Applications of Foundation Models (28%)"
|
|
14
|
+
course:
|
|
15
|
+
id: 019c9619-lt01-7001-c001-lt0100000001
|
|
16
|
+
title: 'Luyện thi AWS Certified AI Practitioner (AIF-C01)'
|
|
17
|
+
slug: luyen-thi-aws-ai-practitioner
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
<div style="text-align: center; margin: 2rem 0;">
|
|
21
|
+
<img src="/storage/uploads/2026/04/aws-aif-bai8-bedrock-architecture.png" alt="Amazon Bedrock Architecture" style="max-width: 800px; width: 100%; border-radius: 12px;" />
|
|
22
|
+
<p><em>Amazon Bedrock Architecture — Foundation Models, Agents, Guardrails và Knowledge Bases</em></p>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<h2 id="bedrock-overview"><strong>1. Amazon Bedrock Overview</strong></h2>
|
|
26
|
+
|
|
27
|
+
<p><strong>Amazon Bedrock</strong> là fully managed service cung cấp access đến <strong>FMs từ nhiều providers</strong> qua single API, kèm theo tools để customize, deploy, và secure AI applications.</p>
|
|
28
|
+
|
|
29
|
+
<h3 id="bedrock-key-features"><strong>1.1. Key Value Propositions</strong></h3>
|
|
30
|
+
|
|
31
|
+
<ul>
|
|
32
|
+
<li><strong>Choice</strong>: Access FMs từ Amazon, Anthropic, Meta, Mistral, Cohere, Stability AI, AI21 Labs</li>
|
|
33
|
+
<li><strong>Customization</strong>: Fine-tuning, continued pre-training, RAG (Knowledge Bases)</li>
|
|
34
|
+
<li><strong>Security</strong>: Data stays in your AWS account, encrypted, not used to train models</li>
|
|
35
|
+
<li><strong>Serverless</strong>: No infrastructure to manage</li>
|
|
36
|
+
<li><strong>Integration</strong>: Native AWS service integration (IAM, CloudWatch, CloudTrail)</li>
|
|
37
|
+
</ul>
|
|
38
|
+
|
|
39
|
+
<h3 id="fm-providers"><strong>1.2. Foundation Model Providers on Bedrock</strong></h3>
|
|
40
|
+
|
|
41
|
+
<table>
|
|
42
|
+
<thead><tr><th>Provider</th><th>Models</th><th>Strengths</th></tr></thead>
|
|
43
|
+
<tbody>
|
|
44
|
+
<tr><td><strong>Amazon</strong></td><td>Titan Text, Titan Embeddings, Titan Image Generator</td><td>General purpose, embeddings, image gen</td></tr>
|
|
45
|
+
<tr><td><strong>Anthropic</strong></td><td>Claude 3 Haiku, Sonnet, Opus</td><td>Complex reasoning, analysis, vision</td></tr>
|
|
46
|
+
<tr><td><strong>Meta</strong></td><td>Llama 2, Llama 3</td><td>Open-source, customizable</td></tr>
|
|
47
|
+
<tr><td><strong>Mistral AI</strong></td><td>Mistral, Mixtral</td><td>Fast, efficient, multilingual</td></tr>
|
|
48
|
+
<tr><td><strong>Cohere</strong></td><td>Command, Embed</td><td>Enterprise text, multilingual embeddings</td></tr>
|
|
49
|
+
<tr><td><strong>Stability AI</strong></td><td>Stable Diffusion XL</td><td>Image generation</td></tr>
|
|
50
|
+
<tr><td><strong>AI21 Labs</strong></td><td>Jurassic</td><td>Text generation, summarization</td></tr>
|
|
51
|
+
</tbody>
|
|
52
|
+
</table>
|
|
53
|
+
|
|
54
|
+
<h2 id="bedrock-features"><strong>2. Bedrock Features Deep Dive</strong></h2>
|
|
55
|
+
|
|
56
|
+
<h3 id="bedrock-agents"><strong>2.1. Amazon Bedrock Agents</strong></h3>
|
|
57
|
+
|
|
58
|
+
<p>Agents cho phép FMs <strong>thực hiện multi-step tasks</strong> bằng cách tự động plan, execute actions, và use tools.</p>
|
|
59
|
+
|
|
60
|
+
<pre><code class="language-text">User: "Book a flight from Hanoi to Tokyo for next Friday"
|
|
61
|
+
|
|
62
|
+
Agent workflow:
|
|
63
|
+
1. PLAN: Need to search flights, check availability, book
|
|
64
|
+
2. ACTION: Call flight search API → find available flights
|
|
65
|
+
3. OBSERVE: Found 3 flights, cheapest is $450
|
|
66
|
+
4. ACTION: Call booking API → reserve the flight
|
|
67
|
+
5. RESPOND: "Booked VN flight HAN→NRT, Dec 20, $450"
|
|
68
|
+
</code></pre>
|
|
69
|
+
|
|
70
|
+
<h3 id="agent-components"><strong>Agent Components:</strong></h3>
|
|
71
|
+
|
|
72
|
+
<table>
|
|
73
|
+
<thead><tr><th>Component</th><th>Purpose</th></tr></thead>
|
|
74
|
+
<tbody>
|
|
75
|
+
<tr><td><strong>Foundation Model</strong></td><td>Brain that reasons and plans</td></tr>
|
|
76
|
+
<tr><td><strong>Instructions</strong></td><td>System prompt defining agent's role</td></tr>
|
|
77
|
+
<tr><td><strong>Action Groups</strong></td><td>APIs the agent can call (Lambda functions or OpenAPI schemas)</td></tr>
|
|
78
|
+
<tr><td><strong>Knowledge Bases</strong></td><td>RAG data sources for information retrieval</td></tr>
|
|
79
|
+
<tr><td><strong>Guardrails</strong></td><td>Safety and compliance filters</td></tr>
|
|
80
|
+
</tbody>
|
|
81
|
+
</table>
|
|
82
|
+
|
|
83
|
+
<blockquote>
|
|
84
|
+
<p><strong>Exam tip:</strong> "An AI assistant needs to look up order status, check inventory, and process returns" → <strong>Bedrock Agent</strong> with action groups connected to business APIs.</p>
|
|
85
|
+
</blockquote>
|
|
86
|
+
|
|
87
|
+
<h3 id="bedrock-guardrails"><strong>2.2. Amazon Bedrock Guardrails</strong></h3>
|
|
88
|
+
|
|
89
|
+
<p>Guardrails implement <strong>safety controls</strong> for AI applications:</p>
|
|
90
|
+
|
|
91
|
+
<table>
|
|
92
|
+
<thead><tr><th>Guardrail Type</th><th>What it does</th><th>Example</th></tr></thead>
|
|
93
|
+
<tbody>
|
|
94
|
+
<tr><td><strong>Content filters</strong></td><td>Block harmful content categories</td><td>Hate, violence, sexual, insults</td></tr>
|
|
95
|
+
<tr><td><strong>Denied topics</strong></td><td>Block specific topics</td><td>"Don't discuss competitor products"</td></tr>
|
|
96
|
+
<tr><td><strong>Word filters</strong></td><td>Block specific words/phrases</td><td>Profanity, banned terms</td></tr>
|
|
97
|
+
<tr><td><strong>PII filters</strong></td><td>Detect and redact PII</td><td>SSN, credit card numbers, emails</td></tr>
|
|
98
|
+
<tr><td><strong>Contextual grounding</strong></td><td>Check if response is grounded in context</td><td>Prevent hallucination in RAG</td></tr>
|
|
99
|
+
</tbody>
|
|
100
|
+
</table>
|
|
101
|
+
|
|
102
|
+
<pre><code class="language-text">Guardrails Flow:
|
|
103
|
+
User Input → [Input Guardrails] → FM Processing → [Output Guardrails] → User
|
|
104
|
+
Check for: Check for:
|
|
105
|
+
- Denied topics - Harmful content
|
|
106
|
+
- Harmful input - PII in response
|
|
107
|
+
- PII in input - Off-topic responses
|
|
108
|
+
- Grounding check
|
|
109
|
+
</code></pre>
|
|
110
|
+
|
|
111
|
+
<h3 id="bedrock-eval"><strong>2.3. Model Evaluation</strong></h3>
|
|
112
|
+
|
|
113
|
+
<p>Compare and evaluate FMs for your specific use case:</p>
|
|
114
|
+
|
|
115
|
+
<ul>
|
|
116
|
+
<li><strong>Automatic evaluation</strong>: BERTScore, accuracy, toxicity metrics</li>
|
|
117
|
+
<li><strong>Human evaluation</strong>: Custom criteria rated by human reviewers</li>
|
|
118
|
+
<li><strong>A/B comparison</strong>: Side-by-side model comparison</li>
|
|
119
|
+
<li><strong>Custom tasks</strong>: Upload your own test dataset</li>
|
|
120
|
+
</ul>
|
|
121
|
+
|
|
122
|
+
<h3 id="bedrock-playground"><strong>2.4. Bedrock Playgrounds</strong></h3>
|
|
123
|
+
|
|
124
|
+
<table>
|
|
125
|
+
<thead><tr><th>Playground</th><th>Use Case</th></tr></thead>
|
|
126
|
+
<tbody>
|
|
127
|
+
<tr><td><strong>Text playground</strong></td><td>Test text models interactively</td></tr>
|
|
128
|
+
<tr><td><strong>Chat playground</strong></td><td>Test conversational models</td></tr>
|
|
129
|
+
<tr><td><strong>Image playground</strong></td><td>Test image generation models</td></tr>
|
|
130
|
+
</tbody>
|
|
131
|
+
</table>
|
|
132
|
+
|
|
133
|
+
<h2 id="partyrock"><strong>3. Amazon PartyRock</strong></h2>
|
|
134
|
+
|
|
135
|
+
<p><strong>PartyRock</strong> là <strong>free, no-code playground</strong> cho Bedrock — cho phép bất kỳ ai tạo GenAI apps mà không cần AWS account hay coding skills.</p>
|
|
136
|
+
|
|
137
|
+
<table>
|
|
138
|
+
<thead><tr><th>Feature</th><th>Detail</th></tr></thead>
|
|
139
|
+
<tbody>
|
|
140
|
+
<tr><td><strong>No AWS account needed</strong></td><td>Free to use with social login</td></tr>
|
|
141
|
+
<tr><td><strong>No coding</strong></td><td>Drag-and-drop app builder</td></tr>
|
|
142
|
+
<tr><td><strong>Shareable</strong></td><td>Share apps via URL</td></tr>
|
|
143
|
+
<tr><td><strong>Use case</strong></td><td>Learning, prototyping, experimentation</td></tr>
|
|
144
|
+
</tbody>
|
|
145
|
+
</table>
|
|
146
|
+
|
|
147
|
+
<blockquote>
|
|
148
|
+
<p><strong>Exam tip:</strong> "A non-technical marketing team wants to experiment with generative AI without an AWS account" → <strong>PartyRock</strong>.</p>
|
|
149
|
+
</blockquote>
|
|
150
|
+
|
|
151
|
+
<h2 id="amazon-q"><strong>4. Amazon Q</strong></h2>
|
|
152
|
+
|
|
153
|
+
<h3 id="q-developer"><strong>4.1. Amazon Q Developer</strong></h3>
|
|
154
|
+
|
|
155
|
+
<p>AI coding assistant cho developers:</p>
|
|
156
|
+
|
|
157
|
+
<ul>
|
|
158
|
+
<li><strong>Code generation</strong>: Write code from natural language</li>
|
|
159
|
+
<li><strong>Code explanation</strong>: Explain existing code</li>
|
|
160
|
+
<li><strong>Code transformation</strong>: Upgrade Java versions, .NET migrations</li>
|
|
161
|
+
<li><strong>Debugging</strong>: Identify and fix bugs</li>
|
|
162
|
+
<li><strong>Security scanning</strong>: Find vulnerabilities in code</li>
|
|
163
|
+
<li><strong>IDE integration</strong>: VS Code, JetBrains, AWS Console</li>
|
|
164
|
+
</ul>
|
|
165
|
+
|
|
166
|
+
<h3 id="q-business"><strong>4.2. Amazon Q Business</strong></h3>
|
|
167
|
+
|
|
168
|
+
<p>AI assistant for business users:</p>
|
|
169
|
+
|
|
170
|
+
<ul>
|
|
171
|
+
<li><strong>Connect enterprise data</strong>: S3, SharePoint, Confluence, Salesforce, etc.</li>
|
|
172
|
+
<li><strong>Q&A on company data</strong>: Answers based on connected data sources</li>
|
|
173
|
+
<li><strong>Respects access controls</strong>: ACLs from connected systems</li>
|
|
174
|
+
<li><strong>Plugins</strong>: Create tickets (Jira), send emails, etc.</li>
|
|
175
|
+
</ul>
|
|
176
|
+
|
|
177
|
+
<h3 id="q-vs-bedrock"><strong>4.3. Amazon Q vs Bedrock</strong></h3>
|
|
178
|
+
|
|
179
|
+
<table>
|
|
180
|
+
<thead><tr><th>Feature</th><th>Amazon Q</th><th>Amazon Bedrock</th></tr></thead>
|
|
181
|
+
<tbody>
|
|
182
|
+
<tr><td><strong>Target user</strong></td><td>End users (devs, business)</td><td>Developers building AI apps</td></tr>
|
|
183
|
+
<tr><td><strong>Customization</strong></td><td>Limited (connect data sources)</td><td>Full (fine-tune, RAG, agents)</td></tr>
|
|
184
|
+
<tr><td><strong>Managed</strong></td><td>Fully managed assistant</td><td>API/SDK access to FMs</td></tr>
|
|
185
|
+
<tr><td><strong>Use case</strong></td><td>Productivity tool</td><td>Building custom AI applications</td></tr>
|
|
186
|
+
</tbody>
|
|
187
|
+
</table>
|
|
188
|
+
|
|
189
|
+
<h2 id="pricing"><strong>5. Bedrock Pricing Models</strong></h2>
|
|
190
|
+
|
|
191
|
+
<table>
|
|
192
|
+
<thead><tr><th>Pricing Model</th><th>How it works</th><th>Best For</th></tr></thead>
|
|
193
|
+
<tbody>
|
|
194
|
+
<tr><td><strong>On-Demand</strong></td><td>Pay per input/output token</td><td>Variable, unpredictable workloads</td></tr>
|
|
195
|
+
<tr><td><strong>Provisioned Throughput</strong></td><td>Reserved model units (hourly)</td><td>Consistent, production workloads</td></tr>
|
|
196
|
+
<tr><td><strong>Batch Inference</strong></td><td>Submit batch jobs (up to 50% cheaper)</td><td>Large-scale, non-real-time processing</td></tr>
|
|
197
|
+
</tbody>
|
|
198
|
+
</table>
|
|
199
|
+
|
|
200
|
+
<blockquote>
|
|
201
|
+
<p><strong>Exam tip:</strong> "Cost-optimize a GenAI workload with predictable traffic?" → <strong>Provisioned Throughput</strong>. "Process thousands of documents overnight?" → <strong>Batch Inference</strong>.</p>
|
|
202
|
+
</blockquote>
|
|
203
|
+
|
|
204
|
+
<h2 id="choosing-fm"><strong>6. How to Choose the Right FM</strong></h2>
|
|
205
|
+
|
|
206
|
+
<pre><code class="language-text">Decision Framework:
|
|
207
|
+
┌─────────────────────────────────────────────────┐
|
|
208
|
+
│ 1. TASK TYPE │
|
|
209
|
+
│ Text? Image? Code? Multi-modal? │
|
|
210
|
+
├─────────────────────────────────────────────────┤
|
|
211
|
+
│ 2. COMPLEXITY │
|
|
212
|
+
│ Simple classification → smaller model │
|
|
213
|
+
│ Complex reasoning → larger model │
|
|
214
|
+
├─────────────────────────────────────────────────┤
|
|
215
|
+
│ 3. LATENCY REQUIREMENTS │
|
|
216
|
+
│ Real-time → smaller/faster model (Haiku) │
|
|
217
|
+
│ Batch processing → larger model (Opus) │
|
|
218
|
+
├─────────────────────────────────────────────────┤
|
|
219
|
+
│ 4. COST CONSTRAINTS │
|
|
220
|
+
│ Budget limited → smaller model │
|
|
221
|
+
│ Quality critical → larger model │
|
|
222
|
+
├─────────────────────────────────────────────────┤
|
|
223
|
+
│ 5. CUSTOMIZATION NEEDS │
|
|
224
|
+
│ Fine-tuning needed? Check supported models │
|
|
225
|
+
│ LoRA? Check compatibility │
|
|
226
|
+
├─────────────────────────────────────────────────┤
|
|
227
|
+
│ 6. EVALUATE with Model Evaluation │
|
|
228
|
+
│ Test candidates side-by-side │
|
|
229
|
+
└─────────────────────────────────────────────────┘
|
|
230
|
+
</code></pre>
|
|
231
|
+
|
|
232
|
+
<h2 id="other-services"><strong>7. Other AWS GenAI Services</strong></h2>
|
|
233
|
+
|
|
234
|
+
<table>
|
|
235
|
+
<thead><tr><th>Service</th><th>What it does</th></tr></thead>
|
|
236
|
+
<tbody>
|
|
237
|
+
<tr><td><strong>Amazon CodeWhisperer</strong></td><td>Now part of Amazon Q Developer (code suggestions)</td></tr>
|
|
238
|
+
<tr><td><strong>AWS App Studio</strong></td><td>Build enterprise apps with natural language</td></tr>
|
|
239
|
+
<tr><td><strong>Amazon SageMaker JumpStart</strong></td><td>Deploy open-source FMs with SageMaker</td></tr>
|
|
240
|
+
<tr><td><strong>Amazon Comprehend</strong></td><td>NLP service (sentiment, entities, topics — pre-built)</td></tr>
|
|
241
|
+
<tr><td><strong>Amazon Transcribe</strong></td><td>Speech-to-text</td></tr>
|
|
242
|
+
<tr><td><strong>Amazon Polly</strong></td><td>Text-to-speech</td></tr>
|
|
243
|
+
<tr><td><strong>Amazon Translate</strong></td><td>Machine translation</td></tr>
|
|
244
|
+
<tr><td><strong>Amazon Rekognition</strong></td><td>Image/video analysis</td></tr>
|
|
245
|
+
<tr><td><strong>Amazon Textract</strong></td><td>Extract text from documents (OCR+)</td></tr>
|
|
246
|
+
</tbody>
|
|
247
|
+
</table>
|
|
248
|
+
|
|
249
|
+
<h2 id="practice-questions"><strong>8. Practice Questions</strong></h2>
|
|
250
|
+
|
|
251
|
+
<p><strong>Q1:</strong> A retail company wants to build an AI assistant that can check inventory, process returns, and answer product questions from their catalog. Which Amazon Bedrock feature should they use?</p>
|
|
252
|
+
<ul>
|
|
253
|
+
<li>A) Bedrock Guardrails</li>
|
|
254
|
+
<li>B) Bedrock Knowledge Bases only</li>
|
|
255
|
+
<li>C) Bedrock Agents with Action Groups and Knowledge Bases ✓</li>
|
|
256
|
+
<li>D) Bedrock Model Evaluation</li>
|
|
257
|
+
</ul>
|
|
258
|
+
<p><em>Explanation: Bedrock Agents can orchestrate multi-step tasks by calling APIs (action groups for inventory/returns) and retrieving information (knowledge bases for product catalog).</em></p>
|
|
259
|
+
|
|
260
|
+
<p><strong>Q2:</strong> Which Amazon Bedrock feature should be used to prevent a generative AI application from discussing competitor products and to filter out personally identifiable information (PII)?</p>
|
|
261
|
+
<ul>
|
|
262
|
+
<li>A) Bedrock Knowledge Bases</li>
|
|
263
|
+
<li>B) Bedrock Custom Models</li>
|
|
264
|
+
<li>C) Bedrock Guardrails ✓</li>
|
|
265
|
+
<li>D) Bedrock Agents</li>
|
|
266
|
+
</ul>
|
|
267
|
+
<p><em>Explanation: Guardrails provide denied topic filtering (block competitor discussions) and PII detection/redaction. They can be applied to both input and output of FM calls.</em></p>
|
|
268
|
+
|
|
269
|
+
<p><strong>Q3:</strong> A company wants to process 50,000 customer reviews overnight for sentiment analysis using a foundation model. Which Bedrock pricing model is MOST cost-effective?</p>
|
|
270
|
+
<ul>
|
|
271
|
+
<li>A) On-Demand pricing</li>
|
|
272
|
+
<li>B) Provisioned Throughput</li>
|
|
273
|
+
<li>C) Batch Inference ✓</li>
|
|
274
|
+
<li>D) Free tier</li>
|
|
275
|
+
</ul>
|
|
276
|
+
<p><em>Explanation: Batch Inference is designed for large-scale, non-real-time workloads and offers up to 50% cost savings compared to on-demand pricing. Ideal for overnight processing.</em></p>
|