| name | validating-ai-ethics-and-fairness |
| description | Validate AI/ML models and datasets for bias, fairness, and ethical concerns.
Use when auditing AI systems for ethical compliance, fairness assessment, or bias detection.
Trigger with phrases like "evaluate model fairness", "check for bias", or "validate AI ethics".
|
| allowed-tools | Read, Write, Edit, Grep, Glob, Bash(python:*) |
| version | 1.0.0 |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| license | MIT |
| compatible-with | claude-code, codex, openclaw |
| tags | ["ai","compliance","audit"] |
AI Ethics Validator
Overview
Validate AI/ML models and datasets for bias, fairness, and ethical compliance using quantitative fairness metrics and structured audit workflows.
Prerequisites
- Python 3.9+ with Fairlearn >= 0.9 (
pip install fairlearn)
- IBM AI Fairness 360 toolkit (
pip install aif360) for comprehensive bias analysis
- pandas, NumPy, and scikit-learn for data manipulation and model evaluation
- Model predictions (probabilities or binary labels) and corresponding ground truth labels
- Demographic attribute columns (age, gender, race, etc.) accessible under appropriate data governance
- Optional: Google What-If Tool for interactive fairness exploration on TensorFlow models
Instructions
- Load the model predictions and ground truth dataset using the Read tool; verify schema includes sensitive attribute columns
- Define the protected attributes and privileged/unprivileged group definitions for the fairness analysis
- Compute representation statistics: group counts, class label distributions, and feature coverage per demographic segment
- Calculate core fairness metrics using Fairlearn or AIF360:
- Demographic parity ratio (selection rate parity across groups)
- Equalized odds difference (TPR and FPR parity)
- Equal opportunity difference (TPR parity only)
- Predictive parity (precision parity across groups)
- Calibration scores per group (predicted probability vs observed outcome)
- Apply four-fifths rule: flag any metric where the ratio falls below 0.80 as potential adverse impact
- Classify each finding by severity: low (ratio 0.90-1.0), medium (0.80-0.90), high (0.70-0.80), critical (below 0.70)
- Identify proxy variables by computing correlation between non-protected features and sensitive attributes
- Generate mitigation recommendations: resampling, reweighting, threshold adjustment, or in-processing constraints (e.g.,
ExponentiatedGradient from Fairlearn)
- Produce a compliance assessment mapping findings to IEEE Ethically Aligned Design, EU Ethics Guidelines for Trustworthy AI, and ACM Code of Ethics
- Document all ethical decisions, trade-offs, and residual risks in a structured audit report
Output
- Fairness metric dashboard: per-group values for demographic parity, equalized odds, equal opportunity, predictive parity, and calibration
- Severity-classified findings table: metric name, affected groups, ratio value, severity level, recommended action
- Representation analysis: group sizes, class distributions, feature coverage gaps