@xdev-asia/xdev-knowledge-mcp 1.0.41 → 1.0.43
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/chapters/01-phan-1-data-engineering/lessons/01-bai-1-data-repositories-ingestion.md +193 -0
- package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/01-phan-1-data-engineering/lessons/02-bai-2-data-transformation.md +178 -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/aws-ai-practitioner.json +362 -0
- package/data/quizzes/aws-ml-specialty.json +200 -0
- package/data/quizzes/gcp-ml-engineer.json +200 -0
- package/data/quizzes.json +764 -0
- package/package.json +1 -1
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: 019c9619-lt01-d4-l09
|
|
3
|
+
title: 'Bài 9: Responsible AI — Fairness, Bias & Transparency'
|
|
4
|
+
slug: bai-9-responsible-ai-fairness-bias-transparency
|
|
5
|
+
description: >-
|
|
6
|
+
Responsible AI principles. Types of bias (data, algorithmic, societal).
|
|
7
|
+
Fairness metrics, model explainability (SHAP, LIME).
|
|
8
|
+
AWS AI Service Cards, Transparency in AI.
|
|
9
|
+
duration_minutes: 55
|
|
10
|
+
is_free: true
|
|
11
|
+
video_url: null
|
|
12
|
+
sort_order: 1
|
|
13
|
+
section_title: "Domain 4: Guidelines for Responsible AI (14%)"
|
|
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-bai9-responsible-ai-pillars.png" alt="Responsible AI Pillars" style="max-width: 800px; width: 100%; border-radius: 12px;" />
|
|
22
|
+
<p><em>Responsible AI Pillars và các điểm Bias xâm nhập trong ML Pipeline</em></p>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<h2 id="responsible-ai"><strong>1. What is Responsible AI?</strong></h2>
|
|
26
|
+
|
|
27
|
+
<p><strong>Responsible AI</strong> là framework đảm bảo AI systems được phát triển và sử dụng một cách <strong>ethical, fair, transparent, và accountable</strong>.</p>
|
|
28
|
+
|
|
29
|
+
<h3 id="pillars"><strong>1.1. Pillars of Responsible AI</strong></h3>
|
|
30
|
+
|
|
31
|
+
<table>
|
|
32
|
+
<thead><tr><th>Pillar</th><th>Definition</th><th>Example</th></tr></thead>
|
|
33
|
+
<tbody>
|
|
34
|
+
<tr><td><strong>Fairness</strong></td><td>Treat all groups equitably</td><td>Loan approval model doesn't discriminate by race</td></tr>
|
|
35
|
+
<tr><td><strong>Explainability</strong></td><td>Understand why model made a decision</td><td>"Your loan was denied because debt-to-income ratio > 0.5"</td></tr>
|
|
36
|
+
<tr><td><strong>Transparency</strong></td><td>Clear about AI capabilities & limitations</td><td>Disclose when content is AI-generated</td></tr>
|
|
37
|
+
<tr><td><strong>Privacy</strong></td><td>Protect personal data</td><td>Don't train on PII without consent</td></tr>
|
|
38
|
+
<tr><td><strong>Safety</strong></td><td>Prevent harmful outputs</td><td>Content filters, guardrails</td></tr>
|
|
39
|
+
<tr><td><strong>Robustness</strong></td><td>Reliable under adversarial conditions</td><td>Resist prompt injection attacks</td></tr>
|
|
40
|
+
<tr><td><strong>Governance</strong></td><td>Oversight and accountability</td><td>Human review for high-stakes decisions</td></tr>
|
|
41
|
+
</tbody>
|
|
42
|
+
</table>
|
|
43
|
+
|
|
44
|
+
<h2 id="bias"><strong>2. Understanding Bias in AI</strong></h2>
|
|
45
|
+
|
|
46
|
+
<h3 id="bias-types"><strong>2.1. Types of Bias</strong></h3>
|
|
47
|
+
|
|
48
|
+
<table>
|
|
49
|
+
<thead><tr><th>Bias Type</th><th>What</th><th>Example</th></tr></thead>
|
|
50
|
+
<tbody>
|
|
51
|
+
<tr><td><strong>Selection bias</strong></td><td>Training data doesn't represent population</td><td>Hiring model trained only on tech company data</td></tr>
|
|
52
|
+
<tr><td><strong>Measurement bias</strong></td><td>Inconsistent data collection</td><td>Different image quality across demographic groups</td></tr>
|
|
53
|
+
<tr><td><strong>Confirmation bias</strong></td><td>Model reinforces existing patterns</td><td>Recommender shows only what users already like</td></tr>
|
|
54
|
+
<tr><td><strong>Label bias</strong></td><td>Human labelers introduce biases</td><td>Inconsistent sentiment labels across annotators</td></tr>
|
|
55
|
+
<tr><td><strong>Algorithmic bias</strong></td><td>Model architecture amplifies bias</td><td>Optimizing for accuracy favors majority group</td></tr>
|
|
56
|
+
<tr><td><strong>Recall bias</strong></td><td>Overrepresented historical patterns</td><td>More arrest data in certain areas → predicts more crime there</td></tr>
|
|
57
|
+
<tr><td><strong>Sampling bias</strong></td><td>Non-random data collection</td><td>Online survey misses elderly population</td></tr>
|
|
58
|
+
</tbody>
|
|
59
|
+
</table>
|
|
60
|
+
|
|
61
|
+
<h3 id="bias-lifecycle"><strong>2.2. Where Bias Can Enter the ML Lifecycle</strong></h3>
|
|
62
|
+
|
|
63
|
+
<pre><code class="language-text">Data Collection Data Processing Model Training Evaluation Deployment
|
|
64
|
+
↓ ↓ ↓ ↓ ↓
|
|
65
|
+
Selection bias Feature engineering Algorithmic Evaluation Feedback
|
|
66
|
+
Sampling bias Missing values bias metric bias loop bias
|
|
67
|
+
Measurement Encoding choices Optimization User bias
|
|
68
|
+
bias objective
|
|
69
|
+
</code></pre>
|
|
70
|
+
|
|
71
|
+
<blockquote>
|
|
72
|
+
<p><strong>Exam tip:</strong> "Where can bias be introduced in an ML pipeline?" → <strong>At every stage</strong> — data collection, preprocessing, model training, evaluation, and deployment. This is why monitoring throughout the lifecycle is critical.</p>
|
|
73
|
+
</blockquote>
|
|
74
|
+
|
|
75
|
+
<h2 id="fairness"><strong>3. Fairness Metrics</strong></h2>
|
|
76
|
+
|
|
77
|
+
<h3 id="fairness-concepts"><strong>3.1. Key Fairness Concepts</strong></h3>
|
|
78
|
+
|
|
79
|
+
<table>
|
|
80
|
+
<thead><tr><th>Concept</th><th>Definition</th></tr></thead>
|
|
81
|
+
<tbody>
|
|
82
|
+
<tr><td><strong>Demographic parity</strong></td><td>Positive outcomes at same rate across groups</td></tr>
|
|
83
|
+
<tr><td><strong>Equal opportunity</strong></td><td>Equal true positive rates across groups</td></tr>
|
|
84
|
+
<tr><td><strong>Equalized odds</strong></td><td>Equal TPR and FPR across groups</td></tr>
|
|
85
|
+
<tr><td><strong>Individual fairness</strong></td><td>Similar individuals get similar outcomes</td></tr>
|
|
86
|
+
<tr><td><strong>Disparate impact</strong></td><td>Ratio of positive outcomes between groups (80% rule)</td></tr>
|
|
87
|
+
</tbody>
|
|
88
|
+
</table>
|
|
89
|
+
|
|
90
|
+
<h3 id="detect-bias"><strong>3.2. Detecting Bias</strong></h3>
|
|
91
|
+
|
|
92
|
+
<ul>
|
|
93
|
+
<li><strong>Pre-training</strong>: Analyze training data distribution across demographic groups</li>
|
|
94
|
+
<li><strong>Post-training</strong>: Compare model predictions across groups</li>
|
|
95
|
+
<li><strong>Runtime</strong>: Monitor live predictions for drift in fairness metrics</li>
|
|
96
|
+
</ul>
|
|
97
|
+
|
|
98
|
+
<h2 id="explainability"><strong>4. Model Explainability</strong></h2>
|
|
99
|
+
|
|
100
|
+
<p><strong>Explainability</strong> = ability to understand <strong>why</strong> a model made a specific prediction.</p>
|
|
101
|
+
|
|
102
|
+
<h3 id="explainability-methods"><strong>4.1. Explainability Techniques</strong></h3>
|
|
103
|
+
|
|
104
|
+
<table>
|
|
105
|
+
<thead><tr><th>Technique</th><th>Type</th><th>What it does</th></tr></thead>
|
|
106
|
+
<tbody>
|
|
107
|
+
<tr><td><strong>SHAP</strong> (SHapley Additive exPlanations)</td><td>Model-agnostic</td><td>Shows contribution of each feature to prediction</td></tr>
|
|
108
|
+
<tr><td><strong>LIME</strong> (Local Interpretable Model-agnostic Explanations)</td><td>Model-agnostic</td><td>Explains individual predictions by approximating locally</td></tr>
|
|
109
|
+
<tr><td><strong>Feature importance</strong></td><td>Model-specific</td><td>Ranks features by their impact on model output</td></tr>
|
|
110
|
+
<tr><td><strong>Attention visualization</strong></td><td>Transformer-specific</td><td>Shows which tokens the model focused on</td></tr>
|
|
111
|
+
<tr><td><strong>Partial Dependence Plots</strong></td><td>Model-agnostic</td><td>Shows how a feature affects predictions</td></tr>
|
|
112
|
+
</tbody>
|
|
113
|
+
</table>
|
|
114
|
+
|
|
115
|
+
<pre><code class="language-text">SHAP Example:
|
|
116
|
+
Loan Application: DENIED
|
|
117
|
+
|
|
118
|
+
Feature Contributions:
|
|
119
|
+
Debt-to-income ratio: +0.42 (pushes toward DENY)
|
|
120
|
+
Credit score: +0.28 (pushes toward DENY)
|
|
121
|
+
Employment years: -0.15 (pushes toward APPROVE)
|
|
122
|
+
Loan amount: +0.08 (pushes toward DENY)
|
|
123
|
+
Age: -0.03 (neutral)
|
|
124
|
+
─────────────
|
|
125
|
+
Base (avg prediction): 0.45
|
|
126
|
+
Final prediction: 0.45 + 0.42 + 0.28 - 0.15 + 0.08 - 0.03 = 1.05 → DENY
|
|
127
|
+
</code></pre>
|
|
128
|
+
|
|
129
|
+
<blockquote>
|
|
130
|
+
<p><strong>Exam tip:</strong> "How to explain why an ML model denied a loan application?" → <strong>SHAP values</strong> — shows the contribution of each feature to the individual prediction. <strong>SageMaker Clarify</strong> provides this on AWS.</p>
|
|
131
|
+
</blockquote>
|
|
132
|
+
|
|
133
|
+
<h2 id="transparency"><strong>5. Transparency in AI</strong></h2>
|
|
134
|
+
|
|
135
|
+
<h3 id="ai-service-cards"><strong>5.1. AWS AI Service Cards</strong></h3>
|
|
136
|
+
|
|
137
|
+
<p><strong>AI Service Cards</strong> are public documentation from AWS that provide transparency about AWS AI services:</p>
|
|
138
|
+
|
|
139
|
+
<ul>
|
|
140
|
+
<li><strong>Intended use cases</strong>: What the service is designed for</li>
|
|
141
|
+
<li><strong>Limitations</strong>: Known limitations and failure modes</li>
|
|
142
|
+
<li><strong>Design choices</strong>: How the model was built</li>
|
|
143
|
+
<li><strong>Best practices</strong>: Recommended usage patterns</li>
|
|
144
|
+
<li><strong>Fairness considerations</strong>: Known demographic performance differences</li>
|
|
145
|
+
</ul>
|
|
146
|
+
|
|
147
|
+
<p>Available for: Amazon Rekognition, Textract, Comprehend, Transcribe, etc.</p>
|
|
148
|
+
|
|
149
|
+
<h3 id="model-cards"><strong>5.2. Model Cards</strong></h3>
|
|
150
|
+
|
|
151
|
+
<p><strong>Model Cards</strong> (from SageMaker) are internal documentation you create for <strong>your own models</strong>:</p>
|
|
152
|
+
|
|
153
|
+
<ul>
|
|
154
|
+
<li>Model description and intended use</li>
|
|
155
|
+
<li>Training data details</li>
|
|
156
|
+
<li>Performance metrics across subgroups</li>
|
|
157
|
+
<li>Ethical considerations</li>
|
|
158
|
+
<li>Limitations and risks</li>
|
|
159
|
+
</ul>
|
|
160
|
+
|
|
161
|
+
<h3 id="transparency-practices"><strong>5.3. Transparency Best Practices</strong></h3>
|
|
162
|
+
|
|
163
|
+
<table>
|
|
164
|
+
<thead><tr><th>Practice</th><th>How</th></tr></thead>
|
|
165
|
+
<tbody>
|
|
166
|
+
<tr><td>Disclose AI usage</td><td>Tell users when they're interacting with AI</td></tr>
|
|
167
|
+
<tr><td>Source attribution</td><td>Cite sources in RAG applications</td></tr>
|
|
168
|
+
<tr><td>Confidence scores</td><td>Show model confidence to users</td></tr>
|
|
169
|
+
<tr><td>Limitations disclosure</td><td>Document what the model can't do</td></tr>
|
|
170
|
+
<tr><td>Watermarking</td><td>Mark AI-generated content (images, text)</td></tr>
|
|
171
|
+
</tbody>
|
|
172
|
+
</table>
|
|
173
|
+
|
|
174
|
+
<h2 id="toxicity"><strong>6. Toxicity & Harmful Content</strong></h2>
|
|
175
|
+
|
|
176
|
+
<h3 id="toxicity-types"><strong>Types of Harmful Content:</strong></h3>
|
|
177
|
+
|
|
178
|
+
<ul>
|
|
179
|
+
<li><strong>Hate speech</strong>: Content targeting protected groups</li>
|
|
180
|
+
<li><strong>Violence</strong>: Graphic or promoting violence</li>
|
|
181
|
+
<li><strong>Sexual content</strong>: Explicit or inappropriate</li>
|
|
182
|
+
<li><strong>Self-harm</strong>: Promoting self-harm or suicide</li>
|
|
183
|
+
<li><strong>Misinformation</strong>: Factually incorrect content presented as fact</li>
|
|
184
|
+
<li><strong>Prompt injection</strong>: Malicious prompts that override system instructions</li>
|
|
185
|
+
</ul>
|
|
186
|
+
|
|
187
|
+
<h3 id="toxicity-mitigation"><strong>Mitigation Strategies:</strong></h3>
|
|
188
|
+
|
|
189
|
+
<ol>
|
|
190
|
+
<li><strong>Content filters</strong>: Automated detection and blocking (Bedrock Guardrails)</li>
|
|
191
|
+
<li><strong>Human review</strong>: Human-in-the-loop for high-risk content</li>
|
|
192
|
+
<li><strong>Input sanitization</strong>: Validate and sanitize user inputs</li>
|
|
193
|
+
<li><strong>Output filtering</strong>: Check model outputs before showing to users</li>
|
|
194
|
+
<li><strong>Red teaming</strong>: Adversarial testing before deployment</li>
|
|
195
|
+
</ol>
|
|
196
|
+
|
|
197
|
+
<h2 id="practice-questions"><strong>7. Practice Questions</strong></h2>
|
|
198
|
+
|
|
199
|
+
<p><strong>Q1:</strong> A hiring AI system consistently ranks male candidates higher than equally qualified female candidates. Which type of bias is MOST likely present?</p>
|
|
200
|
+
<ul>
|
|
201
|
+
<li>A) Measurement bias</li>
|
|
202
|
+
<li>B) Selection bias in training data ✓</li>
|
|
203
|
+
<li>C) Confirmation bias</li>
|
|
204
|
+
<li>D) Recall bias</li>
|
|
205
|
+
</ul>
|
|
206
|
+
<p><em>Explanation: If the training data contained historical hiring decisions that favored male candidates, the model would learn and reproduce that selection bias. The training data didn't represent the qualified population fairly.</em></p>
|
|
207
|
+
|
|
208
|
+
<p><strong>Q2:</strong> A bank is required by regulators to explain why each loan application was approved or denied. Which AWS service feature can provide per-prediction explanations?</p>
|
|
209
|
+
<ul>
|
|
210
|
+
<li>A) Amazon Bedrock Guardrails</li>
|
|
211
|
+
<li>B) Amazon SageMaker Clarify with SHAP values ✓</li>
|
|
212
|
+
<li>C) Amazon Comprehend sentiment analysis</li>
|
|
213
|
+
<li>D) AWS AI Service Cards</li>
|
|
214
|
+
</ul>
|
|
215
|
+
<p><em>Explanation: SageMaker Clarify computes SHAP values that show the contribution of each feature to individual predictions, providing the explainability required by regulators.</em></p>
|
|
216
|
+
|
|
217
|
+
<p><strong>Q3:</strong> Which AWS resource provides public documentation about the intended use cases, limitations, and fairness considerations of AWS AI services?</p>
|
|
218
|
+
<ul>
|
|
219
|
+
<li>A) SageMaker Model Cards</li>
|
|
220
|
+
<li>B) AWS AI Service Cards ✓</li>
|
|
221
|
+
<li>C) Amazon Bedrock Model Evaluation</li>
|
|
222
|
+
<li>D) AWS Trusted Advisor</li>
|
|
223
|
+
</ul>
|
|
224
|
+
<p><em>Explanation: AWS AI Service Cards are public documents that provide transparency about the design, limitations, and best practices for AWS AI services like Rekognition, Textract, and Comprehend. Model Cards are for your own custom models.</em></p>
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: 019c9619-lt01-d4-l10
|
|
3
|
+
title: 'Bài 10: AWS Responsible AI Tools — Clarify, A2I & Guardrails'
|
|
4
|
+
slug: bai-10-aws-responsible-ai-tools
|
|
5
|
+
description: >-
|
|
6
|
+
Amazon SageMaker Clarify (bias detection, explainability).
|
|
7
|
+
Amazon Augmented AI (A2I) — Human-in-the-loop.
|
|
8
|
+
Amazon Bedrock Guardrails deep dive. Content moderation.
|
|
9
|
+
duration_minutes: 50
|
|
10
|
+
is_free: true
|
|
11
|
+
video_url: null
|
|
12
|
+
sort_order: 2
|
|
13
|
+
section_title: "Domain 4: Guidelines for Responsible AI (14%)"
|
|
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-bai10-clarify-a2i-guardrails.png" alt="AWS Responsible AI Tools" style="max-width: 800px; width: 100%; border-radius: 12px;" />
|
|
22
|
+
<p><em>AWS Responsible AI Tools: SageMaker Clarify, Amazon A2I và Bedrock Guardrails</em></p>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<h2 id="sagemaker-clarify"><strong>1. Amazon SageMaker Clarify</strong></h2>
|
|
26
|
+
|
|
27
|
+
<p><strong>SageMaker Clarify</strong> helps detect bias in data and models, and provides model explainability — the go-to AWS service for Responsible AI.</p>
|
|
28
|
+
|
|
29
|
+
<h3 id="clarify-capabilities"><strong>1.1. Three Core Capabilities</strong></h3>
|
|
30
|
+
|
|
31
|
+
<table>
|
|
32
|
+
<thead><tr><th>Capability</th><th>When</th><th>What it does</th></tr></thead>
|
|
33
|
+
<tbody>
|
|
34
|
+
<tr><td><strong>Pre-training bias detection</strong></td><td>Before training</td><td>Detects imbalances in training data across demographic groups</td></tr>
|
|
35
|
+
<tr><td><strong>Post-training bias detection</strong></td><td>After training</td><td>Detects bias in model predictions (e.g., different accuracy across groups)</td></tr>
|
|
36
|
+
<tr><td><strong>Explainability (SHAP)</strong></td><td>After training</td><td>Shows feature contributions to each prediction</td></tr>
|
|
37
|
+
</tbody>
|
|
38
|
+
</table>
|
|
39
|
+
|
|
40
|
+
<h3 id="clarify-bias-metrics"><strong>1.2. Key Bias Metrics in Clarify</strong></h3>
|
|
41
|
+
|
|
42
|
+
<table>
|
|
43
|
+
<thead><tr><th>Metric</th><th>Pre/Post training</th><th>What it measures</th></tr></thead>
|
|
44
|
+
<tbody>
|
|
45
|
+
<tr><td><strong>Class Imbalance (CI)</strong></td><td>Pre-training</td><td>Distribution of classes across groups</td></tr>
|
|
46
|
+
<tr><td><strong>Difference in Proportions (DPL)</strong></td><td>Pre-training</td><td>Proportion of positive labels across groups</td></tr>
|
|
47
|
+
<tr><td><strong>KL Divergence</strong></td><td>Pre-training</td><td>Distribution divergence between groups</td></tr>
|
|
48
|
+
<tr><td><strong>Disparate Impact (DI)</strong></td><td>Post-training</td><td>Ratio of positive predictions across groups</td></tr>
|
|
49
|
+
<tr><td><strong>Accuracy Difference (AD)</strong></td><td>Post-training</td><td>Accuracy gap between groups</td></tr>
|
|
50
|
+
<tr><td><strong>Treatment Equality (TE)</strong></td><td>Post-training</td><td>Ratio of FP to FN across groups</td></tr>
|
|
51
|
+
</tbody>
|
|
52
|
+
</table>
|
|
53
|
+
|
|
54
|
+
<h3 id="clarify-workflow"><strong>1.3. Clarify Workflow</strong></h3>
|
|
55
|
+
|
|
56
|
+
<pre><code class="language-text">1. Configure Clarify Job
|
|
57
|
+
├── Specify sensitive attributes (gender, age, race)
|
|
58
|
+
├── Define facets (groups to compare)
|
|
59
|
+
└── Choose bias metrics to compute
|
|
60
|
+
|
|
61
|
+
2. Run Pre-training Analysis
|
|
62
|
+
├── Upload training dataset
|
|
63
|
+
└── Get bias report on data distribution
|
|
64
|
+
|
|
65
|
+
3. Train Model
|
|
66
|
+
|
|
67
|
+
4. Run Post-training Analysis
|
|
68
|
+
├── Compare predictions across groups
|
|
69
|
+
└── Get SHAP values for explainability
|
|
70
|
+
|
|
71
|
+
5. Monitor with SageMaker Model Monitor
|
|
72
|
+
└── Detect bias drift over time in production
|
|
73
|
+
</code></pre>
|
|
74
|
+
|
|
75
|
+
<blockquote>
|
|
76
|
+
<p><strong>Exam tip:</strong> "Which AWS service can detect if a model makes more errors for one racial group vs another?" → <strong>SageMaker Clarify</strong> (post-training bias detection).</p>
|
|
77
|
+
</blockquote>
|
|
78
|
+
|
|
79
|
+
<h2 id="a2i"><strong>2. Amazon Augmented AI (Amazon A2I)</strong></h2>
|
|
80
|
+
|
|
81
|
+
<p><strong>Amazon A2I</strong> cung cấp <strong>human-in-the-loop (HITL)</strong> workflows cho AI predictions — đặc biệt quan trọng khi model confidence thấp hoặc high-stakes decisions.</p>
|
|
82
|
+
|
|
83
|
+
<h3 id="a2i-how"><strong>2.1. How A2I Works</strong></h3>
|
|
84
|
+
|
|
85
|
+
<pre><code class="language-text">AI Prediction Flow with A2I:
|
|
86
|
+
┌─────────────┐
|
|
87
|
+
User Request → AI Model → Confident? YES → Return result
|
|
88
|
+
│
|
|
89
|
+
NO (below threshold)
|
|
90
|
+
↓
|
|
91
|
+
┌──────────────────┐
|
|
92
|
+
│ Create Human │
|
|
93
|
+
│ Review Task │
|
|
94
|
+
│ (A2I Workflow) │
|
|
95
|
+
└────────┬─────────┘
|
|
96
|
+
↓
|
|
97
|
+
┌──────────────────┐
|
|
98
|
+
│ Human Reviewer │ ← AWS Mechanical Turk
|
|
99
|
+
│ Reviews & │ ← Private workforce
|
|
100
|
+
│ Corrects │ ← Third-party vendor
|
|
101
|
+
└────────┬─────────┘
|
|
102
|
+
↓
|
|
103
|
+
Return human-verified result
|
|
104
|
+
</code></pre>
|
|
105
|
+
|
|
106
|
+
<h3 id="a2i-components"><strong>2.2. A2I Components</strong></h3>
|
|
107
|
+
|
|
108
|
+
<table>
|
|
109
|
+
<thead><tr><th>Component</th><th>Purpose</th></tr></thead>
|
|
110
|
+
<tbody>
|
|
111
|
+
<tr><td><strong>Human review workflow</strong></td><td>Defines when and how to trigger human review</td></tr>
|
|
112
|
+
<tr><td><strong>Worker task template</strong></td><td>UI for human reviewers to make decisions</td></tr>
|
|
113
|
+
<tr><td><strong>Workforce</strong></td><td>Who does the review (private, Mechanical Turk, vendor)</td></tr>
|
|
114
|
+
<tr><td><strong>Activation conditions</strong></td><td>Confidence threshold triggers (e.g., < 95%)</td></tr>
|
|
115
|
+
</tbody>
|
|
116
|
+
</table>
|
|
117
|
+
|
|
118
|
+
<h3 id="a2i-built-in"><strong>2.3. Built-in A2I Integrations</strong></h3>
|
|
119
|
+
|
|
120
|
+
<table>
|
|
121
|
+
<thead><tr><th>Service</th><th>A2I Use Case</th></tr></thead>
|
|
122
|
+
<tbody>
|
|
123
|
+
<tr><td><strong>Amazon Textract</strong></td><td>Review low-confidence document extractions</td></tr>
|
|
124
|
+
<tr><td><strong>Amazon Rekognition</strong></td><td>Review low-confidence content moderation</td></tr>
|
|
125
|
+
<tr><td><strong>Custom ML models</strong></td><td>Any SageMaker model can trigger A2I</td></tr>
|
|
126
|
+
</tbody>
|
|
127
|
+
</table>
|
|
128
|
+
|
|
129
|
+
<blockquote>
|
|
130
|
+
<p><strong>Exam tip:</strong> "A healthcare company needs a human to review AI diagnoses when the model is less than 90% confident" → <strong>Amazon A2I</strong> with activation condition set to confidence < 90%.</p>
|
|
131
|
+
</blockquote>
|
|
132
|
+
|
|
133
|
+
<h2 id="guardrails-deep"><strong>3. Amazon Bedrock Guardrails — Deep Dive</strong></h2>
|
|
134
|
+
|
|
135
|
+
<h3 id="guardrails-policies"><strong>3.1. Guardrail Policies</strong></h3>
|
|
136
|
+
|
|
137
|
+
<table>
|
|
138
|
+
<thead><tr><th>Policy</th><th>How it works</th><th>Configuration</th></tr></thead>
|
|
139
|
+
<tbody>
|
|
140
|
+
<tr><td><strong>Content filters</strong></td><td>Block by category + severity</td><td>None / Low / Medium / High for each category (Hate, Insults, Sexual, Violence, Misconduct)</td></tr>
|
|
141
|
+
<tr><td><strong>Denied topics</strong></td><td>Define topics to block</td><td>Natural language description + sample phrases</td></tr>
|
|
142
|
+
<tr><td><strong>Word filters</strong></td><td>Block specific words</td><td>Custom word/phrase list + profanity filter toggle</td></tr>
|
|
143
|
+
<tr><td><strong>Sensitive info (PII)</strong></td><td>Detect PII with action</td><td>BLOCK or ANONYMIZE for each PII type (SSN, email, phone, name, address, ...)</td></tr>
|
|
144
|
+
<tr><td><strong>Contextual grounding</strong></td><td>Check if answer is grounded</td><td>Grounding threshold (0-1) + relevance threshold</td></tr>
|
|
145
|
+
</tbody>
|
|
146
|
+
</table>
|
|
147
|
+
|
|
148
|
+
<h3 id="guardrails-flow"><strong>3.2. How Guardrails Process Requests</strong></h3>
|
|
149
|
+
|
|
150
|
+
<pre><code class="language-text">User Input
|
|
151
|
+
↓
|
|
152
|
+
[INPUT GUARDRAILS]
|
|
153
|
+
├── Content filter check
|
|
154
|
+
├── Denied topic check
|
|
155
|
+
├── Word filter check
|
|
156
|
+
├── PII detection → BLOCK or ANONYMIZE
|
|
157
|
+
↓ (if passes all checks)
|
|
158
|
+
Foundation Model generates response
|
|
159
|
+
↓
|
|
160
|
+
[OUTPUT GUARDRAILS]
|
|
161
|
+
├── Content filter check
|
|
162
|
+
├── Denied topic check
|
|
163
|
+
├── Word filter check
|
|
164
|
+
├── PII detection → BLOCK or ANONYMIZE
|
|
165
|
+
├── Contextual grounding check
|
|
166
|
+
↓ (if passes all checks)
|
|
167
|
+
Response returned to user
|
|
168
|
+
|
|
169
|
+
If blocked → Return configured "blocked" message
|
|
170
|
+
</code></pre>
|
|
171
|
+
|
|
172
|
+
<h3 id="guardrails-vs-system"><strong>3.3. Guardrails vs System Prompts</strong></h3>
|
|
173
|
+
|
|
174
|
+
<table>
|
|
175
|
+
<thead><tr><th>Aspect</th><th>System Prompt</th><th>Guardrails</th></tr></thead>
|
|
176
|
+
<tbody>
|
|
177
|
+
<tr><td><strong>Enforcement</strong></td><td>Soft — model may ignore</td><td>Hard — enforced by the platform</td></tr>
|
|
178
|
+
<tr><td><strong>Bypass risk</strong></td><td>Can be bypassed via prompt injection</td><td>Cannot be bypassed by prompts</td></tr>
|
|
179
|
+
<tr><td><strong>PII handling</strong></td><td>Model asked to not output PII</td><td>Programmatic detection & redaction</td></tr>
|
|
180
|
+
<tr><td><strong>Auditability</strong></td><td>Limited</td><td>Full logging and metrics</td></tr>
|
|
181
|
+
</tbody>
|
|
182
|
+
</table>
|
|
183
|
+
|
|
184
|
+
<blockquote>
|
|
185
|
+
<p><strong>Exam tip:</strong> "A company needs to GUARANTEE that PII is never in model responses" → <strong>Bedrock Guardrails</strong> (not system prompts, which can be bypassed).</p>
|
|
186
|
+
</blockquote>
|
|
187
|
+
|
|
188
|
+
<h2 id="content-moderation"><strong>4. Content Moderation on AWS</strong></h2>
|
|
189
|
+
|
|
190
|
+
<table>
|
|
191
|
+
<thead><tr><th>Service</th><th>Content Type</th><th>Use Case</th></tr></thead>
|
|
192
|
+
<tbody>
|
|
193
|
+
<tr><td><strong>Amazon Rekognition</strong></td><td>Images & Video</td><td>Detect inappropriate content, faces, text</td></tr>
|
|
194
|
+
<tr><td><strong>Amazon Comprehend</strong></td><td>Text</td><td>Toxicity detection, sentiment analysis</td></tr>
|
|
195
|
+
<tr><td><strong>Bedrock Guardrails</strong></td><td>FM input/output</td><td>Filter harmful content in GenAI apps</td></tr>
|
|
196
|
+
<tr><td><strong>Amazon A2I</strong></td><td>Any</td><td>Human review for edge cases</td></tr>
|
|
197
|
+
</tbody>
|
|
198
|
+
</table>
|
|
199
|
+
|
|
200
|
+
<h2 id="governance"><strong>5. AI Governance</strong></h2>
|
|
201
|
+
|
|
202
|
+
<h3 id="governance-framework"><strong>5.1. Governance Framework</strong></h3>
|
|
203
|
+
|
|
204
|
+
<table>
|
|
205
|
+
<thead><tr><th>Area</th><th>What to implement</th></tr></thead>
|
|
206
|
+
<tbody>
|
|
207
|
+
<tr><td><strong>Policy</strong></td><td>Organization-wide AI ethics guidelines</td></tr>
|
|
208
|
+
<tr><td><strong>Risk assessment</strong></td><td>Evaluate risks before deploying AI systems</td></tr>
|
|
209
|
+
<tr><td><strong>Monitoring</strong></td><td>Continuous monitoring for bias, performance drift</td></tr>
|
|
210
|
+
<tr><td><strong>Audit trail</strong></td><td>Log all model decisions for accountability</td></tr>
|
|
211
|
+
<tr><td><strong>Human oversight</strong></td><td>Human-in-the-loop for high-stakes decisions</td></tr>
|
|
212
|
+
<tr><td><strong>Documentation</strong></td><td>Model cards, AI Service Cards</td></tr>
|
|
213
|
+
</tbody>
|
|
214
|
+
</table>
|
|
215
|
+
|
|
216
|
+
<h3 id="sagemaker-governance"><strong>5.2. SageMaker ML Governance</strong></h3>
|
|
217
|
+
|
|
218
|
+
<ul>
|
|
219
|
+
<li><strong>SageMaker Model Cards</strong>: Document model details and intended use</li>
|
|
220
|
+
<li><strong>SageMaker Model Dashboard</strong>: Centralized view of all model status</li>
|
|
221
|
+
<li><strong>SageMaker Model Monitor</strong>: Detect data drift, model quality degradation</li>
|
|
222
|
+
<li><strong>SageMaker Role Manager</strong>: Fine-grained access control for ML</li>
|
|
223
|
+
</ul>
|
|
224
|
+
|
|
225
|
+
<h2 id="practice-questions"><strong>6. Practice Questions</strong></h2>
|
|
226
|
+
|
|
227
|
+
<p><strong>Q1:</strong> An insurance company wants to ensure their claim approval model treats customers of all ages fairly. Which AWS service should they use to detect age-based bias in the model's predictions?</p>
|
|
228
|
+
<ul>
|
|
229
|
+
<li>A) Amazon Rekognition</li>
|
|
230
|
+
<li>B) Amazon SageMaker Clarify ✓</li>
|
|
231
|
+
<li>C) Amazon Bedrock Guardrails</li>
|
|
232
|
+
<li>D) Amazon Comprehend</li>
|
|
233
|
+
</ul>
|
|
234
|
+
<p><em>Explanation: SageMaker Clarify can run post-training bias analysis comparing model predictions across age groups, using metrics like Disparate Impact and Accuracy Difference.</em></p>
|
|
235
|
+
|
|
236
|
+
<p><strong>Q2:</strong> A document processing application using Amazon Textract needs human review when the extracted data has low confidence. Which AWS service provides this capability?</p>
|
|
237
|
+
<ul>
|
|
238
|
+
<li>A) Amazon SageMaker Ground Truth</li>
|
|
239
|
+
<li>B) Amazon Augmented AI (A2I) ✓</li>
|
|
240
|
+
<li>C) Amazon Mechanical Turk directly</li>
|
|
241
|
+
<li>D) Amazon Bedrock Agents</li>
|
|
242
|
+
</ul>
|
|
243
|
+
<p><em>Explanation: Amazon A2I has built-in integration with Amazon Textract and can automatically trigger human review workflows when extraction confidence falls below a defined threshold.</em></p>
|
|
244
|
+
|
|
245
|
+
<p><strong>Q3:</strong> A chatbot must NEVER reveal customer credit card numbers in its responses, even if the data exists in the knowledge base. Which approach provides the STRONGEST guarantee?</p>
|
|
246
|
+
<ul>
|
|
247
|
+
<li>A) Add "never output credit card numbers" to the system prompt</li>
|
|
248
|
+
<li>B) Fine-tune the model to not output PII</li>
|
|
249
|
+
<li>C) Use Amazon Bedrock Guardrails with PII filters set to BLOCK ✓</li>
|
|
250
|
+
<li>D) Remove credit card numbers from the knowledge base</li>
|
|
251
|
+
</ul>
|
|
252
|
+
<p><em>Explanation: Bedrock Guardrails with PII filters provide programmatic detection and blocking of credit card numbers in both input and output — this cannot be bypassed by prompt injection, unlike system prompts.</em></p>
|