Fair Normalizing Flows
Mislav Balunović, Anian Ruoss, Martin Vechev
Introduction
As machine learning is increasingly being used in scenarios that can negatively affect humans (Brennan et al., 2009; Khandani et al., 2010; Barocas & Selbst, 2016), fair representation learning has become one of the most promising ways to encode data into new, unbiased representations with high utility. Concretely, the goal is to ensure that representations have two properties: (i) they are informative for various prediction tasks of interest, (ii) sensitive attributes of the original data (e.g., race) cannot be recovered from the representations. Perhaps the most prominent approach for learning fair representations is adversarial training (Edwards & Storkey, 2016; Madras et al., 2018; Xie et al., 2017; Song et al., 2019; Roy & Boddeti, 2019), which jointly trains an encoder trying to transform data into a fair representation with an adversary attempting to recover sensitive attributes from the representation. However, several recent lines of work (Feng et al., 2019; Moyer et al., 2018; Elazar & Goldberg, 2018; Xu et al., 2020; Gupta et al., 2021; Song & Shmatikov, 2020) have noticed that these approaches do not produce truly fair representations: stronger adversaries can in fact recover sensitive attributes. Clearly, this could allow malicious or ignorant users to use the provided representations to discriminate. This problem emerges at a time when regulators are crafting rules (Whittaker et al., 2018; EU, 2021; FTC, 2021) on the fair usage of AI, stating that any entity that cannot guarantee non-discrimination would be held accountable for the produced data. This raises the question: Can we learn representations which provably guarantee that sensitive attributes cannot be recovered?
Following prior work, we focus on tabular datasets used for tasks such as loan or insurance assessment where fairness is of high relevance. We assume that the original input data comes from two probability distributions and , representing groups with sensitive attributes and , respectively. In the cases where distributions and are known, we will obtain provable fairness guarantees, and otherwise we perform density estimation and obtain guarantees with respect to the estimated distribution. In our experimental evaluation we confirm that the bounds computed on the estimated distribution in practice also bound adversarial accuracy on the true distribution, meaning that density estimation works well for the setting we consider.
To address the above challenges, we propose Fair Normalizing Flows (FNF), a new method for learning fair representations with guarantees. In contrast to other approaches where encoders are standard feed-forward neural networks, we instead model the encoder as a normalizing flow (Rezende & Mohamed, 2015). Fig. 1 provides a high-level overview of FNF. As shown on the left in Fig. 1, using raw inputs allows us to train high-utility classifiers , but at the same time does not protect against the existence of a malicious adversary that can predict a sensitive attribute from the features in . Our architecture consists of two flow-based encoders and , where flow transforms probability distribution into by mapping into . The goal of the training procedure is to minimize the distance between the resulting distributions and so that an adversary cannot distinguish between them. Intuitively, after training our encoder, each latent representation can be inverted into original inputs and that should ideally have similar probability w.r.t. and , meaning that even the optimal adversary cannot distinguish which of them actually produced latent . Crucially, as normalizing flows enable us to compute the exact likelihood in the latent space, for trained encoders we can upper bound the accuracy of any adversary with , which should be small if training was successful. Furthermore, the distance provides a tight upper bound (Madras et al., 2018) on common fairness notions such as demographic parity (Dwork et al., 2012) and equalized odds (Hardt et al., 2016). As shown on the right in Fig. 1, we can still train high-utility classifiers using our representations, but now we can actually guarantee that no adversary can recover sensitive attributes better than chance.
We empirically demonstrate that FNF can substantially increase provable fairness without significantly sacrificing accuracy on several common datasets. Additionally, we show that the invertibility of FNF enables algorithmic recourse, allowing us to examine how to reverse a negative decision outcome.
Main contributions
A novel fair representation learning method, called Fair Normalizing Flows (FNF), which guarantees that the sensitive attributes cannot be recovered from the learned representations at the cost of a small decrease in classification accuracy.
Experimental evaluation demonstrating that FNF can provably remove sensitive attributes from the representations, while keeping accuracy for the prediction task sufficiently high.
Extensive investigation of algorithmic recourse and applications of FNF to transfer learning.
Related Work
In this work, we focus on group fairness, which requires certain classification statistics to be equal across different groups of the population. Concretely, we consider demographic parity (Dwork et al., 2012), equalized odds (Hardt et al., 2016), and equality of opportunity (Hardt et al., 2016), which are widely studied in the literature (Edwards & Storkey, 2016; Madras et al., 2018; Zemel et al., 2013). Algorithms enforcing such fairness notions target various stages of the machine learning pipeline: Pre-processing methods transform sensitive data into an unbiased representation (Zemel et al., 2013; McNamara et al., 2019), in-processing methods modify training by incorporating fairness constraints (Kamishima et al., 2011; Zafar et al., 2017), and post-processing methods change the predictions of a pre-trained classifier (Hardt et al., 2016). Here, we consider fair representation learning (Zemel et al., 2013), which computes data representations that hide sensitive information, e.g. group membership, while maintaining utility for downstream tasks and allowing transfer learning.
Fair representations can be learned with a variety of different approaches, including variational autoencoders (Moyer et al., 2018; Louizos et al., 2016), adversarial training (Edwards & Storkey, 2016; Madras et al., 2018; Xie et al., 2017; Song et al., 2019; Roy & Boddeti, 2019; Liao et al., 2019; Jaiswal et al., 2020; Feng et al., 2019), and disentanglement (Creager et al., 2019; Locatello et al., 2019). Adversarial training methods minimize a lower bound on demographic parity, namely an adversary’s accuracy for predicting the sensitive attributes from the latent representation. However, since these methods only empirically evaluate worst-case unfairness, adversaries that are not considered during training can still recover sensitive attributes from the learned representations (Feng et al., 2019; Moyer et al., 2018; Elazar & Goldberg, 2018; Xu et al., 2020; Gupta et al., 2021; Song & Shmatikov, 2020). These findings illustrate the necessity of learning representations with provable guarantees on the maximum recovery of sensitive information regardless of the adversary, which is precisely the goal of our work. Prior work makes first steps in this direction: Gupta et al. (2021) upper bound a monotonically increasing function of demographic parity with the mutual information between the latent representation and sensitive attributes. However, the monotonic nature of this bound prevents computing guarantees on the reconstruction power of the optimal adversary. Feng et al. (2019) minimize the Wasserstein distance between latent distributions of different protected groups, but only provide an upper bound on the performance of any Lipschitz continuous adversary. However, as we will show, the optimal adversary is generally discontinuous. A concurrent work (Cerrato et al., 2022) also learns fair representations using normalizing flows, but different to us, they do not use exact likelihood computation to provide theoretical fairness guarantees.
Provable fairness guarantees
The ongoing development of guidelines on the fair usage of AI (Whittaker et al., 2018; EU, 2021; FTC, 2021) has spurred interest in provably fair algorithms. Unlike this work, the majority of these efforts (McNamara et al., 2019; John et al., 2020; Urban et al., 2020; Ruoss et al., 2020) focus on individual fairness. Individual fairness is also tightly linked to differential privacy (Dwork et al., 2012; 2006), which guarantees that an attacker cannot infer whether a given individual was present in the dataset or not, but these models can still admit reconstruction of sensitive attributes by leveraging population-level correlations (Jagielski et al., 2019). Group fairness certification methods (Albarghouthi et al., 2017; Bastani et al., 2019; Segal et al., 2020) generally only focus on certification and, unlike our work, do not learn representations that are provably fair.
Background
Fair representations
Instead of directly predicting from , Zemel et al. (2013) introduced the idea of learning fair representations of data. The idea is that a data producer preprocesses the original data to obtain a new representation . Then, any data consumer, who is using this data to solve a downstream task, can use as an input to the classifier instead of the original data . Thus, if the data producer can ensure that data representation is fair (w.r.t. some fairness notion), then all classifiers employing this representation will automatically inherit the fairness property. However, due to inherent biases of the dataset, this fairness increase generally results in a small accuracy decrease (see Appendix C for an investigation of this tradeoff in the context of our method).
Normalizing flows
Flow-based generative models (Rezende & Mohamed, 2015; Dinh et al., 2015; 2016; Kingma & Dhariwal, 2018) provide an attractive framework for transforming any probability distribution into another distribution . Accordingly, they are often used to estimate densities from data using the change of variables formula on a sequence of invertible transformations, so-called normalizing flows (Rezende & Mohamed, 2015). In this work, however, we mainly leverage the fact that flow models sample a latent variable from a density and apply an invertible function , parametrized by , to obtain datapoint . Given a density , the exact log-likelihood is then obtained by applying the change of variables formula . Thus, for with , , and , we have
A clever choice of transformations (Rezende & Mohamed, 2015; Dinh et al., 2015; 2016) makes the computation of the log-determinant tractable, resulting in efficient training and sampling. Alternative generative models cannot compute the exact log-likelihood (e.g., VAEs (Kingma & Welling, 2014), GANs (Goodfellow et al., 2014)) or have inefficient sampling (e.g., autoregressive models). Our approach is also related to discrete flows (Tran et al., 2019; Hoogeboom et al., 2019) and alignment flows (Grover et al., 2020; Usman et al., 2020). However, alignment flows jointly learn the density and the transformation, unlike the fairness setting where these are computed by different entities.
Motivation
Adversarial training (Edwards & Storkey, 2016; Madras et al., 2018) is an approach that trains encoder and classifier jointly with an adversary trying to predict the sensitive attribute . While the adversary tries to minimize its loss , the encoder and classifier are trying to maximize and minimize the classification loss as
where denotes the model family of adversaries, e.g., neural networks, considered during training. Unfortunately, there are two key issues with adversarial training. First, it yields a non-convex optimization problem, which usually cannot be solved to optimality because of saddle points. Second, it assumes that the adversary comes from a fixed model family , which means that even if the optimal cannot recover the sensitive attribute , adversaries from other model families can still do so as demonstrated in recent work (Feng et al., 2019; Moyer et al., 2018; Elazar & Goldberg, 2018; Xu et al., 2020; Gupta et al., 2021). To investigate these issues, we apply adversarial training to learn representations for our synthetic example, and measure how often the sensitive attributes can be recovered from learned representations. Our results, shown in Fig. 3, repeated 100 times with different seeds, demonstrate that adversarial training is unstable and rarely results in truly fair representations (where only 50% can be recovered). In Section 6 we follow up on recent work and show that several adversarial fair representation learning approaches do not work against adversaries from a different model familiy (e.g., larger networks). In Fig. 3 we show that our approach, introduced next, can reliably produce fair representations without affecting the utility.
Fair Normalizing Flows
Throughout this section we will assume knowledge of prior distributions and . At the end of the section, we discuss the required changes if we only work with estimates. Let and denote conditional distributions of for , and let and denote their respective densities. Madras et al. (2018) have shown that bounding the statistical distance between and provides an upper bound on the unfairness of any classifier built on top of the representation encoded by . The statistical distance between and is defined similarly to maximum mean discrepancy (MMD) (Gretton et al., 2006) between the two distributions:
In the following lemma we state the form of an optimal adversary which attains the supremum in the definition of statistical distance in Eq. 3. We show the proof in Section A.1.
The adversary attaining the supremum in the definition of can be defined as , namely it evaluates to if and only if .
This intuitively makes sense – given some representation , the adversary computes likelihood under both distributions and , and predicts the attribute with higher likelihood for that . Liao et al. (2019) also observed that the optimal adversary can be phrased as . So far, prior work mostly focused on mapping input to the latent representation via standard neural networks. However, for such models, given densities and over the input space, it is intractable to compute the densities and in the latent space as many inputs can be mapped to the same latent and we cannot use inverse function theorem. Consequently, adversarial training methods cannot compute the optimal adversary and thus resort to a lower bound.
Encoding with normalizing flows
Our approach, named Fair Normalizing Flows (FNF), consists of two models, and , that encode inputs from the groups with sensitive attributes and , respectively. We show a high-level overview of FNF in Fig. 1. Note that models and are parameterized by and , but we do not write this explicitly to ease the notation. Given some input , it is encoded to , inducing a probability distribution with density over all possible latent representations . Similarly, inputs are encoded to , inducing the probability distribution with density . Clearly, if we can train and so that the resulting distributions and have small distance, then we can guarantee fairness of the representations using the bounds from Madras et al. (2018). As evaluating the statistical distance is intractable for most neural networks, we need a model family that allows us to compute this quantity.
We propose to use bijective encoders and based on normalizing flows (Rezende & Mohamed, 2015) which allow us to compute the densities at using the change of variables formula
Given a finite number of samples and , denote as and and let be an empirical estimate of the statistical distance . Then, for we are guaranteed that with probability at least .
Training flow-based encoders
The next challenge is to design a training procedure for our newly proposed architecture. The main issue is that the statistical distance is not differentiable (as the classifier is binary), so we replace it with a differentiable proxy based on the symmetrized KL divergence, shown in Lemma 5.3 below (proof provided in Section A.1). We show a high-level description of our training procedure in Algorithm 1. In each step, we sample a batch of and from the respective distributions and encode them to the representations and . We then estimate the symmetrized KL divergence between distributions and , denoted as , and combine it with a classification loss using tradeoff parameter , and perform a gradient descent step to minimize the joint loss. While we use a convex scalarization scheme to obtain the joint loss in Algorithm 1, our approach is independent of the concrete multi-objective optimization objective (see Appendix C).
We can bound
Bijective encoders for categorical data
Many fairness datasets consist of categorical data, and often even continuous data is discretized before training. In this case, we will show that the optimal bijective representation can be easily computed. Consider the case of discrete samples coming from a probability distribution where each component takes a value from a finite set . Similar to the continuous case, our goal is to find bijections and that minimize the statistical distance of the latent distributions. Intuitively, we want to pair together inputs that have similar probabilities in both and . In Lemma 5.4 we show that the solution that minimizes the statistical distance is obtained by sorting the inputs according to their probabilities in and , and then matching inputs at the corresponding indices in these two sorted arrays. As this can result in a bad classification accuracy when inputs with different target labels get matched together, we can obtain another representation by splitting inputs in two groups according to the predicted classification label and then matching inputs in each group using Lemma 5.4. We can trade off accuracy and fairness by randomly selecting one of the two mappings based on a parameter .
Let and bijections . Denote and permutations of such that and . The encoders defined by mapping and are bijective representations with the smallest possible statistical distance.
Statistical distance of true vs. estimated density
In this work we assume access to a density of the inputs for both groups and we provably guarantee fairness with respect to this density. While it is sensible in the cases where the density estimate can be trusted (e.g., if it was provided by a regulatory agency), in many practical scenarios, and our experiments in Section 6, we only have an estimate and of the true densities and . We now want to know how far off our guarantees are compared to the ones for the true density. The following theorem provides a way to theoretically bound the statistical distance between and using the statistical distance between and .
Let and be density estimates such that and , where stands for the total variation between two distributions. If we denote the latent distributions and as and then .
This theorem can be combined with Lemma 5.2 to obtain a high probability upper bound on the statistical distance of the underlying true densities using estimated densities and a finite number of samples. Computing exact constants for the theorem is often not tractable, but as we will show experimentally, in practice the bounds computed on the estimated distribution in fact bound adversarial accuracy on the true distribution. Moreover, for low-dimensional data relevant to fairness, obtaining good estimates can be provably done for models such as Gaussian Mixture Models (Hardt & Price, 2015) and Kernel Density Estimation (Jiang, 2017). We can thus leverage the rich literature on density estimation (Rezende & Mohamed, 2015; Dinh et al., 2016; van den Oord et al., 2016a; b; c) to estimate and . Importantly, FNF is agnostic to the density estimation method (as we show in Appendix C), and can benefit from future advances in the field. Finally, we note that density estimation has already been applied in a variety of security-critical areas such as fairness (Song et al., 2019), adversarial robustness (Wong & Kolter, 2020), and anomaly detection (Pidhorskyi et al., 2018).
Experimental Evaluation
In this section, we evaluate Fair Normalizing Flows (FNF) on several standard datasets from the fairness literature. We consider UCI Adult and Crime (Dua & Graff, 2017), Compas (Angwin et al., 2016), Law School (Wightman, 2017), and the Health Heritage dataset. We preprocess Compas and Adult into categorical datasets by discretizing continuous features, and we keep the other datasets as continuous. Moreover, we preprocess the datasets by dropping uninformative features, facilitating the learning of a good density estimate, while keeping accuracy high (details shown in Appendix B). We make all of our code publicly available at https://github.com/eth-sri/fnf.
We first evaluate FNF’s effectiveness in learning fair representations by training different FNF models with different values for the utility vs. fairness tradeoff parameter . We estimate input densities using RealNVP (Dinh et al., 2016) for Health, MADE (Germain et al., 2015) for Adult and Compas, and Gaussian Mixture Models (GMMs) for the rest (we experiment with other density estimation methods in Appendix C). For continuous datasets we use RealNVP as encoder, while for categorical datasets we compute the optimal bijective representations using Lemma 5.4. Fig. 4 shows our results, each point representing a single model, with models on the right focusing on classification accuracy, and models on the left gradually increasing their fairness focus. The results in Fig. 4, averaged over 5 random seeds, indicate that FNF successfully reduces the statistical distance between representations of sensitive groups while maintaining high accuracy. We observe that for some datasets (e.g., Law School) enforcing fairness only slightly degrades accuracy, while for others there is a substantial drop (e.g., Crime). In such datasets where the label and sensitive attribute are highly correlated we cannot achieve fairness and high accuracy simultaneously (Menon & Williamson, 2018; Zhao & Gordon, 2019). Overall, we see that FNF is generally insensitive to the random seed and can reliably enforce fairness. Recall that we have focused on minimizing statistical distance of learned representations because, as mentioned earlier, Madras et al. (2018) have shown that fairness metrics such as demographic parity, equalized odds and equal opportunity can all be bounded by statistical distance. For example, FNF reduces the demographic parity distance of a classifier on Health from 0.39 to 0.08 with an accuracy drop of 3.9% (we provide similar results showing FNF’s good performance for equalized odds and equality of opportunity in Appendix C).
Bounding adversarial accuracy
Recall that the guarantees provided by FNF hold for estimated densities and . Namely, the maximum adversarial accuracy for predicting whether the latent representation originates from distribution or is bounded by . In this experiment, we investigate how well these guarantees transfer to the underlying distributions and . In Fig. 5 we show our upper bound on the adversarial accuracy computed from the statistical distance using the estimated densities (diagonal dashed line), together with adversarial accuracies obtained by training an adversary, a multilayer perceptron (MLP) with two hidden layers of 50 neurons, for each model from Fig. 4. We also show 95% confidence intervals obtained using the Hoeffding bound from Lemma 5.2. We observe that our upper bound from the estimated densities and provides a tight upper bound on the adversarial accuracy for the true distributions and . This demonstrates that, even though the exact constants from Theorem 5.5 are intractable, our density estimate is good enough in practice, and our bounds hold for adversaries on the true distribution.
Comparison with adversarial training
We now compare FNF with adversarial fair representation learning methods on Adult dataset: LAFTR-DP () (Madras et al., 2018), MaxEnt-ARL () (Roy & Boddeti, 2019), and Adversarial Forgetting () (Jaiswal et al., 2020). We train with a family of adversaries trying to predict the sensitive attribute from the latent representation. Here, the families are MLPs with 1 hidden layer of 8 neurons for LAFTR-DP, and 2 hidden layers with 64 neurons and 50 neurons for MaxEnt-ARL and Adversarial Forgetting, respectively. In Table 1 we show that these methods generally prevent adversaries from to predict the sensitive attributes. However, we can still attack these representations using either larger MLPs (3 layers of 200 neurons for LAFTR-DP) or simple preprocessing steps (for MaxEnt-ARL and Adversarial Forgetting) as proposed by Gupta et al. (2021) (essentially reproducing their results). Our results confirm findings from prior work (Feng et al., 2019; Xu et al., 2020; Gupta et al., 2021): adversarial training provides no guarantees against adversaries outside . In contrast, FNF computes a provable upper bound on the accuracy of any adversary for the estimated input distribution, and Table 1 shows that this extends to the true distribution. FNF thus learns representations with significantly lower adversarial accuracy with only minor decrease in task accuracy.
Algorithmic recourse with FNF
Flow architectures
In the next experiment we compare the RealNVP encoder with an alternative encoder based on the Neural Spline Flows architecture (Durkan et al., 2019) for the Crime dataset. In Table 2 we show the statistical distance and accuracy for models obtained using different values for the tradeoff parameter . We can observe that both flows offer similar performance. Note that FNF will benefit from future advances in normalizing flows research, as it is orthogonal to the concrete flow architecture that is used for training.
Transfer learning
Unlike prior work, transfer learning with FNF requires no additional reconstruction loss since both encoders are invertible and thus preserve all information about the input data. To demonstrate this, we follow the setup from Madras et al. (2018) and train a model to predict the Charlson Index for the Health Heritage Prize dataset. We then transfer the learned encoder and train a classifier for the task of predicting the primary condition group. Our encoder reduces the statistical distance from 0.99 to 0.31 (this is independent of the label). For the primary condition group MSC2a3 we retain the accuracy at 73.8%, while for METAB3 it slightly decreases from 75.4% to 73.1%.
Conclusion
We introduced Fair Normalizing Flows (FNF), a new method for learning representations ensuring that no adversary can predict sensitive attributes at the cost of a small accuracy decrease. This guarantee is stronger than prior work which only considers adversaries from a restricted model family. The key idea is to use an encoder based on normalizing flows which allows computing the exact likelihood in the latent space, given an estimate of the input density. Our experimental evaluation on several datasets showed that FNF effectively enforces fairness without significantly sacrificing utility, while simultaneously allowing interpretation of the representations and transferring to unseen tasks.
Ethics Statement
Since machine learning models have been shown to reinforce the human biases that are embedded in the training data, regulators and scientists alike are striving to propose novel regulations and algorithms to ensure the fairness of such models. Our method enables data producers to learn fair data representations that are guaranteed to be non-discriminatory regardless of the concrete downstream use case. Since our method relies on accurate density estimates, we envision that the data regulators, whose tasks already include determining fairness criteria, data sources, and auditing results, would create a regulatory framework for density estimation that can then be realized by, e.g., industrial partners. Importantly, this would not require regulators to estimate the densities themselves. Nevertheless, data regulators would need to take great care when formulating such legislation since the potential negative effects of poor density estimates are still largely unexplored, both in the context of our work and in the broader field (particularly for high-dimensional data). In this setting, any data producer using our method would then be able to guarantee the fairness of all potential downstream consumer models.
References
Appendix A Appendix
Here we present the proofs of the theorems used in the paper.
Proof of Lemma 5.2 (Finite sample estimate)
We start by plugging in the optimal adversary from Lemma 5.1 into the definition of the statistical distance. Let be the optimal adversary defined in Lemma 5.1, namely if and only if . We first write the statistical distance in terms of the optimal adversary , then bound the statistical distance using triangle inequality and finally apply Hoeffding’s inequality on the individual terms:
where Hoeffding’s inequality guarantees that with probability at least the first and last summand are at most . ∎
Proof of Lemma 5.3 (Bounding the statistical distance with symmetrized KL)
We can bound the statistical distance by noticing that because is a binary classifier and thus
Pinsker’s inequality guarantees that . Given that we also have that . Thus, in order to bound the statistical distance we can use , which corresponds to our objective with symmetrized KL divergence used in Algorithm 1. ∎
Proof of Lemma 5.4 (Encoding for discrete distributions)
Without loss of generality we can assume that . Assume that and where and . Let and . In the case when or it is easy to show that . Now, in the case when , we can see that . Similarly, when , we can see that . In all cases, , which means that if we swap and the total variation either decreases or stays the same. We can repeatedly swap such pairs, and once there are no more swaps to do, we arrive at the condition of the lemma where the two arrays are sorted the same way.
Proof of Theorem 5.5 (True and approximate distributions)
Let be a sensitive attribute, and assume that . Recall that the change of variables for probability densities gives us that for the representation we have, similar as in Eq. 4, and . Then, using those formulas together with the change of variables rule for multivariate integrals we derive:
We will also use the observation from the proof of Lemma 5.1 which states that
We can now observe that the following inequality holds:
Here, the last inequality follows from the previously proved inequality , applied for both and . ∎
Appendix B Experimental Setup
In this section, we provide the full specification of our experimental setup. We first discuss the datasets considered and the corresponding preprocessing methods employed. We empirically validate that our preprocessing maintains high accuracy on the respective prediction tasks. Finally, we specify the hyperparameters and computing resources for the experiments in Section 6.
We consider five commonly studied datasets from the fairness literature: Adult and Crime from the UCI machine learning repository (Dua & Graff, 2017), Compas (Brennan et al., 2009), Law School (Wightman, 2017), and the Health Heritage Prize (Kaggle, 2012) dataset. Below, we briefly introduce each of these datasets and discuss whether they contain personally identifiable information, if applicable. We preprocess Adult and Compas into categorical datasets by discretizing continuous features, keeping the other datasets as continuous. We drop rows and columns with missing values. For each dataset, we first split the data into training and test set, using the original splits wherever possible and a 80% / 20% split of the original dataset otherwise. We then further sample 20% of the training set to be used as validation set. Table 3 displays the dataset statistics for each of these splits. Finally, we drop uninformative features to facilitate density estimation. We show that the removal of these features does not significantly affect the predictive utility of the data in Table 4.
The Adult dataset, also known as Census Income dataset, was extracted from the 1994 Census database by Barry Becker and is provided by the UCI machine learning repository (Dua & Graff, 2017). It contains 14 attributes: age, workclass, fnlwgt, education, education-num, marital-status, occupation, relationship, race, sex, capital-gain, capital-loss, hours-per-week, and native-country. The prediction task is to determine whether a person makes over US dollars per year. We consider sex as the protected attribute, and we discretize the dataset by keeping only the categorical columns relationship, workclass, marital-status, race, occupation, education-num, and education.
Compas
The Compas (Brennan et al., 2009) dataset was procured by ProPublica, and contains the criminal history, jail and prison time, demographics, and COMPAS risk scores for defendants from Broward County from 2012 and 2013. Through a public records request, ProPublica obtained two years worth of COMPAS scores ( people) from the Broward County Sheriff’s Office in Florida. This data was then augmented with public criminal records from the Broward County Clerk’s Office website. Furthermore, jail records were obtained from the Browards County Sheriff’s Office, and public incarceration records were downloaded from the Florida Department of Corrections website. The task consists of predicting recidivsm within two years for all individuals. We only consider Caucasian and African-American individuals and use race as the protected attribute. We discretize the continuous features age, diff-custody, diff-jail, and priors-count, and we remove all other features except for sex, c-charge-degree, and v-score-text.
Crime
The Communities and Crime dataset combines socio-economic data from the 1990 US Census, law enforcement data from the 1990 US LEMAS survey, and crime data from the 1995 FBI UCR. It was created by Michael Redmond and is provided by the UCI machine learning repository (Dua & Graff, 2017). The dataset contains 128 attributes such as county, population, per capita income, and number of immigrants. The task consists of predicting whether the number of violent crimes per population for a given community is above or below the median. We consider race as the protected attribute, which we set to 1 if the percentage of white people divided by 5 is smaller than the percentage of black, asian, and hispanic individuals, and to 0 otherwise. We keep the following 6 features: racePctWhite, pctWInvInc, PctFam2Par, PctKids2Par, PctYoungKids2Par, PctKidsBornNeverMar.
Health
The Health dataset was created for the Heritage Health Prize (Kaggle, 2012) competition on Kaggle and contains medical records of over patients. We consider the merged claims, drug count, lab count, and members sheets, which have a total of 18 attributes. The identity of individual patients and health care providers, as well as other individual identifiable information, has been removed from the datasets to protect the privacy of those involved and to comply with applicable law. We consider age as the protected attribute, which we binarize to patients above and below 60 years. The task is to predict the maximum Charlson Comordbidity Index, which predicts 10-year survival in patients with multiple comorbities. We drop all but the following features: DrugCount-total, DrugCount-months, no-Claims, no-Providers, PayDelay-total, PrimaryConditionGroup, Specialty, ProcedureGroup, and PlaceSvc. For the transfer learning experiments we follow Madras et al. (2018) and omit the primary condition group labels from the set of features and try to predict them from the latent representation without explicitly optimizing for the task.
Law School
The Law School (Wightman, 2017) dataset contains admissions data from 25 law schools over the 2005, 2006, and in some cases 2007 admission cycles, providing information on over individual applications. The data was procured by Project SEAPHE and was cleaned to adhere to high standards of data privacy. Concretely, when the school, race, year, and gender information for enrolled students produced cells of fewer than five subjects, the cells were combined to minimize reidentification risk. The attributes are law school, year of fall term, LSAT score, undergraduate GPA, race, gender, and in-state residency. We consider race as the protected attribute, which we binarize to white and non-white. We remove all features but the LSAT score, undergraduate GPA, and the college to which the student applied (ordered by decreasing admission rate).
B.2 Training details
Our code is implemented in PyTorch (Paszke et al., 2019).
We run all experiments on a desktop PC using a single GeForce RTX 2080 Ti GPU and 16-core Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz.
Hyperparameters for main experiments
For Crime we estimate input density using Gaussian Mixture Model (GMM) with 4 components for and 2 components for . For Law we use GMM with 8 components for both groups. The Health dataset requires more complex density estimation so we use RealNVP (Dinh et al., 2016) with 4 blocks of 20 neurons each. For categorical datasets, Adult and Compas, we perform density estimation using MADE (Germain et al., 2015), which is represented using network of 2 hidden layers with 50 neurons.
We represent flow encoders using RealNVP with 4 blocks for Crime and Law, and 6 blocks for Health. Crime and Law use batch size 128, initial learning rate 0.01 and weight decay 0.0001, while Health uses batch size 256, initial learning rate 0.001 and weight decay 0. Training is performed using Adam (Kingma & Ba, 2015) optimizer. We use 60, 100, and 80 epochs for Crime, Law and Health, respectively. These parameters were chosen based on the performance on validation set.
For experiments in Fig. 4, we trained with the following 5 values for for respective datasets: 0, 0.02, 0.1, 0.2, 0.9 for Crime, Adult and Compas, 0, 0.001, 0.02, 0.1, 0.9 for Law, 0, 0.05, 0.1, 0.5, 0.95 for Health. Training for 1 epoch takes around 1 second for Crime, 5 seconds for Law, and 30 seconds for Health.
Appendix C Additional Experiments
In this section we present additional experimental results.
In Section 6 we focused on presenting results on statistical distance, as it can bound various fairness metrics Madras et al. (2018). In constrast, here we provide more detailed experiments with three common group fairness metrics: demographic parity, equalized odds, and equality of opportunity. We demonstrate the tradeoff between these metrics and downstream accuracy in Fig. 6. We observe that FNF achieves high rates of demographic parity, equalized odds, and equality of opportunity with only small decreases in classification accuracy (similar to the results for the statistical distance showed in Fig. 4).
Compatibility with different scalarization schemes
Since fairness and accuracy are often competing objectives, they merit a treatment from multi-objective optimization. Here, we investigate the scalarization scheme proposed by Wei & Niethammer (2020) and replace our objective , obtained via convex scalarization, with the Chebyshev scalarization scheme , where we use the same normalization for , , and as Wei & Niethammer (2020).
We evaluate the schemes for a large range of values on the Crime dataset and compute the Area Under the Curve (AUC) with the trapezoidal rule. The convex scalarization yields an AUC of 0.6036, whereas the Chebyshev scalarization attains an AUC of 0.6051. Moreover, we aggregate the results in Fig. 7. In general, we observe that the convex scalarization slightly outperforms the Chebyshev scalarization scheme. We believe that this is due to two reasons, (i) the Pareto curve is almost convex, which is why the convex scalarization performs well, and (ii) the stochasticity of gradient-based optimization. We consider more advanced multi-objective optimization methods Lin et al. (2019); Martínez et al. (2020) an interesting direction for future work.
Compatibility with different priors
In the following experiment, we demonstrate that FNF is compatible with any differentiable estimate of and . We consider Crime with the same setup as before, but with 3 different priors: a GMM with components, an autoregressive prior, and a RealNVP flow (Dinh et al., 2016). For each of these priors, we train an encoder using FNF and a classifier on top of the learned representations. Fig. 8 shows the tradeoff between the statistical distance and accuracy for each of the priors. Based on these results, we can conclude that FNF achieves similar results for each of the priors, empirically demonstrating the flexibility of our approach.
Interpreting the representations
Tradeoff between accuracy and fairness
Zhao & Gordon (2019) proved that any classifier with perfect statistical distance necessarily has to sacrifice classification accuracy, where the exact tradeoff depends on the difference in base rates between the different sensitive groups. We confirm this statement, with an investigation of the tradeoff between accuracy and fairness for the Crime dataset, where we need to sacrifice a significant amount of accuracy in order to decrease the statistical distance (as can be observed in Fig. 4).
For each pair of sensitive attribute (racial group) and label (whether the number of violent crimes is above the median) we report the probability in Table 5 (the probabilities for the other datasets can be found in Table 3). Clearly, Table 5 shows that the sensitive attribute and the task label of the Crime dataset are highly correlated: one racial group was much more likely to be reported for violent crimes than the other. This is, of course, a consequence of bias in the data (e.g., some neighborhoods tend to be policed more often so more crimes will be reported), as has been documented in various studies, e.g., see Brennan et al. (2009) for a study of the Compas dataset. Thus, in accordance with the result from Zhao & Gordon (2019), we need to sacrifice a lot of accuracy to achieve a small statistical distance on the Crime dataset.