服务 · Machine Learning · 基于 AIF-C01
Amazon Bedrock Guardrails
Set content filter strengths, topics, words, PII handling and grounding thresholds, and call the guardrail on any model.
本课尚未翻译,暂以英文显示。
你在AI Practitioner中已学过
- Guardrails filter harmful content, block denied topics and mask personal data on inputs and outputs.
- Contextual grounding checks detect answers that stray from the source.
- Guardrails work with Bedrock models and other models through ApplyGuardrail.
Content filters
- Checks
- Harm categories and prompt attacks
- Acts on
- Prompts and responses
Denied topics
- Checks
- Subjects you define
- Acts on
- Prompts and responses
Word filters
- Checks
- Exact words and phrases
- Acts on
- Prompts and responses
Sensitive information
- Checks
- PII and custom patterns
- Acts on
- Block or mask
Contextual grounding
- Checks
- Grounding and relevance scores
- Acts on
- Responses
Automated Reasoning
- Checks
- Logic from your policy rules
- Acts on
- Responses
| Policy | Checks | Acts on |
|---|---|---|
| Content filters | Harm categories and prompt attacks | Prompts and responses |
| Denied topics | Subjects you define | Prompts and responses |
| Word filters | Exact words and phrases | Prompts and responses |
| Sensitive information | PII and custom patterns | Block or mask |
| Contextual grounding | Grounding and relevance scores | Responses |
| Automated Reasoning | Logic from your policy rules | Responses |
1 / 2
Content filters
- Checks
- Harm categories and prompt attacks
- Acts on
- Prompts and responses
Denied topics
- Checks
- Subjects you define
- Acts on
- Prompts and responses
Word filters
- Checks
- Exact words and phrases
- Acts on
- Prompts and responses
| Policy | Checks | Acts on |
|---|---|---|
| Content filters | Harm categories and prompt attacks | Prompts and responses |
| Denied topics | Subjects you define | Prompts and responses |
| Word filters | Exact words and phrases | Prompts and responses |
2 / 2
Sensitive information
- Checks
- PII and custom patterns
- Acts on
- Block or mask
Contextual grounding
- Checks
- Grounding and relevance scores
- Acts on
- Responses
Automated Reasoning
- Checks
- Logic from your policy rules
- Acts on
- Responses
| Policy | Checks | Acts on |
|---|---|---|
| Sensitive information | PII and custom patterns | Block or mask |
| Contextual grounding | Grounding and relevance scores | Responses |
| Automated Reasoning | Logic from your policy rules | Responses |
是什么
Content filters cover Hate, Insults, Sexual, Violence, Misconduct and Prompt Attack. Each has a strength (none, low, medium, high), set separately for prompts and responses; higher blocks more. Prompt Attack checks prompts only, for jailbreaks and injection. Denied topics are subjects you define with a name, a description and example phrases. Word filters block exact words and phrases, such as profanity or competitor names. Sensitive information filters detect PII in standard formats, plus your own regular expressions, and block or mask it, differently for input and output.
是什么
Contextual grounding checks compare a response with a source you give and with the user question. The grounding score checks that the answer is supported by the source. The relevance score checks that it answers the question. You set a threshold from 0 to 0.99 for each, and lower scores are blocked. You mark the source and question in the request. Automated Reasoning checks verify answers against logical rules derived from your policy documents.
是什么
ApplyGuardrail checks text without calling a model, so it works with any model, including models outside Bedrock, and can check input or retrieved text before a call. For streaming, synchronous mode (the default) buffers and checks chunks before sending: safer, with more latency. Asynchronous mode sends chunks at once and checks in the background, so bad text may reach the user first, and PII masking is not supported. Edit a guardrail as a working draft, create a numbered version that cannot change, and point applications at it. You can enforce a guardrail with an IAM condition.
要记住
- Content filters: six categories, strength none to high, set for input and output.
- Grounding and relevance thresholds: 0 to 0.99.
考试中
- “Stop the chatbot giving investment advice” points to a denied topic.
- “Replace phone numbers in answers with a placeholder” points to a sensitive information filter set to mask.
- “Block RAG answers with facts not in the documents” points to contextual grounding with a grounding threshold.
- “Apply safeguards to a model outside Bedrock” points to the ApplyGuardrail API.
别和这些弄混
- Bedrock access controlIAM decides which models and profiles a caller may invoke. SCPs and a guardrail condition enforce the rules for everyone.
- Monitoring FM quality in productionInfrastructure metrics cannot tell if answers are good. Sample live traffic, score it, and alarm on the scores.
- AI and ML security risksKnow the attacks by name, what each damages, and the control that stops it.
本任务内容 · 4.3
- Scanning code and images in CI/CD
- Least privilege for ML artifacts
- IAM roles for SageMaker and ML workloads
- Bedrock access control
- Credential types for Bedrock
- Auditing, logging and compliance for ML
- Troubleshooting ML security issues
- Isolating ML systems with VPCs
- Encryption and data protection for ML
- AI and ML security risks
Guardrails