Achieving fairness and mitigating biases in AI and ML models.
What does a fair model mean?
Machine Learning and Artificial Intelligence become more and more widespread, and their fairness and balance becomes a critical concern. Their applications touch on a plethora of areas of our lives, demanding that we are aware of the ethical concerns inherently connected with them. In this article, I aim to explore the general problem of these algorithms being biased.
Bias — inclination or prejudice for or against one person or group, > especially in a way considered to be unfair1.
The definition of bias I will refer to here, found above, is a different one from the most commonly used in ML and AI-related fields. Here, we will talk about fair models that will not discriminate against certain groups of people.
Why is it important to have a fair model?
The models are used in a variety of settings. We see their impact in our social media feeds and recommendations systems in the platforms we use most often. But it is important to remember, their usage is not limited to those cases. They are also utilized in critical infrastructure. Think about healthcare, transportation, defense and government. All of those use scenarios demand the highest quality of outputs.
It is important that in all of these domains, individuals have access to equal quality of service. People in power should make the most influential stakeholders keep the highest standard in regards to bias. We need it to have systems that provide useful results, which are not only unbiased but also do not perpetuate bias further, stopping it from spreading.
The kinds of harms an unfair model introduces
There are several issues that arise when the models we use are biased. Let’s look at some of the issues coming from the real world.
In recruitment, Applicant Tracking Systems (ATS) are widely used in recruiting. They extract key information from the resumes, match it with a job description, and score it. While this can significantly decrease the number of headache pills an HR specialist has to take, if the algorithm is biased, it can lead to rejecting promising talents too early. This is an example of allocation harm. It comes up when an AI system extends or withholds opportunities, resources, or information.
Other types of harm can occur. Quality-of-service-harm is something I referred to earlier. It happens when a system does not work as well for one person as it does for another, even if there is no allocation harm involved. An example of such damage is that Facial Recognition Systems can work worse for different demographic groups2.
The last two types of harms that I want to bring up are stereotypical bias, which suggests outputs that perpetuate bias, and erasure harm. To get a better understanding of the first one, think about how biases can lead to certain groups of people being falsely arrested more often because of algorithm specifications. The second one can be seen in the case of short biographies of Alan Turing, not mentioning his sexuality.
How to check if a model is fair or not?
Luckily, there are multiple things that we can use to test whether our models are fair. An investigation into the data source is critical. It could be the case that the sample that was gathered was not random. When we are exploring the data to be later fit into the model, we could plot histograms of different categories of our data to see whether it is imbalanced. When we have the model ready, we should test it on multiple metrics assessing fairness, including demographic parity, equalized odds, or bounded group loss. These metrics can be found in libraries such as Microsoft’s fairlearn.org.
Where do unfair models come from?
The procedure of coming up with a model is a multi-step one. Unfairness can be introduced mistakenly to a model at multiple stages. At each stage, there are different ways to check for and avoid it.
Maybe the most obvious moment would be the data understanding stage. It is at this stage that we collect the data, describe and explore it, as well as verify its quality. At this moment, it is important to think about what data we are using. Often, when we are using historical data, we can expect some biases to come up. Because some prejudices were prevalent in the past, they were reflected in the data. Often, this leads to imbalanced data.
Imbalanced data is such that there is an overrepresentation or underrepresentation of certain categories over the others. Such datasets do not contain enough observations of the minority classes to properly train the model, introducing biases.
If we want to build fair models, we should notice these prejudices and make sure that the model does not replicate and propel them further. Luckily, there are ways to balance those biases out, I will talk about them in the next section.
How do we fix unfair models?
We can treat the unfairness of a model at multiple stages. The first thing to notice, however, is to be aware of the biases. It is important to utilize metrics to check for them, while keeping in mind their importance.
When running evaluations of our models, you can use metrics supplied by packages like fairlearn.org , which I mentioned earlier. These include the following:
- Demographic Parity (DP),
- Equalized Odds (EO),
- True Positive Rate Parity (TPRP),
- False Positive Rate Parity (FPRP),
- Error Rate Parity (ERP),
- Bounded Group Loss (BGL).
Demographic parity aims to ensure that predictions of a model are independent of membership in a sensitive group. An example of this being achieved is when, in a recruitment process, an equal number of people is selected for the interview across all groups of people applying.
Equalized odds is a measure of how much the probability of the outcome of the model is independent of conditioning on the sensitive variables. It shows if a model predicts an outcome class equally well for all values a sensitive variable takes.
This subject is way too broad for a single general post like this. At this point, I would like to focus on a more general outline of the problem and what ways are there to deal with it. To make a deeper dive into the rest of the metrics, feel free to check out this glossary3.
Given that we now know the ways there are to assess the fairness of our models, how can we proceed to fix them accordingly? You can use techniques such as correlation removers. They project away the correlation of sensitive variables with the predicted variable. You can also re-weight your data to achieve demographic parity or equalized odds.
How can we ensure there are fewer and fewer unfair models?
Once again, let me stress the importance of not perpetuating biases when designing models. This ensures that biases that were visible in the historical data become less widespread in applications and future datasets. Noticing the importance of this practice is a necessary step moving forward.
It is also critical to take adequate steps to mitigate biases in your models. Let us remember that we can and should do better. Being lenient to such biases today can lead to unforeseen circumstances in the future. Let us hope that influential actors keep this in mind.
In my future posts, I hope to explore the topics of ethics in ML and AI and discuss ways to achieve them in more detail. Follow for more.