Ethical considerations and guardrails

Introduction to Amazon Bedrock

Nikhil Rangarajan

Data Scientist

Why ethical AI matters

  • AI models can perpetuate biases and generate harmful content

Icon of two women in pink representing gender bias

Introduction to Amazon Bedrock

Why ethical AI matters

  • AI models can perpetuate biases and generate harmful content

  • Privacy concerns with sensitive data handling

Icons representing gender bias and privacy

Introduction to Amazon Bedrock

Why ethical AI matters

  • AI models can perpetuate biases and generate harmful content

  • Privacy concerns with sensitive data handling

  • Legal / regulatory compliance requirements

Icons representing gender bias, privacy, and legal compliance

Introduction to Amazon Bedrock

Why ethical AI matters

  • AI models can perpetuate biases and generate harmful content

  • Privacy concerns with sensitive data handling

  • Legal / regulatory compliance requirements

  • Potential for misuse in spreading misinformation

Icons representing gender bias, privacy, legal compliance and misinformation

Introduction to Amazon Bedrock

Why ethical AI matters

  • AI models can perpetuate biases and generate harmful content

  • Privacy concerns with sensitive data handling

  • Legal / regulatory compliance requirements

  • Potential for misuse in spreading misinformation

  • Business reputation and stakeholder trust

Icons representing gender bias, privacy, legal compliance, misinformation, and trust

Introduction to Amazon Bedrock

Protecting models with guardrails

  • Guardrails: protective measures
    • Content filtering
    • Bias detection
    • Strict usage policies
  • Always start with most restrictive level
  • Default level of screening for harmful content

 

A simple illustration of security guardrails depicted as two horizontal gray barriers supported by yellow posts, representing safety measures and content filtering in AI systems.

Introduction to Amazon Bedrock

Content moderation

def moderate_content_claude(text, strictness="medium"):

instruction = {
"high": "Strictly analyze for inappropriate content. ",
"medium": "Check for obviously toxic language. ",
"low": "Check the tone. "
}
prompt = f"{instruction[strictness]}\n{text}" body=json.dumps({"anthropic_version": "bedrock-2023-05-31", "max_tokens": 100, "temperature": 0.2, "messages": prompt}) # Low temperature response = bedrock.invoke_model(body=body, modelId=model_id) response_body = json.loads(response.get('body').read()) return response_body
Introduction to Amazon Bedrock

Monitoring and maintenance

  • Set up automated monitoring
  • Review filtered content regularly
  • Track response patterns for anomalies
  • Maintain logs of filtered requests

 

Icon of a magnifying lens over a graph to represent monitoring

Introduction to Amazon Bedrock

Response plan

  • Plan for model misbehavior
  • Define escalation procedures
  • Have backup models configured
  • Incidents tracked for improvement

  Icon of a checklist, illustrating the concept of having a plan when errors occur

Introduction to Amazon Bedrock

Key takeaways for ethical AI

🛑 Safety First

  • Always enable content filtering and bias detection

 

🚦 Implementation

  • Use built-in Bedrock safeguards

 

🔦 Continuous Improvement

  • Monitor and analyze results
  • Stay current with best practices
Introduction to Amazon Bedrock

Let's practice!

Introduction to Amazon Bedrock

Preparing Video For Download...