Fair Text Classification with W asserstein Independence (2023)

Abstract: Group fairness is a central research topic in text classification, where reaching fair treatment between sensitive groups (e.g. women vs. men) remains an open challenge. This paper presents a novel method for mitigating biases in neural text classification, agnostic to the model architecture. Considering the difficulty to distinguish fair from unfair information in a text encoder, we take inspiration from adversarial training to induce Wasserstein independence between representations learned to predict our target label and the ones learned to predict some sensitive attribute. Our approach provides two significant advantages. Firstly, it does not require annotations of sensitive attributes in both testing and training data. This is more suitable for real-life scenarios compared to existing methods that require annotations of sensitive attributes at train time. Secondly, our approach exhibits a comparable or better fairness-accuracy trade-off compared to existing methods.

## introduction machine learning algorithms have become increasingly influential in decision-making processes that significantly impact our daily lives. one of the major challenges that has emerged in research, both academic and industrial, concerns the fairness of these models, i.e. their ability to prevent predictions related to individuals to be based on sensitive attributes such as gender or ethnicity. in this article, we focus on the problem of fairness in the domain of natural language processing (nlp) @xcite @xcite . while many studies already report biases in nlp systems @xcite @xcite legend : sensitive attributes : target labels ⊥ ⊥ figure 1: our method, wfc, modifies the representation space of documents such that it is fairer when training a classifier on top. to do that, it makes it independent of a "demonic" model that predicts the sensitive attribute. @xcite , these issues become even more significant with the advent of public-ready ai-powered nlp systems such as chatgpt (openai) or google bard @xcite , making the need for fair nlp solutions even more compelling. as more researchers work to overcome these shortcomings, the first problem is to define what fairness is. such a definition may hardly be consensual or is at least difficult to establish, as it depends on situational and cultural contexts @xcite . in this work, we adopt the most common definition of group fairness, and the one adopted by laws in several countries, which is based on the notion of disparate impact: a prediction model is considered to have a disparate impact if its results disproportionately harm (or benefit) people with certain sensitive attribute values (e.g., women, black people). in this work, we focus on group fairness for neural text classification as it is one of the most ubiquitous tasks in our society, with prominent examples in medical and legal domains @xcite or human resources @xcite , to name a few. neural text classification relies on text encoders, which are parameterized and learned functions that map tokens (arbitrary text chunks) into a latent space of controllable dimension, usually followed by a classification layer. built upon the transformers architecture @xcite , popular pre-trained language models (plms) such as bert @xcite , gpt3 @xcite or llama @xcite leverage self-supervised learning to train the text encoder parameters. in modern nlp pipelines, these plms are further fine-tuned on the supervised task at hand. ultimately, plms accumulate uncontrolled levels of unfairness due to unbalanced learning data or algorithmic biases, for instance. this results in observable biases in predictions but also in the latent space as studied in @xcite . we propose a novel approach (see figure 1 ), to mitigate bias in text encoders, that aims to tackle bias directly in the latent space on which documents are projected, thus making our model applicable to any text encoder or decoder (e.g. bert or llama). to proceed, we disentangle the neural signals encoding bias from the neural signals used for prediction. the proposed architecture is based on three components. first, two multi-layer perceptrons (mlps): the first one whose objective is to predict the sensitive attribute, and the second one is dedicated to the prediction task at hand. then, a third mlp, referred to as a critic, approximates the wasserstein distance that acts as a regularizer in our objective function. our proposition overcomes a major shortcoming of prior studies: they rely on the availability of the sensitive attributes at train time. a constraint that is incompatible with recent regulations as the new european ones, that enforce more stringent requirements for the collection and utilization of protected attributes. prior studies are thus more difficult to use in practical settings. in the following, we will show that our approach can address this limitation by avoiding the use of this information during both testing and training. the rest of this paper is organized as follows. section 2 presents recent advances regarding fairness in nlp. section 3 argues about our motivation and provides the background knowledge to understand our contribution. section 4 proceeds with the description of the proposed approach, its theoretical analysis, and algorithmic implementation. section 5 introduces the setting of our experiments, and section 6 presents the results and interpretation. the last section concludes the paper and gives a couple of hints for possible future research. ## related works numerous studies have been conducted on how to tackle bias in machine learning systems. approaches to reinforce fairness can be divided between pre-, in-, and post-processing methods. in the nlp literature, common pre-processing techniques consist of data rebalancing @xcite or embedding debiasing @xcite . yet, despite the efficiency of those methods, @xcite and @xcite showed that other biases can be learned during the training or fine-tuning processes. on the other hand, post-processing procedures aim at correcting biases after the learning step, through model calibration @xcite or data projection @xcite . we refer to @xcite for more exhaustive surveys of bias in nlp. recently, adversarial methods @xcite @xcite have been investigated to mitigate biases. @xcite ) respectively suggest using several discriminators where each learns different hidden representations and applying an adversarial approach in-and cross-domain to train the adversary on a different dataset, with methods called adv and gate. differently, recent contributions focus on directly constraining the objective to improve fairness @xcite . for instance, by adding some fairness metric, such as the equal opportunity that we will define later in this paper, to the objective function. our approach is at the crossroad of these two philosophies: on the one hand, we propose to train a biased model whose sole purpose is to predict the sensitive attribute and use this latter to enforce fairness in our main prediction model. on the second hand, we minimize a classifier loss with a regularization term measuring the dependence between the latent representations of the classifier and some unfair representations, using wasserstein distance. while many works use the kullback-leibler (kl) divergence to measure the mutual information between representations, @xcite show several limitations: the kl-divergence is sensitive to small perturbations in the data, and exploiting it for estimating the mutual information does not scale up properly. thus, they suggest an improvement thanks to the wasserstein distance. other methods based on this distance suggest focusing on the distance between the distributions of predictions to en-force fairness @xcite . finally, most approaches aforementioned depend on the availability of sensitive attribute annotations in the training data, and as @xcite recently emphasized, employing proxy-sensitive attributes often worsens the fairness-accuracy tradeoff. they also propose a proxy model to retrieve the missing sensitive attributes, adapted to improve the model's fairness. ## preliminaries in this section, we introduce the notations used throughout this paper. we also present the definitions of the necessary fairness metrics, and the main concepts, mostly related to the wasserstein distance which are essential for understanding the rest of the paper. ## our contribution we are now ready to show how one can cast the problem of group fairness as an independence constraint in the intermediate latent space of the mlps and derive a theoretically sound approach based on the wasserstein distance to solve it. ## experimental protocol in our experiments, we intensively use the fairlib package @xcite , which provides an access to many state-of-the-art methods and datasets. ## conclusion we presented wfc a novel method that enforces fairness constraints using a pre-trained neural network on the sensitive attributes and wasserstein regularization. our model is theoretically well-motivated and has interesting properties over existing models. the most important one is the fact that it does not require annotation of the sensitive attribute at both training and inference time. we obtain competitive results compared to baselines on the bios dataset and outperform them on the fairness score with comparable accuracy on moji dataset. furthermore, we present a solution for our algorithm to be trained when sensitive attributes are not available for a given dataset, paving the way for its use under realistic applications. in further studies, we will focus on applying this method using different text encoders or decoders, datasets, and downstream tasks, as this method can generalize to tasks out of the text classification scope, notably, regression and even unsupervised objectives.