Pre-, In- and Post-Processing Mitigation
Applying pre-processing data re-weighting, in-processing constrained loss functions, and post-processing threshold adjustments to reduce bias.
3 Stages of Algorithmic Bias Mitigation
Once an engineering team identifies bias in a machine learning system, how do they reduce it?
Bias mitigation techniques are categorized by Where in the ML pipeline they intervene:
Pre-Processing (Data Layer) ──► In-Processing (Training Layer) ──► Post-Processing (Output Layer)
(Re-weighting / Re-sampling) (Adversarial Debiasing) (Group Threshold Tuning)
1. Pre-Processing Mitigation (Data Level)
Modifies the training dataset before model training begins:
┌──────────────────────────┬──────────────────────────┐
│ RE-WEIGHTING │ DISPARATE IMPACT REMOVER │
├──────────────────────────┼──────────────────────────┤
│ Assigns higher loss │ Edits feature distributions│
│ weights to under- │ to remove correlation with│
│ represented group │ protected attributes │
│ samples during training. │ while preserving rank. │
└──────────────────────────┴──────────────────────────┘
- Pros: Model-agnostic. Pre-processed datasets can be shared across any downstream algorithm (XGBoost, Neural Nets, SVM).
- Cons: Cannot fix biases introduced later during model training or optimization.
2. In-Processing Mitigation (Model Training Level)
Modifies the model architecture or loss function during training:
- Adversarial Debiasing: A primary model predicts the target label, while a secondary Adversary Model tries to predict the protected attribute from the primary model's internal activations. The primary model is trained to maximize target accuracy while minimizing the adversary's ability to guess the protected attribute!
- Constrained Optimization: Adds explicit fairness penalty terms to the loss function:
$$\mathcal{L}{\text{total}} = \mathcal{L}{\text{task}} + \lambda \cdot \text{FairnessPenalty}$$
- Pros: Directly optimizes the trade-off between accuracy and fairness.
- Cons: Requires modifying model training code and increases training complexity.
3. Post-Processing Mitigation (Inference Output Level)
Modifies prediction probability thresholds after model training finishes:
- Group-Specific Thresholding: Selects distinct decision thresholds $\tau_A$ and $\tau_B$ for protected groups $A$ and $B$ to achieve Equal Opportunity (equal True Positive Rates).
- Pros: Requires zero model retraining! Works on legacy black box models.
- Cons: Requires knowing the protected attribute at inference time, which may be legally prohibited in credit or employment applications.
Strategy Selection Guide
| Stage | Requires Model Retraining? | Needs Protected Attribute at Inference? | Model Agnostic? |
|---|---|---|---|
| Pre-Processing | Yes | No | Yes |
| In-Processing | Yes | No | No |
| Post-Processing | No | Yes | Yes |
Say this out loud
Bias mitigation techniques intervene at data pre-processing, model in-processing, or prediction post-processing stages. Pre-processing re-weights or re-samples training data prior to training. In-processing adds fairness constraints or adversarial debiasing into loss functions. Post-processing adjusts decision probability thresholds per group without requiring model retraining.
Followups to expect
- What is AIF360 (AI Fairness 360)? An open source Python toolkit developed by IBM containing metrics and algorithms for detecting and mitigating algorithmic bias across pre-processing, in-processing, and post-processing stages.
- Why can post-processing threshold adjustments face legal challenges? Using explicit demographic attributes to set different threshold cutoffs can be interpreted legally as intentional disparate treatment in specific jurisdictions.
Check yourself
What pre-processing technique balances representation by adjusting sample loss weights prior to model training?