Venue: NAACL 2019

# Learning to Decipher Hate Symbols

 Jing Qian, Mai ElSherief, Elizabeth Belding, William Yang Wang

Department of Computer Science

University of California, Santa Barbara

Santa Barbara, CA 93106 USA

{jing_qian,mayelsherif,ebelding,william}@cs.ucsb.edu

###### Abstract

Existing computational models to understand hate speech typically frame the problem as a simple classification task, bypassing the understanding of hate symbols (e.g., _14 words_, _kigy_) and their secret connotations. In this paper, we propose a novel task of deciphering hate symbols. To do this, we leverage the Urban Dictionary and collected a new, symbolic Twitter corpus of hate speech. We investigate neural network latent context models for deciphering hate symbols. More specifically, we study Sequence-to-Sequence models and show how they are able to crack the ciphers based on context. Furthermore, we propose a novel Variational Decipher and show how it can generalize better to unseen hate symbols in a more challenging testing setting.

## 1 Introduction

The statistics are sobering. The Federal Bureau of Investigation of United States1 reported over 6,000 criminal incidents motivated by bias against race, ethnicity, ancestry, religion, sexual orientation, disability, gender, and gender identity during 2016. The most recent 2016 report shows an alarming 4.6% increase, compared with 2015 data2. In addition to these reported cases, thousands of Internet users, including celebrities, are forced out of social media due to abuse, hate speech, cyberbullying, and online threats. While such social media data is abundantly available, the broad question we are asking is--What can machine learning and natural language processing do to help and prevent online hate speech?

Footnote 1: [https://www.fbi.gov/news/stories/2016-hate-crime-statistics](https://www.fbi.gov/news/stories/2016-hate-crime-statistics)

Footnote 2: [https://www.fbi.gov/news/stories/2015-hate-crime-statistics-released](https://www.fbi.gov/news/stories/2015-hate-crime-statistics-released)

The vast quantity of hate speech on social media can be analyzed to study online abuse. In recent years, there has been a growing trend of developing computational models of hate speech. However, the majority of the prior studies focus solely on modeling hate speech as a binary or multiclass classification task Djuric et al. (2015); Waseem and Hovy (2016); Burnap and Williams (2016); Wulczyn et al. (2017); Pavlopoulos et al. (2017).

While developing new features for hate speech detection certainly has merits, we believe that understanding hate speech requires us to design computational models that can decipher hate symbols that are commonly used by hate groups. Figure 1 shows an example usage of hate symbols in an otherwise seemingly harmless tweet that promotes hate. For example, _Aryan Warrior_ is a longstanding racist prison gang based in the Nevada prison system. _WPWW_ is the acronym for _White Pride World Wide_. The hate symbols _1488_ and _2316_ are more implicit. _14_ symbolizes the 14 words: _"WE MUST SECURE THE EXISTENCE OF OUR PEOPLE AND A FUTRE FOR WHITE CHILDREN"_, spoken by members of the Order neo-Nazi movement. \(H\) is the 8th letter of the alphabet, so _88=HH=Heil Hitler_. Similarly, \(W\) is the 23rd and \(P\) is the 16th letter of the alphabet, so _2316=WP=White Power_.

Figure 1: An example tweet with hate symbols.



In this work, we propose the first models for deciphering hate symbols. We investigate two families of neural network approaches: the Sequence-to-Sequence models (Sutskever et al., 2014; Cho et al., 2014) and a novel Variational Decipher based on the Conditional Variational Autoencoders (Kingma and Welling, 2014; Sohn et al., 2015; Larsen et al., 2016). We show how these neural network models are able to guess the meaning of hate symbols based on context embeddings and even generalize to unseen hate symbols during testing. Our contributions are three-fold:

* We propose a novel task of learning to decipher hate symbols, which moves beyond the standard formulation of hate speech classification settings.
* We introduce a new, symbol-rich tweet dataset for developing computational models of hate speech analysis, leveraging the Urban Dictionary.
* We investigate a sequence-to-sequence neural network model and show how it is able to encode context and crack the hate symbols. We also introduce a novel Variational Decipher, which generalizes better in a more challenging setting.

In the next section, we outline related work in text normalization, machine translation, conditional variational autoencoders, and hate speech analysis. In Section 3, we introduce our new dataset for deciphering hate speech. Next, in Section 4, we describe the design of two neural network models for the decipherment problem. Quantitative and qualitative experimental results are presented in Section 5. Finally, we conclude in Section 6.

## 2 Related Work

### Text Normalization in Social Media

The proposed task is related to text normalization focusing on the problems presented by user-generated content in online sources, such as misspelling, rapidly changing out-of-vocabulary slang, short-forms and acronyms, punctuation errors or omissions, etc. These problems usually appear as out-of-vocabulary words. Extensive research has focused on this task (Beaufort et al., 2010; Liu et al., 2011; Gouws et al., 2011; Han and Baldwin, 2011; Han et al., 2012; Chu et al., 2012; Chrupala, 2014). However, our task is different from the general text normalization in social media in that instead of the out-of-vocabulary words, we focus on the symbols conveying hateful meaning. These hate symbols can go beyond lexical variants of the vocabulary and thus are more challenging to understand.

### Machine Translation

An extensive body of work has been dedicated to machine translation. Knight et al. (2006) study a number of natural language decipherments problems using unsupervised learning. Ravi and Knight (2011) further frame the task of machine translation as decipherment and tackle it without parallel training data. Machine translation using deep learning (Neural Machine Translation) has been proposed in recent years. Sutskever et al. (2014) and Cho et al. (2014) use Sequence to Sequence (Seq2Seq) learning with Recurrent Neural Networks (RNN). Bahdanau et al. (2015) further improve translation performance using the attention mechanism. Google's Neural Machine Translation System (GNMT) employs a deep attentional LSTM network with residual connections (Wu et al., 2016). Recently, machine translation techniques have been also applied to explain non-standard English expressions (Ni and Wang, 2017). However, our deciphering task is not the same as machine translation in that hate symbols are short and cannot be modeled as language.

Our task is more closely related to (Hill et al., 2016) and (Noraset et al., 2017). Hill et al. (2016) propose using neural language embedding models to map the dictionary definitions to the word representations, which is the inverse of our task. Noraset et al. (2017) propose the definition modeling task. However, in their task, for each word to be defined, its pre-trained word embedding is required as an input, which is actually the prior knowledge of the words. However, such kind of prior knowledge is not available in our decipherment task. Therefore, our task is more challenging and is not simply a definition modeling task.

### Conditional Variational Autoencoder

Unlike the original Seq2Seq model that directly encodes the input into a latent space, the Variational Autoencoder (VAE) (Kingma and Welling, 2014) approximates the underlying probability distribution of data. VAE has shown promise in multiple generation tasks, such as handwritten 

digits (Kingma and Welling, 2014; Salimans et al., 2015), faces (Kingma and Welling, 2014; Rezende et al., 2014), and machine translation (Zhang et al., 2016). Conditional Variational Autoencoder Larsen et al. (2016); Sohn et al. (2015) extends the original VAE framework by incorporating conditions during generation. In addition to image generation, CVAE has been successfully applied to some NLP tasks. For example, Zhao et al. (2017) apply CVAE to dialog generation, while Guu et al. (2018) use CVAE for sentence generation.

### Hate Speech Analysis

Closely related to our work are Pavlopoulos et al. (2017); Gao et al. (2017). Pavlopoulos et al. (2017) build an RNN supplemented by an attention mechanism that outperforms the previous state of the art system in user comment moderation (Wulczyn et al., 2017). Gao et al. (2017) propose a weakly-supervised approach that jointly trains a slur learner and a hate speech classifier. While their work contributes to the automation of harmful content detection and the highlighting of suspicious words, our work builds upon these contributions by providing a learning mechanism that deciphers suspicious hate symbols used by communities of hate to bypass automated content moderation systems.

## 3 Dataset

In this section, we describe the dataset we collected for hate symbol decipherment.

### Hate Symbols

We first collect hate symbols and the corresponding definitions from the Urban Dictionary. Each term with one of the following hashtags: _#hate, #racism, #racist, #sexism, #sexist, #nazi_ is selected as a candidate and added to the set \(S_{0}\). We collected a total of 1,590 terms. Next, we expand this set by different surface forms using the Urban Dictionary API. For each term \(s_{i}\) in set \(S_{0}\), we obtain a set of terms \(R_{i}\) that have the same meaning as \(s_{i}\) but with different surface forms. For example, for the term _brown shirt_, there are four terms with different surface forms: _brown shirts, Brownshirts, brownshirt_. Each term in \(R_{i}\) has its own definition in Urban Dictionary, but since these terms have exactly the same meaning, we select a definition \(d_{i}\) with maximum up-vote/down vote ratio for all the terms in \(R_{i}\). For example, for each term in the set \(R_{i}\)={_brown shrit, brown shirts, Brownshirts, brownshirt_}, the corresponding definition is _"Soldiers in Hitler's storm trooper army, SA during the Nazi regime..."_ After expanding, we obtain 2,105 distinct hue symbol terms and their corresponding definitions. On average, each symbol consists of 9.9 characters, 1.5 words. Each definition consists of 96.8 characters, 17.0 words.

### Tweet Collection

For each of the hate symbols, we collect all tweets from 2011-01-01 to 2017-12-31 that contain exactly the same surface form of hate symbol in the text. Since we only focus on hate speech, we train an SVM Cortes and Vapnik (1995) classifier to filter the collected tweets. The SVM model is trained on the dataset published by Waseem and Hovy (2016). Their original dataset contains three labels: Sexism, Racism, and None. Since the SVM model is used to filter the non-hate speech, we merge the instances labeled as sexism and racism, then train the SVM model to do binary classification. After filtering out all the tweets classified as non-hate, our final dataset consists of 18,667 (tweet, hate symbol, definition) tuples.

## 4 Our Approach

We formulate hate symbol deciphering as the following equation:

\[Obj=\sum_{(u,s,d^{*})\in X}\log p(d^{*}|(u,s)) \tag{1}\]

\(X\) is the dataset, \((u,s,d^{*})\) is the (tweet, symbol, definition) tuple in the dataset. The inputs are the tweet and the hate symbol in this tweet. The output is the definition of the symbol. Our objective is to maximize the probability of the definition given the (tweet, symbol) pair. This objective function is very similar to that of machine translation. So we first try to tackle it based on the Sequence-to-Sequence model, which is commonly used in machine translation.

### Sequence-to-Sequence Model

We implement an RNN Encoder-Decoder model with attention mechanism based on Bahdanau et al. (2015). We use GRU Cho et al. (2014) for decoding. However, instead of also using GRU for encoding, we found that LSTM Hochreiter 

and Schmidhuber, 1997) performs better on our task. Therefore, our Seq2Seq model uses LSTM encoders and GRU decoders. An overview of our Seq2Seq model is shown in Figure 2. The computation process is shown as the following equations:

\[c_{u},h_{u}=f_{u}(u) \tag{2}\] \[c_{sw},h_{sw}=f_{sw}(s_{w})\] (3) \[c_{sc},h_{sc}=f_{sc}(s_{c}) \tag{4}\]

\(u\) is the word embedding of the tweet text, \(s_{w}\) is the word embedding of the hate symbol, \(s_{c}\) is the character embedding of the symbol. \(f_{u}\), \(f_{sw}\), and \(f_{sc}\) are LSTM functions. \(c_{u}\), \(c_{sw}\), \(c_{sc}\) are the outputs of the LSTMs at the last time step and \(h_{u}\), \(h_{su}\), \(h_{sc}\) are the hidden states of the LSTMs at all time steps. We use two RNN encoders to encode the symbol, one encodes at the word level and the other one encodes at the character level. The character-level encoded hate symbol is used to provide the feature of the surface form of the hate symbol while the word-level encoded hate symbol is used to provide the semantic information of the hate symbol. The hidden states of the two RNN encoders for hate symbols are concatenated:

\[h=h_{sw}\oplus h_{sc} \tag{5}\]

\(c_{u}\) is the vector of encoded tweet text. The tweet text is the context of the hate symbol, which provides additional information during decoding. Therefore, the encoded tweet text it is also fed into the RNN decoder. The detailed attention mechanism and decoding process at time step \(t\) are as follows:

\[w_{t}=\sigma(l_{w}(d_{t-1}\oplus e_{t-1})) \tag{6}\] \[a_{t}=\sum_{i=1}^{T}w_{ti}h_{i}\] (7) \[b_{t}=\sigma(l_{c}(d_{t-1}\oplus a_{t}))\] (8) \[o_{t},e_{t}=k(c_{u}\oplus b_{t},e_{t-1})\] (9) \[p(d_{t}|u,s)=\sigma(l_{o}(o_{t})) \tag{10}\]

\(w_{t}\) is the attention weights at time step \(t\) and \(w_{ti}\) is the \(i_{th}\) weight of \(w_{t}\). \(d_{t-1}\) is the generated word at last time step and \(e_{t-1}\) is the hidden state of the decoder at last time step. \(h_{i}\) is the \(i_{th}\) time step segment of \(h\). \(l_{w}\), \(l_{c}\), and \(l_{o}\) are linear functions. \(\sigma\) is a nonlinear activation function. \(k\) is the GRU function. \(o_{t}\) is the output and \(e_{t}\) is the hidden state of the GRU. \(p(d_{t}|u,s)\) is the probability distribution of the vocabulary at time step \(t\). The attention weights \(w_{t}\) are computed based on the decoder's hidden state and the generated word at time step \(t-1\). Then the computed weights are applied to the concatenated hidden states \(h\) of encoders. The result \(a_{t}\) is the context vector for the decoder at time step \(t\). The context vector and the last generated word are combined by a linear function \(l_{c}\) followed by a nonlinear activation function. The result \(b_{t}\) is concatenated with the encoded tweet context \(c_{u}\), and then fed into GRU together with the decoder's last hidden state \(e_{t-1}\). Finally, the probability of each vocabulary word is computed from \(o_{t}\).

### Variational Decipher

The Variational Decipher is based on the CVAE model, which is another model that can be used to parametrize the conditional probability \(p(d^{*}|(u,s))\) in the objective function (Equation 1). Unlike the Seq2Seq model, which directly parametrizes \(p(d^{*}|(u,s))\), our variational decipher formulates the task as follows:

\[Obj= \sum_{(u,s,d^{*})\in X}\log p(d^{*}|(u,s)) \tag{11}\] \[= \sum_{(u,s,d^{*})\in X}\log\int_{z}p(d^{*}|z)p(z|(u,s))dz\]

where \(z\) is the latent variable. \(p(d^{*}|(u,s)\) is written as the marginalization of the product of two terms over the latent space. Since the integration

Figure 2: Our Seq2Seq model. \(u\), \(s_{w}\) are the word embeddings of the tweet text and hate symbol. \(s_{c}\) is the character embedding of the symbol. \(c_{u}\) is the encoded tweet and \(h\) is the concatenated hidden states. \(d\) is the generated text. Detailed explanation is in section 4.1.

 

over \(z\) is intractable, we instead try to maximize the evidence lower bound (ELBO). Our variational lower bound objective is in the following form:

\[Obj= E[\log p_{\varphi}(d^{*}|z,u,s)]- \tag{12}\] \[D_{KL}[p_{\alpha}(z|d^{*},u,s)||p_{\beta}(z|u,s)]\]

where \(p_{\varphi}(d^{*}|z,u,s)\) is the likelihood, \(p_{\alpha}(z|d^{*},u,s)\) is the posterior, \(p_{\beta}(z|u,s)\) is the prior, and \(D_{KL}\) is the Kullback-Leibler (KL) divergence. We use three neural networks to model these three probability distributions. An overview of our variational decipher is shown in Figure 3. We first use four recurrent neural networks to encode the (tweet, symbol, definition) pair in the dataset. Similar to what we do in the Seq2Seq model, there are two encoders for the hate symbol. One is at the word level and the other is at the character level. The encoding of symbols and tweets are exactly the same as in our Seq2Seq model (see Equations 2-4). The difference is that we also need to encode definitions for the Variational Decipher.

\[x,h_{d}=f_{d}(d^{*}) \tag{13}\]

Here, \(f_{d}\) is the LSTM function. \(x\) is the output of the LSTM at the last time step and \(h_{d}\) is the hidden state of the LSTM at all time steps. The condition vector \(c\) is the concatenation of the encoded symbol words, symbol characters, and the tweet text:

\[c=c_{u}\oplus c_{sw}\oplus c_{sc} \tag{14}\]

We use multi-layer perceptron (MLP) to model the posterior and the prior in the objective function. The posterior network and the prior network have the same structure and both output a probability distribution of latent variable \(z\). The only difference is that the input of the posterior network is the concatenation of the encoded definition \(x\) and the condition vector \(c\) while the input of the prior network is only the condition vector \(c\). Therefore, the output of the posterior network \(p=p_{\alpha}(z|d^{*},u,s)\) and the output of the prior network \(p^{\prime}=p_{\beta}(z|u,s)\). By assuming the latent variable \(z\) has a multivariate Gaussian distribution, the actual outputs of the posterior and prior networks are the mean and variance: (\(\mu\), \(\Sigma\)) for the posterior network and (\(\mu^{\prime}\), \(\Sigma^{\prime}\)) for the prior network.

\[\mu,\Sigma=g(x\oplus c) \tag{15}\] \[\mu^{\prime},\Sigma^{\prime}=g^{\prime}(c) \tag{16}\]

\(g\) is the MLP function of the posterior network and \(g^{\prime}\) is that of the prior network. During training, the latent variable \(z\) is randomly sampled from the Gaussian distribution \(\mathcal{N}(\mu,\Sigma)\) and fed into the likelihood network. During testing, the posterior network is replaced by the prior network, so \(z\) is sampled from \(\mathcal{N}(\mu^{\prime},\Sigma^{\prime})\). The likelihood network is modeled by an RNN decoder with attention mechanism, very similar to the decoder of our Seq2Seq model. The only difference lies in the input for the GRU. The decoder in our Variational Decipher model is to model the likelihood \(p_{\varphi}(d^{*}|z,u,s)\), which is conditioned on the latent variable, tweet context, and the symbol. Therefore, for the Variational Decipher, the condition vector \(c\) and the sampled latent variable \(z\) are fed into the decoder.

\[o_{t},e_{t}=k(z\oplus c\oplus b_{t},e_{t-1}) \tag{17}\]

\(e_{t-1}\) is the hidden state of the RNN decoder at the last time step. \(k\) is the GRU function. \(o_{t}\) is its output and \(e_{t}\) is its hidden state. Detailed decoding process and explanations are in section 4.1.

Figure 3: The Variational Decipher. Note that this structure is used during training. During testing, the structure is slightly different. \(d^{*}\) is the word embeddings of the definition. \(x\) is the encoded definition. \(c\) is the concatenation of the encoded tweet and hate symbol. \(p\) and \(p^{\prime}\) are output distributions. \(z\) is the latent variable. The definitions of other variables are the same as those in Figure 2. Detailed explanation is in section 4.2.

 

According to the objective function in Equation 12, the loss function of the Variational Decipher is as follows:

\[{\cal L}= L_{REC}+L_{KL} \tag{18}\] \[= E_{z\sim p_{\alpha}(z|d^{*},u,s)}[-\log p_{\varphi}(d^{*}|z,u,s)]+\] \[D_{KL}[p_{\alpha}(z|d^{*},u,s)||p_{\beta}(z|u,s)]\]

It consists of two parts. The first part \(L_{REC}\) is called reconstruction loss. Optimizing \(L_{REC}\) can push the sentences generated by the posterior network and the likelihood network closer to the given definitions. The second part \(L_{KL}\) is the KL divergence loss. Optimizing this loss can push the output Gaussian Distributions of the prior network closer to that of the posterior network. This means we teach the prior network to learn the same knowledge learned by the posterior network, such that during testing time, when the referential definition \(d^{*}\) is no longer available for generating the latent variable \(z\), the prior network can still output a reasonable probability distribution over the latent variable \(z\). The complete training and testing process for the Variational Decipher is shown in Algorithm 1. \(M\) is the predefined maximum length of the generated text. \(BCE\) refers to the Binary Cross Entropy loss.

```
1:functiontrain(\(U\))
2: randomly initialize network parameters \(\varphi\), \(\alpha\), \(\beta\);
3:for\(epoch=1,E\)do
4:for\((tweet,symbol,definition)\) in \(U\)do
5: get embeddings \(u\), \(s_{w}\), \(s_{c}\), \(d^{*}\);
6: compute \(x\), \(c\) and \(h\) with RNN encoders;
7: compute \(\mu\), \(\Sigma\) with the posterior network;
8: compute \(\mu^{\prime}\), \(\Sigma^{\prime}\) with the prior network;
9: compute KLI-divergence loss \(L_{KL}\);
10: sample \(z=reparameterize(\mu,\Sigma)\);
11: initialize the decoder state \(e_{0}=c\);
12:\(L_{REC}=0\);
13:for\(t=1,M\)do
14: compute attention weights \(w_{t}\);
15: compute \(o_{t}\), \(e_{t}\) and \(p(d_{t}|z,u,s)\);
16:\(d_{t}=indmax(p(d_{t}|z,u,s))\);
17:\(L_{REC}+=BCE(d_{t},d_{t}^{*})\);
18:if\(d_{t}\)==ESOSthen
19: break;
20:endif
21:endfor
22: update \(\varphi\), \(\alpha\), \(\beta\) on \({\cal L}=L_{REC}+L_{KL}\);
23:endfor
24:endfor
25:endfunction
26:
27:functiontest(\(V\))
28:for\((tweeet,symbol,definition)\) in \(V\)do
29: get embeddings \(u\), \(s_{w}\), \(s_{c}\);
30: compute \(c\) and \(h\) with RNN encoders;
31: compute \(\mu^{\prime}\), \(\Sigma^{\prime}\) with the prior network;
32: sample \(z=reparameterize(\mu^{\prime},\Sigma^{\prime})\);
33: initialize the decoder state \(e_{0}=c\);
34:for\(t=1,M\)do
35: compute attention weights \(w\);
36: compute \(o_{t}\), \(e_{t}\) and \(p(d_{t}|z,u,s)\);
37:\(d_{t}=indmax(p(d_{t}|z,u,s))\);
38:if\(d_{t}\)==ESOSthen
39: break;
40:endif
41:endfor
42:endfor
43:endfunction
```

**Algorithm 1** Train & Test Variational Decipher 

For the Seq2Seq model, we use negative log-likelihood loss for training. Both models are optimized using Adam optimizer (Kingma and Ba, 2015). The hyper-parameters of two models are exactly the same. We set the maximum generation length \(M=50\). The hidden size of the encoders is 64. The size of the word embedding is 200 and that of character embedding is 100. The word embeddings and character embeddings are randomly initialized. Each model is trained for 50 epochs. We report the deciphering results of two models on three testing datasets \(D\), \(D_{s}\) and \(D_{d}\).

### Experimental Results

**Quantitative Results:** We use equally weighted BLEU score for up to 4-grams (Papineni et al., 2002), ROUGE-L (Lin, 2004) and METEOR (Banerjee and Lavie, 2005) to evaluate the decipherment results. The results are shown in Table 1. Figure 4 shows the BLEU score achieved by the two models on three testing datasets \(D\), \(D_{s}\) and \(D_{d}\) during the training process. Both our Seq2Seq model and Variational Decipher achieve reasonable BLEU scores on the testing datasets. The Seq2Seq model outperforms the Variational Decipher on \(D_{s}\) while Variational Decipher outperforms Seq2Seq on \(D_{d}\). Note that \(D_{s}\) is more than twice the size of \(D_{d}\). Therefore, Seq2Seq outperforms Variational Decipher on the entire testing dataset \(D\). The different performance of the two models on \(D_{s}\) and \(D_{d}\) is more obvious in Figure 4. The gap between the performance of the Seq2Seq model on \(D_{s}\) and \(D_{d}\) is much larger than that between the performance of the Variational Decipher on these two datasets.

**Human Evaluation:** We employed crowdsourced workers to evaluate the deciphering results of two models. We randomly sampled 100 items of deciphering results from \(D_{s}\) and another 100 items from \(D_{d}\). Each item composes a choice question and each choice question is assigned to five workers on Amazon Mechanical Turk. In each choice question, the workers are given the hate symbol, the referential definition, the original tweet and two machine-generated plain texts from the Seq2Seq model and Variational Decipher. Workers are asked to select the more reasonable of the two results. In each choice question, the order of the results from the two models is permuted. Ties are permitted for answers. We batch five items in one assignment and insert an artificial item with two identical outputs as a sanity check. The workers who fail to choose "tie" for that item are rejected from our test. The human evaluation results are shown in Table 2, which coincide with the results in Table 1 and Figure 4.

**Discussion:** When deciphering the hate symbols that have the same definitions as in the training dataset, the model can rely more on the surface forms of hate symbols than the tweet context to make a prediction because usually the hate symbols that share the same definitions also have similar surface forms. However, when it comes to the hate symbols with unseen definitions, simply relying on the surface forms cannot lead to a reasonable deciphering result. Instead, the model should learn the relationships between the con

Figure 4: BLEU scores of two models on the testing dataset \(D\), \(D_{s}\) and \(D_{d}\). The three dotted curves represent the performance of the Seq2Seq model while the three solid curves represent the performance of the Variational Decipher.

 

text information and the definition of the symbol. Therefore, the different performances of two models on the two testing datasets \(D_{s}\) and \(D_{d}\) indicate that the Seq2Seq model is better at capturing the similarities among different surface forms of a hate symbol, while the Variational Decipher is better at capturing the semantic relationship between the tweet context and the hate symbol. The Sequence-to-Sequence model tries to capture such kinds of relationships by compressing all the context information into a fixed length vector, so its deciphering strategy is actually behavior cloning. On the other hand, the Variational Decipher captures such relationships by explicitly modeling the posterior and likelihood distributions. The modeled distributions provide higher-level semantic information compared to the compressed context, which allows the Variational Decipher to generalize better to the symbols with unseen definitions. This explains why the gap between the performance of the Seq2Seq model on two datasets is larger.

### Error Analysis

Figure 5 shows some example errors of the deciphering results of our Seq2Seq model and Variational Decipher. One problem with the deciphering results is that the generated sentences have poor grammatical structure, as shown in Figure 5. This is mainly because the size of our dataset is small, and the models need a much larger corpus to learn the grammar. We anticipate that the generation performance will be improved with a larger dataset.

For the hate symbols in \(D_{s}\), the deciphering results are of high quality when the length of referential definitions are relatively short. An example is _macaca_, a French slur shows in Figure 5. The deciphering result of the Seq2Seq model is close to the referential definition. As to the Variational Decipher, although the result is not literally the same as the definition, the meaning is close. _closet homosexualals_ in Figure 5 is another example. However, when the length of the referential definition increases, the performance of both models tends to be unsatisfactory, as the third example _cofederate flag_ shows in Figure 5. Although there exists the symbol _Confederate Flag_ with the same definition in the training set, both models fail on this example. One possible reason is that the complexity of generating the referential definition grows substantially with the increasing length, so when the tweet context and the symbol itself cannot provide enough information, the generation model cannot learn the relationship between the symbol and its definition.

Deciphering hate symbols in \(D_{d}\) is much more challenging. Even for humans, deciphering completely new hate symbols is not a simple task. The two examples in Figure 5 show that the models have some ability to capture the semantic similarities. For the symbol _niggering_, the Variational Decipher generates the word _nigger_ and Seq2Seq model generates _black_. For _Heil Hitler_, the Variational Decipher generates _leader person_ and _Nazi_, while Seq2Seq also generates _Nazi_. Although these generated words are not in the definition, they still make some sense.

Figure 5: Some example errors in the generated results of our Seq2Seq model and Variational Decipher.

 

Conclusion

We propose a new task of learning to decipher hate symbols and create a symbol-rich tweet dataset. We split the testing dataset into two parts to analyze the characteristics of the Seq2Seq model and the Variational Decipher. The different performance of these two models indicates that the models can be applied to different scenarios of hate symbol deciphering. The Seq2Seq model outperforms the Variational Decipher for deciphering the hate symbols with similar definitions to that in the training dataset. This means the Seq2Seq model can better explain the hate symbols when Twitter users intentionally misspell or abbreviate common slur terms. On the other hand, the Variational Decipher tends to be better at deciphering hate symbols with unseen definitions, so it can be applied to explain newly created hate symbols on Twitter. Although both models show promising deciphering results, there still exists much room for improvement.

## References

* Bahdanau et al. (2015) Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2015. Neural machine translation by jointly learning to align and translate. In _Proceedings of the 3rd International Conference on Learning Representations_.
* Banerjee and Lavie (2005) Satanjeev Banerjee and Alon Lavie. 2005. Meteor: An automatic metric for MT evaluation with improved correlation with human judgments. In _Proceedings of the ACL workshop on intrinsic and extrinsic evaluation measures for machine translation and/or summarization_, pages 65-72.
* Beaufort et al. (2010) Richard Beaufort, Sophie Roekhaut, Louise-Amleie Cougnon, and Cedrick Fairon. 2010. A hybrid rule/model-based finite-state framework for normalizing SMS messages. In _Proceedings of the 48th Annual Meeting of the Association for Computational Linguistics_, pages 770-779. Association for Computational Linguistics.
* Burnap and Williams (2016) Pete Burnap and Matthew L Williams. 2016. Us and them: identifying cyber hate on Twitter across multiple protected characteristics. _EPJ Data Science_, 5(1):11.
* Cho et al. (2014) Kyunghyun Cho, Bart van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. 2014. Learning phrase representations using RNN encoder-decoder for statistical machine translation. In _Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP)_, pages 1724-1734.
* Chrupala (2014) Grzegorz Chrupala. 2014. Normalizing tweets with edit scripts and recurrent neural embeddings. In _Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers)_, volume 2, pages 680-686.
* Cortes and Vapnik (1995) Corinna Cortes and Vladimir Vapnik. 1995. Supportvector networks. _Machine Learning_, 20(3):273-297.
* Djuric et al. (2015) Nemanja Djuric, Jing Zhou, Robin Morris, Mihajlo Grobovic, Vladan Radosavljevic, and Narayan Bhamidipati. 2015. Hate speech detection with comment embeddings. In _Proceedings of the 24th ACM International Conference on World Wide Web_, pages 29-30.
* Gao et al. (2017) Lei Gao, Alexis Kuppersmith, and Ruihong Huang. 2017. Recognizing explicit and implicit hate speech using a weakly supervised two-path bootstrapping approach. In _Proceedings of the Eighth International Joint Conference on Natural Language Processing_, pages 774-782.
* Gouws et al. (2011) Stephan Gouws, Dirk Hovy, and Donald Metzler. 2011. Unsupervised mining of lexical variants from noisy text. In _Proceedings of the First workshop on Unsupervised Learning in NLP_, pages 82-90. Association for Computational Linguistics.
* Guu et al. (2018) Kelvin Guu, Tatsunori B Hashimoto, Yonatan Oren, and Percy Liang. 2018. Generating sentences by editing prototypes. _Transactions of the Association of Computational Linguistics_, 6:437-450.
* Han and Baldwin (2011) Bo Han and Timothy Baldwin. 2011. Lexical normalisation of short text messages: Makn sens an# twitter. In _Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies-Volume 1_, pages 368-378. Association for Computational Linguistics.
* Han et al. (2012) Bo Han, Paul Cook, and Timothy Baldwin. 2012. Automatically constructing a normalisation dictionary for microblogs. In _Proceedings of the 2012 Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning_, pages 421-432. Association for Computational Linguistics.
* Hill et al. (2016) Felix Hill, KyungHyun Cho, Anna Korhonen, and Yoshua Bengio. 2016. Learning to understand phrases by embedding the dictionary. _Transactions of the Association of Computational Linguistics_, 4:17-30.
* Hochreiter and Schmidhuber (1997) Sepp Hochreiter and Jurgen Schmidhuber. 1997. Long short-term memory. _Neural Computation_, 9(8):1735-1780.
* Kingma and Ba (2015) Diederik P. Kingma and Jimmy Ba. 2015. Adam: A method for stochastic optimization. In _Proceedings of the 3rd International Conference on Learning Representations_ 

* Kingma and Welling (2014) Diederik P. Kingma and Max Welling. 2014. Auto-encoding variational bayes. In _Proceedings of the 2nd International Conference on Learning Representations_. Knight et al. (2006) Kevin Knight, Anish Nair, Nishit Rathod, and Kenji Yamada. 2006. Unsupervised analysis for decipherment problems. In _Proceedings of the 21st International Conference on Computational Linguistics and 44th Annual Meeting of the Association for Computational Linguistics_, pages 499-506.
* Larsen et al. (2016) Anders Boesen Lindbo Larsen, Soren Kaae Sonderby, Hugo Larochelle, and Ole Winther. 2016. Autocending beyond pixels using a learned similarity metric. In _Proceedings of the 33rd International Conference on Machine Learning_, pages 1558-1566.
* Lin (2004) Chin-Yew Lin. 2004. Rouge: A package for automatic evaluation of summaries. _Text Summarization Branches Out_.
* Liu et al. (2012) Fei Liu, Fuliang Weng, and Xiao Jiang. 2012. A broad-coverage normalization system for social media language. In _Proceedings of the 50th Annual Meeting of the Association for Computational Linguistics: Long Papers-Volume 1_, pages 1035-1044. Association for Computational Linguistics.
* Liu et al. (2011) Fei Liu, Fuliang Weng, Bingqing Wang, and Yang Liu. 2011. Insertion, deletion, or substitution?: normalizing text messages without pre-categorization nor supervision. In _Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies: short papers-Volume 2_, pages 71-76. Association for Computational Linguistics.
* Ni and Wang (2017) Ke Ni and William Yang Wang. 2017. Learning to explain non-standard english words and phrases. In _Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 2: Short Papers)_, volume 2, pages 413-417.
* Noraset et al. (2017) Thanapon Noraset, Chen Liang, Larry Birnbaum, and Doug Downey. 2017. Definition modeling: Learning to define word embeddings in natural language. In _Thirty-First AAAI Conference on Artificial Intelligence_.
* Papineni et al. (2002) Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. BLEU: a method for automatic evaluation of machine translation. In _Proceedings of the 40th Annual Meeting on Association for Computational Linguistics_, pages 311-318. Association for Computational Linguistics.
* Pavlopoulos et al. (2017) John Pavlopoulos, Profromos Malakasiotiis, and Ion Androutsopoulos. 2017. Deeper attention to abusive user content moderation. In _Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing_, pages 1125-1135.
* Ravi and Knight (2011) Sujith Ravi and Kevin Knight. 2011. Deciphering foreign language. In _Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies-Volume 1_, pages 12-21. Association for Computational Linguistics.
* Rezende et al. (2014) Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. 2014. Stochastic backpropagation and approximate inference in deep generative models. In _Proceedings of the 31st International Conference on International Conference on Machine Learning_, pages 1278-1286.
* Salimans et al. (2015) Tim Salimans, Diederik Kingma, and Max Welling. 2015. Markov chain monte carlo and variational inference: Bridging the gap. In _Proceedings of the 32nd International Conference on Machine Learning_, pages 1218-1226.
* Sohn et al. (2015) Kihyuk Sohn, Honglak Lee, and Xinchen Yan. 2015. Learning structured output representation using deep conditional generative models. In _Advances in Neural Information Processing Systems 28: Annual Conference on Neural Information Processing Systems 2015_, pages 3483-3491.
* Sutskever et al. (2014) Ilya Sutskever, Oriol Vinyals, and Quoc V Le. 2014. Sequence to sequence learning with neural networks. In _Advances in Neural Information Processing Systems 27: Annual Conference on Neural Information Processing Systems 2014_, pages 3104-3112.
* Waseem and Hovy (2016) Zeerak Waseem and Dirk Hovy. 2016. Hateful symbols or hateful people? predictive features for hate speech detection on Twitter. In _Proceedings of the Student Research Workshop, SRW@HLT-NAACL 2016_, pages 88-93.
* Wu et al. (2016) Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, et al. 2016. Google's neural machine translation system: Bridging the gap between human and machine translation. _arXiv preprint arXiv:1609.08144_.
* Wulczyn et al. (2017) Ellery Wulczyn, Nithum Thain, and Lucas Dixon. 2017. Ex machina: Personal attacks seen at scale. In _Proceedings of the 26th International Conference on World Wide Web_, pages 1391-1399.
* Zhang et al. (2016) Biao Zhang, Devi Xiong, Hong Duan, Min Zhang, et al. 2016. Variational neural machine translation. In _Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing_, pages 521-530.
* Zhao et al. (2017) Tiancheng Zhao, Ran Zhao, and Maxine Eskenazi. 2017. Learning discourse-level diversity for neural dialog models using conditional variational autoencoders. In _Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)_, volume 1, pages 654-664.