Compositional Demographic Word Embeddings (2020)

Abstract: Word embeddings are usually derived from corpora containing text from many individuals, thus leading to general purpose representations rather than individually personalized representations. While personalized embeddings can be useful to improve language model performance and other language processing tasks, they can only be computed for people with a large amount of longitudinal data, which is not the case for new users. We propose a new form of personalized word embeddings that use demographic-specific word representations derived compositionally from full or partial demographic information for a user (i.e., gender, age, location, religion). We show that the resulting demographic-aware word representations outperform generic word representations on two tasks for English: language modeling and word associations. We further explore the trade-off between the number of available attributes and their relative effectiveness and discuss the ethical implications of using them.

## introduction word embeddings are used in many natural language processing tasks as a way of representing language. embeddings can be efficiently trained on large corpora using methods like word2vec or glove @xcite , which learn one vector per word. these embeddings capture syntactic and semantic properties of the language of all individuals who contributed to the corpus. however, they are unable to account for user-specific word preferences (e.g., using the same word in different ways across different contexts), particularly for individuals whose usage deviates from the majority. these individual preferences are reflected in the word's nearest neighbors. as an example, additionally, personalized embeddings can be useful for applications such as predictive typing systems that auto-complete sentences by providing suggestions to users, or dialog systems that follow the style of certain individuals or professionals (e.g., counselors, advisors). they can also be used to match the communication style of a user, which would signal cooperation from a dialog agent. in this paper, we propose compositional demographic word embeddings as a way of building personalized word embeddings by leveraging data from users sharing the same demographic attributes (e.g., age: young, location: europe). our proposed method has the benefits of personalized word representations, while at the same time being applicable to users with limited or no data. to implement and evaluate our proposed method, we build a large corpus of reddit posts from 61,981 users for whom we extract self-reported values of up to four demographic properties: age, location, gender, and religion. we examine differences in word usage and association captured by the demographics we extracted and discuss the limitations and ethical considerations of using or drawing conclusions from this method. we explore the value of compositional demographic word embeddings on two english nlp tasks: language modeling and word associations. in both cases, we show that our proposed embeddings improve performance over generic word representations. ## related work embedding bias. recent work on embeddings has revealed and attempted to remove racial, gender, religious, and other biases @xcite . the bias in our corpora and embeddings have a societal impact and risks exclusion and demographic misrepresentation @xcite . this means that users of certain regions, ages, or genders may find nlp technologies more difficult to use. for instance, when using standard corpora for pos tagging, @xcite found that models perform significantly lower on younger people and ethnic minorities. similarly, results on textbased geotagging show best results for men over 40 @xcite . similar results are starting to be found in embeddings produced by contextual embedding methods @xcite . we focus on non-contextual embedding methods because of their computational efficiency, which is crucial if many separate representations are being learned. additionally, there may not be a large amount of available data for underrepresented groups and these contextualized models require billions of tokens for training. recent work has also shown that static embeddings are competitive with contextualized ones in some settings @xcite . personalization. the closest work is @xcite 's exploration of demographic-specific word embedding spaces. they trained word embeddings for male and female speakers who live in the usa and india using skip-gram architectures that learn a separate word matrix for each demographic group (e.g., male speakers from the usa). another line of work used discrete @xcite or continuous values @xcite to learn speaker embeddings: a single vector for each user. the speaker embedding is appended to the input of the recurrent or output layer, and trained simultaneously with the rest of the model. this idea applies to any contextual information type and was introduced as a way to condition language models on topics learned by topic modeling @xcite . it has since been used as a way of representing users in tasks such as task-oriented and open-domain dialog @xcite , information retrieval based on book preferences @xcite , query auto-completion @xcite , authorship attribution @xcite , sarcasm detection (kolchinski and potts, 2018), sentiment analysis @xcite , and cold-start language modeling @xcite . finally, a recent study by @xcite compared how to improve a language model with user-specific data using priming and interpolation, depending on the amount of data available, learning a new model for each user. more generally, personalization has been extensively applied to marketing, webpage layout, product and news recommendation, query completion, and dialog @xcite . @xcite ) explored predicting response time, common messages, and speaker relationships from personal conversation data. @xcite conditioned dialog systems on artificially constructed personas and @xcite used meta-learning to improve this process. goal-oriented dialog has used demographics (i.e. age, gender) to condition system response generation, showing that this relatively coarse grained personalization improves system performance @xcite . social media. we use social media data with demographic attributes inferred from user posts. prior work has explored extraction or prediction of attributes such as age, gender, region, and political orientation @xcite . work on analyzing the demographics of social media users also includes race/ethnicity, income level, urbanity, emotional stability, personality traits @xcite , and life satisfaction @xcite . one particularly relevant study by @xcite presented a corpus of reddit users with personality information as well as some demographics for a subset of users. unlike our approach, which is based on text content, they extract information from reddit flairs, a type of user tag. out of their set of 10,295 users, 2,253 are also in our set of users (22% of theirs, 0.5% of ours) that have one or more demographic labels, confirming the speculation in their paper that extracting demographics from text is a complementary approach that captures more information about users in their data. other work has used reddit posts to identify users who were diagnosed with depression @xcite and to construct personas for personalized dialog agents @xcite . language models. to evaluate embeddings, we consider language modeling, a task that has long been used for speech recognition and translation, and more recently been widely used for model pretraining. a range of models have been developed, with progressively larger models trained on more data (e.g., @xcite . variations of the lstm have consistently achieved state-of-the-art performance without massive compute resources @xcite @xcite . we use the awd-lstm @xcite in our experiments, as it achieves very strong performance, has a well-studied codebase, and can be trained on a single gpu in a day. ## dataset our first contribution is a new dataset. we use english reddit comments as they are publicly available, are written by many users, and span multiple years. 1 we extract demographic properties of users from self-identification in their text. ## generating compositional demographic word embeddings we propose two methods for learning compositional demographic embeddings. the first learns a generic embedding for each word and a vector representation of each demographic attribute (including 'unknown'). this is memory efficient, as we need only 19 vectors to cover all of our attributes. in the second method, for each word we learn (a) a generic embedding and (b) a vector for each demographic attribute. this is more expressive, but requires twenty vectors for each word. ## language modeling we first examine the usefulness of our embeddings by showing that they can help us better model a user's language. we consider two experiments. first, we focus on compositional demographic embeddings and sample 50k posts from our corpus for training the language model and 5k for each of validation and test. next, we compare with a userspecific model on a sample of our data with text from just 100 users who each have a large amount of data available in our corpus, with an average of 3.2 million tokens per user. in both experiments, we use the language model developed by @xcite . as discussed in § 2, this model was recently state-of-the-art and has been the basis of many variations. we modify it to initialize the word embeddings with the ones we provide and to concatenate multiple embedding vectors as input to the recurrent layers. the rest of the architecture is unaltered. we tried adding rather than concatenating and found no improvement. we chose to concatenate the inputs with the intuition that the network would learn how to combine the information itself. we explored various hyperparameter configurations on our validation set and found the best results using dropout with the same mask for generic and demographic-specific embeddings, untied weights, and fixed input embeddings. untying and fixing input embeddings is supported by concurrent work @xcite . each model is trained for 50 epochs. we use the version from the epoch that had the best validation set perplexity, a standard metric in language modeling that measures the accuracy of the predicted probability distribution. ## demographic word associations as a second evaluation, we consider word associations, a core task in nlp that probes the relatedness or similarity between words. data is collected for the task by presenting a stimulus word (e.g., cat) and asking people what other words come to mind (e.g., dog or mouse). earlier systems relied on resources such as wordnet to solve the task, but most recent work has used word embeddings. ## limitations and ethical considerations this work uses demographic information to modify language representation. this type of work is encouraged by the numerous arguments outlined in @xcite , which demonstrate the need for demographic data disaggregation in order to make decisions and build technologies that are equitable for all. we view our work as an initial investigation of differences in language model performance across demographics and how technology can be improved for the identified groups. our results in tables 4 and 5 show that using demographic information can enable the development of language tools that improve performance for all groups compared to simply training on all data. although we show that some language production aspects are correlated with demographic information, we do not believe the way we speak is a direct and only consequence of one's demographics, neither do we claim that this is the ideal information source for it or that this will necessarily hold for populations sampled significantly differently than in our study. as a consequence, it is possible that using demographics in embedding construction could accentuate bias, although this remains to be studied. those that use our method should account for this possibility. our study uses four demographic variables and only covers a subset of the potential values of each demographic. for instance, we do not use the same granularity across locations, include all locations, religions, or gender identities. we simplify age into ranges. the groups 'secular', 'agnostic', and 'atheist' are grouped into one broader group. our sample is further biased by the choice of platform as each platform contains text from different populations. users in our sample are predominately young, male, atheist, and live in the united states. when using gender as a study variable, we followed the recommendations of @xcite . our "gender" extraction method does not refer to biological sex. after running gender extraction patterns, users are assigned to either the 'male', 'female', or 'unknown' label, meaning that on the basis of these phrases one's gender identity is assumed to be binary or to be a gender identity unknown to our model, which may include those who are transgender, non-binary, or those who do not wish to disclose their gender. however, we are aware that the use of regular expressions for the extraction of demographic attributes can lead to false positives and false negatives (error rates are provided in the supplemental material) and that there exists a bias in using these strategies, as populations that do not wish to be identified are less likely to explicitly make such statements. for transparency, our released code includes the scripts used to assign demographic labels. above we discussed concerns for incorrect demographic assignment when developing models. there are also potential negative consequences when using these models in a deployed system. our embeddings can only be used when the demographics of a user are known. this may be acceptable if the user voluntarily self-reports their demographics with the understanding that they will alter the predictions they receive. however, if demographics are automatically inferred there is a risk of misattribution, which depending on the application may have negative consequences. a separate consideration is the environmental impact of this approach. compared to the standard method, our approach does involve training more models, but the cost of inference is likely only marginally higher. we believe the additional cost in training is worth the benefits to individual users. finally, we acknowledge that components of our method could potentially be used for user profiling @xcite and/or surveillance of target populations, thus exposing members of underrepresented groups to harms such as discrimination and coercion and threatening intellectual freedom @xcite . similarly, the language models could be used to generate text in the style of a target population or at least to estimate the label distribution of a given text, which would help obfuscate the identity of the author @xcite . this obfuscation could help hide an author's identity in order to avoid surveillance or could be used maliciously to infiltrate communities online. we advocate against the use of our methods for these or other ethically questionable applications. ## conclusions we proposed a novel method of generating word representations by composing demographicspecific word vectors. through experiments on two core language processing tasks, language modeling and word associations, we show that demographicaware word representations outperform generic embeddings. we also find that demographic matrices perform much better than demographic vectors. through several ablation analyses we show that word embeddings that leverage multiple demographic attributes give better performance than those using single attributes. to support future work that can help model individuals and demographics, our code is available at http://lit.eecs.umich.edu . our data is not available due to licensing restrictions but can be redownloaded and processed with our scripts. we hope this will support work on solutions for nlp applications and resources that can better serve minorities and underrepresented groups.