18.3 Responsible AI: Detecting & Monitoring Bias
Key Takeaways
- Agent Platform data bias metrics include Difference in Population Size and Difference in Positive Proportions in True Labels, computed before training.
- Agent Platform model bias metrics include Accuracy Difference, Difference in Positive Proportions in Predicted Labels, Recall Difference, Specificity Difference, and Difference in Ratio of Error Types.
- In Agent Platform's fairness metrics, a positive value generally indicates potential bias favoring slice 1, zero indicates no difference, and a negative value favors slice 2.
- Bias can enter through unrepresentative data, historical labels, proxy features, and deployment context, so fairness checks belong before training, before deployment, and in production monitoring.
- For gen AI, responsible AI practice combines safety filters, evaluation of outputs across user groups, and human review of high-impact use cases.
The exam guide lists responsible AI practices (for example, monitoring for bias) as part of identifying risks to AI solutions. The exam expects you to recognize bias sources, pick suitable fairness metrics, and put checks into the lifecycle, not just to state principles.
Where Bias Comes From
| Source | Example |
|---|---|
| Representation | A smile-detection dataset with far fewer older people |
| Historical labels | Past hiring decisions that favored one group become the "ground truth" |
| Measurement | Different data quality across regions (older devices, missing fields) |
| Proxy features | ZIP code standing in for protected attributes |
| Aggregation | One model for populations that behave differently |
| Deployment context | A model used for decisions it wasn't designed or validated for |
| Feedback loops | A model's decisions shape future training data, such as fewer loans giving fewer repayment examples |
Agent Platform Fairness Metrics
Agent Platform provides bias metrics (preview) comparing slice 1 (the group measured) against slice 2 (the comparison group). For most metrics, positive values suggest potential bias favoring slice 1, zero means no difference, and negative values favor slice 2. The evaluation pipeline components DetectDataBiasOp and DetectModelBiasOp compute them.
Data bias metrics (before training)
Example: 200 California applicants (60 accepted) and 100 Florida applicants (20 accepted).
| Metric | Formula | Example |
|---|---|---|
| Difference in Population Size | (n₁ − n₂) / (n₁ + n₂) | (200 − 100) / 300 = 0.33 |
| Difference in Positive Proportions in True Labels (DPPTL), also called label imbalance | positives₁/n₁ − positives₂/n₂ | 60/200 − 20/100 = 0.10 |
Model bias metrics (after training)
Confusion matrices: California TP 50, FN 10, FP 20, TN 120. Florida TP 20, FN 0, FP 30, TN 50.
| Metric | Compares | Example |
|---|---|---|
| Accuracy Difference | (TP+TN)/n for each slice | 170/200 − 70/100 = 0.15 |
| Difference in Positive Proportions in Predicted Labels (DPPPL) | Predicted positives / n | 70/200 − 50/100 = −0.15 |
| Recall Difference | TP / (TP+FN) | 50/60 − 20/20 = −0.17 |
| Specificity Difference | TN / (TN+FP) | 120/140 − 50/80 ≈ 0.23 |
| Difference in Ratio of Error Types (treatment equality) | FN/FP for each slice | 10/20 − 0/30 = 0.50. Both slices have 30 errors, but California's errors include missed acceptances while Florida's are all false acceptances |
Reading the example: the model is more accurate for California (+0.15) but predicts acceptance more often for Florida (−0.15) and has higher recall for Florida (−0.17). Which gap matters depends on the harm. In admissions, wrongly rejecting qualified applicants (recall) may be the main concern.
Choosing Fairness Criteria
There is no single fairness metric. They can conflict, so choose based on the decision's harms:
| If the main harm is... | Watch |
|---|---|
| Qualified people being denied (missed opportunities) | Recall difference (equal opportunity) |
| Unqualified people being wrongly approved or flagged | False positive rate or specificity difference |
| Unequal selection rates across groups | DPPPL (demographic parity) |
| Overall quality gaps | Accuracy difference plus per-slice precision and recall |
Involve domain, legal, and affected stakeholders in picking metrics and acceptable thresholds.
Putting Fairness into the Lifecycle
| Stage | Practice |
|---|---|
| Problem framing | Decide if ML is appropriate. Document intended use and misuse |
| Data | Check representation (Difference in Population Size) and label imbalance (DPPTL). Look for proxies |
| Training | Reweight or resample underrepresented groups. Consider constraints or separate thresholds where lawful |
| Evaluation | Slice metrics and bias metrics as pipeline gates (Chapter 15) |
| Deployment | Canary monitoring by segment. Human review for high-impact decisions |
| Production | Monitor prediction distributions and outcomes by slice, and retrain or roll back when gaps widen |
| Documentation | Record data sources, evaluation slices, limitations, and approvals with the model version |
Mitigation Techniques
- Collect more representative data for underrepresented groups. This is often the most effective fix.
- Reweight or resample training examples, for example with AutoML's row weight column.
- Remove or transform proxy features, and test whether performance gaps shrink.
- Adjust decision thresholds per operating context where policy and law allow.
- Human-in-the-loop review for borderline or high-impact predictions.
- Explain predictions (Section 18.4) to find features driving unequal outcomes.
Monitoring Fairness in Production
Fairness at launch doesn't guarantee fairness later, because populations and behavior change.
- Log the slice attributes needed for analysis (where lawful and privacy-approved) alongside predictions.
- Schedule bias metrics on recent predictions and, once labels arrive, on outcomes. For example, run the model bias component monthly in a pipeline.
- Alert on thresholds agreed with stakeholders, such as a recall difference beyond ±0.05.
- Investigate root causes with slice-level feature distributions and explanations before retraining.
- Record decisions (accepted trade-offs, mitigations) with the model version for accountability.
Responsible Gen AI
- Safety filters and Model Armor reduce harmful outputs (Section 18.2).
- Evaluate across user groups and languages, because quality and safety can vary by dialect or topic (Gen AI evals, Chapter 7).
- Grounding and citations reduce fabricated claims that can mislead users.
- Transparency: tell users they are interacting with AI and where content is AI-generated.
- Human oversight for medical, legal, financial, and employment uses.
Before training a hiring model, a team finds that 90% of historical 'hired' labels belong to one group, even though applicants were evenly split. Which Agent Platform metric directly quantifies this label imbalance?
For slice 1, TP = 40 and FN = 10. For slice 2, TP = 45 and FN = 5. What is the Recall Difference (slice 1 minus slice 2), and what does its sign suggest?
A lending model's overall AUC improved in a new version, but approval recall for one protected group dropped substantially. What should the deployment pipeline do?