Kiến thức cần nắm:
Giải thích chi tiết:
Amazon Bedrock Guardrails cung cấp nhiều lớp bảo vệ:
| Filter Type | Mô tả | Ví dụ |
|---|---|---|
| Content filters | Lọc nội dung harmful (hate, violence, sexual) | Block prompts chứa nội dung bạo lực |
| Denied topics | Chặn topics cụ thể | Không cho phép hỏi về financial advice |
| Word filters | Block từ/cụm từ cụ thể | Chặn profanity, competitor names |
| PII filters | Detect và redact PII | Mask email, phone numbers |
| Contextual grounding | Kiểm tra factual accuracy | Verify response dựa trên source documents |
Cấu hình Guardrails:
import boto3
client = boto3.client('bedrock')
response = client.create_guardrail(
name='content-safety-guardrail',
description='Filter harmful content',
contentPolicyConfig={
'filtersConfig': [
{
'type': 'SEXUAL',
'inputStrength': 'HIGH',
'outputStrength': 'HIGH'
},
{
'type': 'VIOLENCE',
'inputStrength': 'HIGH',
'outputStrength': 'HIGH'
},
{
'type': 'HATE',
'inputStrength': 'HIGH',
'outputStrength': 'HIGH'
}
]
}
)
Kiến thức cần nắm:
Giải thích chi tiết:
Output Safety Layers:
Kiến thức cần nắm:
Exam Tip: Khi gặp câu hỏi về giảm hallucination, câu trả lời thường liên quan đến RAG/Knowledge Bases (grounding), Guardrails, hoặc structured outputs. Đây là pattern rất phổ biến trong đề thi.
Strategies giảm hallucination:
| Strategy | Implementation | Hiệu quả |
|---|---|---|
| RAG/Grounding | Knowledge Bases | Cao — cung cấp factual context |
| Structured outputs | JSON Schema | Trung bình — giới hạn format |
| Contextual grounding | Guardrails | Cao — verify against sources |
| Temperature thấp | Model parameters | Trung bình — giảm creativity |
| Chain-of-thought | Prompt engineering | Trung bình — improve reasoning |
Kiến thức cần nắm:
Defense-in-depth architecture:
User Input
↓
[Layer 1: API Gateway] — Rate limiting, WAF rules
↓
[Layer 2: Pre-processing] — Comprehend PII detection, input sanitization
↓
[Layer 3: Guardrails] — Bedrock Guardrails (content filters, denied topics)
↓
[Layer 4: FM Invocation] — Model generates response
↓
[Layer 5: Output Guardrails] — Response filtering, PII redaction
↓
[Layer 6: Post-processing] — Lambda custom validation
↓
Safe Response to User
Kiến thức cần nắm:
Giải thích chi tiết:
Prompt Injection Types:
| Type | Mô tả | Mitigation |
|---|---|---|
| Direct injection | User trực tiếp inject malicious instructions | Input validation, Guardrails |
| Indirect injection | Malicious content trong retrieved documents | Source validation, output filtering |
| Jailbreak | Bypass safety controls qua creative prompting | Safety classifiers, Guardrails |
Mitigation strategies: