SlowGuess/NAACL_2022_OCR huggingface dataset:
Enrico Liscio, Alin E. Dondera, Andrei Geadău, Catholijn M. Jonker, and Pradeep K. Murukannaiah  
Delft University of Technology, the Netherlands
{E.Liscio,C.M.Jonker,P.K.Murukannaiah}@tudelft.nl
{A.E.Dondera,A.Geadau}@student.tudelft.nl
Moral values influence how we interpret and act upon the information we receive. Identifying human moral values is essential for artificially intelligent agents to co-exist with humans. Recent progress in natural language processing allows the identification of moral values in textual discourse. However, domain-specific moral rhetoric poses challenges for transferring knowledge from one domain to another.
We provide the first extensive investigation on the effects of cross-domain classification of moral values from text. We compare a state-of-the-art deep learning model (BERT) in seven domains and four cross-domain settings. We show that a value classifier can generalize and transfer knowledge to novel domains, but it can introduce catastrophic forgetting. We also highlight the typical classification errors in cross-domain value classification and compare the model predictions to the annotators agreement. Our results provide insights to computer and social scientists that seek to identify moral rhetoric specific to a domain of discourse.
Morality helps humans discern right from wrong. Pluralist moral philosophers argue that human morality can be represented, understood, and explained by a finite number of irreducible basic elements, referred to as moral values (Graham et al., 2013). The difference in our preferences over moral values explains how and why we think differently. For instance, both conservatives and liberals may agree that individual welfare is important. However, a conservative, who cherishes the values of freedom and independence, may believe that taxes should be decreased to attain more individual welfare. In contrast, a liberal, who cherishes the values of community and care, may believe that taxes should be increased to obtain welfare (Graham et al., 2009).
It is crucial to understand human morality to develop beneficial AI (Russell et al., 2015; Soares and Fallenstein, 2017). To operate among humans, artificial agents must be able to comprehend and recognize the moral values that drive the differences in human behavior (Akata et al., 2020; Gabriel, 2020). The ability to understand moral rhetoric can be instrumental for, e.g., facilitating human-agent trust (Chhogyal et al., 2019; Mehrotra et al., 2021) and engineering value-aligned socio-technical systems (Ajmeri et al., 2020; Murukannaiah et al., 2020; Serramia et al., 2021; Montes and Sierra, 2021).
There are survey instruments to estimate individual value profiles (Schwartz, 2012; Graham et al., 2013). However, reasoning about moral values is challenging for humans (Le Dantec et al., 2009; Pommeranz et al., 2012). Further, in practical applications, e.g., to conduct meaningful conversations (Tigunova et al., 2019) or to identify online trends (Mooijman et al., 2018), artificial agents should be able to understand moral rhetoric on the fly.
The growing capabilities of natural language processing (NLP) enable the estimation of moral rhetoric from textual discourse (Hoover et al., 2020; Araque et al., 2020; Alshomary et al., 2022; Kiesel et al., 2022). Specifically, a value classifier can be used to identify the moral values underlying a piece of text on the fly. For instance, Mooijman et al. (2018) show that detecting moral values from tweets can predict violent protests.
Existing value classifiers are evaluated on a specific dataset, without re-training or testing the classifier on a different dataset. This shows the ability of the classifier to predict values from text, but not the ability to transfer the learned knowledge across datasets. A critical aspect of moral values is that they are intrinsically linked to the domain under discussion (Pomeranz et al., 2012; Liscio et al., 2021, 2022). Moral value expressions may take different forms in different domains. For example, in the driving domain, the value of safety concerns
Findings of the Association for Computational Linguistics: NAACL 2022, pages 2727 - 2745 July 10-15, 2022 ©2022 Association for Computational Linguistics
speed limits and seat belts, but in the COVID-19 domain, safety concerns social distancing and face masks. Further, a word (broadly, language) may trigger different moral rhetoric in different domains. For example, in a libertarian blog, the word 'taxes' may be linked to the authority value, but in a socialist blog it may be linked to the community value. Thus, it is crucial for a value classifier to recognize domain-specific connotations of moral rhetoric.
Collecting and annotating a sufficient amount of training examples in each domain is expensive and time consuming. To reduce the need for new annotated examples, we can pretrain classifiers with similar available annotated data and transfer the acquired knowledge to a novel task—a practice known as transfer learning (Ruder, 2019). Despite the benefits, transfer learning poses well-known challenges, including: (1) generalizability: how well does a classifier perform on novel data? (2) transferability: how well is knowledge transferred from one domain to another? and (3) catastrophic forgetting: to what extent is knowledge of a previous domain lost after training in a new domain? These challenges are crucial for value classification because of its domain-specific nature.
We perform the first comprehensive cross-domain evaluation of a value classifier. We employ the Moral Foundation Twitter Corpus (Hoover et al., 2020), consisting of seven datasets spanning different socio-political areas, annotated with the value taxonomy of the Moral Foundation Theory (Graham et al., 2013). Treating each dataset as a domain, we train a deep learning model, BERT (Devlin et al., 2019), in four training settings to evaluate the value classifier's generalizability, transferability, and catastrophic forgetting.
Our experiments show that (1) a value classifier can generalize to novel domains, especially when trained on a variety of domains; (2) initializing a classifier with examples from different domains improves performance in novel domains even when little training data is available in the novel domains; (3) catastrophic forgetting occurs even when training on a small portion of data from the novel domain, and its impact must be considered when training on a novel domain; and (4) in the large majority of cases, in all considered training settings, at least one annotator agrees with the model predictions.
Our investigation is significant because moral rhetoric is seldom explicit in language, but often lies in subtle domain-dependent cues. Understand
ing whether a classifier can recognize and transfer such hidden patterns across domains is instrumental for the practical use. By unveiling the successes and mistakes of value classifiers in cross-domain settings, we hope to inspire researchers and practitioners to employ value classification responsibly.
2 Background and Data
We introduce the Moral Foundation Theory (MFT) (Graham et al., 2013) and the Moral Foundation Twitter Corpus (MFTC) (Hoover et al., 2020) used in our experiments.
The MFT is a well-established theory of moral values developed by social and cultural psychologists. It argues that human morality is composed of a finite set of innate moral foundations, similar to how the five taste receptors (for sweet, sour, salt, bitter, and umami) combine to yield the tastes we experience. The MFT includes five foundations, each composed of a vice-virtue duality, resulting in the 10 moral values shown in Table 1.
Table 1: The five moral foundations in the MFT
Foundation	Definition
Care/Harm	Support for care for others/Refrain from harming others
Fairness/Cheating	Support for fairness and equality/Refrain from cheating or exploiting others
Loyalty/Betrayal	Support for prioritizing one's inner circle/Refrain from betraying the inner circle
Authority/Subversion	Support for respecting authority and tradition/Refrain from subverting authority or tradition
Purity/Degradation	Support for the purity of sacred entities/Refrain from corrupting such entities
The MFTC is composed of 35,108 tweets, divided into seven datasets, each corresponding to a topic: All Lives Matter (ALM), Baltimore protests (BLT), Black Lives Matter (BLM), hate speech and offensive language (DAV) (Davidson et al., 2017), 2016 presidential election (ELE), MeToo movement (MT), and hurricane Sandy (SND). These datasets from complex and diverse socio-political issues allow us to evaluate the transferability by treating each dataset as belonging to a domain.
The tweets were annotated by multiple annotators with the MFT taxonomy. Hoover et al. (2020) provide additional details on the annotation process. They recognize that the vice and the virtue constituting one moral foundation are expressed differently in natural language. For example, an ut
terance describing a care concern (e.g., taking care of one's offspring) does not necessarily also contain harm expressions. For this reason, each tweet was annotated with all 10 individual moral values plus an additional nonmoral label, resulting in 11 possible labels per tweet. Due to the subjective nature of moral values, different annotators may label the same tweet differently. For this reason, Hoover et al. (2020) apply a majority vote to select the definitive label(s) of each tweet. Tweets with no majority label are labeled as nonmoral. Table 2 shows three examples of annotated tweets.
Table 2: Examples of labeled tweets in MFTC
Tweet	Dataset	Labels
Police lives matter, all lives matter, peace and love people	ALM	care
Which oppression is worse, sexism or racism?	BLM	harm, cheating
Baltimore Police will deliver an update on the #FreddieGray investigation. Listen live on WBAL	BLT	nonmoral
Table 3 shows the distribution of labels. The MeanIR is a measure of imbalance in a dataset (Charte et al., 2015). MeanIR is the mean of  $\mathrm{IR}_l$  for each label  $l$ , where  $\mathrm{IR}_l$  is the ratio of the number of instances having the majority (i.e., nonmoral) label and the number of instances having label  $l$ . The degree of imbalance varies largely across datasets, which is realistic since different domains are likely to have different distributions of moral content.
Table 3: Distribution of labels per dataset of the MFTC
Foundation	ALM	BLT	BLM	DAV	ELE	MT	SND
Care	456	171	321	9	398	206	992
Harm	735	244	1037	138	588	433	793
Fairness	515	133	522	4	560	391	179
Cheating	505	519	876	62	620	685	459
Loyalty	244	373	523	41	207	322	415
Betrayal	40	621	169	41	128	366	146
Authority	244	17	276	20	169	415	443
Subversion	91	257	303	7	165	874	451
Purity	81	40	108	5	409	173	56
Degradation	122	28	186	67	138	941	91
Nonmoral	1744	3826	1583	4509	2501	1565	1313
Total	4424	5593	5257	5358	4961	4591	4891
MeanIR	11.5	51.3	5.4	344.8	9.6	4.0	6.4
Predicting moral values is a multi-label classification problem. Given a set of textual documents,  $\mathcal{T}$ , and a set of moral value labels,  $\mathcal{L} = (l_1, l_2, \dots, l_n)$ ,
we wish to learn a mapping  $\mathcal{C}:\mathcal{T}\mapsto \mathcal{P}(\mathcal{L})$ . Each element in  $\mathcal{P}(\mathcal{L})$  is a binary vector,  $y = (y_{1},y_{2},\ldots ,y_{n})$ , where  $y_{i} = 1$  if the corresponding text is labeled with  $l_{i}$ . The mapping  $\mathcal{C}$  is learned via BERT (Devlin et al., 2019), a language representation model based on the Transformer architecture (Vaswani et al., 2017). We choose BERT as it represents the state-of-the-art for several NLP tasks, including value classification (Kobbe et al., 2020; Alshomary et al., 2022; Kiesel et al., 2022). We provide additional details, including hyperparameters, in the Appendix. The code is available on GitHub<sup>1</sup>.
3.1 Cross-Domain Evaluation
To perform cross-domain evaluation, we partition the MFTC datasets into  $\mathcal{T}_{source}$  and  $\mathcal{T}_{target}$ . We treat  $\mathcal{T}_{source}$  as available data and  $\mathcal{T}_{target}$  as an incoming dataset from a novel domain. In our experiments,  $\mathcal{T}_{target}$  is always composed of one MFTC dataset. We experiment with  $\mathcal{T}_{source}$  composed of one, three, and six datasets. We present the results for the setting with six datasets as  $\mathcal{T}_{source}$  in Section 4 and the other settings in the Appendix.
For each partition, we train a value classifier,  $\mathcal{C}$ , in each of the four scenarios shown in Figure 1. These scenarios differ in how the classifier is trained. (1) In the source scenario,  $\mathcal{T}_{source}$  is the training set. (2) In the target scenario,  $\mathcal{T}_{target}$  is the training set. (3) In the finetune scenario, the classifier is first trained on  $\mathcal{T}_{source}$  and then continued to train (i.e., finetuned) on  $\mathcal{T}_{target}$ . (4) In the all scenario, the training set includes both  $\mathcal{T}_{source}$  and  $\mathcal{T}_{target}$ .
Figure 1: The cross-domain evaluation setting
<https://github.com/adondera/transferability-of-values
In each scenario, the classifier is evaluated on both  $\mathcal{T}_{source}$  and  $\mathcal{T}_{target}$ , resulting in eight settings (combinations of training scenario and evaluation set) as shown in Figure 1. For example,  $\mathcal{C}(source, target)$  indicates that  $\mathcal{C}$  is trained in the source scenario (i.e., on  $\mathcal{T}_{source}$ ) and evaluated on  $\mathcal{T}_{target}$ .
As we have seven partitions and four scenarios, we train 28 unique models. We evaluate the models on both  $\mathcal{T}_{source}$  and  $\mathcal{T}_{target}$ , covering 56 settings.
3.2 Comparisons
Our experimental setting (partitioning, training scenarios, and evaluation settings) enables a comprehensive cross-domain evaluation of the value classifiers as described below.
Baseline  $\mathcal{C}$  (source, source) and  $\mathcal{C}$  (target, target) show the performances of a value classifier on the training domain, when no cross-domain training is performed.
Topline  $\mathcal{C}(all, source)$  and  $\mathcal{C}(all, target)$  represent the ideal scenario, where all data is simultaneously available for training.
Generalizability  $\mathcal{C}(\text{source},\text{target})$  and  $\mathcal{C}(\text{target},\text{source})$  reflect the ability of a value classifier to generalize to a new domain.
Transferability Comparing  $\mathcal{C}$  (finetune, target) and  $\mathcal{C}$  (target, target) shows whether the knowledge learned by pretraining on  $\mathcal{T}_{\text {source }}$  (finetune scenario) has an advantage over the absence of pretraining (target scenario).
Catastrophic Forgetting Comparing  $\mathcal{C}(\text{finetune}, \text{source})$  and  $\mathcal{C}(\text{source}, \text{source})$  shows the extent to which the knowledge learned by training on  $\mathcal{T}_{\text{source}}$  is lost when finetuned on  $\mathcal{T}_{\text{target}}$ .
Since the imbalance in our datasets varies greatly, we report both the micro  $F_{1}$ -score and the macro  $F_{1}$ -score in each setting. The micro  $F_{1}$ -score,  $m$ , is the weighted (by class size) mean of the per-label  $F_{1}$ -scores. The macro  $F_{1}$ -score,  $M$ , is the unweighted mean of the per-label  $F_{1}$ -scores.
When training and testing on the same set, we use 10-fold cross-validation with fixed splits into training and test data, and report the average  $F_{1}$ -scores over the 10 runs. For consistency, when testing on a set different from the training set, we test on 10 splits of the set (i.e., ultimately on the whole set) and report average  $F_{1}$ -scores.
We evaluate the performance of the model in four training scenarios (source, target, finetune, all). Table 4 reports the micro and macro  $F_{1}$ -scores of the eight evaluation settings. The columns indicate the dataset used as  $T_{target}$  (e.g., in the BLT column, BLT is  $T_{target}$  and the remaining six datasets compose  $T_{source}$ ). The final column reports the average  $F_{1}$ -scores over the seven datasets. We also report the results of the majority classifier which labels all tweets as nonmoral (the majority class in all datasets), for both  $T_{source}$  and  $T_{target}$ .
We perform Wilcoxon's ranksum test (Hollander and Wolfe, 1999) to evaluate whether two results significantly differ or not. In each column (and in the top-half or the bottom-half), we choose the setting with the highest  $F_{1}$ -score and perform a pair-wise comparison with each of the other settings in that (half) column. We highlight, in bold, the best result and the results that are not significantly different ( $p > 0.05$ ) from the best.
4.1 General Trends
Before cross-domain analysis, we observe some general trends. First, the topline training scenario (all) leads to the best results when evaluating on both  $\mathcal{T}_{\text{source}}$  and  $\mathcal{T}_{\text{target}}$  (Table 4). However, all is the ideal scenario. In the top half of the table,  $\mathcal{C}(\text{source}, \text{source})$  has comparable results to  $\mathcal{C}(\text{all}, \text{source})$ , which is to be expected, since the two models are trained on similar data (six out of seven datasets in the source scenario, all seven in the all scenario). Analogously, in the bottom half of the table, the  $\mathcal{C}(\text{finetune}, \text{target})$  setting leads to results comparable to  $\mathcal{C}(\text{all}, \text{target})$ . We analyze this result further in Section 4.3.
Second, the results are rather consistent across datasets when evaluating on  $\mathcal{T}_{source}$  (top half of Table 4), but have large differences when evaluating on  $\mathcal{T}_{target}$  (bottom half of Table 4). These differences can be attributed to BLT and DAV, two highly-imbalanced datasets (Table 3). The class imbalance also justifies the large difference between micro and macro  $F_{1}$ -scores for these two datasets.
4.2 Generalizability
To evaluate generalizability, we analyze the results for the  $\mathcal{C}(\text{source},\text{target})$  and  $\mathcal{C}(\text{target},\text{source})$  settings. In  $\mathcal{C}(\text{source},\text{target})$ ,  $\mathcal{T}_{\text{source}}$  includes six datasets and  $\mathcal{T}_{\text{target}}$  includes one dataset. In contrast, in  $\mathcal{C}(\text{target},\text{source})$ ,  $\mathcal{T}_{\text{source}}$  includes
Table 4: Results of the four training scenarios evaluated on  $\mathcal{T}_{source}$  and  $\mathcal{T}_{target}$ . The columns indicate the dataset used as  $\mathcal{T}_{target}$ . We report both micro  $F_{1}$ -score (m, left column) and macro  $F_{1}$ -score (M, right column).
Classifier Setting	ALM	BLT	BLM	DAV	ELE	MT	SND	Average
m	M	m	M	m	M	m	M	m	M	m	M	m	M	m	M
Csource, source)	73.9	65.6	73.9	68.3	71.2	61.8	71.1	66.4	73.3	66.4	75.7	68.0	74.5	66.5	73.4	66.1
C(target, source)	61.6	37.7	43.8	13.1	62.6	43.0	38.8	5.1	59.3	40.4	52.4	39.1	54.4	36.6	53.3	30.7
C(finetune, source)	70.3	57.2	61.2	47.8	69.2	54.9	56.6	41.9	70.5	61.5	67.7	60.5	68.0	60.8	66.2	54.9
C(all, source)	73.7	65.6	73.7	68.0	71.3	62.1	71.0	66.4	73.6	66.7	75.6	67.7	74.3	66.6	73.3	66.2
Majority (source)	47.0	6.1	42.3	5.6	49.0	6.2	38.8	5.3	46.1	6.0	49.0	6.2	48.9	6.2	45.9	5.9
Csource, target)	63.7	57.9	63.2	29.2	76.1	75.3	83.9	8.7	63.4	54.8	54.3	51.3	49.2	38.6	64.8	45.1
C(target, target)	68.0	56.8	71.4	23.5	84.4	84.6	92.2	9.0	70.9	52.6	59.4	55.9	65.3	44.6	73.1	46.7
C(finetune, target)	69.4	67.0	72.1	37.4	84.6	85.5	92.2	9.2	72.9	65.2	61.4	59.3	66.7	55.6	74.2	54.2
C(all, target)	69.9	67.0	71.2	34.7	83.9	85.2	90.4	9.3	71.1	62.3	61.4	59.3	66.3	55.6	73.5	53.3
Majority (target)	37.9	5.1	64.8	7.4	28.3	4.2	92.2	8.7	44.5	5.7	27.9	4.4	26.4	4.0	46.0	5.6
one dataset and  $\mathcal{T}_{\text{target}}$  includes six datasets. Thus,  $\mathcal{C}(\text{target}, \text{source})$  is a more challenging setting for generalization than  $\mathcal{C}(\text{source}, \text{target})$ .
First, we observe that the model achieves better average  $F_{1}$ -scores in the  $\mathcal{C}(\text{source}, \text{target})$  setting than the majority (target) baseline. This indicates that the moral rhetoric learned on a varied array of domains is generalizable to a novel domain to some extent, in spite of the domain-specific nature of moral values. However, the performances in  $\mathcal{C}(\text{source}, \text{target})$  are not on par with the best results on  $T_{\text{target}}$ , as we discuss in Section 4.3.
Second, we observe that the model achieves better average  $F_{1}$ -scores in the  $\mathcal{C}(target, source)$  setting than the majority (source) baseline, despite the more challenging setting. However, the results are just marginally better than the majority (source) baseline, showing the difficulty in generalizing from one to multiple domains.
Finally, in both cases, when we look at the results for individual datasets, the generalizability result does not hold for BLT and DAV, which highlights the challenge of generalizing to domains with a skewed distribution of moral values.
4.3 Transferability
Recall that, in the target scenario, a model is only trained on  $\mathcal{T}_{\text{target}}$ , but in the finetune scenario, the model is first trained on  $\mathcal{T}_{\text{source}}$  and then finetuned on  $\mathcal{T}_{\text{target}}$ . Thus, to evaluate transferability, we compare the  $\mathcal{C}(\text{finetune}, \text{target})$  and  $\mathcal{C}(\text{target}, \text{target})$  settings.
From the average  $F_{1}$ -scores in Table 4, we observe that  $\mathcal{C}(finetune, target)$  performs better than or on par with  $\mathcal{C}(target, target)$ —precisely, similar  $m$  and  $8\%$  increase of  $M$ . Thus, the bene
fits of finetuning are larger for the macro than the micro  $F_{1}$ -scores. This suggests that pretraining on  $\mathcal{T}_{source}$ , which contains a more varied distribution of labels than  $\mathcal{T}_{target}$ , improves the prediction of the minority labels in  $\mathcal{T}_{target}$ .
To transfer knowledge from  $\mathcal{T}_{source}$  to  $\mathcal{T}_{target}$ , typically, we need some labeled data in  $\mathcal{T}_{target}$ . For the results in Table 4, we used  $90\%$  of  $\mathcal{T}_{target}$  for training, and the leftover  $10\%$  for evaluating at each fold. However, in practice, such a large amount of training data may not be available in the target domain. Thus, we perform an additional experiment to compare  $\mathcal{C}(target, target)$  and  $\mathcal{C}(finetune, target)$ , when trained or finetuned, respectively, on a smaller portion of  $\mathcal{T}_{target}$  (10%, 25%, and 50%) and tested on a fixed, randomly selected, 10% of  $\mathcal{T}_{target}$ . Figure 2 shows this comparison. We report the average results of 10-fold cross-validations performed on each of the seven datasets.
Figure 2:  $\mathcal{C}$  (target, target) and  $\mathcal{C}$  (finetune, target) results trained with increasing portions of  $T_{\text {target }}$
We make an important observation from Figure 2. The finetuning paradigm does not require a large portion of  $\mathcal{T}_{\text{target}}$  to perform well in the target domain. In contrast, the performance of  $\mathcal{C}(\text{target}, \text{target})$  increases (but does not surpass
$\mathcal{C}(\text{finetune}, \text{target})$  as training data from  $\mathcal{T}_{\text{target}}$  increases. Indeed,  $\mathcal{C}(\text{finetune}, \text{target})$  with  $10\%$  of  $\mathcal{T}_{\text{target}}$  performs on par with  $\mathcal{C}(\text{target}, \text{target})$  trained on  $90\%$  of  $\mathcal{T}_{\text{target}}$ . This result shows that transferring the knowledge of values from source domains to a target domain is valuable especially when the target domain has little training data.
4.4 Catastrophic Forgetting
Recall that, in the source scenario, a model is only trained on  $\mathcal{T}_{source}$ , but in the finetune scenario, the model is first trained on  $\mathcal{T}_{source}$  and then finetuned on  $\mathcal{T}_{target}$ . Thus, comparing  $\mathcal{C}(\text{finetune}, \text{source})$  and  $\mathcal{C}(\text{source}, \text{source})$  provides insight on the extent to which a model forgot about  $\mathcal{T}_{source}$  because of finetuning on  $\mathcal{T}_{target}$ .