{'fraction_non_alphanumeric': 0.03465075208574386, 'fraction_numerical': 0.006840833891561618, 'mean_word_length': 5.075974346324617, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Causal Multi-Level Fairness

Algorithmic systems are known to impact marginalized groups severely, and more so, if all sources of bias are not considered. While work in algorithmic fairness to-date has primarily focused on addressing discrimination due to individually linked attributes, social science research elucidates how some properties we link to individuals can be conceptualized as having causes at macro (e.g. structural) levels, and it may be important to be fair to attributes at multiple levels. For example, instead of simply considering race as a causal, protected attribute of an individual, the cause may be distilled as perceived racial discrimination an individual experiences, which in turn can be affected by neighborhood-level factors. This multi-level conceptualization is relevant to questions of fairness, as it may not only be important to take into account if the individual belonged to another demographic group, but also if the individual received advantaged treatment at the macro-level. In this paper, we formalize the problem of multi-level fairness using tools from causal inference in a manner that allows one to assess and account for effects of sensitive attributes at multiple levels. We show importance of the problem by illustrating residual unfairness if macro-level sensitive attributes are not accounted for, or included without accounting for their multi-level nature. Further, in the context of a real-world task of predicting income based on macro and individual-level attributes, we demonstrate an approach for mitigating unfairness, a result of multi-level sensitive attributes.


INTRODUCTION
There has been much recent interest in designing algorithms that make fair predictions [3,14,29]. Definitions of algorithmic fairness have been summarized in detail elsewhere [40,57]; broadly approaches to algorithmic fairness in machine learning can be divided into two kinds: group fairness, which ensures some form of statistical parity for members of different protected groups [16,40] and individual notions of fairness which aim to ensure that people who are 'similar' with respect to the classification task receive similar outcomes [5,6,23]. Historically sensitive variables such as age, gender, race have been thought of as attributes that can lead to unfairness or discrimination. Recently, the causal framework [48] has also been used to conceptualize fairness. Kusner et al. [32] introduced a causal definition of fairness, counterfactual fairness, which states that a decision is fair toward an individual if it coincides with the one that would have been taken in a counterfactual world in which the sensitive attribute of the individual had been different. This approach assumes prior knowledge about how data is generated and how variables affect each other, represented by a causal diagram and considers that all paths from the sensitive attribute to the outcome are unfair. Counterfactual fairness, thus, postulates that the entire effect of the sensitive attribute on the decision, along all causal paths from the sensitive attribute to the outcome is unfair. This approach is restrictive when only certain causal paths are unfair. For example, the effect of gender on income levels can be considered unfair but the effect through education attainment level is fair [9]. Path-specific counterfactual fairness has then been conceptualized, which attempts to correct the effect of the sensitive attribute on the outcomes only along unfair causal pathways instead of entirely removing the effect of the sensitive attribute [9]. It should be noted that throughout this work, determination of fair and unfair paths requires domain expertise and possibly discussions between policymakers, lawyers, and computer scientists.
Leveraging domain knowledge from sociology highlights that notwithstanding these clarifications of path-specific fairness, algorithmic fairness efforts in general have been limited to sensitive attributes at only the individual-level, missing important assertions regarding how social aspects can be influenced and created more by societal structures and cultural assumptions than by individual and psychological factors [27]. Critical Theory is an approach in sociology which motivates the consideration of macro-structural attributes, often simply called macro-properties or 'structural attributes'. These structural attributes correspond to overall organizations of society that extend beyond the immediate milieu of individual attributes yet have an impact on an individual, such as social groups, organizations, institutions, nation-states, and their respective properties and relations [19,35]. Accounting for a multi-level conceptualization in algorithmic fairness is consistent with recent literature which have discussed similar concerns with the conceptualization of race as a fixed, individual-level attribute [8,22,56,64]. Analytically framing race as an individual-level attribute ignores systemic racism and other factors which are the mechanisms by which race has consequences [8]. Instead, accounting for the macro-level phenomena associated with race, which a multi-level perspective promotes (e.g. structural racism, childhood experiences that shape the perception of race) will augment the impact of algorithmic fairness work [22]. Several different terms have been used as synonyms for macro-structural attributes, including "group-level" variables in multi-level analysis, "ecological variables", "macro-level variables", "contextual variables", "group variables", and "population variables", and we refer the reader to a full elaboration on macro-property variables in previous work by Diez-Roux [15]. In this paper, we refer to all information measured beyond an individual-level as macro-properties and macro-level attributes.
Without accounting for macro-properties, assessment of how "fair" an algorithm is may inadvertently be unfair by not accounting for important variance in attributes that are at the structural level. Indeed, today's growing availability of data that captures such effects means that leveraging the right data can be used to account for and address unexplained variance when using individual-level attributes as proxies for structural attributes. This can help work towards equity versus in-sample fairness (e.g. an algorithm fair with respect to perceived race will still be unfair to structural differences that perceived race may be a proxy for, such as neighborhood socio-economics, and including the structural factors can help to mitigate unfairness within the perceived race category) [38]. Accounting for structural factors can also clearly identify populations that input data is not representing. Indeed, many macro-properties can be considered as sensitive attributes. For example, neighborhood socioeconomic status which is a measure of the inequality in distribution of macro-level resources of education, work, and economic resources [52]. It has been shown that patients who reside in low socioeconomic neighborhoods can have significantly higher risk for readmission following hospitalization for sepsis in comparison to patients residing in higher socioeconomic neighborhoods even if all individual-level risk factors are the same, indicating that low SES is an independent factor of relevance to the outcome [20]. Thus, accounting for relevant macro-level properties while making decisions, say, about post-hospitalization care, is critical to ensure that disadvantaged patients, comprehensively accounting for all relevant sources of unfairness, receive appropriate care.
Towards this goal, we propose a novel definition of fairness called causal multi-level fairness, which is defined as a decision being fair towards an individual if it coincides with the one in the counterfactual world where, contrary to what is observed, the individual receives advantaged treatment at both the macro and individual levels, described by macro and individual-level sensitive attributes, respectively. This work builds upon previous work on path-specific counterfactual fairness, limited to individual-level sensitive attributes, to account for both macro and individual-level discrimination. Multi-level sensitive attributes are a specific case of multiple sensitive attributes, in which we specifically consider a sensitive attribute at a macro level that influences one at an individual level. This is an important and broad class of settings; such multi-level interactions are also considered in multi-level modelling in statistics [21]. Moreover, this work addresses a different problem than the setting of proxy variables, in which the aim is to eliminate influence of the proxy on outcome prediction [26]. Indeed, for variables such as race, detailed analyses from epidemiology have articulated how concepts such as racial inequality can be decomposed into the portion that would be eliminated by equalizing adult socioeconomic status across racial groups, and a portion of the inequality that would remain even if adult socioeconomic status across racial groups were equalized (i.e. racism). Thus, if we simply ascribe the race variable to the individual (as is sometimes done as a proxy), we will miss the population-level factors that affect it and any particular outcome [56].
Explicitly accounting for multi-level factors enables us to decompose concepts such as racial inequality and approach questions such as: what would the outcome be if there was a different treatment on a population-level attribute such as neighborhood socioeconomic status? This is an important step in auditing not just the sources of bias that can lead to discriminatory outcomes but also in identifying and assessing the level of impact of different causal pathways that contribute to unfairness. Given that in some subject areas, the most effective interventions are at the macro level (e.g. in health the largest opportunity for decreasing incidence due to several diseases lie with the social determinants of health such as availability of resources versus individual-level attributes [38]), it is critical to have a framework to assess these multiple sources of unfairness. Moreover, by including macro-level factors and their influence on individual ones, we engage themes of inequality and power by specifying attributes outside of an individual's control. In sum, our work is one step towards integrating perspectives that articulate the multi-dimensionality of sensitive attributes (for example race, and other social constructs) into algorithmic approaches. We do this by bringing focus to social processes which often affect individual attributes, and developing a framework to account for multiple casual pathways of unfairness amongst them. Our specific contributions are: • We formalize multi-level causal systems, which include potentially fair and unfair path effects at both macro and individuallevel sensitive variables. Such a framework enables the algorithmicist to conceptualize systems that include the systemic factors that shape outcomes. • Using the above framework, we demonstrate that residual fairness can result if macro-level attributes are not accounted for. • We provide necessary conditions for achieving multi-level fairness and demonstrate an approach for mitigating multilevel unfairness while retaining model performance.

RELATED WORK
Causal Fairness. Several statistical fairness criteria have been introduced over the last decade, to ensure models are fair with respect to group fairness metrics or individual fairness metrics. However, further discussions have highlighted that several of the fairness metrics cannot be concurrently satisfied on the same data Y (a) Proxy ( ) for sensitive attributes ( ) Figure 1: Causal graphs to describe and distinguish different general sensitive attribute settings. Green arrows denote discriminatory causal paths and dashed green-black arrows from any node to denote discrimination only due to the portion of the effect from a green arrow into and not from itself (fair paths defined via a priori knowledge), red nodes represent sensitive attributes. a) Individual-level variable (e.g. name) acts as a proxy for the individual sensitive attribute (e.g. perceived race) and affects outcome (e.g. health outcomes). (e.g. a biological factor) is not a proxy but also affects the outcome. b) Multiple sensitive attributes at the individual level, (e.g. gender) and (e.g. perceived race) affect individual variables, , and health outcome, . c) Example of cycles in the causal graph, where individual level attribute , individual income, causes macro-level sensitive attribute, mean neighborhood income, , which in turn affects education resources in the neighborhood, , with being the outcome. Since ∈ , this violates the necessary conditions for obtaining a fair predictor with multi-level causal fairness. [4,10,18,25,28,37]. In light of this, causal approaches to fairness have been recently developed to provide a more intuitive reasoning corresponding to domain specifics of the applications [7, 9, 26, 31-33, 43, 44, 50, 53, 62, 63]. Most of these approaches advocate for fairness by addressing an unfair causal effect of the sensitive attribute on the decision. Kusner et al. [32] have introduced an individuallevel causal definition of fairness, known as counterfactual fairness. The intuition is that the decision is fair if it coincides with the one that would have been taken in a counterfactual world in which the individual would be identified by a different sensitive attribute. For example, a hiring decision is counterfactually fair if the individual identified by the gender male would have also been offered the job had the individual identified as female. In sum, these efforts develop concepts of fairness with respect to individual level sensitive attributes, while here we develop fairness accounting for multi-level sensitive attributes, comprising of both individual and macro-level sensitive attributes. Inspired from research in social sciences [6,22,56], the work here extends the idea to multi-level sensitive attributes. In our considered setting, a decision is fair not only if the individual identified with a different individual-level sensitive attribute but also if the individual received advantaged treatment at the macro-level, attributed as the macro-level sensitive attribute.
Identification of Causal Effects. While majority of the work in causal inference is on identification and estimation of the total causal effect [2,45,48,49,55], studies have also looked at identifying the causal effect along certain causal pathways [47,54]. The most common approach for identifying the causal effect along different causal pathways is decomposing the total causal effect along direct and indirect pathways [46,47,54]. We leverage the approach developed by Shpitser [54] on how causal effects of multiple variables along a single causal pathway can be identified. While we assume no unmeasured confounding for the analysis in this work, research in causal estimation in the presence of unmeasured confounding, [39,58] can be used to extend our current contribution.
Path-specific causal fairness. Approaches in causal fairness such as path-specific counterfactual fairness [9,43,44], proxy discrimination, and unresolved discrimination [26,59] have aimed to understand the effect of sensitive attributes (i.e. variables that correspond to gender, race, disability, or other protected attributes of individuals) on outcomes directly as well as indirectly to identify the causal pathways (represented using a causal diagram) that result into discriminatory predictions of outcomes based on the sensitive attribute. Generally such approaches focus on sensitive attributes at the individual-level and require an understanding of the discriminatory causal pathways for mitigating causal discrimination along the specified pathways. Our approach builds on the work of Chiappa [9] for mitigating unfairness by removing pathspecific effects for fair predictions, doing so while accounting for both individual and macro-level unfairness.
Intersectional fairness. There is recent focus on identifying the impact of multiple sensitive attributes (intersectionality) on model predictions. There are several works that have been developed for this setting [17,41,60], however, these approaches do not take into account the different causal interactions between sensitive attributes themselves which can be important in identifying bias due to intersectionality. In particular, this includes intersectional attributes at the individual and macro level, such as race and socioeconomic status [11,30].
Causal Models: Following Pearl et al. [48] we define a causal model as a triple of sets (U, V, ) such that: • U are a set of latent variables, which are not caused by any of the observed variables in V. • is set of functions for each ∈ V, such that = pa , , ⊆ V \ and ⊆ U. Such equations relating to and are known as structural equations [13]. When is strictly linear, this is known as a linear structural equation model, which is represented as = , where is the mixing coefficient and [ ] denotes the th parent of variable .
Here, " " refers to the causal parents of , i.e. the variables that affect the specific value obtains. The joint distribution over all the variables, Pr 1 , 2 , · · · , is given by the product of the conditional distribution of each variable, , given it's causal parents as follows: Graphical definition of causal models: While structural equations define the relations between variables we can graphically represent the causal relationships between random variables using Graphical Causal Models (GCMs) [9]. The nodes in a GCM represent the random variables of interest, , and the edges represent the causal and statistical relationships between them. Here, we restrict our analysis to Directed Acyclic Graphs (DAGs) where there are no cycles, i.e., a node cannot have an edge both originating from and terminating at itself. Furthermore, a node is known as a child of another node if there is an edge between the two that originates at and terminates on . Here, is called a direct cause of . If is a descendant of , with some other variable along the path from to , → · · · → → · · · , then is known as a mediator variable and remains as a potential cause of . For example, in Figure 1b, , , , are the random variables of interest. , are direct causes of and while is a direct cause of . Here, is known as a mediating variable for both and .
Causal effects: The causal effect of on is the information propagated by towards via the causal directed paths, → · · · → . This is equal to the conditional distribution of given if there are no bidirected paths between and . A bidirected path between and , ← · · · → represents confounding; that is some causal variable known as a confounder, which may be unobserved, affecting both and . If confounders are present then the causal effect can be estimated by intervening upon . This means that we externally set the value of to the desired value and remove any edges that terminate at , since manually setting to would inhibit any causation by . After intervening the causal effect of on is given by Pr The intervention = results into a potential outcome, = (also represented as ), where the distribution of the potential outcome variable is defined as Pr = Pr * ( | = ).
Counterfactual fairness: Counterfactual fairness is a causal notion of fairness that restricts the decisions of the algorithm to be invariant to the value assigned to the sensitive variable. Assuming to be the sensitive attribute obtaining only two values, and ′ , as the remaining variables, and as the outcome of interest, counterfactual fairness is defined as follows: Definition 3.1. Predictor^is counterfactually fair if under any context and = , With this background, we next discuss the problem setup.

PROBLEM SETUP
Let us denote all the variables associated with the system being modelled as V := { , , I, P, }, where and are the sensitive attributes at the individual-level and the macro-level respectively 1 , I is a non empty set of individual level variables, P is a non empty set of macro-level variables, and is an outcome of interest. We assume access to a causal graph, G, consisting of V which accurately represents the data-generating process. Our goal is to obtain a classifier,^f air , which is fair with respect to both and . While previous approaches in algorithmic fairness have only considered as a sensitive attribute, we present a novel approach to also counter any discrimination resulting from . While macro-level attributes, P and , may seem like regular nodes in the causal graph, the difference is that based on them being macro-properties, their effects on the outcome may be mediated via the individual level attributes, I and , making it nontrivial to mitigate unfairness due to these macro-properties. We highlight that this paper presents, to our knowledge, the first approach for incorporating unfairness due to macro-properties into algorithmic fairness. In order to further help guide the reader regarding differences in macro and individual-level variables, we clarify the types of macro-level attributes which are considered in our setting. Per the extant literature [15], macro-level attributes can be categorized into two types: • Category 1: non-aggregate group properties like nationality, existence of certain types of regulations, population density, degree of income inequality in a community, political regime, legal status of women which do not include individual properties in their computation • Category 2: aggregate properties such as neighborhood income and median household income, which include individual properties (here individual income) in their computation Thus, individual variables influence aggregate macro-properties (Category 2) but not non-aggregate macro-properties (Category 1). This categorization of macro-properties helps us to identify the necessary conditions for obtaining a fair classifier with respect to both individual and macro-level sensitive attributes. In parallel, a main assumption in causal fairness and causal inference settings is that we have access to a causal graph and that the graph does not include any bidirected edges or cycles, [9,32,44] which are assumptions we maintain for the causal multi-level fairness setting. This assumption also clarifies that we should limit our consideration of macro-level attributes to Category 1 and not consider aggregate information like mean neighborhood income as macro-level sensitive variables since individual-level information has a causal influence on mean neighborhood income, i.e. → . Certainly, an increase in the individual income increases mean neighborhood income, which can result in feedback loops in the causal graph which are disallowed. Figure 1c represents such a case involving cycles which the current framework does not support. Further, we assume that the structural equation model representing the functional form underlying the causal graph is linear in nature, i.e. a node is a linear combination of its causal parents. Future work should extend the analysis to non-linear relationships and non-parametric forms. We also assume that we are aware about the fair and unfair causal paths for the multi-level sensitive attributes, again consistent with previous work [9]. Next, we present an example to realize the importance of macro-level sensitive attributes.

An Illustrative Example
In prior sections we have motivated the need to consider macrolevel attributes. We now describe multi-level sensitive attributes and provide an illustrative example of why considering macro-level sensitive attributes in algorithmic fairness efforts can be important. Consider neighborhood socioeconomic status (SES) as . Neighborhood SES can be a cause of population-level factors such as resources available. Neighborhood SES can also affect individuallevel attributes, such as perception of race 2 (which is protected), by shaping the cultural and social experiences of an individual [12] as well as non-protected attributes, (e.g. body-mass index, given that neighborhood SES can shape the types of resources available and norms [36]). Furthermore, research has described how macro attributes such as neighborhood SES can affect health behaviors like smoking directly as well as through individual factors such as perceived racial discrimination. Thus, given that this macroattribute shapes the resources and circumstances of an individual ( can be influenced by ), it could be desirable for algorithms which are being used to decide fair allocation of health services or resources to predicted smokers, to account for this macro-property. Not being fair to this property lacks consideration for variance within the individual attributes that it influences. In other words, accounting for only individual-level attributes such as perceived racial discrimination can still lead to unfairness without considering that people within the same individual-level category could have different resources or opportunities available to them.
A general framework for macro/individual attribute relationships and possible unfair paths in presented in Figure 2. In illustrating the relationship between and (green arrow) we make distinction between the multi-level fairness setting and literature on intersectionality in fairness, which has considered multiple sensitive attributes that are independent of each other (Figure 1b) [17,41,60,61]. While this assumption of independence may hold for individual-level sensitive attributes like age and gender, it fails when we consider sensitive attributes at both the individual and macro level. It is important to understand the relationship between individual and macro-level attributes in order to delineate the pathspecific effects that may lead to biased predictions of . 2 We note that race is a social construct and henceforth use "perceived racial discrimination" here consistent with best practice [1].
Next, we describe how these interactions can lead to unfairness, by introducing multi-level path-specific fairness accounting for both individual and macro-level sensitive attributes.

MULTI-LEVEL PATH-SPECIFIC FAIRNESS
We begin the discussion about multi-level path-specific fairness by first introducing path-specific effects, discussing the necessary conditions to identify the effects with multiple sensitive attributes, and finally describe an approach to obtain fair predictions with multi-level path specific effects. I Y P

Path-specific effects
While counterfactual fairness assumes that the entire effect of the sensitive variables on the outcomes is problematic and constructs the predictor with only the non-descendants of the sensitive attribute [32], it is a fairly restrictive scenario especially when the sensitive attributes can affect the outcome along both fair and unfair pathways as shown in Figure 2. Thus, disregarding the effect only along unfair paths can help in preserving the fair individual information regarding sensitive attributes [9]. Indeed, domain experts and policymakers can guide these decisions about identifying fair and unfair pathways. We are interested only in correcting the effect of the sensitive attribute on the outcome along the unfair paths. For this we turn to path-specific effects, which isolate the causal effect of a treatment on an outcome only along a certain causal pathway [45]. In order to obtain the causal effect only along a certain pathway, the idea that path-specific effects can be formulated as nested counterfactuals is leveraged [54]. This is done by considering that along the causal path of interest, say, → → , the variable, , propagates the observed value, for example, in Figure 2, and along other pathways, → , the counterfactual value, ′ is propagated, assuming that = { , ′ }. In this case, the effect of any mediator between and is evaluated according to the corresponding value of propagated along the specific causal path, the mediator obtains the value ( ). Here, the primary object of interest is the potential outcome variable, ( ), which represents the outcome if, possibly contrary to fact, were externally set to value . Given the values of , ′ , comparison of ( ′ ) and ( ) in expectation: E[ ( )] − E[ ( ′ )] would allow us to quantify the path-specific causal effect, PSE, of on .
Using this concept of path-specific effect, we next state pathspecific counterfactual fairness, defined by Chiappa [9]. Definition 5.1. Path-specific counterfactual fairness is defined as a decision being fair towards an individual if it coincides with the one that would have been made in a counterfactual world in which the sensitive attribute along the unfair pathways (denoted by ) was set to the counterfactual value.
Chiappa [9] further propose that in order to obtain a fair decision, the path-specific effect of the sensitive attribute along the discriminatory causal paths is removed from the model predictions, i.e. fair =^−PSE. However, a key limitation of the approach presented by Chiappa [9] is that only the path-specific counterfactual fairness with respect to the sensitive attributes at the individual level is considered. The presence of sensitive attributes at the macro-level that affect properties at the individual level makes it non-trivial to estimate the path-specific effect consisting of both macro and individual-level sensitive attributes. Following, we describe the identifiability conditions for obtaining path-specific counterfactual fairness with respect to multi-level sensitive attributes by estimating multi-level path-specific effects.
Identification of multi-level path-specific effects. Proposition 1. In the absence of any unmeasured confounding between and and { , I} ∉ , the multi-level path-specific effects of both and on are identifiable.

Proposition 1 follows from the possible structural interactions between
and , where is a non-aggregate macro-property not involving any individual-level computation. Next, we discuss the interaction between and , where the macro-level sensitive attribute is a causal parent of the individual-level sensitive attribute, ∈ { }. Figure 2 presents such an exemplar case of multi-level interactions where macro-level sensitive attributes can cause individual level variables, with the data generating process as described in Figure 3a. and are binary variables where we assume ′ and ′ to represent the baseline values denoting advantaged treatments. The rest of the variables , and are continuous and follow a linear relationship between the parents and the specific variables. , , , are unobserved zero-mean Gaussian terms. For this specific model we obtain the multi-level path-specific effects consisting of both and . The population level sensitive attribute, affects via multiple paths along 1) → → , 2) → → , 3) → → , and 4) → → → ; the individual level sensitive attribute affects along two causal paths, 1) → → , and 2) → . With prior assumption that → and → are not discriminatory causal paths, we evaluate the path-specific effect along · · · → → , where · · · → repesents all paths into . Overall the path-specific effect can be calculated as follows: The path-specific effect along · · · → → is computed by comparison of the counterfactual variable ′ , ′ , , , where , are set to the baseline value of 1 in the counterfactual and 0 in the original. The counterfactual distribution can be estimated as follows: We obtain the mean of this distribution as follows: PSE ···→ → ← , ← is then obtained by comparing the observed and counterfactual value of the mean of the counterfactual distribution, Substituting = 1, = 1, ′ = 0, ′ = 0 in Equation 7 we obtain the path-specific effect as a function of the parameters 3 : By the same approach, path-specific effects for individual and macro-level sensitive attributes as well as the multi-level path specific effects for all the causal paths in Figure 2, are also evaluated. Estimating the multi-level path-specific effects helps in constructing a fair predictor which is described in the following section.

Algorithm 1 Causal Multi-level Fairness
Input: Causal Graph G consisting of nodes , data D over , discriminatory causal pathways , . Output: Fair predictor^f air , model parameters for ∈ V do

Fair predictions with multi-level path-specific effects.
Fair outcomes can be estimated by removing the unfair path-specific effect from the prediction (essentially making a correction on all the descendants of the sensitive attributes),^by simply subtracting it, i.e.^f air =^− PSE. As done in Chiappa [9], removing such unfair information at test time ensures that the resulting decision coincides with the one that would have been taken in a counterfactual world 3 Plug-in estimators can be used to compute the parameters needed for estimating PSE. is considered as an individual-level sensitive attribute instead of macro-level sensitive attribute as presented in Figure  2, ∉ , resulting path-specific effects with as individual-level sensitive attribute, and c) Path-specific unfairness controlling for discriminatory effects of just (blue), considered as an individual-level sensitive attribute instead of macrolevel sensitive attribute (green), both , considered as individual-level sensitive attributes (purple), and , considered as multi-level sensitive attributes (orange), over 10 runs.
in which the sensitive attribute along the unfair pathways were set to the baseline. We leverage this same idea for multi-level causal fairness by generating fair predictions,^f air , by controlling for the path-specific effects of multi-level sensitive attributes. For example, consider the PSE resulting from intervening upon both and via the path · · · → → , PSE ···→ → ← , ← = + , we can control for the discrimination at test time as follows: where accounts for the control over the path-specific effect. For our analysis ranges from 0 to 1, where 0 denotes that we do not account for any path-specific effect while 1 denotes that we remove the entire path-specific effect. Intermediate values allow for only partial removal of the path-specific effect. We study the effect of the control over different path-specific effects on the performance metric of the classifier. The steps are outlined in Algorithm 1. We highlight that an accurate causal graph and a linear functional form are key assumptions of this approach.

EXPERIMENTS
Our experiments in this section serve to empirically assess and demonstrate residual unfairness when correcting for path-specific effects of multiple sensitive attributes. We consider a synthetic setting demonstrated in Figure 2 and real-world setting for income prediction presented in Figure 4a; in both cases the structural causal model is known a priori as well as the unfair pathways. In each case, we first learn the parameters of the model (Θ) from the observed data based on the known underlying causal graph, G as illustrated in Algorithm 1. We then draw observed and counterfactual samples from the distribution by sampling from the path-specific counterfactual distribution, referred to as counterfactual distribution 4 . We estimate fair predictors for both the observed and counterfactual data using Algorithm 1. In case of no resultant unfairness, distributions of the outcome estimate for both observed and counterfactual data should coincide. Density plots that do not coincide signifies residual unfairness.

Synthetic setting
Here we generate data according to the structural equation model presented in Figure 3a with linear relationships with the exception that we consider to be binary, using a sigmoid function 5 . This represents the data-generating process in accordance with the multilevel setting presented in Figure 2. The simulation parameters, , are non-negative to ensure a positive path-specific effect, i.e. an unfair effect. Furthermore, the parameters are standardized between 0 and 1 to allow for computational efficiency. The range of the parameters in the uniform distribution is simulated to ensure a realistic setting where the counterfactual distribution is diverse, and the differences between the original and counterfactual distribution is significant to evaluate multi-level fairness. If there are little differences in the original and the counterfactual distribution, path-specific effects become negligible resulting in no significant unfairness issues. In total, 10 simulations with = 2000 samples in each are performed. We train a linear regression model for , , and a logistic regression model for , to learn the parameters ( ). We then calculate three 4 Path-specific counterfactual distribution is obtained by altering the original value to the counterfactual value only along the unfair paths (described by green in the causal graph), and retaining the original value along the fair pathways. 5 The analysis of the path-specific effects remains similar to the one discussed in Section 5, where the effects are calculated on the odds ratio scale as Nabi and Shpitser [44]. path-specific effects as follows: 1) PSE , accounting for the effect of both and , 2) PSE accounting for the effect of only , and 3) PSE accounting for the effect of only . Details about this calculation are presented in Equation 7.
We observe that controlling for the multi-level path-specific effects of both and leads to little drop in the model performance (accuracy). We also assess the counterfactual fairness of the resulting model after removing the unfair multi-level path-specific effects. This is done by training a classifier for obtaining fair predictors, , , on the actual and counterfactual data respectively, where the counterfactual data is obtained by altering the values of the sensitive variables, and . This is done by first learning the parameters, from the original data and then altering the values of the sensitive attributes, and and obtaining the values of , and from these counterfactual values of , and . We assess the counterfactual fairness of the resulting models while accounting for unfairness due to both , and either or , in Figure  3c. The Y axis shows the average difference between observed and counterfactual predictions, |^−^′ | where is the observed value of the sensitive attribute and ′ is the corresponding counterfactual value. This difference is analyzed for varying control of the path-specific effect (PSE), along the X-axis. In order to assess the advantage of considering the multi-level nature of the data, we compare with the model presented in Figure 3b, where we treat the macro-level sensitive attribute, as another individual-level sensitive attribute, , i.e.
∉ . The blue line represents the difference while accounting only for the individual-level path specific effect while the orange line represents the multi-level path-specific effect of both and . Similarly, the green line represents the setting presented in Figure 3b, where , is treated as an individual-level sensitive attribute (multi-level nature of its action removed), and purple line represents the case where both and are treated as individual-level sensitive attributes. For counterfactually fair models we expect the difference to be close to zero since controlling for the path-specific effects cancels out the counterfactual change. We observe that this happens only while accounting for the multi-level path-specific effects. Thus, accounting for individual-level path-specific effects solely (blue, green, and purple lines) does not result in counterfactually fair predictions as can be seen from the high difference (0.7-0.9). Moreover, correcting for the unfair multi-level path-specific effects of both and results in counterfactually fair predictions with a slight drop in accuracy from 94.5% to 91.5%.

UCI Adult Dataset
We demonstrate real-world evaluation of the proposed approach on the Adult dataset from the UCI repository [34]. The UCI Adult dataset is amenable for demonstration of our method, given that it was used in Chiappa [9] to assess path-specific counterfactual fairness, and because there are variables oriented in a manner that create a potential multi-level scenario. We consider this well-studied setting [9,44] wherein the goal is to predict whether an individual's income is above or below $50,000. The data consist of age, working class, education level, marital status, occupation, relationship, race, gender, capital gain and loss, working hours, and nationality variables for 48842 individuals. The causal graph is represented in Figure 4a. Consistent with Chiappa [9] and Nabi and Shpitser [44], we do not include race or capital gain and loss variables. Here, represents the individual-level protected attribute sex, is nationality, is marital status, is the level of education, corresponds to working class, occupation, and hours per week, is the income class. We make an observation that nationality, , could be considered as a non-aggregate macro-level sensitive attribute. This is because it may affect social influences and/or resources available at the macro-level. For example, nationality affects both education levels and martial status of individuals. Moreover, we also note that marital status, , can also be considered as an individual-level sensitive attribute, as we may not want to discriminate individuals based on their marital status [24,51]. Thus, , a macro-level sensitive attribute affects , an individual-level sensitive attribute and the relationship between and other variables in the graph mimics that of a multi-level scenario. Moreover, it may be reasonable to consider a setting in which it is desirable to predict income, while also being fair to nationality, in order to understand the effect that nationality may have. We highlight that macro-properties such as nationality are included in datasets like UCI adult, however, correcting for any unfairness due to macro-level sensitive attributes has not been considered in previous fairness studies. We also emphasize that there may be other datasets that better express the need for macro and individual-level sensitive attributes, however we consider this dataset/setting in order to be consistent with previous work in causal fairness which has used the same dataset, though have only analyzed unfairness due to an individual-level sensitive attribute [9]. Paths in Figure 4a are thus defined based on mapping the figure from Chiappa [9] to the multi-level framework in Figure  1b with as the macro-level sensitive attribute and , as the individual-level sensitive attributes.
To first evaluate the path-specific effect of a single individuallevel sensitive attribute as done in prior work [9], we evaluate the effect of only (the individual level sensitive attribute considered in Chiappa [9]) along → and → → · · · → to be 3.716. We obtain a fair prediction as follows: by removing the path specific effect of along a priori known discriminatory paths. The fair accuracy is 78.87%, consistent with Chiappa [9].
We next evaluate the path-specific effect of both the macro ( ) and individual-level sensitive attributes ( , ) 6 . In the counterfactual world, the individual receives advantaged macro and individual level treatment. Since, is mostly represented by the value 39, and is represented by 2 levels 0 and 1, worst to best, we consider the baseline values to be = 39 and = 1. We compute the path-specific effect of on via → → · · · → , → → · · · → , → → · · · → , and → in the baseline scenario to be 10.65. As we do not completely remove the effect of ; only along certain paths as described above, we still retain important information about nationality, , an informative feature. After correcting for the unfair effect of , , and , the accuracy is 77.92% ( = 1), in comparison with an accuracy of 78.87% from removing the unfair 6 We use pre-processed data from [42].  Figure 4: a) Causal graph for the UCI Adult dataset [9], and represent the individual-level protected attributes, sex and marital status, respectively, is age and nationality, is the level of education, corresponds to working class, occupation, and hours per week, is the income class, unfair paths are represented in green b) Density of^, c) path-specific unfairness, |^−^′ | controlling for the effects of just (blue), (orange) and both , (yellow).
effect of alone. Thus, there is not significant drop in the model performance after correcting for the unfair effects of both , and .
Next, we study the residual unfairness in a series of counterfactual settings which account for unfairness at individual, macro-level sensitive attributes and their combination. Results are presented in Figure 4b. If density of two plots coincide, then they are counterfactually fair, i.e. there is no difference in prediction based on unfair pathways. The purple plot represents the fair model,^f air , trained on the original data that corrects for the multi-level path-specific effects of { , , }. In the process of learning the fair predictions, we learn the parameters for the model represented in Figure 4a as illustrated in Algorithm 1 and then generate counterfactual samples from the observed distribution. We next assess fairness of models that account for varying fair/unfair pathways and variable types. First, we generate individual-level counterfactual data by only altering the individual-level sensitive attributes and along the unfair pathways, and train a model on the individual-level counterfactual data, we call this^ ′ . The red curve represents the density plot of^ ′ after controlling for the individual-level path-specific effect at = 1. Similarly, we generate macro-level counterfactual data by only altering the macro-level sensitive attribute, , along the unfair paths, → → · · · , → → · · · , and train a model on this macro-level counterfactual data, which is represented bŷ ( ′ ) (green curve). At last, we generate individual and macrolevel counterfactual data, by altering , and along all unfair paths, represented by green in Figure 4a. In this case, the predictor, ( ′ , ′ ), is represented by the black curve, As can be seen from the general overlap of the purple and black curves, controlling for path-specific effects of both individual and macro-level sensitive attributes generates counterfactually fair models, while only controlling for the individual or macro variables doesn't provide the same density estimate as a fair model. Similarly, the residual unfairness is presented in Figure 4c, and controlling for the multi-level path-specific effects (yellow curve) results in a counterfactual fair model as the difference, |^−^′ | approaches zero. Thus, correcting the multi-level path specific effect does not marginally drop the model performance, while ensuring that predictions are fair with respect to individual and macro-level attributes.

CONCLUSION
Our work extends algorithmic fairness to account for the multilevel and socially-constructed nature of forces that shape unfairness. In doing so, we first articulate a new definition of fairness, multilevel fairness. Multi-level fairness articulates a decision being fair towards the individual if it coincides with the one in the counterfactual world where, contrary to what is observed, the individual identifies with the advantaged sensitive attribute at the individuallevel and also receives advantaged treatment at the macro-level described by the macro-level sensitive attribute. A framework like this can be used to assess unfairness at each level, and identify the places for intervention that would reduce unfairness best (e.g. via macro-level policies versus individual attributes). As we show here, leveraging datasets that represent more than individual attributes can improve fairness, as often individual level attributes have variance with respect to macro-properties, or are proxies for macro-properties which may be the critical sources of unfairness [38]. This is becoming possible given the large number of open data sets representing macro-attributes that are available, relevant to health, economics, and many other settings. Through our experiments, we illustrate the importance of accounting for macro-level sensitive attributes by exhibiting residual unfairness if they are not accounted for. Importantly, we show this residual unfairness persists even in cases when the same information and variables are considered, but without accounting for the multi-level nature of their interaction.
Finally, we demonstrate a method for achieving fair outcomes by removing unfair path-specific effects with respect to both individual and macro-level sensitive attributes. While a clear understanding of the macro-level sensitive attributes is essential for multi-level fairness, approaches to learning the latent representation of the macro-level sensitive attributes in their absence from individuallevel factors could be important future work. As an initial framework, we consider path-specific effects for linear models here; we also endeavor to extend this to fewer assumptions on the functional form in the future.