@xdev-asia/xdev-knowledge-mcp 1.0.40 → 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.
Files changed (19) hide show
  1. 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
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. package/content/series/luyen-thi/luyen-thi-aws-ai-practitioner/index.md +257 -0
  14. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/index.md +240 -0
  15. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/index.md +225 -0
  16. package/data/categories.json +16 -4
  17. package/data/quizzes.json +764 -0
  18. package/data/settings.json +2 -1
  19. package/package.json +1 -1
@@ -0,0 +1,218 @@
1
+ ---
2
+ id: 019c9619-lt01-d2-l03
3
+ title: 'Bài 3: Generative AI & Foundation Models'
4
+ slug: bai-3-generative-ai-foundation-models
5
+ description: >-
6
+ Generative AI là gì. Foundation Models: pre-training, fine-tuning.
7
+ Types: text-to-text, text-to-image, text-to-code. Tokenization.
8
+ Model parameters, inference, temperature, top-p, top-k.
9
+ duration_minutes: 60
10
+ is_free: true
11
+ video_url: null
12
+ sort_order: 1
13
+ section_title: "Domain 2: Fundamentals of Generative AI (24%)"
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-bai3-foundation-model-lifecycle.png" alt="Foundation Model Lifecycle" style="max-width: 800px; width: 100%; border-radius: 12px;" />
22
+ <p><em>Foundation Model Lifecycle — Pre-training, Fine-tuning, RAG và Prompt Engineering</em></p>
23
+ </div>
24
+
25
+ <h2 id="overview"><strong>Tổng quan Domain 2</strong></h2>
26
+
27
+ <p>Domain 2 chiếm <strong>24% đề thi</strong> — đây là domain lớn thứ hai. Bạn cần hiểu rõ Generative AI, Foundation Models, và cách chúng khác biệt so với traditional ML.</p>
28
+
29
+ <h2 id="what-is-genai"><strong>1. What is Generative AI?</strong></h2>
30
+
31
+ <p><strong>Generative AI</strong> là nhánh của AI tập trung vào việc <strong>tạo nội dung mới</strong> (text, images, code, audio, video) dựa trên patterns học được từ training data.</p>
32
+
33
+ <h3 id="discriminative-vs-generative"><strong>Discriminative vs Generative AI</strong></h3>
34
+
35
+ <table>
36
+ <thead><tr><th>Aspect</th><th>Discriminative AI</th><th>Generative AI</th></tr></thead>
37
+ <tbody>
38
+ <tr><td><strong>What it does</strong></td><td>Classify / predict</td><td>Create / generate</td></tr>
39
+ <tr><td><strong>Output</strong></td><td>Label, category, number</td><td>New content (text, image, code)</td></tr>
40
+ <tr><td><strong>Example</strong></td><td>"Is this email spam?" → Yes/No</td><td>"Write an email about..." → New email</td></tr>
41
+ <tr><td><strong>Models</strong></td><td>Logistic Regression, SVM, CNN classifier</td><td>GPT, Claude, Stable Diffusion, DALL-E</td></tr>
42
+ </tbody>
43
+ </table>
44
+
45
+ <h3 id="genai-modalities"><strong>Generative AI Modalities</strong></h3>
46
+
47
+ <table>
48
+ <thead><tr><th>Input → Output</th><th>Examples</th><th>Models</th></tr></thead>
49
+ <tbody>
50
+ <tr><td><strong>Text → Text</strong></td><td>Chatbot, summarization, translation</td><td>GPT-4, Claude, Llama</td></tr>
51
+ <tr><td><strong>Text → Image</strong></td><td>Image generation from description</td><td>DALL-E, Stable Diffusion, Titan Image Generator</td></tr>
52
+ <tr><td><strong>Text → Code</strong></td><td>Code generation, debugging</td><td>CodeWhisperer, Copilot</td></tr>
53
+ <tr><td><strong>Text → Audio</strong></td><td>Speech synthesis, music generation</td><td>Amazon Polly (TTS)</td></tr>
54
+ <tr><td><strong>Image → Text</strong></td><td>Image captioning, visual Q&A</td><td>Claude (multi-modal), GPT-4V</td></tr>
55
+ <tr><td><strong>Audio → Text</strong></td><td>Transcription</td><td>Amazon Transcribe, Whisper</td></tr>
56
+ </tbody>
57
+ </table>
58
+
59
+ <h2 id="foundation-models"><strong>2. Foundation Models</strong></h2>
60
+
61
+ <p><strong>Foundation Model (FM)</strong> là model AI cực lớn, được <strong>pre-trained trên massive datasets</strong>, có thể adapt cho nhiều downstream tasks khác nhau.</p>
62
+
63
+ <h3 id="fm-characteristics"><strong>Key Characteristics</strong></h3>
64
+
65
+ <ul>
66
+ <li><strong>Large-scale pre-training</strong>: Trained on billions of data points (text from internet, books, code)</li>
67
+ <li><strong>General-purpose</strong>: Can handle multiple tasks without task-specific training</li>
68
+ <li><strong>Adaptable</strong>: Can be fine-tuned or prompted for specific use cases</li>
69
+ <li><strong>Expensive to train</strong>: Requires massive compute (GPU/TPU clusters)</li>
70
+ <li><strong>Accessible via API</strong>: Users don't need to train — use through APIs (Amazon Bedrock)</li>
71
+ </ul>
72
+
73
+ <h3 id="fm-lifecycle"><strong>Foundation Model Lifecycle</strong></h3>
74
+
75
+ <pre><code class="language-text">┌─────────────────┐ ┌──────────────┐ ┌──────────────┐
76
+ │ 1. Pre-training │────→│ 2. Fine- │────→│ 3. Inference │
77
+ │ (Massive data, │ │ tuning │ │ (Use model │
78
+ │ Billion params,│ │ (Adapt to │ │ via API or │
79
+ │ Very expensive)│ │ specific │ │ endpoint) │
80
+ │ │ │ domain) │ │ │
81
+ └─────────────────┘ └──────────────┘ └──────────────┘
82
+ Model Provider You/Org Users
83
+ (Anthropic, Meta, (Applications)
84
+ Amazon, etc.)
85
+ </code></pre>
86
+
87
+ <h2 id="tokenization"><strong>3. Tokenization</strong></h2>
88
+
89
+ <p><strong>Tokenization</strong> là quá trình chia text thành các đơn vị nhỏ (<strong>tokens</strong>) mà model hiểu được.</p>
90
+
91
+ <pre><code class="language-text">Input: "Machine learning is amazing!"
92
+ Tokens: ["Machine", " learning", " is", " amazing", "!"]
93
+ token_1 token_2 token_3 token_4 token_5
94
+
95
+ OR (subword tokenization):
96
+ Tokens: ["Mach", "ine", " learn", "ing", " is", " amaz", "ing", "!"]
97
+ </code></pre>
98
+
99
+ <h3 id="token-key-points"><strong>Key Concepts for Exam:</strong></h3>
100
+
101
+ <ul>
102
+ <li><strong>Token ≠ word</strong>: A token can be part of a word, a whole word, or punctuation</li>
103
+ <li><strong>Context window</strong>: Maximum number of tokens a model can process at once (input + output)</li>
104
+ <li><strong>Token limit</strong>: Determines how much text the model can "see" and generate</li>
105
+ <li><strong>Pricing</strong>: API calls are typically priced per token (input tokens + output tokens)</li>
106
+ </ul>
107
+
108
+ <blockquote>
109
+ <p><strong>Exam tip:</strong> Context window size matters. Larger context = can process longer documents. But costs more and may be slower.</p>
110
+ </blockquote>
111
+
112
+ <h2 id="model-parameters"><strong>4. Model Parameters & Inference Settings</strong></h2>
113
+
114
+ <h3 id="model-params"><strong>4.1. Model Parameters (Learned during training)</strong></h3>
115
+
116
+ <ul>
117
+ <li><strong>Parameters</strong> = weights and biases trong neural network</li>
118
+ <li>GPT-4: ~1.7 trillion parameters, Claude: undisclosed, Llama 3: 8B/70B/405B</li>
119
+ <li>More parameters → generally more capable, but more expensive</li>
120
+ </ul>
121
+
122
+ <h3 id="inference-params"><strong>4.2. Inference Parameters (Set by user)</strong></h3>
123
+
124
+ <p>Khi gọi model, bạn có thể điều chỉnh các <strong>inference parameters</strong>:</p>
125
+
126
+ <table>
127
+ <thead><tr><th>Parameter</th><th>Range</th><th>What it controls</th></tr></thead>
128
+ <tbody>
129
+ <tr><td><strong>Temperature</strong></td><td>0.0 → 1.0+</td><td>Randomness/creativity. Low = deterministic, focused. High = creative, diverse.</td></tr>
130
+ <tr><td><strong>Top-p (Nucleus)</strong></td><td>0.0 → 1.0</td><td>Cumulative probability threshold. Lower = more focused vocabulary.</td></tr>
131
+ <tr><td><strong>Top-k</strong></td><td>1 → ∞</td><td>Number of top tokens to consider. Lower = more predictable.</td></tr>
132
+ <tr><td><strong>Max tokens</strong></td><td>1 → limit</td><td>Maximum length of generated output.</td></tr>
133
+ <tr><td><strong>Stop sequences</strong></td><td>strings</td><td>Text that tells model to stop generating.</td></tr>
134
+ </tbody>
135
+ </table>
136
+
137
+ <h3 id="temperature-guide"><strong>Temperature Guide for Exam</strong></h3>
138
+
139
+ <pre><code class="language-text">Temperature = 0 → Most deterministic (factual Q&A, code, data extraction)
140
+ Temperature = 0.3 → Slightly creative (business writing, summaries)
141
+ Temperature = 0.7 → Creative (stories, brainstorming, marketing copy)
142
+ Temperature = 1.0+ → Very random (poetry, creative writing — may hallucinate more)
143
+ </code></pre>
144
+
145
+ <blockquote>
146
+ <p><strong>Exam tip:</strong> "A company needs consistent, accurate answers for customer FAQ" → use <strong>low temperature</strong>. "A company wants creative marketing slogans" → use <strong>high temperature</strong>.</p>
147
+ </blockquote>
148
+
149
+ <h2 id="hallucination"><strong>5. Hallucination</strong></h2>
150
+
151
+ <p><strong>Hallucination</strong> là khi model tạo ra output <strong>confident nhưng incorrect</strong> — bịa ra facts, citations, hoặc thông tin không tồn tại.</p>
152
+
153
+ <h3 id="hallucination-causes"><strong>Causes:</strong></h3>
154
+ <ul>
155
+ <li>Training data gaps or outdated information</li>
156
+ <li>Model doesn't truly "know" facts — it predicts likely next tokens</li>
157
+ <li>Ambiguous or too-open prompts</li>
158
+ <li>High temperature settings</li>
159
+ </ul>
160
+
161
+ <h3 id="hallucination-mitigation"><strong>Mitigation Strategies:</strong></h3>
162
+ <table>
163
+ <thead><tr><th>Strategy</th><th>How it helps</th></tr></thead>
164
+ <tbody>
165
+ <tr><td><strong>RAG</strong> (Retrieval-Augmented Generation)</td><td>Ground responses in actual data from knowledge base</td></tr>
166
+ <tr><td><strong>Lower temperature</strong></td><td>Reduce randomness in generation</td></tr>
167
+ <tr><td><strong>Guardrails</strong></td><td>Filter/validate outputs (Amazon Bedrock Guardrails)</td></tr>
168
+ <tr><td><strong>Better prompts</strong></td><td>"Only answer based on provided context" / "Say I don't know if unsure"</td></tr>
169
+ <tr><td><strong>Fine-tuning</strong></td><td>Train model on domain-specific accurate data</td></tr>
170
+ <tr><td><strong>Human review</strong></td><td>Human-in-the-loop validation</td></tr>
171
+ </tbody>
172
+ </table>
173
+
174
+ <h2 id="fm-on-aws"><strong>6. Foundation Models on AWS (Amazon Bedrock)</strong></h2>
175
+
176
+ <p>Amazon Bedrock cung cấp access đến nhiều Foundation Models từ các providers:</p>
177
+
178
+ <table>
179
+ <thead><tr><th>Provider</th><th>Models</th><th>Strengths</th></tr></thead>
180
+ <tbody>
181
+ <tr><td><strong>Anthropic</strong></td><td>Claude 3 (Haiku, Sonnet, Opus)</td><td>Reasoning, safety, long context</td></tr>
182
+ <tr><td><strong>Meta</strong></td><td>Llama 3</td><td>Open-source, versatile</td></tr>
183
+ <tr><td><strong>Amazon</strong></td><td>Titan (Text, Embeddings, Image)</td><td>AWS-native, embeddings for RAG</td></tr>
184
+ <tr><td><strong>Mistral AI</strong></td><td>Mistral, Mixtral</td><td>Efficient, fast inference</td></tr>
185
+ <tr><td><strong>Stability AI</strong></td><td>Stable Diffusion</td><td>Image generation</td></tr>
186
+ <tr><td><strong>Cohere</strong></td><td>Command, Embed</td><td>Enterprise NLP, embeddings</td></tr>
187
+ <tr><td><strong>AI21 Labs</strong></td><td>Jurassic</td><td>Text generation</td></tr>
188
+ </tbody>
189
+ </table>
190
+
191
+ <h2 id="practice-questions"><strong>7. Practice Questions</strong></h2>
192
+
193
+ <p><strong>Q1:</strong> What is the PRIMARY advantage of Foundation Models compared to traditional ML models?</p>
194
+ <ul>
195
+ <li>A) They are smaller and faster</li>
196
+ <li>B) They can be adapted to multiple downstream tasks without task-specific training ✓</li>
197
+ <li>C) They never produce incorrect outputs</li>
198
+ <li>D) They don't require any compute resources</li>
199
+ </ul>
200
+ <p><em>Explanation: Foundation Models are pre-trained on massive datasets and can be adapted (via prompting or fine-tuning) for many different tasks. They are large, can hallucinate, and still require compute.</em></p>
201
+
202
+ <p><strong>Q2:</strong> A company uses a generative AI model and notices it sometimes generates plausible but factually incorrect information. What is this phenomenon called?</p>
203
+ <ul>
204
+ <li>A) Overfitting</li>
205
+ <li>B) Data drift</li>
206
+ <li>C) Hallucination ✓</li>
207
+ <li>D) Bias</li>
208
+ </ul>
209
+ <p><em>Explanation: Hallucination is when a generative AI model produces confident but factually incorrect outputs.</em></p>
210
+
211
+ <p><strong>Q3:</strong> A developer wants to ensure their generative AI chatbot provides consistent, factual answers with minimal creativity. Which inference parameter should they adjust?</p>
212
+ <ul>
213
+ <li>A) Set max tokens to a very high value</li>
214
+ <li>B) Set temperature close to 0 ✓</li>
215
+ <li>C) Set temperature close to 1</li>
216
+ <li>D) Increase the top-k value</li>
217
+ </ul>
218
+ <p><em>Explanation: Low temperature makes the model more deterministic and focused, reducing creativity and randomness in responses.</em></p>
@@ -0,0 +1,232 @@
1
+ ---
2
+ id: 019c9619-lt01-d2-l04
3
+ title: 'Bài 4: LLMs, Transformers & Multi-modal Models'
4
+ slug: bai-4-llm-transformers-multimodal
5
+ description: >-
6
+ Transformer architecture: attention mechanism, self-attention.
7
+ GPT (decoder-only), BERT (encoder-only), T5 (encoder-decoder).
8
+ Multi-modal models. Hallucination: causes and mitigation.
9
+ Embeddings và vector representations.
10
+ duration_minutes: 60
11
+ is_free: true
12
+ video_url: null
13
+ sort_order: 2
14
+ section_title: "Domain 2: Fundamentals of Generative AI (24%)"
15
+ course:
16
+ id: 019c9619-lt01-7001-c001-lt0100000001
17
+ title: 'Luyện thi AWS Certified AI Practitioner (AIF-C01)'
18
+ slug: luyen-thi-aws-ai-practitioner
19
+ ---
20
+
21
+ <div style="text-align: center; margin: 2rem 0;">
22
+ <img src="/storage/uploads/2026/04/aws-aif-bai4-transformer-architecture.png" alt="Transformer Architecture" style="max-width: 800px; width: 100%; border-radius: 12px;" />
23
+ <p><em>Transformer Architecture — Encoder stack, Decoder stack và các biến thể BERT/GPT/T5</em></p>
24
+ </div>
25
+
26
+ <h2 id="transformer"><strong>1. Transformer Architecture</strong></h2>
27
+
28
+ <p>Transformer là kiến trúc neural network đã <strong>cách mạng hoá NLP</strong>, được giới thiệu trong paper "Attention Is All You Need" (2017). Hầu hết LLMs hiện tại đều dựa trên Transformer.</p>
29
+
30
+ <h3 id="attention"><strong>1.1. Self-Attention Mechanism</strong></h3>
31
+
32
+ <p>Self-attention cho phép model xem xét <strong>mối quan hệ giữa tất cả các từ</strong> trong input, bất kể khoảng cách.</p>
33
+
34
+ <pre><code class="language-text">Input: "The cat sat on the mat because it was tired"
35
+
36
+ Self-attention answers: What does "it" refer to?
37
+ → Attends to "cat" (high attention score)
38
+ → Not "mat" (low attention score)
39
+
40
+ Traditional RNN would struggle with this long-range dependency.
41
+ </code></pre>
42
+
43
+ <h3 id="encoder-decoder"><strong>1.2. Encoder-Decoder Architecture</strong></h3>
44
+
45
+ <pre><code class="language-text">Original Transformer:
46
+ ┌──────────────────────────┐
47
+ │ ENCODER │ ← Understands input
48
+ │ (Self-Attention + │
49
+ │ Feed-Forward layers) │
50
+ ├──────────────────────────┤
51
+ │ DECODER │ ← Generates output
52
+ │ (Masked Self-Attention +│
53
+ │ Cross-Attention + │
54
+ │ Feed-Forward layers) │
55
+ └──────────────────────────┘
56
+ </code></pre>
57
+
58
+ <h3 id="transformer-types"><strong>1.3. Three Types of Transformers</strong></h3>
59
+
60
+ <table>
61
+ <thead><tr><th>Type</th><th>Architecture</th><th>Best For</th><th>Models</th></tr></thead>
62
+ <tbody>
63
+ <tr><td><strong>Encoder-only</strong></td><td>Encoder</td><td>Understanding text (classification, NER, sentiment)</td><td>BERT, RoBERTa, DistilBERT</td></tr>
64
+ <tr><td><strong>Decoder-only</strong></td><td>Decoder</td><td>Generating text (chatbot, content creation)</td><td>GPT-4, Claude, Llama</td></tr>
65
+ <tr><td><strong>Encoder-Decoder</strong></td><td>Both</td><td>Sequence-to-sequence (translation, summarization)</td><td>T5, BART</td></tr>
66
+ </tbody>
67
+ </table>
68
+
69
+ <blockquote>
70
+ <p><strong>Exam tip:</strong> "Which architecture is best for text generation?" → <strong>Decoder-only</strong> (GPT, Claude). "Which architecture is best for text classification?" → <strong>Encoder-only</strong> (BERT).</p>
71
+ </blockquote>
72
+
73
+ <h2 id="llm"><strong>2. Large Language Models (LLMs)</strong></h2>
74
+
75
+ <p>LLMs là Foundation Models specifically для text — trained on massive text corpora to understand and generate human language.</p>
76
+
77
+ <h3 id="llm-capabilities"><strong>2.1. LLM Capabilities</strong></h3>
78
+
79
+ <table>
80
+ <thead><tr><th>Capability</th><th>Description</th><th>Example</th></tr></thead>
81
+ <tbody>
82
+ <tr><td><strong>Text Generation</strong></td><td>Create new text content</td><td>Articles, emails, stories</td></tr>
83
+ <tr><td><strong>Summarization</strong></td><td>Condense long text</td><td>Document summaries</td></tr>
84
+ <tr><td><strong>Translation</strong></td><td>Convert between languages</td><td>English → Vietnamese</td></tr>
85
+ <tr><td><strong>Q&A</strong></td><td>Answer questions</td><td>Customer support, FAQ</td></tr>
86
+ <tr><td><strong>Code Generation</strong></td><td>Write and explain code</td><td>Amazon Q Developer</td></tr>
87
+ <tr><td><strong>Text Classification</strong></td><td>Categorize text</td><td>Sentiment analysis</td></tr>
88
+ <tr><td><strong>Reasoning</strong></td><td>Logical analysis</td><td>Math problems, step-by-step reasoning</td></tr>
89
+ </tbody>
90
+ </table>
91
+
92
+ <h3 id="llm-limitations"><strong>2.2. LLM Limitations</strong></h3>
93
+
94
+ <ul>
95
+ <li><strong>Knowledge cutoff</strong>: Doesn't know events after training data cutoff date</li>
96
+ <li><strong>Hallucination</strong>: Can generate false information confidently</li>
97
+ <li><strong>Context window limit</strong>: Can't process unlimited text</li>
98
+ <li><strong>No real-time data</strong>: Can't access internet or live data (unless augmented)</li>
99
+ <li><strong>Expensive</strong>: Large models need significant compute for inference</li>
100
+ <li><strong>Bias</strong>: Can reflect biases in training data</li>
101
+ </ul>
102
+
103
+ <h2 id="embeddings"><strong>3. Embeddings & Vector Representations</strong></h2>
104
+
105
+ <p><strong>Embeddings</strong> biến text (hoặc images, audio) thành <strong>numerical vectors</strong> mà machines hiểu được. Các text có ý nghĩa tương tự sẽ có vectors gần nhau trong không gian nhiều chiều.</p>
106
+
107
+ <pre><code class="language-text">Text: "King" → [0.23, 0.87, -0.12, 0.45, ...]
108
+ Text: "Queen" → [0.21, 0.89, -0.15, 0.43, ...] ← Close vectors!
109
+ Text: "Banana" → [0.91, -0.32, 0.67, -0.88, ...] ← Far away
110
+
111
+ Relationship: King - Man + Woman ≈ Queen
112
+ </code></pre>
113
+
114
+ <h3 id="embeddings-use"><strong>Why Embeddings Matter for the Exam:</strong></h3>
115
+
116
+ <ul>
117
+ <li><strong>Semantic search</strong>: Find similar documents based on meaning (not just keywords)</li>
118
+ <li><strong>RAG</strong>: Convert documents to embeddings, store in vector DB, retrieve relevant context</li>
119
+ <li><strong>Clustering</strong>: Group similar documents/sentences</li>
120
+ <li><strong>Amazon Titan Embeddings</strong>: AWS model specifically for creating text embeddings</li>
121
+ </ul>
122
+
123
+ <h3 id="vector-db"><strong>Vector Databases</strong></h3>
124
+
125
+ <p>Store and search embeddings efficiently:</p>
126
+
127
+ <table>
128
+ <thead><tr><th>Vector DB</th><th>Notes</th></tr></thead>
129
+ <tbody>
130
+ <tr><td><strong>Amazon OpenSearch Serverless</strong></td><td>AWS-managed vector search</td></tr>
131
+ <tr><td><strong>Amazon Aurora (pgvector)</strong></td><td>PostgreSQL with vector extension</td></tr>
132
+ <tr><td><strong>Pinecone</strong></td><td>Popular third-party vector DB</td></tr>
133
+ <tr><td><strong>Amazon Bedrock Knowledge Bases</strong></td><td>Managed RAG — handles vector storage internally</td></tr>
134
+ </tbody>
135
+ </table>
136
+
137
+ <h2 id="multimodal"><strong>4. Multi-modal Models</strong></h2>
138
+
139
+ <p><strong>Multi-modal models</strong> có thể xử lý và tạo nội dung từ <strong>nhiều loại data types</strong> (text + images + audio + video).</p>
140
+
141
+ <h3 id="multimodal-examples"><strong>Examples on AWS:</strong></h3>
142
+
143
+ <table>
144
+ <thead><tr><th>Model</th><th>Modalities</th><th>What it can do</th></tr></thead>
145
+ <tbody>
146
+ <tr><td><strong>Claude 3</strong> (Anthropic)</td><td>Text + Image input → Text output</td><td>Describe images, analyze charts, visual Q&A</td></tr>
147
+ <tr><td><strong>Amazon Titan Image Generator</strong></td><td>Text → Image</td><td>Create images from text descriptions</td></tr>
148
+ <tr><td><strong>Amazon Titan Multimodal Embeddings</strong></td><td>Text + Image → Vectors</td><td>Search across text and images</td></tr>
149
+ <tr><td><strong>Stable Diffusion</strong> (Stability AI)</td><td>Text → Image</td><td>Generate and edit images</td></tr>
150
+ </tbody>
151
+ </table>
152
+
153
+ <h3 id="multimodal-usecases"><strong>Multi-modal Use Cases for Exam:</strong></h3>
154
+
155
+ <ul>
156
+ <li>"Analyze product images and generate descriptions" → Multi-modal model (Claude 3 Vision)</li>
157
+ <li>"Generate product images from text descriptions" → Text-to-image (Titan Image Generator, Stable Diffusion)</li>
158
+ <li>"Search across both text documents and images" → Multi-modal embeddings</li>
159
+ </ul>
160
+
161
+ <h2 id="diffusion"><strong>5. Diffusion Models</strong></h2>
162
+
163
+ <p>Diffusion models (như Stable Diffusion) hoạt động bằng cách:</p>
164
+
165
+ <ol>
166
+ <li><strong>Forward process</strong>: Gradually add noise to an image until it becomes pure noise</li>
167
+ <li><strong>Reverse process</strong>: Learn to remove noise step by step, generating a new image</li>
168
+ </ol>
169
+
170
+ <pre><code class="language-text">Training (Forward):
171
+ Clean Image → Add Noise → Add More Noise → ... → Pure Noise
172
+
173
+ Generation (Reverse):
174
+ Pure Noise → Remove Noise → Remove More Noise → ... → New Image
175
+ (guided by text prompt)
176
+ </code></pre>
177
+
178
+ <blockquote>
179
+ <p><strong>Exam tip:</strong> Bạn không cần biết math chi tiết, chỉ cần hiểu concept: diffusion models tạo images bằng cách <strong>từ từ khử noise có guided bởi text prompt</strong>.</p>
180
+ </blockquote>
181
+
182
+ <h2 id="training-types"><strong>6. Pre-training vs Fine-tuning vs Prompting</strong></h2>
183
+
184
+ <table>
185
+ <thead><tr><th>Method</th><th>What</th><th>Data Needed</th><th>Cost</th><th>When to Use</th></tr></thead>
186
+ <tbody>
187
+ <tr><td><strong>Pre-training</strong></td><td>Train from scratch</td><td>Billions of examples</td><td>$$$$</td><td>Creating new FM (done by providers)</td></tr>
188
+ <tr><td><strong>Fine-tuning</strong></td><td>Further train existing FM</td><td>Thousands of examples</td><td>$$</td><td>Domain-specific knowledge</td></tr>
189
+ <tr><td><strong>Prompt Engineering</strong></td><td>Craft better inputs</td><td>None (few examples)</td><td>$</td><td>Quick adaptation, no training needed</td></tr>
190
+ <tr><td><strong>RAG</strong></td><td>Augment with external data</td><td>Knowledge base</td><td>$</td><td>Access current/proprietary data</td></tr>
191
+ </tbody>
192
+ </table>
193
+
194
+ <h3 id="decision-tree"><strong>Decision Tree for Exam:</strong></h3>
195
+
196
+ <pre><code class="language-text">Need the model to know specific domain knowledge?
197
+ ├── Is the knowledge in documents you can provide?
198
+ │ └── YES → RAG (Bedrock Knowledge Bases)
199
+ │ └── NO, model needs to learn patterns →
200
+ │ ├── Have thousands of training examples? → Fine-tuning
201
+ │ └── Only a few examples? → Few-shot prompting
202
+ ├── General knowledge is enough? → Prompt Engineering (zero/few-shot)
203
+ </code></pre>
204
+
205
+ <h2 id="practice-questions"><strong>7. Practice Questions</strong></h2>
206
+
207
+ <p><strong>Q1:</strong> A company wants to search for relevant information across both product images and text descriptions. Which type of model would be MOST suitable?</p>
208
+ <ul>
209
+ <li>A) A text-only LLM</li>
210
+ <li>B) A multi-modal embedding model ✓</li>
211
+ <li>C) A diffusion model</li>
212
+ <li>D) A RNN model</li>
213
+ </ul>
214
+ <p><em>Explanation: Multi-modal embedding models can create vector representations of both text and images in the same vector space, enabling cross-modal search.</em></p>
215
+
216
+ <p><strong>Q2:</strong> Which Transformer architecture is BEST suited for text generation tasks such as chatbots and content creation?</p>
217
+ <ul>
218
+ <li>A) Encoder-only (BERT)</li>
219
+ <li>B) Decoder-only (GPT, Claude) ✓</li>
220
+ <li>C) Encoder-decoder (T5)</li>
221
+ <li>D) Convolutional Neural Network (CNN)</li>
222
+ </ul>
223
+ <p><em>Explanation: Decoder-only architectures generate text one token at a time (autoregressive) and are the basis for most modern chatbots and text generators.</em></p>
224
+
225
+ <p><strong>Q3:</strong> What is the purpose of text embeddings in the context of generative AI applications?</p>
226
+ <ul>
227
+ <li>A) To compress files for storage</li>
228
+ <li>B) To convert text into numerical vectors that capture semantic meaning ✓</li>
229
+ <li>C) To encrypt text for security</li>
230
+ <li>D) To translate text between languages</li>
231
+ </ul>
232
+ <p><em>Explanation: Embeddings are numerical vector representations of text that capture semantic meaning. Similar texts have similar vectors, enabling semantic search, RAG, and clustering.</em></p>