4.1.2. Tools for Responsible AI on AWS (Bias Analysis and Amazon Bedrock Guardrails)
First Principle: AWS provides specific tools designed to help developers implement Responsible AI principles, making it easier to detect bias, explain predictions, and enforce safety policies.
AWS operationalizes Responsible AI by providing concrete services and features.
- For Traditional ML - Bias and Explainability Analysis:
- Purpose: Helps improve model transparency by detecting potential bias and explaining how models make predictions. (Amazon SageMaker Clarify packaged both analyses but is closed to new customers; the techniques below are what the exam tests.)
- Key Features:
- Bias Detection: Measures your data and model for statistical biases before and after training, through subgroup analysis. For example, it can show that your model performs better for one demographic group than another.
- Explainability: Explains why your model made a certain prediction by showing which input features were most influential (for example, SHAP feature attributions).
- For Generative AI - Guardrails for Amazon Bedrock:
- Purpose: A safety feature that allows you to implement policies to control the types of content your generative AI application will generate. It acts as a safety wrapper around a Foundation Model.
- Key Features:
- Denied Topics: Define specific topics that you want to prevent the application from discussing (e.g., financial advice, medical diagnoses).
- Content Filters: Configure thresholds to filter out harmful content across categories like hate speech, insults, and violence.
- Filtered Word-lists: Block specific keywords from appearing in prompts or responses.
- Personally Identifiable Information (PII) Redaction: Can identify and remove PII from the conversation.
Naming note: AWS now calls this feature Amazon Bedrock Guardrails (you will also see the older name, Guardrails for Amazon Bedrock). Its current safeguards extend the list above:
- Content filters with configurable strength for hate, insults, sexual content, violence and misconduct, plus a prompt attack category.
- Sensitive information filters that block or mask PII, with custom regular expressions for your own patterns.
- Contextual grounding checks that detect hallucinated or irrelevant responses against a source (see 5.1.4).
- Automated Reasoning checks that validate responses against logical rules (see 5.1.4).
Guardrails can also be applied through the ApplyGuardrail API without invoking a foundation model, so the same policies can protect a model hosted outside Bedrock.
Scenario: A company is deploying a generative AI chatbot for public use and is concerned that users might prompt it to generate harmful content.
Reflection Question: How would the company use Guardrails for Amazon Bedrock to set up content filters and denied topics as a critical safety measure before releasing the chatbot?
💡 Tip: Use bias and explainability analysis (subgroup metrics and SHAP) for deep analysis of your custom-trained traditional ML models. Use Guardrails for Amazon Bedrock for real-time safety enforcement on your generative AI applications.