They, Them, Theirs: Rewriting with Gender-Neutral English

Tony Sun, Kellie Webster, Apu Shah, William Yang Wang, Melvin Johnson

Introduction

As the adoption of natural language models becomes more widespread, it is increasingly important to consider how they are used and who their users are. One direction for considering this has been to ask whether representations encode social biases Bolukbasi et al. (2018); Gonen and Goldberg (2019) or whether there is the potential for harm when applied to downstream applications Blodgett et al. (2020), including coreference resolution Zhao et al. (2018); Rudinger et al. (2018); Webster et al. (2018) and language generation Sheng et al. (2019); Nadeem et al. (2020). A complementary direction analyzes the distribution of training corpora and the potential to reinforce historical biases Crawford (2017); Sun et al. (2019).

While much of this prior work studies gender identity, most is built on techniques which assume gender is binary. At the same time, there is growing recognition of non-binary gender identities, with the singular they emerging as a popular way to associate with a non-binary identity or simply not indicate a binary gender (Sakurai, 2017; Lee, 2019).

Given its importance for gender inclusion, we perform a case study on the generation of the singular they in NLP. We define a new task, where we ask a model to understand and fluently change from gendered forms to neutral forms. This captures alternations such as the he-pronoun sentence “His dream is to be a fireman when he grows up” becoming the they-pronoun counterpart: “Their dream is to be a firefighter when they grow up” (Figure 2). We do not consider sentences with more than one human entity, to avoid introducing ambiguity.

We make two key contributions: (1) we build a human-curated evaluation benchmark for the re-writing task, comprising 500 gendered and gender-neutral sentence-pairs from five domains (Twitter, Reddit, news articles, movie quotes, jokes); and (2) we show how to train a model to produce they-forms in English with no human-labeled training data. We select lightweight, scalable techniques to allow future work to consider the many different identity markers across languages.

The underlying goal of this work is to improve support for model users to be able to self-identify their preferred pronouns, thereby empowering people to interact with technology in a way that is consistent with their social identity. We see applications of the task we propose in machine translation and augmented writing, and conclude by considering the ethical aspects of real-world deployment.

Applications

We see many applications of a model which can understand different reference forms and fluently move between them. An obvious application is machine translation (MT), when translating from a language with gender-neutral pronouns (e.g. Turkish) to a language with gendered pronouns (e.g. English). In this setting, many definitions of the MT task require a system to decide whether to use a he-pronoun or a she-pronoun in the English translation, even though this is not expressed in the source. If there is no disambiguating information available, providing multiple alternatives Kuczmarski and Johnson (2018) with a gender-neutral translation might be more appropriate. A model trained for this task could also be useful for augmented writing tools which provide suggestions to authors as they write, e.g. to reduce unintended targeting in job listings. Finally, given the efficacy of data augmentation techniques for improving model robustness Dixon et al. (2018), we anticipate the sentences our re-writer produces would be useful input for models.

Challenges

Rule-based Approach. One idea to rewrite gendered sentences in English to its gender-neutral variant is to use a simple rule-based method, mapping certain gendered words to their gender-neutral variants. This is a tempting solution, since the pronouns “she” and “he” can always be rewritten as “they.” In fact, we can even extend this idea to words such as “fireman” and “spokesman,” which can be mapped to their gender-neutral counterparts “firefighter” and “spokesperson,” respectively.

However, the simple find-and-replace approach struggles with two types of situations: (1) pronouns with one-to-many mappings and (2) identifying and rewriting verbs. In the former situation, some pronouns can be rewritten differently depending on the context of the sentence. To give an example, the pronoun “her” can map to either “their” or “them” depending on its usage. In the sentence “This is her pen,” “her” should be rewritten as “their,” but in the sentence “This pen belongs to her,” “her” should be rewritten as “them.” Other examples of this one-to-many mapping include “his” to “their / theirs” and “(s)he’s” to “they’re / they’ve.”

Another challenge that the rule-based method needs to address is how to identify and rewrite the appropriate verbs. From the example in Figure 2, the verb “is” remains the same while the verb “grows” is rewritten as “grow.” The insight is that verbs that correspond to a non-gendered subject should remain the same and verbs that correspond to either “she” or “he” as the subject should be rewritten. Doing this with a list of rules might be feasible, but would likely require a large set of handcrafted features that could be expensive to create and maintain.

Seq2Seq Model. On the other end of the spectrum, a separate idea is to train a Seq2Seq model that learns the mapping from gendered sentence to gender-neutral variant. This is a natural approach to the problem because the task of rewriting can be viewed a form of MT, a task where Seq2Seq models have demonstrated tremendous success Sutskever et al. (2014); Bahdanau et al. (2014); Wu et al. (2016); Vaswani et al. (2017).

However, the main challenge here is that there are few naturally-occurring corpora for gendered and gender-neutral sentences. The lack of such a large, parallel dataset is a non-trivial challenge for the training and evaluation of a Seq2Seq model.

Methodology

Our approach aims to combine the positive aspects of both the rule-based approach and Seq2Seq model. Although parallel gendered and gender-neutral sentences can be difficult to mine, standalone gendered sentences are easily accessible. We take a corpora of 100 million sentences from Wikipedia and filter them using regular expressions based on our criteria of containing a single gendered entity. We would keep sentences that contain words from the set {she,her,hers,herself}\{she,her,hers,herself\} or the set {he,him,his,himself}\{he,him,his,himself\}, but not sentences that contain words from both sets since that would indicate multiple entities of different genders. Using these filters, we find that 15 million sentences from our original Wikipedia corpora are gendered and take them to be the source side of our dataset.

From these gendered sentences, we form a parallel dataset by creating a rewriting algorithm that takes a gendered sentence as input and returns its gender-neutral variant as output. Then, we train a Seq2Seq model on this parallel dataset to learn the mapping from gendered to gender-neutral sentences. Building an end-to-end Seq2Seq model enables us to: 1) generalize better to unseen examples, and 2) convert the multi-step algorithm into a single step.

Finally, we evaluate the performance of both the algorithm and the model on a test set of 500 manually annotated sentence-pairs We plan to open-source the code for the algorithm and the resulting model.. Source sentences, which are gendered, in the test set are taken equally from five diverse domains: Twitter, Reddit, news articles, movie quotes, and jokes. In addition, we ensure that each domain is gender-balanced, meaning that we use an equal number of sentences with masculine and feminine pronouns from each domain. It is important to have a gender-balanced test set so that a rewriter cannot attain a strong score by performing well on either masculine or feminine sentences. For our metrics, we use BLEU score Papineni et al. (2002) and word error rate (WER). Comparisons between the algorithm and the model are shown in Table 1. We elaborate on both the algorithm and the model below in further detail.

Our rewriting algorithm is composed of three main components: regular expressions, a dependency parser, and a language model.

Regular expressions are responsible for finding and replacing certain tokens regardless of the context. Similar to the aforementioned rule-based approach, we always rewrite “(s)he” to be “they” and certain stereotypically gendered words to their gender-neutral counterparts. We release full list of words in the Appendix.

We use SpaCy’s Honnibal and Montani (2017) dependency parser for building a parse tree of the input sentence. Using the parse tree, we tag verbs that correspond to “(s)he” as their subject and convert them to their third-person plural conjugation using a list of rules. Verbs that correspond to a non-gendered subject remain the same.

Finally, we use the pre-trained GPT-2 language model Radford et al. (2019) to resolve pronouns with one-to-many mappings. Given a sentence with such a pronoun, we would generate all possible variants by substituting each gender-neutral variant. Then, we rank the perplexity of each sentence and choose the sentence with the lowest perplexity as the gender-neutral variant.

2 Model Details

We train a Transformer model Vaswani et al. (2017) with 66 encoder and 66 decoder layers using the Fairseq library Ott et al. (2019) on the parallel dataset generated by our algorithm. We further augment our parallel data with: 1) non-gendered to non-gendered identity data and 2) gender-inflected sentences (converting a masculine sentence to a feminine sentence or vice versa and keeping the same gender-neutral translation). We find that both of these augmentation techniques lead to improved performance. We use a split of 70-30 rewritten and identity pairs in the training set.

Our dmodeld_{model} and dffd_{ff} values are 512 and 1024 respectively and we use 4 attention heads. We use Adam Kingma and Ba (2014) with an initial learning rate of 5e45e-4 and the inverse square-root schedule described in Vaswani et al. (2017) with a warmup of 40004000 steps. Additionally, we use a byte-pair vocabulary Sennrich et al. (2015) of 3200032000 units. Finally, we pick the checkpoint with the best BLEU score on the dev set (held-out from Wikipedia).

Results

We present our results on the annotated test set in Table 2. We include the source sentence to establish the baseline with the identity function, which demonstrates that only certain gendered terms and their corresponding verbs should be rewritten while all other tokens remain the same.

Impressively, both the algorithm and the model achieve over 99 BLEU and less than 1% word error rate. We find that the algorithm performs marginally better than the model on the test set. However, upon closer inspection, as seen in Figure 3, the model actually has less of its mistakes due to pronouns and verbs, but nearly half of the model’s mistakes are due to rare tokens like whitespaces, emojis, and symbols (e.g. @, %, *, etc.). The algorithm will occasionally make mistakes when the underlying dependency parser incorrectly categorizes the part of speech of a target verb, as seen in the third example in Table 1, or when the language model gives the wrong gender-neutral variant a lower perplexity.

Robustness to rare words and domain mismatch are known problems for Seq2Seq models Koehn and Knowles (2017). In this situation, this problem may likely be exacerbated by the domain mismatch between training (clean Wikipedia sentences) and testing (noisy sentences from Twitter and Reddit). In fact, the model performs better on domains such as movie quotes and jokes, which tend to contain clean text.

We also find that both the algorithm and model tend to make more mistakes on feminine sentences compared to masculine sentences. For the algorithm, we noticed that the language model can have difficulty resolving “her” to “their / them” in certain contexts. For the model, we observed that around 70% of gendered sentences from Wikipedia were masculine. We aimed to offset this with the gender-inflected sentences, but having more naturally-occurring feminine sentences would likely help improve model performance.

Conclusion

We have presented a case study into how to fluently move between different ways to refer to a person, focusing on the alternation between English gendered pronouns and the singular they. We propose the new task of re-writing gendered sentences to be gender-neutral with the underlying goal of developing gender inclusive natural language systems. We show how it is possible to train a model to do this without any human-labeled data, by automatically generating large amounts of data by rule.

It is important to recognize that there are very many different identity markers in the many languages beyond English, and we are excited by the potential for our lightweight methodology to scale to these. We are excited for future work to dig into challenges with these languages, especially those which have greater morphological complexity.

Ethical Considerations

An underlying aim of the task we propose is to improve support for model users to be able to self-identify their preferred pronouns, including if these are non-binary. That is, the task follows and reflects the social change in English of using the singular they for gender inclusion. Work in this direction should always aim to be empowering, to allow people to interact with technology in a way that is consistent with their social identity. Therefore, an anti-goal of this work that should be avoided in future work, is being able to infer a person’s preferred pronouns when they are not explicitly given to a system. It is also important to note that we do not prescribe that a particular form is correct or preferred to others, only that it is a desirable capability for models to be able to understand the different forms and fluently change between them as needed. As alternative forms emerge, such as ze, it is important that language models adapt to understand and be able to produce these also. For increased transparency, we provide a detailed model card Mitchell et al. (2019) in the Appendix.

References

Appendix A Appendix

List of mappings from stereotypically gendered terms to their gender-neutral counterparts (this is by no means comprehensive, and there is an active area of research on expanding this list):

mankindhumanity\textrm{mankind}\rightarrow\textrm{humanity}

laymanlayperson\textrm{layman}\rightarrow\textrm{layperson}

laymenlay people\textrm{laymen}\rightarrow\textrm{lay people}

policemanpolice officer\textrm{policeman}\rightarrow\textrm{police officer}

policewomanpolice officer\textrm{policewoman}\rightarrow\textrm{police officer}

policemenpolice officers\textrm{policemen}\rightarrow\textrm{police officers}

policewomenpolice officers\textrm{policewomen}\rightarrow\textrm{police officers}

stewardessflight attendant\textrm{stewardess}\rightarrow\textrm{flight attendant}

weathermanweather reporter\textrm{weatherman}\rightarrow\textrm{weather reporter}

firemanfirefighter\textrm{fireman}\rightarrow\textrm{firefighter}

chairmanchair\textrm{chairman}\rightarrow\textrm{chair}

spokesmanspokesperson\textrm{spokesman}\rightarrow\textrm{spokesperson}

Developed by researchers at the University of California, Santa Barbara and Google.

Transformer model with 6 encoder layers and 6 decoder layers.

Trained to optimize per-token cross-entropy loss.

Used for research in converting gendered English sentences with single person entities, into gender-neutral forms.

Not suitable for generic text that has not been preselected for having single individual entities.

Based on training data and difficulty the results for converting he-pronoun sentences to neutral vs she-pronoun sentences to neutral vary as documented in Figure 3.

15 million sentences filtered from 100 million English Wikipedia sentences containing single gendered entities.

These sentences were automatically rewritten using manual rules plus the SpaCy dependency parser and GPT-2 LM.

Manually curated English gendered sentences represented equally across five diverse domains: Twitter, Reddit, news articles, movie quotes, and jokes.

The technology is intended to be used to demonstrate the ability of models to rewrite gendered text to the chosen gender of a user.

The model is not intended to identify gender nor to prescribe a particular form.

This is by no-means exhaustive and does not match all potential pronouns a user may request.

Intended to rewrite sentences only consisting of a single person entity.