Enhancing Model Robustness and Fairness with Causality: A Regularization Approach (2021)

Abstract: Recent work has raised concerns on the risk of spurious correlations and unintended biases in statistical machine learning models that threaten model robustness and fairness. In this paper, we propose a simple and intuitive regularization approach to integrate causal knowledge during model training and build a robust and fair model by emphasizing causal features and de-emphasizing spurious features. Specifically, we first manually identify causal and spurious features with principles inspired from the counterfactual framework of causal inference. Then, we propose a regularization approach to penalize causal and spurious features separately. By adjusting the strength of the penalty for each type of feature, we build a predictive model that relies more on causal features and less on non-causal features. We conduct experiments to evaluate model robustness and fairness on three datasets with multiple metrics. Empirical results show that the new models built with causal awareness significantly improve model robustness with respect to counterfactual texts and model fairness with respect to sensitive attributes.

## introduction modern machine learning models are becoming increasingly successful and are widely used in high-stake applications such as filtering loan applicants @xcite , determining school admissions @xcite , and medical diagnosis @xcite , etc. however, a big challenge for statistical machine learning is that the models are data-driven and usually built on statistical correlations that are sometimes spurious. for example, a sentiment classifier trained on imdb movie reviews predicts "the film directed by spielberg is incredibly interesting" as positive. while the prediction is correct, the model takes "spielberg" as a highly predictive feature, that is learned to be strongly correlated with positive sentiment during model training. this is a spurious correlation the film directed by spielberg is incredibly interesting . 0.712 0.576 0.290 0. 874 for another example, a classifier trained on school admission data learns the "gender" attribute to be predictive of admission status. the classifier learns this correlation because the "gender" attribute happens to correlate with admission in the training data that might contain discrimination and societal bias. such a biased classifier will raise issues of discrimination when deployed in the real world. in the above examples, the spurious correlations are built in the model because those features happen to correlate with a specific class in the training data, but model designers do not want such features to carry predictive power in the model because that will make the model suffer from robustness (e.g., fail on different distributions), fairness (e.g., bias towards specific groups), and trustworthiness (e.g., not convincing when explaining model performance). existing works have investigated multiple ways to deal with spurious correlations and improve model robustness and fairness, such as feature selection @xcite , data augmentation @xcite , instance re-weighting @xcite , counterfactual logit pairing @xcite , control for confounders @xcite , apply constraints to design fair and robust objective functions @xcite . recent works also explore causal inference for robust and fair models, such as leveraging human commonsense of causal reasoning @xcite , adapting text embeddings for causal inference @xcite , and providing causal views on robustness of neural networks @xcite . while effective, most works only deal with either fairness or robustness, some works require significant human efforts, some have trade-offs between model robustness and overall performance on test set, and some are complex to deploy in real-world applications. in this paper, we propose a simple and intuitive regularization approach to integrate causal knowledge in model training. we assign large regularization penalties on spurious features and small penalties on causal features (i.e., features that cause a sample to get a label). by doing so, we encourage the model to pay less attention to spurious features and more to causal features. specifically, we first manually identify causal and spurious features based on criteria motivated by the counterfactual framework of causal inference. then, we incorporate regularization components to add different penalties for different types of features. by adjusting the strength of the penalty for each type of feature and optimizing the customized loss function, we build a model that assigns larger weights to causal features and smaller weights to non-causal features. finally, we carry out experiments to test whether our approach improves model robustness and fairness. for model robustness, we experiment with imdb movie reviews and kindle book reviews text data. we evaluate the model performance on both the standard test set as well as a counterfactual test set. results show that our models significantly improves robustness on the counterfactual test set compared to the traditional models (e.g., 12% increase in accuracy for the best model). for model fairness, we experiment with the law school admission dataset and evaluate with two metrics (i.e, equal opportunity and demographic parity). our models show more fair performance than the traditional model (e.g., females and males almost get equal opportunity and demographic parity in the best model). with this framing, the main contributions of this paper are as follows: method: we propose a simple and novel regularization approach to integrate causality during model training. by constructing and optimizing the customized loss function that adjusts the penalty for causal and spurious features, we build predictive models that pay more attention to causal features and less to non-causal features. evaluation: we evaluate our proposed models on both robustness (with high-dimensional text data) and fairness (with low-dimensional tabular data). our models outperform multiple baselines in terms of robustness to counterfactual texts and fairness to sensitive attributes, without sacrificing model performance on test set. ## related work as the main causes for fairness and robustness issues in ml, biases and spurious correlations can be introduced from multiple sources such as culture, data, and algorithm perspectives. examples include societal discrimination and bias @xcite , data imbalance, sampling bias, data poisoning @xcite @xcite ; covariate shift and confounders @xcite , over-parameterization @xcite . fairness in ml can be summarized as individual fairness @xcite , group fairness @xcite , and max-min fairness @xcite . related research typically falls into three categories based on the stage at which fairness is applied: (1) pre-processing: modify training data and revise sensitive attributes @xcite , generate balanced data, increase data diversity @xcite , instance reweighting @xcite ; (2) in-processing: apply fairness constraints (regularizations) to design objective functions @xcite , adversarially learn fair representations @xcite ; (3) post-processing: use active learning to collect feedbacks and correct predictions @xcite . here we focus on group fairness with respect to sensitive attributes. robustness in ml-based nlp models: ribeiro et al. @xcite propose checklist to identify critical model failures with diverse types of test cases; @xcite introduce hard ablation, blindness, and counterfactual logit pairing to improve counterfactual token fairness. @xcite do counterfactual data augmentmentation to improve model robustness. @xcite create gender-balanced dataset to learn embeddings that mitigate gender stereotypes. others explore robust optimization, adversarial training, and domain adaptation methods to improve model robustness @xcite @xcite . recent research draws connections between robustness and causal inference in text. @xcite and @xcite provide detailed overviews. the works closely related to this paper include: achieving robustness by leveraging human commonsense and counterfactual reasoning @xcite , adopting active learning and feedback mechanism to highlight rationales @xcite , automatically generating counterfactuals with causal words @xcite , applying causal inference for feature selection in text classification @xcite , controlling for confounders @xcite . additional works integrate causal inference in text representation and deep learning, such as causal embedding @xcite and causal view on robustness of neural networks @xcite . our proposed approach is inherently different from the aforementioned approaches: (1) we propose a general regularization approach to achieve robustness and fairness with causality. while previous works have shown the ability to improve model fairness and robustness, most of them only deal with either fairness (to sensitive attributes) or robustness (to counterfactual examples); (2) our proposed regularization approach is effective (with high prediction performance), efficient (requires little human annotation), and explainable (larger weights for causal features). ## problem definition our primary task is given input x, where x is represented by a sequence of features [x 1 , x 2 , ..., x n ], to predict an outcome y. we consider the case of a classifier f parameterized by w that produces a prediction ŷ = f w (x). the parameters w are learned during model training by optimizing (minimizing) the loss denoted by the error between y and ŷ. to clearly illustrate the problem addressed in this paper, we first consider the simple approach of logistic regression classifier f w (x) = 1 1+e -x,w ( §6.2 discusses applying other complex models). we estimate the parameters w on labeled data x and then examine the (partial) correlations between features and labels by model coefficients (i.e., feature weights). the goal is to train a model that performs well on test set and generalizes well on data from different distributions, so that the model maintains robustness to counterfactual data as well as fairness to sensitive attributes (e.g., gender, race). ## methods to build a model that is robust to counterfactuals and fair to sensitive attributes, we need to deal with issues of spurious correlations and biases. our solution is a two-stage process. we first manually identify causal and spurious features based on the criteria motivated by the counterfactual framework of causal inference. we then propose a regular-ization approach to build a loss function that adds small penalties for causal features and large penalties for spurious features. by doing so, the model is encouraged to rely more on meaningful causal associations and less on spurious correlations. ## experiments we conduct experiments with three datasets to evaluate the effectiveness of the proposed method from two aspects foot_0 : robustness to counterfactuals (evaluate on high-dimensional text data from imdb movie reviews and kindle book reviews) and fairness to sensitive attributes (evaluate on lowdimensional tabular data of law school admission). kindle book reviews: this dataset foot_1 contains book reviews from the amazon kindle store @xcite and each review is labeled as positive or negative based on its rating (ratings {4,5} as positive and ratings {1,2} as negative). to reduce noisy samples, we limit the reviews to those contain 5 to 40 words and the final dataset is split into train/validation/test sets containing 7,500/2,500/500 samples. for the 500 test samples, we manually edit each sample with minimum changes towards a counterfactual label (i.e., the same criteria used in @xcite to edit counterfactuals for imdb reviews above). law school admission data: this dataset contains admission data of 25 us law schools over 2005-2007 3 . each sample is an admission record for a student and is represented by seven features: lsat, gpa, resident, admission year, gender, race, urm (under-represented minority), with a binary label indicating the admission status. the dataset is split into train/validation/test sets containing 50%, 20%, and 30% samples. for the imdb and kindle datasets, each sample x is a piece of text, represented by a binary, bag-ofwords representation @xmath0, x 2 , ..., x v ], where v is the vocabulary size and x i is a binary value indicating the appearance of a word in the text. compared with the high-dimensional text data, the law school admission data is low-dimension with each sample represented by seven numerical or categorical features. we process this dataset by first applying one-hot encoding for categorical features and then normalizing numerical features into range 0-1. in the experiments below, we show that our method works well on both high-and lowdimensional data. ## conclusions in this paper, we have introduced the idea of integrating causal knowledge through a regularization approach. we implement this by first identifying causal and spurious features and then assigning different penalties for causal and non-causal features in the loss function. the resulting model assigns larger weights for causal features and smaller weights for spurious features. experiments have demonstrated that the tuned model is effective to improve robustness and fairness and it works well for both low-and high-dimensional data. the proposed idea is simple to implement, intuitive to explain, has the potential to be easily deployed to other frameworks and various tasks on model robustness and fairness. for future works, we will design automatic methods to identify causal and spurious features and extend the regularization approach to complex deep learning frameworks.