Get startedGet started for free

Mitigate Bias - Model Remediation

1. Mitigate Bias - Model Remediation

Threshold calibration is an easy way to adjust model output to a more desirable way without changing the model itself. What if we'd also want to intervene in the model training process to actually train a fair system. Remember that neural network models are trained to minimize loss values. If this is the case, does this mean we can change the training process itself by changing the loss function? The answer is yes. We can consider adding a penalty term that represents the magnitude of bias in some way, so that the training process can try to minimize not only the model performance but also biases. It is similar to the idea to reduce model complexity by adding regularization terms like L1 or L2 norms. There could be many ideas about this additional term for fairness. Here are two methods which are covered by the tensor flow model, remediation library MinDiff and counterfactual logit pairing. The two methods have different ideas and goals about fairness, but both add a supplemental term to original loss functions. Let's start with MinDiff method. MinDiff focuses on the distribution difference of model prediction with respect to different subsets of dataset. Let's say we are training a model with a dataset that has a sensitive feature such as gender group or racial group. After training, we split the dataset into two, subgroup A and subgroup B by using the sensitive feature and pass them to the model to get predictions. From this, we can then depict different prediction distributions on these two datasets. The idea of MinDiff is if the model is fair and robust enough, that output distribution of different subsets shouldn't be very different. Now in some situations, a sensitive feature reflects a social context related to the prediction objective and the model ends up capturing the pattern difference. This then becomes reflected in the distribution of the predictions. It does this by adding a penalty term that represents the discrepancy between two distributions by using mean maximum discrepancy. The term is added to the original primary loss function such as binary cross entropy loss and minimized in the train phase. The balance between the primary loss term and this MinDiff term can be controlled with Lambda value. With this term, we can expect the output distributions would be close compared to the original model without MinDiff. Let's move on to the next method, counterfactual logit pairing, or CLP. We already discussed the term counterfactual. In counterfactual analysis, we try to identify bias issues by modifying a sensitive feature, then checking how it affects model predictions. For example, let's say we are creating a machine learning model to validate the toxicity of text sentences, something Google's jigsaw team is actually working on and published as a perspective API. Using this as an example, if a machine learning model returns results that contain toxicity in text sentences, it will be regarded as unfair and harmful to some identities. Although the sentence structure is the same and the identities themselves are neutral, the risk scores are different when an identity token is changed. Again, because machine learning captures patterns from datasets, If harmful Beta patterns exist, it will be reflected in the result. In this case, some identity terms could be unfairly linked to negative scores. Counterfactual analysis provides us this information by setting up a proper what scenario. It helps us identify if the model's predictions are unfairly influenced by the presence of these identity terms, even when they are used in a neutral context. CLP also focuses on this perspective. The idea of this approach is if a model is fair and robust enough, the output result won't be changed much even if we change a sensitive feature value. Based on this idea, it adds an additional loss term that represents the gap of logits between original and counterfactual examples. Remember that logits is a classification models output before applying a normalization function, such as a sigmoid or softmax function. By minimizing this new loss term and the primary loss, we can expect the model would be more robust in terms of counterfactual fairness. This can be measured by some counterfactual metrics such as flip rate as shown in the graph. Counterfactual logit pairing can help models achieve lower flip rate. Although MinDiff and CLP have similar ideas to add a loss term that represents the magnitude of some bias, the target and idea are slightly different. MinDiff focuses on prediction distribution so that it leads to achieving fairness constraints such as equality of opportunity. Whereas CLP focuses on counterfactual fairness.

2. Let's practice!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.