## What is TensorFlow Model Remediation?

If you have identified fairness concerns with your machine learning model, there are three primary types of technical interventions available:

- **Training data pre-processing techniques:** Collecting more data, generating synthetic data, adjusting the weights of examples and sampling rates of different slices.
- **Training-time modeling techniques:** Changing the model itself by introducing or altering model objectives and adding constraints.
- **Post-training techniques:** Modifying the outputs of the model or the interpretation of the outputs to improve performance across metrics.

The TensorFlow Model Remediation library provides training-time techniques to intervene on the model.

<br />

> [!NOTE]
> **Note:** For an overview of machine learning fairness and to better understand the technical interventions listed above, refer to this [online textbook](https://fairmlbook.org/).

## Training-time Modeling

The TensorFlow Model Remediation library provides two techniques for addressing bias and fairness issues in your model, [MinDiff](https://www.tensorflow.org/responsible_ai/model_remediation/min_diff/guide/mindiff_overview.md.txt) and [Counterfactual Logit Pairing (CLP)](https://www.tensorflow.org/responsible_ai/model_remediation/counterfactual/guide/counterfactual_overview.md.txt). They are described in the table below.

|   | MinDiff | CLP |
|---|---|---|
| **When should you use this technique?** | To ensure that a model predicts the preferred label equally well for all values of a sensitive attribute. To achieve group [equality of opportunity](https://developers.google.com/machine-learning/glossary/fairness#equality_of_opportunity). | To ensure that a model's prediction does not change between "counterfactual pairs" (where the sensitive attribute referenced in a feature is different). For example, in a [toxicity classifier](https://www.perspectiveapi.com/#/home), examples such as "I am a man" and "I am a lesbian" should not have a different prediction. To achieve a form of [counterfactual fairness](https://developers.google.com/machine-learning/glossary/fairness#counterfactual_fairness). |
| **How does it work?** | Penalizes the model during training for differences in the *distribution* of scores between the two sets. | Penalizes the model during training for output differences between counterfactual *pairs of examples*. |
| **Input Modalities** | Loss functions operate on output so are, in theory, agnostic to the input and model architecture. | Loss functions operate on output so are, in theory, agnostic to the input and model architecture. |