AI Bias/Fairness Audit Protocol
1. Introduction
This protocol provides a structured framework for auditing AI systems (e.g., ML models, LLMs, classifiers) for bias and fairness issues. It ensures equitable performance across protected cohorts, minimizes disparate impact, and promotes accountability.
Scope: Applies to all production AI systems handling sensitive decisions (e.g., hiring, lending, content moderation). Audits are conducted pre-deployment, post-deployment (quarterly), and after material changes.
Roles:
- Auditor: Data scientist/ML engineer responsible for execution.
- Ethics Review Board: Approves remediation and transparency reports.
- Stakeholders: Model owners, legal/compliance teams.
Tools: Use libraries like AIF360, Fairlearn, Facets, or custom scripts for metrics computation.
2. Cohorts
Cohorts are subgroups defined by sensitive attributes (direct or proxy). Prioritize attributes relevant to the use case and jurisdiction (e.g., GDPR, US EO 13985).
Cohort Selection Criteria
-
Primary Sensitive Attributes:
| Attribute | Examples/Subgroups | Data Source |
|---|
| Gender | Male, Female, Non-binary, Unknown | Self-reported, proxy (names) |
| Race/Ethnicity | White, Black, Asian, Hispanic, etc. | Self-reported, proxy (names/surnames) |
| Age | <18, 18-35, 36-60, >60 | Birthdate, proxy (context) |
| Disability | Yes/No | Self-reported |
| Socioeconomic | Low/Mid/High income | Proxy (ZIP code, education) |
-
Secondary/Intersectional: Combine primaries (e.g., Black Females aged 18-35).
-
Minimum Cohort Size: ≥100 samples per subgroup for statistical significance (use bootstrap if undersized).
-
Proxy Attributes: If direct data unavailable, use high-fidelity proxies (validate correlation >0.8 via audit).
-
Exclusion: Omit cohorts <5% of total data unless domain-critical.
Cohort Preparation:
- Collect/annotate data with attributes (ensure anonymization).
- Stratify train/test/validation sets proportionally.
- Handle missing data: Impute neutrally or exclude.
3. Metrics
Compute metrics on holdout test sets (20% of data, unseen during training). Flag violations if metric exceeds threshold (e.g., |diff| > 0.1 or ratio <0.8/ >1.25).
Binary Classification Metrics (e.g., Approval/Rejection)
| Metric | Definition | Ideal Value/Threshold | Interpretation |
|---|
| Demographic Parity (DP) | P(Ŷ=1 | A=0) - P(Ŷ=1 | A=1) | |diff| ≤ 0.05 | Equal positive rates across groups (A=protected). |
| Equalized Odds (EO) | |TPR_A=0 - TPR_A=1| + |FPR_A=0 - FPR_A=1| | |diff| ≤ 0.1 | Equal TPR/FPR (ignores base rates). |
| Equal Opportunity (EOP) | |TPR_A=0 - TPR_A=1| | |diff| ≤ 0.05 | Equal TPR (focuses on qualified candidates). |
| Disparate Impact (DI) | min(P(Ŷ=1 | A=a) / P(Ŷ=1 | A=ref)) | Ratio ≥ 0.8 | Protected vs. reference group. |
| Calibration | |E[Y | Ŷ=p, A=0] - p| - |E[Y | Ŷ=p, A=1] - p| | |diff| ≤ 0.05 | Equal reliability of scores. |
Regression/Continuous Metrics
| Metric | Definition | Ideal Value/Threshold |
|---|
| Group MAE Diff | |MAE_A=0 - MAE_A=1| | ≤ 0.1 * overall MAE |
| Wasserstein Distance | Distance between outcome distributions per group | ≤ 0.1 |
Generative/NLP Metrics (e.g., LLMs)
| Metric | Definition | Threshold |
|---|
| Toxicity Rate Diff | Toxicity prob. diff. across cohorts (use Perspective API) | |diff| ≤ 0.05 |
| Stereotype Score | Embedding similarity to stereotypes (e.g., WEAT) | Cosine sim. ≤ 0.2 |
| Representation Parity | % mentions of cohorts in generations | ±10% of population proportion |
Aggregation: Compute per cohort pair; report worst-case deviation.
4. Audit Procedure
- Pre-Audit: Define model/use case, select cohorts/metrics.
- Data Audit: Validate cohort balance, check for labeling bias (e.g., CVAT for annotations).
- Run Metrics: Compute on test set; use 95% CI via bootstrapping (n=1000).
- Error Analysis: Slice predictions by cohort; visualize (e.g., Facets Dive).
- Stress Test: Perturb inputs (e.g., name swaps) to probe proxy bias.
- Document: Log all (version control with MLflow/W&B).
Frequency: Initial (deployment), Ongoing (quarterly/random audits).
5. Remediation
Tiered response based on severity (e.g., # violated metrics):
| Severity | Criteria | Actions (Prioritized) |
|---|
| Low (1-2 metrics) | |diff| 0.05-0.1 | - Monitor only.- Log for trends. |
| Medium (3-5 metrics) | |diff| 0.1-0.2 | 1. Pre-Processing: Rebalance data (SMOTE for undersampling).2. In-Processing: Adversarial debiasing (add fairness loss term).3. Retrain & re-audit. |
| High (>5 metrics or DI<0.8) | |diff| >0.2 | 1. Post-Processing: ROC-based threshold adjustment per cohort.2. Model Swap: Ensemble with fairer base models.3. Reject Deployment: Escalate to Ethics Board; redesign inputs. |
Remediation Workflow:
- Implement fix.
- Re-audit (target: all metrics pass).
- A/B Test in shadow mode (1% traffic).
- Validate longitudinally (drift detection).
Fallback: Human-in-loop for high-risk decisions.
6. Transparency and Reporting
Model Card (publish publicly or internally):
- Section 1: Model details (version, training data summary).
- Section 2: Cohort table with sizes/proportions.
- Section 3: Metrics table (all cohorts, worst-case highlighted).
- Section 4: Audit date, auditor, violations/remediation status.
- Section 5: Limitations/risks (e.g., "Proxy race data used; accuracy 85%").
- Section 6: Links to code/data artifacts (GitHub/DVC).
Disclosure Rules:
- Public Models: Full Model Card on HuggingFace/landing page.
- Private Models: Executive summary to stakeholders; full to regulators.
- Incident Reporting: If bias causes harm, disclose within 72h (template: what/impact/remediation).
- API/Dashboard: Real-time fairness metrics (e.g., Grafana dashboard).
Versioning: Track cards in repo; update post-audit.
This protocol is iterative—review annually or per legal changes. For implementation support, contact Trailblazer Labs Ethics Team.