Generating Gender Augmented Data for NLP (2021)

Abstract: Gender bias is a frequent occurrence in NLP-based applications, especially pronounced in gender-inflected languages. Bias can appear through associations of certain adjectives and animate nouns with the natural gender of referents, but also due to unbalanced grammatical gender frequencies of inflected words. This type of bias becomes more evident in generating conversational utterances where gender is not specified within the sentence, because most current NLP applications still work on a sentence-level context. As a step towards more inclusive NLP, this paper proposes an automatic and generalisable re-writing approach for short conversational sentences. The rewriting method can be applied to sentences that, without extra-sentential context, have multiple equivalent alternatives in terms of gender. The method can be applied both for creating gender balanced outputs as well as for creating gender balanced training data. The proposed approach is based on a neural machine translation system trained to ‘translate’ from one gender alternative to another. Both the automatic and manual analysis of the approach show promising results with respect to the automatic generation of gender alternatives for conversational sentences in Spanish.

## introduction recent studies have exposed challenging systematic issues related to bias that extend to a range of ai applications, including natural language processing (nlp) technology @xcite . observed bias problems range from copying biases already existing in data to claims that the training process can lead to an exacerbation or amplification of observed biases @xcite . the algorithms learn to maximize the overall probability of an occurrence, leading to preferences for more frequently appearing training patterns. with this work, we propose a method for generating (more) balanced data in terms of one of the main types of bias frequently observed in language: gender bias. gender bias can occur in language due to the fact that some languages have a way of explicitly marking (natural or grammatical) gender while others do not @xcite . gender bias in translation is usually manifested when animate entities (e.g. professions) are translated from gender neutral language (e.g. english) into a gendered language (e.g. spanish) because the instances seen in training data are biased. also, conversational utterances are prone to bias, both in machine translation as well as in other nlp applications, because systems often do not have the ability to provide multiple gender variants. therefore, users are simply presented with the most probable option which is prone to bias. in our work, we aim to enable the generation of multiple gender variants by expanding each sentence with the missing gender variants, thus fostering inclusion in online conversations/nlp applications. generating gender variants can and should also be used to create gender balanced conversational data that can be used to train less biased nlp models such as machine translation models, language models, chat bots, etc. unlike previous studies, we did not want to limit ourselves to one specific gender phenomenon, such as gender markings on professions @xcite ) (for which the gender can easily be swapped by using hand-crafted lists) or first person personal pronouns @xcite ). the objective of this research aims to include as many cases as possible of gender alternatives related not only to gender of persons but also to grammatical gender of the objects referred to. in example 1, (a) illustrates an example of two alternatives for a sentence where there is agreement with the grammatical gender of an object referred to in the previous sentence, while in (b) there is agreement with the gender of the speaker/writer (i.e. a person). example 1. (a) @xcite ¿está completo? -[female] ¿está completa? foot_0 (b) @xcite estoy confundido. -[female] estoy confundida. 2 at this stage, our approach does not discriminate between human referents and objects. it is furthermore limited to the generation of binary gender alternatives. we are aware of the importance and challenge of dealing with non-binary gender @xcite which we aim to tackle in future work. the research was carried out in collaboration with an anonymous industry partner with a specific application in mind that deals with conversational sentences. our approach aims to alleviate gender bias in the said application. we focus on one gender-rich language (spanish), however, scalability and generalizability were kept in mind while designing the approach. our approach can be summarized as follows: the first two steps are necessary since there is a lack of readily available open-source genderparallel data for training. although language knowledge and a pos tagger are necessary for these steps, the human effort and necessity for external linguistic tools are minimal (contrary to other approaches which heavily rely on linguistic tools @xcite or on manually created gender-parallel data @xcite . ## related work in the literature on gender in nlp, two main approaches for bias mitigation can be identified: (a) approaches that attempt to mitigate bias during model or word representation training, and/or (b) approaches that aim to augment the data by creating more variety in the training set (pre-processing step) or in the output (post-processing step). in the following paragraphs, we focus on the latter as it is most closely related to our approach. there have been attempts to artificially increase the variety in already existing data sets by creating alternatives to sentences in order to decrease the overall bias (in terms of gender). 4 this approach has been referred to in the literature as 'counterfactual data augmentation'(cda) @xcite . their cda approach consists of a simple bidirectional dictionary of gendered words such as he:she, her:him/his, queen:king, etc. @xcite does not use the term cda as this was introduced later, but what they describe can be interpreted as a rudimentary approach to cda: they augmented the existing data set by adding additional sentences in which personal pronouns 'he' and 'she' had been swapped. another cda approach is described in @xcite . similar to @xcite , the approach relies on a bidirectional dictionary of animate nouns. unlike @xcite , pronouns are not handled and the languages worked on are hebrew and spanish, languages that have more gender markers than english. since solely changing the nouns into their male/female counterpart often requires the enforcement of grammatical gender agreement of accompanying articles and adjectives, they introduce markov random fields with optional neural parametrisation that can infer the effect of the swap on the remaining words in the segment. their approach is limited to mitigating gender stereotypes related to animate nouns and relies on dependency trees, lemmata, pos-tags and morpho-syntactic tags in order to solve issues related to the morpho-syntactic agreement. to specific discrepancies between the information encoded in the source and target data, there has been some work on generating the appropriate gender variant for ambiguous source sentences. foot_4 vanmassenhove et al. (2019) appends gender tags to the source side of the training data indicating the gender of the speaker. as such, during testing, the desired (or multiple) gender variant(s) can be generated by adding tags. basta et al. (2020) also experiment with incorporating a gender tag, and investigate adding the previous sentence as additional context information. both methods result in the improvement of automatic mt scores as well as on gender accuracy for english-to-spanish translation. similarly, bentivogli et al. (2020) developed nmt systems using gender tags and evaluated them specifically on gender phenomena. the work described in habash et al. ( 2019 ) is the most similar to ours. they proposed an approach for automatic gender reinflection ("re-gendering") for arabic. they propose a method which consists of two components: a gender classifier and a nmt gender rewriter. in order to build the nmt rewriter, they first manually created a corpus annotated with gender information. subsequently, each gendered sentence is re-gendered manually in order to obtain the necessary gender-parallel data for training. this way, they are able to provide gender alternatives for sentences with natural gender agreement with the first person singular. our research, in contrast, aims to augment existing data with gender alternatives in a broader sense: it is not limited to singular first person phenomena, ambiguity in multilingual settings, or phenomena related solely to gender agreement. it involves the gender of adjectives, past participles, and several types of pronouns for which the referent is not explicitly mentioned within the context of the sentence. ## generating gender-parallel data as mentioned in the introduction, our main objective is to create an automatic gender rewriter using nmt. in order to do so, we need gender-parallel training data that consists of possible gender variants in both directions (masculine-to-feminine and feminine-to-masculine). such data sets are, unfortunately, not publicly available, which is why we first leveraged linguistic knowledge and rules to generate a sufficient amount of gender-parallel data. therefore, we identified the sequences of pos classes that show gender agreement in spanish and can thus be 're-gendered': adjectives, past participles, and several types of pronouns. a detailed description of how the different word classes are tackled to generate gender alternatives is described below. we would like to point out that our target data consisted of very short sentences, where there is at most agreement with one referent. 6 as such, our approach is limited to tackle sentences alike and cannot handle the generation of alternatives for sentences where more than two gender alternatives could be generated (due to grammatical agreement of the re-genderable word with multiple entities). ## gender-parallel data in order to create gender-parallel data, a set of spanish subtitles was downloaded from the opus @xcite website. 8 after basic filtering (removing too long and non-alpha numeric segments), a set of short sentences with up to 10 (untokenized) words was extracted. this candidate set consisted of 22 458 968 sentences. this data set was pos tagged using treetagger 9 . the sentences matching the pos sequences mentioned in the appendix were extracted from this data set. this set consisted of more than 1m sentences. for each extracted re-genderable sentence, the alternative gender variant is created by applying appropriate rules described in the appendix. after applying rules on all re-genderable structures, we joined both re-gendering directions (masculine-tofeminine and feminine-to-masculine) in order to create a balanced data set. as already mentioned, the corpus also contains a number of sentences that are not to be regendered. by including these neutral sentences in our training data, we encourage the rewriter to: (a) learn when to generate alternatives and when not to, and (b) how to generate those alternatives, if necessary. in this way, a corpus with about 2.2m gender-parallel sentences was created. this corpus was then separated into train, development (∼1k sentences) and test (∼3k sentences) sets. the rewritten parts of the development and test sets were revised manually and the errors were corrected for about 6% of sentences and 1.5% of words. the training set, being large, was not verified manually, thus it contained some noise. in addition to opensubtitles, we also obtained data from the industry partner consisting of around 8 000 sentences readily available with all possible alternative versions of the sentences provided. an additional 22 000 sentences had to be revised manually in order to produce the correct gender variant for re-genderable sentences. this set was used as an additional test set for the re-writer. one part of this set can be handled by the described pos sequences and rules ("structured test 1"), while another part contains different pos sequences and cannot be handled by these rules at all ("unstructured test 1"). the latter test set will give a good estimation of the scalability of our approach. an overall split of data sets is described in ## neural rewriter once we compiled a sufficient amount of genderparalell data, we were able to train our automatic rewriter. the automatic rewriter is a nmt system trained on the following parallel data: original sentences as the source language, and re-gendered sentence as the target language. for neutral sentences, the source and the target parts are identical. the nmt rewriter was built using the publicly available sockeye foot_8 implementation @xcite of the transformer architecture @xcite . the system operates on subword units generated by byte-pair encoding (bpe) @xcite . we set the number of bpe merging operations to 32000. we have experimented with the following setups: the system with tags was built using the same technique as proposed in @xcite for multilingual mt systems and used for many other applications including gender-informed mt @xcite . for our experiments, we added a label 'n' (neutral) or 'g' (re-genderable) to each source sentence. these tags are implicitly present in the gender-parallel data -if the source and the target parts differ, it is a re-genderable sentence, if they are identical it is neutral. therefore, the tags are certainly available for the training and development sets, but they might not be available for the test sets. therefore, this system was assessed in two ways: ## results for generating gender variants our first experiment consisted of using the implementation of cda by @xcite to generate gendered variants. however, this work only tackled animate nouns, which rarely occur in the conversational sentences we investigated in this work. our re-implementation of their approach generated the correct gender variant for only 1% of the sentences. because of the very low recall, this implementation was not directly applicable for our research. in addition to this, since our work aims to tackle multiple gender related word classes, we explored extending the implementation by augmenting the list with character adjectives. on doing so, we found that this implementation generated the correct gendered variant in only 9% of the cases. an important point to note is that 3% of the neutral sentences (for which variants should not have been generated) were also converted as opposed to the 1% with only animate nouns, attributed to the presence of more words in the hand-crafted lists. in order to cover more words and improve the performance of this implementation on our data set, we considered augmenting the hand-crafted list with past participles and/or clitic pronouns. however, that increased the size of the list exponentially and made the approach prone to errors, inefficient and not scalable to other languages. ## conclusions and future work in this paper, we describe an initial approach towards enriching short conversational sentences with their gender variants. unlike other related work, our approach is not limited to tackling the first person singular phenomena, swapping third person pronouns or merely dealing with occupa-tional or generally animate nouns. in addition, with our approach, the reliance on linguistic knowledge and tools is kept to a minimum in order to facilitate real-world deployment. the main hurdle for this type of research is the absence of large training sets. although provided with some manually annotated data from the industry partner, the data provided was far from sufficient to train a state-of-the-art automatic gender re-writer. therefore, training data was extracted from opensubtitles using linguistic knowledge about the targeted language, namely spanish. re-genderable types of words (pos classes) were identified and then frequently occurring 're-genderable' as well as 'neutral' pos patterns were extracted. by applying the corresponding rules to the re-genderable sentences, a large gender-parallel spanish data set was compiled. next, an nmt rewriter was trained in order to 'translate' each re-genderable sentence into its gender alternative which showed promising performance both in terms of automatic as well as of manual evaluation. in addition, it is shown that providing additional information regarding the need for rewriting in the form of tags could be helpful for the nmt system, as similar tags have shown to be useful for other applications such as multilingual translation, controlling politeness and gender in mt, etc. while gold standard labels show better performance than the labels generated by the gender classifier, the classifier shows promising results given the very small training set. further experiments should investigate a classifier trained on larger amount of data. in future work, we would like to explore how a similar approach can be applied on more sentence structures in spanish, as well as for different languages which exhibit distinct gendering rules. furthermore, different nmt architectures, e.g. character-level nmt or an nmt system with linguistically motivated subword units could be an interesting extension to the conducted experiments, given that gender is usually marked by specific morphemes (usually not more than one or two specific characters). in addition to that, the performance of the gender classifier can be improved to produce more accurate tags by using larger annotated training sets, adding more morphological information in features and using word embeddings instead of tf-idf scores.