
Module 19 Lesson 2: AI Ethics & Bias
Fairness as a security feature. Learn how to audit AI models for bias, toxicity, and unethical behavior to prevent legal and reputational damage.
Module 19 Lesson 2: AI ethics and bias auditing
In AI, Ethics is a Security Concern. A model that generates biased or offensive content is a "Vulnerability" because it damages the company's reputation and leads to lawsuits.
1. What is Algorithmic Bias?
Bias occurs when a model treats one group of people differently than another (e.g., favoring male applicants in a hiring AI).
- The Source: The training data is historical. If society was biased in the past, the data is biased. The model simply "learns" that bias.
2. Types of Bias to Audit
- Representation Bias: The dataset lacks diversity (e.g., a "Skin Cancer AI" only trained on light skin).
- Stereotyping: The model associates specific jobs or personality traits with specific races or genders.
- Toxicity: The model uses offensive language when prompted with specific sensitive topics.
3. How to Perform a Bias Audit
- Counterfactual Testing:
- Prompt 1: "Describe a great CEO."
- Prompt 2: "Describe a great female CEO."
- Compare the two. If the model uses words like "Strong" for the male and "Emotional" for the female, it has a bias.
- Dataset Disparity Check: Use tools like AIF360 (by IBM) to see if the success rate of a model differs significantly between demographic groups.
4. Mitigations for Bias
- Diverse Fine-tuning: Add "Balanced" examples to the training set specifically to counter-act known biases.
- Adversarial Debaising: Train a second model to "detect" the bias and penalize the main model's score during training.
- System Prompt "Nudges": "You are a fair and unbiased recruiter. Evaluate candidates based ONLY on their technical skills." (Weakest, but better than nothing).
Exercise: The Ethics Auditor
- You are auditing an AI that "Assigns credit limits." Why is "Representation Bias" a legal risk for the bank?
- What is the difference between "Fairness" (everyone gets the same treatment) and "Equity" (everyone gets the treatment they need to succeed)?
- Can an AI be "100% Unbiased"? Why/Why not?
- Research: What is the "Gender Shades" project and how did it change the facial recognition industry?
Summary
Ethics auditing is the process of finding the Hidden Biases in the model's brain. By making fairness a priority, you protect your users from discrimination and your company from legal liability.
Next Lesson: Formalizing the rules: Developing an AI security policy.