Title: TRAINING INDIVIDUALLY FAIR ML MODELS WITH SENSITIVE SUBSPACE ROBUSTNESS

Abstract: We consider training machine learning models that are fair in the sense that their performance is invariant under certain sensitive perturbations to the inputs. For example, the performance of a resume screening system should be invariant under changes to the gender and/or ethnicity of the applicant. We formalize this notion of algorithmic fairness as a variant of individual fairness and develop a distributionally robust optimization approach to enforce it during training. We also demonstrate the effectiveness of the approach on two ML tasks that are susceptible to gender and racial biases.

1. INTRODUCTION:

Machine learning (ML) models are gradually replacing humans in high-stakes decision making roles. For example, in Philadelphia, an ML model classifies probationers as high or low-risk (Metz & Satariano, 2020) . In North Carolina, "analytics" is used to report suspicious activity and fraud by Medicaid patients and providers (Metz & Satariano, 2020) . Although ML models appear to eliminate the biases of a human decision maker, they may perpetuate or even exacerbate biases in the training data (Barocas & Selbst, 2016) . Such biases are especially objectionable when it adversely affects underprivileged groups of users (Barocas & Selbst, 2016) .

In response, the scientific community has proposed many mathematical definitions of algorithmic fairness and approaches to ensure ML models satisfy the definitions. Unfortunately, this abundance of definitions, many of which are incompatible (Kleinberg et al., 2016; Chouldechova, 2017) , has hindered the adoption of this work by practitioners. There are two types of formal definitions of algorithmic fairness: group fairness and individual fairness. Most recent work on algorithmic fairness considers group fairness because it is more amenable to statistical analysis (Ritov et al., 2017) . Despite their prevalence, group notions of algorithmic fairness suffer from certain shortcomings. One of the most troubling is there are many scenarios in which an algorithm satisfies group fairness, but its output is blatantly unfair from the point of view of individual users (Dwork et al., 2011) .

In this paper, we consider individual fairness instead of group fairness. Intuitively, an individually fair ML model treats similar users similarly. Formally, an ML model is a map h : X → Y, where X and Y are the input and output spaces. The leading notion of individual fairness is metric fairness (Dwork et al., 2011) ; it requires d y (h(x 1 ), h(x 2 )) ≤ Ld x (x 1 , x 2 ) for all x 1 , x 2 ∈ X ,

(1.1)

where d x and d y are metrics on the input and output spaces and L ≥ 0 is a Lipschitz constant. The fair metric d x encodes our intuition of which samples should be treated similarly by the ML model. We emphasize that d x (x 1 , x 2 ) being small does not imply x 1 and x 2 are similar in all respects. Even if d x (x 1 , x 2 ) is small, x 1 and x 2 may differ in certain problematic ways, e.g. in their protected/sensitive attributes. This is why we refer to pairs of samples x 1 and x 2 such that d x (x 1 , x 2 ) is small as comparable instead of similar.

Despite its benefits, individual fairness was dismissed as impractical because there is no widely accepted fair metric for many ML tasks. Fortunately, there is a line of recent work on learning the fair metric from data (Ilvento, 2019; Wang et al., 2019) . In this paper, we consider two data-driven choices of the fair metric: one for problems in which the sensitive attribute is reliably observed, and another for problems in which the sensitive attribute is unobserved (see Appendix B).

The rest of this paper is organized as follows. In Section 2, we cast individual fairness as a form of robustness: robustness to certain sensitive perturbations to the inputs of an ML model. This allows us to leverage recent advances in adversarial ML to train individually fair ML models. More concretely, we develop an approach to audit ML models for violations of individual fairness that is similar to adversarial attacks (Goodfellow et al., 2014) and an approach to train ML models that passes such audits (akin to adversarial training (Madry et al., 2017) ). We justify the approach theoretically (see Section 3) and empirically (see Section 4).

2. FAIRNESS THROUGH (DISTRIBUTIONAL) ROBUSTNESS:

To motivate our approach, imagine an auditor investigating an ML model for unfairness. The auditor collects a set of audit data and compares the output of the ML model on comparable samples in the audit data. For example, to investigate whether a resume screening system is fair, the auditor may collect a stack of resumes and change the names on the resumes of Caucasian applicants to names more common among the African-American population. If the system performs worse on the edited resumes, then the auditor may conclude the model treats African-American applicants unfairly. Such investigations are known as correspondence studies, and a prominent example is Bertrand & Mullainathan's celebrated investigation of racial discrimination in the labor market. In a correspondence study, the investigator looks for inputs that are comparable to the training examples (the edited resumes in the resume screening example) on which the ML model performs poorly. In the rest of this section, we formulate an optimization problem to find such inputs.

2.1. FAIR WASSERSTEIN DISTANCES:

Recall X and Y are the spaces of inputs and outputs. To keep things simple, we assume that the ML task at hand is a classification task, so Y is discrete. We also assume that we have a fair metric d x of the form

d x (x 1 , x 2 ) 2 x 1 -x 2 , Σ(x 1 -x 2 ) 1 2

, where Σ ∈ S d×d + . For example, suppose we are given a set of K "sensitive" directions that we wish the metric to ignore; i.e. d(x 1 , x 2 ) 1 for any x 1 and x 2 such that x 1 -x 2 falls in the span of the sensitive directions. These directions may be provided by a domain expert or learned from data (see Section 4 and Appendix B). In this case, we may choose Σ as the orthogonal complement projector of the span of the sensitive directions. We equip X with the fair metric and Z X × Y with

d z ((x 1 , y 1 ), (x 2 , y 2 )) d x (x 1 , x 2 ) + ∞ • 1{y 1 = y 2 }.

We consider d 2 z as a transport cost function on Z. This cost function encodes our intuition of which samples are comparable for the ML task at hand. We equip the space of probability distributions on Z with the fair Wasserstein distance

W (P, Q) = inf Π∈C(P,Q) Z×Z c(z 1 , z 2 )dΠ(z 1 , z 2 ),

where C(P, Q) is the set of couplings between P and Q. The fair Wasserstein distance inherits our intuition of which samples are comparable through the cost function; i.e. the fair Wasserstein distance between two probability distributions is small if they are supported on comparable areas of the sample space.

2.2. AUDITING ML MODELS FOR ALGORITHMIC BIAS:

To investigate whether an ML model performs disparately on comparable samples, the auditor collects a set of audit data {(x i , y i )} n i=1 and solves the optimization problem max P :W (P,Pn)≤ Z (z, h)dP (z), (2.1)

where : Z × H → R + is a loss function, h is the ML model, P n is the empirical distribution of the audit data, and > 0 is a small tolerance parameter. We interpret as a moving budget that the auditor may expend to discover discrepancies in the performance of the ML model. This budget forces the auditor to avoid moving samples to incomparable areas of the sample space. We emphasize that equation 2. 

sup P :W (P,Pn)≤ E P (Z, h) = inf λ≥0 {λ + E Pn c λ (Z, h) }, c λ ((x i , y i ), h) sup x∈X ((x, y i ), θ) -λd x (x, x i ).

(2.3) This is a univariate optimization problem, and it is amenable to stochastic optimization. We describe a stochastic approximation algorithm for equation 2.3 in Algorithm 1. Inspecting the algorithm, we see that it is similar to the PGD algorithm for adversarial attack.

Algorithm 1 stochastic gradient method for equation 2.3

Require: starting point λ1 , step sizes α t > 0 1: repeat 2:

draw mini-batch (x t1 , y t1 ), . . . , (x t B , y t B ) ∼ P n 3:

x * t b ← arg max x∈X ((x, y t b ), h) -λd x (x t b , x), b ∈ [B] 4: λt+1 ← max{0, λt -α t ( -1 B B b=1 d x (x t b , x * t b ))} 5: until converged

It is known that the optimal point of equation 2.1 is the discrete measure 1 n n i=1 δ (T λ (xi),yi) , where T λ : X → X is the unfair map

T λ (x i ) ← arg max x∈X ((x, y i ), h) -λd 2 x (x, x i ).

(2.4)

We call T λ an unfair map because it reveals unfairness in the ML model by mapping samples in the audit data to comparable areas of the sample space that the system performs poorly on. We note that T λ may map samples in the audit data to areas of the sample space that are not represented in the audit data, thereby revealing disparate treatment in the ML model not visible in the audit data alone. We emphasize that T λ more than reveals disparate treatment in the ML model; it localizes the unfairness to certain areas of the sample space.

We present a simple example to illustrating fairness through robustness (a similar example appeared in Hashimoto et al. ( 2018)). Consider the binary classification dataset shown in Figure 1 . There are two subgroups of observations in this dataset, and (sub)group membership is the protected attribute (e.g. the smaller group contains observations from a minority subgroup). In Figure 1a we see the decision heatmap of a vanilla logistic regression, which performs poorly on the blue minority subgroup. The two subgroups are separated in the horizontal direction, so the horizontal direction is the sensitive direction. Figure 1b shows that such classifier is unfair with respect to the corresponding fair metric, i.e. the unfair map equation 2.4 leads to significant loss increase by transporting mass along the horizontal direction with very minor change of the vertical coordinate.

Comparison with metric fairness Before moving on to training individually fair ML models, we compare DRF with metric fairness equation 1.1. Although we concentrate on the differences between the two definitions here, they are more similar than different: both formalize the intuition that the outputs of a fair ML model should perform similarly on comparable inputs. That said, there are two main differences between the two definitions. First, instead of requiring the output of the ML model to be similar on all inputs comparable to a training example, we require the output to be similar to the training label. Thus DRF not only enforces similarity of the output on comparable inputs, but also accuracy of the ML model on the training data. Second, DRF considers differences between datasets instead of samples by replacing the fair metric on inputs with the fair Wasserstein distance induced by the fair metric. The main benefits of this modifications are (i) it is possible to optimize equation 2.1 efficiently, (ii) we can show this modified notion of individual fairness generalizes.

2.3. FAIR TRAINING WITH SENSITIVE SUBSPACE ROBUSTNESS:

We cast the fair training problem as training supervised learning systems that are robust to sensitive perturbations. We propose solving the minimax problem

EQUATION

where c λ is defined in equation 2.3. This is an instance of a distributionally robust optimization (DRO) problem, and it inherits some of the statistical properties of DRO. To see why equation 2.5 encourages individual fairness, recall the loss function is a measure of the performance of the ML model. By assessing the performance of an ML model by its worse-case performance on hypothetical populations of users with perturbed sensitive attributes, minimizing equation 2.5 ensures the system performs well on all such populations. In our toy example, minimizing equation 2.5 implies learning a classifier that is insensitive to perturbations along the horizontal (i.e. sensitive) direction. In Figure 1c this is achieved by the algorithm we describe next.

To keep things simple, we assume the hypothesis class is parametrized by θ ∈ Θ ⊂ R d and replace the minimization with respect to H by minimization with respect to θ. In light of the similarities between the DRO objective function and adversarial training, we borrow algorithms for adversarial training (Madry et al., 2017) to solve equation 2.5 (see Algorithm 2).

Algorithm 2 Sensitive Subspace Robustness (SenSR)

Require: starting point θ1 , step sizes α t , β t > 0 1: repeat 2: sample mini-batch (x 1 , y 1 ), . . . , (x B , y B ) ∼ P n 3: x * t b ← arg max x∈X ((x, y t b ), θ) -λt d x (x t b , x), b ∈ [B] 4: λt+1 ← max{0, λt -α t ( -1 B B b=1 d x (x t b , x * t b ))} 5: θt+1 ← θt -βt B B b=1 ∂ θ ((x * t b , y t b ), θt ) 6: until converged

Related work:

Our approach to fair training is an instance of distributionally robust optimization (DRO). In DRO, the usual sample-average approximation of the expected cost function is replaced by L DRO (θ) sup P ∈U E P (Z, θ) , where U is a (data dependent) uncertainty set of probability distributions. The uncertainty set may be defined by moment or support constraints (Chen et al., 2007; Delage & Ye, 2010; Goh & Sim, 2010) , f -divergences (Ben-Tal et al., 2012; Lam & Zhou, 2015; Miyato et al., 2015; Namkoong & Duchi, 2016) , and Wasserstein distances (Shafieezadeh-Abadeh et al., 2015; Blanchet et al., 2016; Esfahani & Kuhn, 2015; Lee & Raginsky, 2017; Sinha et al., 2017) . Most similar to our work is Hashimoto et al. ( 2018): they show that DRO with a χ 2 -neighborhood of the training data prevents representation disparity, i.e. minority groups tend to suffer higher losses because the training algorithm ignores them. One advantage of picking a Wasserstein uncertainty set is the set depends on the geometry of the sample space. This allows us to encode the correct notion of individual fairness for the ML task at hand in the Wasserstein distance.

Our approach to fair training is also similar to adversarial training (Madry et al., 2017) , which hardens ML models against adversarial attacks by minimizing adversarial losses of the form sup u∈U (z + u, θ), where U is a set of allowable perturbations (Szegedy et al., 2013; Goodfellow et al., 2014; Papernot et al., 2015; Carlini & Wagner, 2016; Kurakin et al., 2016) . Typically, U is a scaled p -norm ball: U = {u : u p ≤ }. Most similar to our work is Sinha et al. (2017) : they consider an uncertainty set that is a Wasserstein neighborhood of the training data.

There are a few papers that consider adversarial approaches to algorithmic fairness. Zhang et al. (2018) propose an adversarial learning method that enforces equalized odds in which the adversary learns to predict the protected attribute from the output of the classifier. Edwards & Storkey (2015) propose an adversarial method for learning classifiers that satisfy demographic parity. Madras et al. (2018) generalize their method to learn classifiers that satisfy other (group) notions of algorithmic fairness. Garg et al. (2019) propose to use adversarial logit pairing (Kannan et al., 2018) to achieve fairness in text classification using a pre-specified list of counterfactual tokens.

3. SENSR TRAINS INDIVIDUALLY FAIR ML MODELS:

One of the main benefits of our approach is it provably trains individually fair ML models. Further, it is possible for the learner to certify that an ML model is individually fair a posteriori. As we shall see, both are consequences of uniform convergence results for the DR loss class. More concretely, we study how quickly the uniform convergence error δ n sup θ∈Θ sup P :W * (P,Pn)≤ E P (Z, θ) -sup P :W (P,Pn)≤ E P (Z, θ) , (3.1)

where W * is the Wasserstein distance on ∆(Z) with a transportation cost function c * that is possibly different from c, vanishes. We permit some discrepancy in the (transportation) cost function to study the effect of a data-driven choice of c. In the rest of this section, we regard c * as the exact cost function and c as a cost function learned from human supervision. We start by stating our assumptions on the ML task:

(A1) the feature space X is bounded: D max{diam(X ), diam * (X )} < ∞;

(A2) the functions in the loss class L = { (•, θ) : θ ∈ Θ} are non-negative and bounded: 0 ≤ (z, θ) ≤ M for all z ∈ Z and θ ∈ Θ, and L-Lipschitz with respect to d x :

sup θ∈Θ {sup (x1,y),(x2,y)∈Z | ((x 1 , y), θ) -((x 2 , y), θ)|} ≤ Ld x (x 1 , x 2 );

(A3) the discrepancy in the (transportation) cost function is uniformly bounded:

sup (x1,y),(x2,y)∈Z |c((x 1 , y), (x 2 , y)) -c * ((x 1 , y), (x 2 , y))| ≤ δ c D 2 .

Assumptions A1 and A2 are standard (see (Lee & Raginsky, 2017 , Assumption 1, 2, 3)) in the DRO literature. We emphasize that the constant L in Assumption A2 is not the constant L in the definition of metric fairness; it may be much larger. Thus most models that satisfy the conditions of the loss class are not individually fair in a meaningful sense.

Assumption A3 deserves further comment. Under A1, A3 is mild. For example, if the exact fair metric is

d x (x 1 , x 2 ) = (x 1 -x 2 ) T Σ * (x 1 -x 2 ) 1 2 , then the error in the transportation cost function is at most |c((x 1 , y), (x 2 , y)) -c * ((x 1 , y), (x 2 , y))| = |(x 1 -x 2 ) T Σ(x 1 -x 2 ) -(x 1 -x 2 ) T Σ * (x 1 -x 2 )| ≤ D 2 Σ-Σ * 2 λmin(Σ * ) ,

We see that the error in the transportation cost function vanishes in the large-sample limit as long as Σ is a consistent estimator of Σ * .

We state the uniform convergence result in terms of the entropy integral of the loss class:

C(L) = ∞ 0 log N ∞ (F, r)dr,

where N ∞ (L, r) as the r-covering number of the loss class in the uniform metric. The entropy integral is a measure of the complexity of the loss class. Proposition 3.1 (uniform convergence). Under Assumptions A1-A3, equation 3.1 satisfies

δ n ≤ 48C(L) √ n + 48LD 2 √ n + Lδ c D 2 √ + M ( log 2 t 2n ) 1 2 (3.2)

with probability at least 1 -t.

We note that Proposition 3.1 is similar to the generalization error bounds by Lee & Raginsky (2017) .

The main novelty in Proposition 3.1 is allowing error in the transportation cost function. We see that the discrepancy in the transportation cost function may affect the rate at which the uniform convergence error vanishes: it affects the rate if The gap is the difference between the optimal value of the auditor's optimization problem equation 2.1 and the (non-robust) risk. A small gap implies the auditor cannot significantly increase the loss by moving samples from P * to comparable samples. Proposition 3.2. Under the assumptions A1-A3, as long as there is θ ∈ Θ such that 

δ c is ω P ( 1 √ n ). A consequence

4. COMPUTATIONAL RESULTS:

In this section, we present results from using SenSR to train individually fair ML models for two tasks: sentiment analysis and income prediction. We pick these two tasks to demonstrate the efficacy of SenSR on problems with structured (income prediction) and unstructured (sentiment analysis) inputs and in which the sensitive attribute (income prediction) is observed and unobserved (sentiment analysis). We refer to Appendix C and D for the implementation details. 

Problem formulation:

We study the problem of classifying the sentiment of words using positive (e.g. 'smart') and negative (e.g. 'anxiety') words compiled by Hu & Liu (2004) . We embed words using 300-dimensional GloVe (Pennington et al., 2014 ) and train a one layer neural network with 1000 hidden units. Such classifier achieves 95% test accuracy, however it entails major individual fairness violation. Consider an application of this sentiment classifier to summarizing customer reviews, tweets or news articles. Human names are typical in such texts and should not affect the sentiment score, hence we consider fair metric between any pair of names to be 0. Then sentiment score for all names should be the same to satisfy the individual fairness. To make a connection to group fairness, following the study of Caliskan et al. (2017) that reveals the biases in word embeddings, we evaluate the fairness of our sentiment classifier using male and female names typical for Caucasian and African-American ethnic groups. We emphasize that to satisfy individual fairness, the sentiment of any name should be the same.

Comparison metrics To evaluate the gap between two groups of names, N 0 for Caucasian (or female) and N 1 for African-American (or male), we report

1 |N0| n∈N0 (h(n) 1 -h(n) 0 ) - 1 |N1| n∈N1 (h(n) 1 -h(n) 0 )

, where h(n) k is logits for class k of name n (k = 1 is the positive class). We use list of names provided in Caliskan et al. (2017) , which consists of 49 Caucasian and 45 African-American names, among those 48 are female and 46 are male. The gap between African-American and Caucasian names is reported as Race gap, while the gap between male and female names is reported as Gend. gap in Table 1 . As in Speer (2017) , we also compare sentiment difference of two sentences: "Let's go get Italian food" and "Let's go get Mexican food", i.e. cuisine gap (abbreviated Cuis. gap in Table 1 ), as a test of generalization beyond names. To embed these sentences we average their word embeddings.

Sensitive subspace We consider embeddings of 94 names that we use for evaluation as sensitive directions, which may be regarded as utilizing the expert knowledge, i.e. these names form a list of words that an expert believes should be treated equally. Fair metric is then defined using an orthogonal complement projector of the span of sensitive directions as we discussed in Section 2.1. When expert knowledge is not available, or we wish to achieve general fairness for names, we utilize a side dataset of popular baby names in New York City. 1 The dataset has 11k names, however only 32 overlap with the list of names used for evaluation. Embeddings of these names define a group of comparable samples that we use to learn sensitive directions with SVD (see Appendix B.2 and Algorithm 3 for details). We take top 50 singular vectors to form the sensitive subspace. It is worth noting that, unlike many existing approaches in the fairness literature, we do not use any protected attribute information. Our algorithm only utilizes training words, their sentiments and a vanilla list of names.

Results:

From the box-plots in Figure 2 , we see that both race and gender gaps are significant when using the baseline neural network classifier. It tends to predict Caucasian names as "positive", while the median for African-American names is negative; the median sentiment for female names is higher than that for male names. We considered three other approaches to this problem: the algorithm of Bolukbasi et al. (2016) for pre-processing word embeddings; pre-processing via projecting (Sinha et al., 2017) . All approaches improved upon the baseline, however only SenSR can be considered individually fair.

Our algorithm practically eliminates gender and racial gaps and achieves the notion of individual fairness as can be seen from almost equal predicted sentiment score for all names. We remark that using expert knowledge (i.e. evaluation names) allowed SenSR-E (E for expert) to further improve both group and individual fairness. However we warn practitioners that if the expert knowledge is too specific, generalization outside of the expert knowledge may not be very good. In Table 1 we report results averaged across 10 repetitions with 90%/10% train/test splits, where we also verify that accuracy trade-off with the baseline is minor. In the right column we present the generalization check, i.e. comparing a pair of sentences unrelated to names. Utilizing expert knowledge led to a fairness over-fitting effect, however we still see improvement over other methods. When utilizing SVD of a larger dataset of names we observe better generalization. Our generalization check suggests that fairness over-fitting is possible, therefore datasets and procedure for verifying fairness generalization are needed.

4.2. ADULT:

Problem formulation Demonstrating the broad applicability of SenSR outside of natural language processing tasks, we apply SenSR to a classification task on the Adult (Dua & Graff, 2017) data set to predict whether an individual makes at least $50k based on features like gender and occupation for approximately 45,000 individuals. Models that predict income without fairness considerations can contribute to the problem of differences in pay between genders or races for the same work. Throughout this section, gender (male or female) and race (Caucasian or non-Caucasian) are binary.

Comparison metrics Arguably a classifier is individually unfair if the classifications for two data points that are the same on all features except demographic features are different. Therefore, to assess individual fairness, we report spouse consistency (S-Con.) and gender and race consistency (GR-Con.), which are measures of how often classifications change only because of differences in demographic features. For S-Con (resp. GR-con), we make 2 (resp. 4) copies of every data point where the only difference is that one is a husband and the other is a wife (resp. difference is in gender and race). S-Con (resp. GR-Con) is the fraction of corresponding pairs (resp. quadruples) that have the same classification. We also report various group fairness measures proposed by De-Arteaga et al. ( 2019) with respect to race or gender based on true positive rates, i.e. the ability of a classifier to correctly identify a given class. See Appendix D.5 for the definitions. We report Gap RMS R , Gap RMS G , Gap max R , and Gap max G where R refers to race, and G refers to gender. We use balanced accuracy (Bacc) instead of accuracy2 to measure predictive ability since only 25% of individuals make at least $50k.

Sensitive subspace Let {(x i , x gi )} m i=1 be the set of features x i ∈ R D of the data except the coordinate for gender is zeroed and where x gi indicates the gender of individual i. For γ > 0, let w g = arg min w∈R D 1 m m i=1 -x gi (w T x i ) + log(1 + e w T xi ) + γ w 2 , i.e. w g is the learned hyperplane that classifies gender given by regularized logistic regression. Let e g ∈ R D (resp. e r ) be the vector that is 1 in the gender (resp. race) coordinate and 0 elsewhere. Then the sensitive subspace is the span of [w g , e g , e r ]. See Appendix B.1 for details.

Results See Table 2 for the average3 of each metric on the test sets over ten 80%/20% train/test splits for Baseline, Project (projecting features onto the orthogonal complement of the sensitive subspace before training), CoCL (De-Arteaga et al., 2019 ), Adversarial Debiasing (Zhang et al., 2018) , and SenSR. With the exception of CoCL (De-Arteaga et al., 2019) , each classifier is a 100 unit single hidden layer neural network. The Baseline clearly exhibits individual and group fairness violations. While SenSR has the lowest B-acc, SenSR is the best by a large margin for S-Con. and has the best group fairness measures. We expect SenSR to do well on GR-consistency since the sensitive subspace includes the race and gender directions. However, SenSR's individually fair performance generalizes: the sensitive directions do not directly use the husband and wife directions, yet SenSR performs well on S-Con. Furthermore, SenSR outperforms Project on S-Con and group fairness measures illustrating that SenSR does much more than just ignoring the sensitive subspace. CoCL only barely improves group fairness compared to the baseline with a significant drop in Bacc and while Adversarial Debiasing also improves group fairness, it is worse than the baseline on individual fairness measures illustrating that group fairness does not imply individual fairness.

5. SUMMARY:

We consider the task of training ML systems that are fair in the sense that their performance is invariant under certain perturbations in a sensitive subspace. This notion of fairness is a variant of individual fairness (Dwork et al., 2011) . One of the main barriers to the adoption of individual fairness is the lack of consensus on a fair metric for many ML tasks. To circumvent this issue, we consider two approaches to learning a fair metric from data: one for problems in which the sensitive attribute is observed, and another for problems in which the sensitive attribute is unobserved. Given a data-driven choice of fair metric, we provide an algorithm that provably trains individually fair ML models.

A PROOFS:

A.1 PROOF OF PROPOSITION 3.1 By the duality result of Blanchet & Murthy (2016) , for any > 0, sup P :W * (P,P * )≤ E P (Z, θ) -sup

P :W (P,Pn)≤ E P (Z, θ) = inf λ≥0 {λ + E P * c * λ (Z, θ) -λ n + E Pn c λn (Z, θ) ≤ E P * c * λn (Z, θ) -E Pn c λn (Z, θ) ,

where

λ n ∈ arg min λ≥0 λ + E Pn c λ (Z, θ) . By assumption A3, | c * λn (z, θ) -c λn (z, θ)| = sup x2∈X ((x 2 , y), θ) -λ n c * ((x, y), (x 2 , y)) -sup x2∈X ((x 2 , y), θ) -λ n c((x, y), (x 2 , y)) ≤ sup x2∈X λ n |c * ((x, y), (x 2 , y)) -c((x, y), (x 2 , y))| ≤ λ n δ c • D 2 .

This implies sup P :W * (P,P * )≤ E P (Z, θ) -sup

P :W (P,Pn)≤ E P (Z, θ) ≤ E P * c * λn (Z, θ) -E Pn c * λn (Z, θ) + λ n δ c D 2

. This bound is crude; it is possible to obtain sharper bounds under additional assumptions on the loss and transportation cost functions. We avoid this here to keep the result as general as possible. Proof. By the optimality of λ,

λ ≤ λ + E P sup x2∈X ((x 2 , Y ), θ) -λd x (X, x 2 ) 2 -((X, Y ), θ) = λ + E P c λ(Z, θ) -(Z, θ) ≤ λ + E P c λ (Z, θ) -(Z, θ) = λ + E P sup x2∈X ((x 2 , Y ), θ) -((X, Y ), θ) -λd x (X, x 2 ) 2

for any λ ≥ 0. By Assumption A2, the right side is at most We combine the preceding bounds to obtain 

λ ≤ λ + E P sup x2∈X Ld x (X, x 2 ) -λd x (X, x 2 ) 2 ≤ λ + sup

≤ sup f ∈L c * Z f (z)d(P n -P * )(z) + Lδ c D 2 √ ,

where

L c * = { c * λ (•, θ) : λ ∈ [0, L √ ]

, θ ∈ Θ} is the DR loss class. In the rest of the proof, we bound sup f ∈L c * Z f (z)d(P * -P n )(z) with standard techniques from statistical learning theory. Assumption A2 implies the functions in F are bounded:

0 ≤ ((x 1 , y 1 ), θ) - λd x (x 1 , x 1 ) ≤ c λ (z 1 , θ) ≤ sup x2∈X ((x 2 , y 1 ), θ) ≤ M.

This implies has bounded differences, so δ n concentrates sharply around its expectation. By the bounded-differences inequality and a symmetrization argument,

sup f ∈L c * Z f (z)d(P n -P * )(z) ≤ 2R n (L c * ) + M ( log 2 t 2n )

1 2

WP at least 1 -t, where R n (F) is the Rademacher complexity of F:

R n (F) = E sup f ∈F 1 n n i=1 σ i f (Z i ) .

Lemma A.2. The Rademacher complexity of the DR loss class is at most

R n (L c ) ≤ 24C(L) √ n + 24LD 2 √ n .

Proof. To study the Rademacher complexity of L c , we first show that the L c -indexed Rademacher process X f

1 n n i=1 σ i f (Z i ) is sub-Gaussian WRT to a pseudometric. Let f 1 = c λ1 (•, θ 1 ) and f 2 = c λ2 (•, θ 2 ). Define d L c (f 1 , f 2 ) (•, θ 1 ) -(•, θ 2 ) ∞ + D 2 |λ 1 -λ 2 |. We check that X f is sub-Gaussian WRT d L c : E exp(t(X f1 -X f2 )) = E exp t n n i=1 σ i ( c λ1 (Z i , θ 1 ) -c λ2 (Z i , θ 2 )) = E exp t n σ( c λ1 (Z, θ 1 ) -c λ2 (Z, θ 2 )) n = E exp t n σ( sup x1∈X inf x2∈X ((x 1 , Y ), θ 1 ) -λ 1 d x (x 1 , X) 2 -((x 2 , Y ), θ 2 ) + λ 2 d x (X, x 2 ) 2 )) n = E exp t n σ( sup x1∈X ((x 1 , Y ), θ 1 ) -((x 1 , Y ), θ 2 ) + (λ 2 -λ 1 )d x (x 1 , X) 2 )) n ≤ exp 1 2 t 2 d L c (f 1 , f 2 ) . Let N (L c , d L c , ) be the -covering number of (L c , d L c ). We observe N (L c , d L c , ) ≤ N (L, • ∞ , 2 ) • N ([0, L √ ], | • |, 2D 2 ) (A.1)

Published as a conference paper at ICLR 2020 By Dudley's entropy integral,

R n (L c ) ≤ 12 √ n ∞ 0 log N (L c , d L c , ) 1 2 d ≤ 12 √ n ∞ 0 log N (L, • ∞ , 2 ) + N [0, L √ ], | • |, 2D 2 1 2 d ≤ 12 √ n ∞ 0 log N (L, • ∞ , 2 ) 1 2 d + ∞ 0 N [0, L √ ], | • |, 2D 2 1 2 d ≤ 24C(L) √ n + 24LD 2 √ n 1 2 0 log( 1 )d

where we recalled equation A.1 in the second step. We evalaute the integral on the right side to arrive at the stated bound:

1 2 0 log( 1 )d < 1. By Lemma A.2, sup f ∈L c * Z f (z)d(P n -P * )(z) ≤ 48C(L) √ n + 48LD 2 √ n + M ( log 2 t 2n ) 1 2 ,

which implies sup P :W (P,Pn)≤ E P (Z, θ) -sup P :W * (P,P * )≤

E P (Z, θ) ≤ 48C(L) √ n + 48LD 2 √ n + Lδ c D 2 √ + M ( log 2 t 2n ) 1 2 .

WP at least 1 -t. Here we assume the sensitive attribute is discrete and is observed for a small subset of the training data. Formally, we assume this subset of the training data has the form {(X i , K i , Y i )}, where K i is the sensitive attribute of the i-th subject. To learn the sensitive subspace, we fit a softmax regression model to the data

P(K i = l | X i ) = exp(a T l X i + b l ) k l=1 exp(a T l X i + b l ) , l = 1, . . . , k,

and take the span of A = [a 1 . . . a k ] as the sensitive subspace to define the fair metric as

d x (x 1 , x 2 ) 2 = (x 1 -x 2 ) T (I -P ran(A) )(x 1 -x 2 ). (B.1)

This approach readily generalizes to sensitive attributes that are not discrete-valued: replace the softmax model by an appropriate generalized linear model.

In many applications, the sensitive attribute is part of a user's demographic information, so it may not be available due to privacy restrictions. This does not preclude the proposed approach because the sensitive attribute is only needed to learn the fair metric and is neither needed to train the classifier nor at test time.

B.2 LEARNING THE FAIR METRIC FROM COMPARABLE SAMPLES:

In this section, we consider the task of learning a fair metric from supervision in a form of comparable samples. This type of supervision has been considered in the literature on debiasing learned representations. For example, method of Bolukbasi et al. (2016) for removing gender bias in word embeddings relies on sets of words whose embeddings mainly vary in a gender subspace (e.g. (king, queen)).

To keep things simple, we focus on learning a generalized Mahalanobis distance

d x (x 1 , x 2 ) = (ϕ(x 1 ) -ϕ(x 2 )) T Σ(ϕ(x 1 ) -ϕ(x 2 )) 1 2 , (B.2)

where ϕ(x) : X → R d is a known feature map and Σ ∈ S d×d + is a covariance matrix. Our approach is based on a factor model

ϕ i = A * u i + B * v i + i , where ϕ i ∈ R d is the learned representation of x i , u i ∈ R K (resp. v i ∈ R L )

is the sensitive/irrelevant (resp. relevant) attributes of x i to the task at hand, and i is an error term. For example, in Bolukbasi et al. (2016) , the learned representations are the embeddings of words in the vocabulary, and the sensitive attribute is the gender bias of the words. The sensitive and relevant attributes are generally unobserved.

Recall our goal is to obtain Σ so that equation B.2 is small whenever v 1 ≈ v 2 . One possible choice of Σ is the projection matrix onto the orthogonal complement of ran(A), which we denote by P ran(A) . Indeed,

d x (x 1 , x 2 ) 2 = (ϕ 1 -ϕ 2 ) T (I -P ran(A) )(ϕ 1 -ϕ 2 ) (B.3) ≈ (v 1 -v 2 ) T B T * (I -P ran(A) )B * (v 1 -v 2 ), (B.4)

which is small whenever v 1 ≈ v 2 . Although ran(A) is unknown, it is possible to estimate it from the learned representations and groups of comparable samples by factor analysis.

The factor model attributes variation in the learned representations to variation in the sensitive and relevant attributes. We consider two samples comparable if their relevant attributes are similar. In other words, if I ⊂ [n] is (the indices of) a group of comparable samples, then This suggests estimating ran(A) from the learned representations and groups of comparable samples by factor analysis. We summarize our approach in Algorithm 3.

Algorithm 3 estimating Σ for the fair metric 

C SENSR IMPLEMENTATION DETAILS:

This section is to accompany the implementation of the SenSR algorithm and is best understood by reading it along with the code implemented using TensorFlow. 4 We discuss choices of learning rates and few specifics of the code. Words in italics correspond to variables in the code and following notation in parentheses defines corresponding name in Table 3 , where we summarize all hyperparameter choices.

Handling class imbalance Datasets we study have imbalanced classes. To handle it, on every epoch(E) (i.e. number of epochs) we subsample a batch size(B) training samples enforcing equal number of observations per class. This procedure can be understood as data augmentation.

Perturbations specifics Our implementation of SenSR algorithm has two inner optimization problems -subspace perturbation and full perturbation (when > 0). Subspace perturbation can be viewed as an initialization procedure for the attack. We implement both using Adam optimizer (Kingma & Ba, 2014) inside the computation graph for better efficiency, i.e. defining corresponding perturbation parameters as Variables and re-setting them to zeros after every epoch. This is in contrast with a more common strategy in the adversarial robustness implementations, where perturbations (i.e. attacks) are implemented using tf.gradients with respect to the input data defined as a Placeholder.

Learning rates As mentioned above, in addition to regular Adam optimizer for learning the parameters we invoke two more for the inner optimization problems of SenSR. We use same learning rate of 0.001 for the parameters optimizer, however different learning rates across datasets for subspace step(s) and full step(f ). Two other related parameters are number of steps of the inner optimizations: subspace epoch(se) and full epoch(f e). We observed that setting subspace perturbation learning rate too small may prevent our algorithm from reducing unfairness, however setting it big does not seem to hurt. On the other hand, learning rate for full perturbation should not be set too big as it may prevent algorithm from solving the original task. Note that full perturbation learning rate should be smaller than perturbation budget eps( ) -we always use /10. In general, malfunctioning behaviors are immediately noticeable during training and can be easily corrected, therefore we did not need to use any hyperparameter optimization tools.

:

titled "Popular Baby Names" and available from https://catalog.data.gov/dataset/

Accuracy is reported inTable 4 in Appendix D.

The standard error is reported in the supplement. Each standard error is within 10 -2 .

√ ) to obtain λ ≤ L √ .

https://github.com/IBM/sensitive-subspace-robustness

Figures and Tables:

Figure 1: Figure (a) depicts a binary classification dataset in which the minority group shown on the right of the plot is underrepresented. This tilts the logistic regression decision boundary in favor of the majority group on the left. Figure (b) shows the unfair map of the logistic regression decision boundary. It maps samples in the minority group towards the majority group.Figure (c) shows an algorithmically fair classifier that treats the majority and minority groups identically.

sup P :W * (P,P * )≤ E P (Z, θ) ≤ δ * (3.4) for some δ * > 0, θ ∈ arg min θ∈Θ sup P :W (P,Pn)≤ E P (Z, h) satisfies sup P :W * (P,P * )≤ E P (Z, θ) -E P * (Z, θ) ≤ δ * + 2δ n , where δ n is the uniform convergence error equation 3.1. Proposition 3.2 guarantees Algorithm 2 trains an individually fair ML model. More precisely, if there are models in H that are (i) individually fair and (ii) achieve small test error, then Algorithm 2 trains such a model. It is possible to replace equation 3.4 with other conditions, but a condition to its effect cannot be dispensed with entirely. If there are no individually fair models in H, then it is not possible for equation 2.5 to learn an individually fair model. If there are individually fair models in H, but they all perform poorly, then the goal of learning an individually fair model is futile. Another consequence of uniform convergence is equation 3.3 is close to its empirical counterpart sup P :W (P,Pn)≤ E P (Z, θ) -E Pn (Z, θ) . (3.5) In other words, the gap generalizes. This implies equation 3.5 is a certificate of individual fairness; i.e. it is possible for practitioners to check whether an ML model is individually fair by evaluating equation 3.5. Proposition 3.3. Under the assumptions A1-A3, for any > 0, sup θ∈Θ sup P :W (P,Pn)≤ E P (Z, θ) -E Pn (Z, θ) -(sup P :W (P,P * )≤ E P (Z, θ) -E P * (Z, θ) ≤ 2δ n w.p. at least 1 -t.

Z, θ) + λ * δ c D 2 , where λ * ∈ arg min λ≥0 {λ + E P * c * λ (Z, θ) . Lemma A.1 (Lee & Raginsky (2017)). Let λ ∈ arg min λ≥0 λ + E P c λ (Z, θ) . As long as the function in the loss class are L-Lipschitz with respect to d x (see Assumption A2), λ ≤ L √ .

We minimize the right side WRT t (set t = L 2λ ) and λ (set λ = L

HΦ I = HU I A T * + : ≈ 0 HV I B T * + HE I ≈ HU I A T * + HE I , (B.5) where H = I |I| -1 |I| 1 |I| 1 T |I| is the centering or de-meaning matrix and the rows of Φ I (resp. U I , V I ) are ϕ i (resp. u i , v i ). If this group of samples have identical relevant attributes, i.e. V I = 1 |I| v T for some v, then HV I vanishes exactly. As long as u i and i are uncorrelated (e.g. E u i T i = 0), equation B.5 implies E Φ T I HΦ I ≈ AE U T I HU I A T + E E T I HE I ,

Input: {ϕ i } n i=1 , comparable groups I 1 , . . . , I G 2: A T ∈ arg min Wg,A { 1 2 G g=1 H g Φ Ig -W g A T 2 F } factor analysis 3: Q ← qr( A)get orthonormal basis of ran( A) 4: Σ ← I d -QQ T

1 detects aggregate violations of individual fairness. In other words, although the violations that the auditor's problem detects are individual in nature, the auditor's problem is only able to detect aggregate violations. We summarize the implicit notion of fairness in equation 2.1 in a definition.

Table content: <table><tr><td>(2.2)</td></tr><tr><td>Although equation 2.1 is an infinite-dimensional optimization problem, it is possible to solve it</td></tr><tr><td>exactly by appealing to duality. Blanchet &amp; Murthy showed that the dual of equation 2.1 is</td></tr></table>

of uniform convergence is SenSR trains individually fair classifiers (if there are such classifiers in the hypothesis class). By individually fair ML model, we mean an ML model that has a small gap sup

Table content: <table/>

Sentiment prediction experiments over 10 restarts Acc.,% Race gap Gend. gap Cuis. gap

Table content: <table><tr><td/><td/><td>20</td><td>Protected Attribute Race: Caucasian</td></tr><tr><td/><td/><td/><td>Race: African-American</td></tr><tr><td/><td/><td/><td>Gender: Male</td></tr><tr><td colspan="2">SenSR SenSR-E 93±1 0.11±.04 0.04±.03 1.11±.15 94±1 0.30±.05 0.19±.03 0.23±.05 Baseline 95±1 7.01±.44 5.59±.37 4.10±.44</td><td>-10 0 10 sentiment score</td><td>Gender: Female</td></tr><tr><td>Project</td><td>94±1 1.00±.56 1.99±.58 1.70±.41</td><td/></tr><tr><td>Sinha+</td><td>94±1 3.88±.26 1.42±.29 1.33±.18</td><td>-20</td></tr><tr><td colspan="2">Bolukb.+ 94±1 6.85±.53 4.33±.46 3.44±.29</td><td colspan="2">Baseline Bolukbasi+ Project Figure 2: Box-plots of sentiment scores Sinha+ SenSR SenSR-E</td></tr><tr><td colspan="3">4.1 FAIR SENTIMENT PREDICTION WITH WORD EMBEDDINGS</td></tr></table>

Summary of Adult classification experiments over 10 restarts B-Acc,% S-Con. GR-Con. Gap RMS

Table content: <table><tr><td>G</td><td>Gap RMS R</td><td>Gap max G</td><td>Gap max R</td></tr></table>

DATA-DRIVEN FAIR METRICS B.1 LEARNING THE FAIR METRIC FROM OBSERVATIONS OF THE SENSITIVE ATTRIBUTE

Table content: <table><tr><td colspan="3">A.2 PROOFS OF PROPOSITIONS 3.2 AND 3.3</td><td/></tr><tr><td colspan="3">Proof of Proposition 3.2. It is enough to show</td><td/></tr><tr><td/><td/><td colspan="2">sup P :W (P,Pn)≤</td><td>E P (Z, θ) + δ n</td></tr><tr><td/><td/><td>≤</td><td>sup</td><td>E P (Z, θ) + 2δ n</td></tr><tr><td/><td/><td colspan="2">P :W * (P,P * )≤</td></tr><tr><td/><td/><td colspan="2">≤ δ  *  + 2δ n .</td></tr><tr><td colspan="3">Proof of Proposition 3.3.</td><td/></tr><tr><td/><td>sup</td><td>E P (Z, θ) -E Pn (Z, θ) -</td><td>sup</td><td>E P (Z, θ) -E P *  (Z, θ)</td></tr><tr><td colspan="2">P :W * (P,Pn)≤</td><td/><td colspan="2">P :W (P,P * )≤</td></tr><tr><td>=</td><td>sup</td><td/><td/></tr></table>

Peer review (iclr2020):
This paper proposes a new definition of algorithmic fairness that is based on the idea of individual fairness. They then present an algorithm that will provably find an ML model that satisfies the fairness constraint (if such a model exists in the search space). One needed ingredient for the fairness constraint is a distance function (or *metric*) in the input space that captures the fact that some features should be irrelevant to the classification task. That is, under this distance function, input that differ only in sensitive attributes like race or gender should be close-by. The idea of the fairness constraint is that by perturbing the inputs (while keeping them close with respect to the distance function), the loss of the model cannot be significantly increased. Thus, this fairness constraint is very much related to robustness. --- Overall, I like the basic idea of the paper but I found the presentation lacking. I do think their idea for a fairness constraint is very interesting, but it gets too bogged down in the details of the mathematical theory. They mention Dwork et al. at the beginning but don*t really compare it to their idea in detail, even though I think there would be a lot of interesting things to say about this. For example, the definition by Dwork et al. seems to imply that some labels in the training set might be incorrect, whereas the definition in this paper does not seem to imply that (which I think is a good thing). The main problem in section 2 is that the choice of distance function is barely discussed although that*s what*s most important to make the result fair. For all the mathematical rigor in section 2, the paragraph that is arguing that the defined constraint encourages fairness is somewhat weak. Here a comparison to other fairness definitions and an in-depth discussion of the distance function would help. (In general I felt that this part was more trying to impress the reader than trying to explain, but I will try to not hold it against this paper.) As it is, I feel the paper cannot be completely understood without reading the appendix. There is also this sentence at the bottom of page 5: *A small gap implies the investigator cannot significantly increase the loss by moving samples from to comparable samples.* This should have been at the beginning of section 2 in order to motivate the derivation. In the experiments, I*m not sure how useful the result of the word embedding experiment really is. Either someone is interested in the sentiment associated with names, in which case your method renders the predicted sentiments useless or someone is not interested in the sentiment associated with names and your method doesn*t even have any effect. Final point: while I like the idea of the balanced TPR, I think the name is a bit misleading because, for example, in the binary case it is the average of the TPR and the TNR. Did you invent this terminology? If so, might I suggest another name like balanced accuracy? I would change the score (upwards) if the following things are addressed: - make it easier to understand the main point of the paper - make more of a comparison to Dwork et al. or other fairness definitions - fix the following minor mistakes Minor comments: - page 2, beginning of section 2: you use the word *regulator* here once but everywhere else you use *investigator* - equation 2.1: as far as I can tell is not defined anywhere; you might mean - page 3, sentence before Eq 2.3: what does the symbol mean? - page 3, sentence before Eq 2.3: what is ? is it ? - Algorithm 2: what is the difference between and ? - page 7: you used a backslash between *90%* and *10%* and *train* and *test*. That would traditionally be a normal slash. - in appendix B: the explanation for what means should be closer to the first usage - in the references, you list one paper twice (the one by Zhang et al.) EDIT: changed the score after looking at the revised version