HateGAN: Adversarial Generative-Based Data Augmentation for Hate Speech Detection
Paper · 2020 · Rui Cao and Roy Ka-Wei Lee
Summary
A hate speech detector learns from examples that people have labeled. When hateful posts make up a small share of those examples, a detector can perform well overall while missing many of the posts it was built to identify. HateGAN asks whether adding newly generated examples to the training data can help. It uses text generation to supplement the hate class, then tests whether existing classifiers identify hateful tweets more reliably after training on the expanded datasets.
HateGAN learns from several collections of tweets and gets feedback from two sources. A discriminator judges whether a completed tweet resembles real examples. A separate scorer estimates toxicity and identity attack, giving the generator a signal about the kind of content the authors want it to produce. The generator learns which word choices tend to lead to higher-scoring tweets by sampling possible endings and scoring the completed text. The resulting synthetic tweets are added to the training data for a separate text classification task.
The authors test a recurrent classifier, a convolutional classifier and a classifier that combines the two approaches. Across WZ-LS and DT, each had higher hate-class F1 with HateGAN augmentation than with its original training data. The authors describe the average gain as 5%. On DT, where the task distinguishes hate from offensive language, the hybrid classifier’s hate-class F1 went from 25.2 to 37.2, and its micro-F1 went from 88.7 to 89.4. Resampling the original data often recovered more hateful tweets than HateGAN did. It also produced more false alarms among tweets classified as hateful, as reflected in lower hate-class precision.
The amount of synthetic data mattered. In an experiment that varied the hate share of the training set, precision rose initially and fell as more generated tweets were added. The authors also matched selected outputs with nearby real tweets to examine what the generator had produced. Several examples expressed hostility toward a target in wording that differed from the closest real tweet. Other examples illustrated how easily generated text with offensive language can approach the boundary of the hate label. The detection results establish a benefit for the classifiers and datasets tested, while the examples give a qualitative account of the generated material.
Deep dive: HateGAN: Adversarial Generative-Based Data Augmentation for Hate Speech Detection
HateGAN uses synthetic tweets to help classifiers detect hate speech when hateful examples are scarce, with tests on two Twitter datasets. · about 32 minutes to read
The problem and its context
How a detector can do well overall and miss hate speech
The paper starts from a practical difficulty in moderating social media. A platform can receive large amounts of text, and checking each post by hand is a different undertaking from maintaining a labeled sample for research. The authors describe efforts by Facebook and Twitter to curb the circulation of hateful content. They also cite work on the spread of hate speech through social networks and on connections between online hostility and hate crimes. Their experiments concentrate on the detection step, where a system gives a post a label based on patterns learned from earlier examples. The earlier research landscape is surveyed in A Survey on Hate Speech Detection using Natural Language Processing and A Survey on Automatic Detection of Hate Speech in Text.
A supervised detector uses the wording and assigned labels of its training posts to learn what distinguishes the classes. The distribution of those posts matters. If examples from one class are scarce, the classifier has fewer occasions to see the variety of expressions that people assigned to it. Frequent classes offer more examples and account for more of the decisions the system makes on a test set with a similar distribution. A single score over all tweets can therefore give an incomplete picture of how the classifier handles the category the researchers most want to detect.
The paper illustrates this with two collections whose labels divide the task differently. In the Waseem and Hovy collection, the annotations identify tweets involving racism or sexism. The paper describes about 30% of those tweets as labeled racism or sexism. In the Davidson collection, the authors distinguish hate from offensive language, and the paper describes less than 12% of the tweets as hateful. Both collections give the detector many more examples from outside the hate category, but the competing labels differ. The sources are Hateful Symbols or Hateful People? and Automated Hate Speech Detection and the Problem of Offensive Language.
The distinction in the Davidson collection matters because an offensive word may occur in tweets assigned to different classes. A detector can learn that a word is a sign of hostility and still struggle to decide whether a speaker is attacking a target in the sense meant by the hate label. The categories established through linguistic annotation determine which of those decisions count as errors. Adding more posts containing offensive words would give the system more exposure to those words. The paper’s proposal depends on adding examples that offer some evidence about the narrower category the classifier is supposed to learn.
The literature reviewed by the authors already included both traditional supervised classification and neural approaches. The latter used different ways of extracting evidence from short text. A convolutional classifier can look for local patterns in a sequence, for instance, while a recurrent classifier processes the sequence in order and carries information forward. The authors treat these architectures as starting points for an experiment about training data. If the same intervention helps several kinds of classifier, the result is relevant to anyone deciding how to allocate effort between collecting data and changing the classifier. Earlier examples include Using Convolutional Neural Networks to Classify Hate-Speech and One-step and Two-step Classification for Abusive Language Detection on Twitter.
Why generate additional tweets?
Data augmentation means creating extra training examples using material or patterns already available. The paper contrasts the possibilities available for images and audio with those available for text. The earlier work it cites uses approaches such as injecting noise or changing some property of a sample. Written language is a sequence of discrete choices. Exchanging a word for a nearby term can alter the strength or target of an insult. Moving a word can change which phrase it modifies or make the post difficult to read. A modification has value for supervised learning when the resulting example still supports the label assigned to it.
The most direct precedent in the paper is the hate speech augmentation study by Rizos and colleagues. One approach chose substitutes for words. Another rearranged positions within an existing text. A recurrent generator offered a third route by learning to predict successive words and then producing new sequences. The HateGAN authors identify challenges for each. Words associated with abuse can carry meanings that close substitutes miss, and social media vocabulary can change quickly. Rearrangement can disrupt coherence. The generation method in the earlier study learned how text continued, with limited control over what kind of example the final sequence would provide.
A recurrent generator makes a different kind of intervention possible. It can choose an opening and continue it in several ways, so the whole sequence can vary. For hate speech detection, the purpose of that freedom is to create additional training material whose relation to the target class can survive changes in wording. The same freedom makes the label harder to justify. When each word can change, the generated post may lose the relevant target or become ordinary profanity. HateGAN addresses this by giving a finished sequence a score and allowing that score to influence the choices that produced it.
The paper places its approach alongside several ways of generating text. SeqGAN provides the immediate precedent for treating word selection as a series of decisions with feedback. LeakGAN is another adversarial approach discussed in the paper. The authors note that this family can show substantial variation during training and can suffer from mode collapse, where a generator repeatedly produces a narrow selection of outputs. A training objective may favor realistic text even when only a small part of the observed variety finds its way into the generated samples.
The authors also discuss variational autoencoders as a means of producing varied sequences. An encoder maps examples into a latent representation, a set of internal numerical values, and a decoder uses that representation to produce text. A probabilistic latent representation allows generated outputs to vary. The paper also describes conditional variants that introduce stochastic latent variables to help produce text that is both diverse and relevant to a specified attribute. HateGAN pursues control through the feedback it gives the generator after it has produced a sequence. The approaches the authors discuss are represented by Auto-Encoding Variational Bayes and Generating Sentences from a Continuous Space.
That context explains why the paper gives the generator separate signals for plausibility and content. Learning ordinary continuations can help a sequence read like a tweet. Learning which completed sequences score highly for toxicity and identity attack can shift the kinds of continuations the generator favors. The authors’ practical question is whether examples produced under both pressures provide useful additional evidence when a detector has few labeled instances of hate.
The method, step by step
The generator and the detector have different jobs
HateGAN produces training material. The detector trained later assigns hate speech labels to tweets. This distinction matters because the generator’s training objective never directly asks whether an individual synthetic tweet improves a detector’s prediction. Its immediate feedback comes from judgments about the generated tweet itself. The effectiveness of that feedback is tested downstream, after the synthetic examples have been added to the data used by a separate classifier.
During generation, a recurrent network builds a tweet through successive word choices. The discriminator learns from examples of real and generated text, and it scores a completed sequence according to how real it appears. A toxicity scorer supplies a second signal. It was trained before the adversarial stage and contributes assessments related to toxicity and attacks on identity. Taken together, the two components give the generator feedback about how the tweet reads and which attributes its content exhibits.
How HateGAN generates examples for classifier training
The steps in order.
The scoring stage works on complete sequences. When the generator has produced only the beginning of a tweet, it samples possible endings before asking for a score. A word choice early in a sentence might allow the text to develop in several directions. The average score across sampled endings gives the training procedure an estimate of how favorable that choice is. A choice at the final position has already produced a complete sequence and can receive a score directly. This arrangement lets the generator learn from feedback that arrives at the level of a whole tweet.
Training the toxicity scorer
The scorer is a multi-label classifier. A comment can display several attributes simultaneously, so training it entails predicting a set of labels for the same input. The authors used about 160,000 comments from Kaggle’s Toxic Comment Classification Challenge. The labels cover toxicity, obscenity, threats, insults, identity attacks and sexually explicit content. The variety makes it possible to train a scorer on distinct properties of comments and then select the properties that matter for the generator’s objective.
The scorer first turns the words into word embeddings, vectors that represent words as numerical inputs to a network. The authors trained these embeddings with Word2Vec on pandemic-related tweets collected from 17 March 2020 to 28 April 2020. The embeddings have dimension 300. This stage uses Twitter text to learn the input representations, while the labeled comments supply the examples that teach the network to predict the toxicity categories. The authors thus give the same component representations learned on tweets and supervised feedback learned on comments.
The sequence then passes through two stacked long short-term memory layers, or LSTMs. An LSTM is a recurrent network whose state carries information across word positions. The first layer sequences the embeddings, and the second reads the first layer’s outputs. From the hidden states of the second layer, the authors take a maximum and an average for each feature. The maximum can retain a large activation at any position. The average captures how strongly the feature appears across the sequence. Joining the resulting vectors gives the next layer a fixed-size representation regardless of which positions carried the strongest signals.
A fully connected layer turns that representation into scores for the categories. Training uses binary cross-entropy, which penalizes the classifier when it gives low probability to an attribute that is present or high probability to an attribute that is absent. Each label can contribute separately to this loss. This is useful when, for instance, an insulting comment can also be threatening. The training task allows those attributes to coexist.
The generator’s reward uses the toxicity and identity attack outputs. The authors motivate their choice with a view of hate speech that gives weight to both hostile expression and its target. A toxicity score can respond to the nature of the expression, and an identity attack score can respond to whom it appears to attack. The selected outputs provide a proxy suited to the authors’ objective. The distribution of scores ultimately comes from a supervised classifier trained on labeled comments, so the signal inherits what that classifier learned to recognize.
The scorer’s parameters stay fixed during adversarial training. As the generator changes its behavior, a given completed tweet is assessed by the same trained scorer. The discriminator changes as it learns to distinguish real tweets from the generator’s current outputs. Keeping one component fixed makes its role closer to that of a standing criterion for the content the authors want, while the other provides feedback that adapts as the generated text changes.
Assigning a reward to each word choice
The generator defines a probability distribution over the next word. In the paper’s account, a sequence of words is written as follows.
W = (w₁, w₂, …, wₙ)
Here W is the generated sequence, w₁ and w₂ are its opening words, and wₙ is the word in the final position. The index n gives the length of the sequence, and the ellipsis stands for the intervening words. The generator is denoted by Gα, with α standing for its trainable parameters.
At a position t, the words already produced form the state. The next word wₜ is the action, and the vocabulary V supplies the set of actions available. Sampling the next word produces a discrete choice. A gradient through the scorer of a finished tweet cannot be passed directly through that sampled choice as though the choice were a continuously variable value. A policy gradient instead updates the probabilities that the generator assigned to choices, using estimated rewards for making those choices.
The authors use Monte Carlo sampling to estimate those rewards. This means repeatedly sampling possible outcomes under the generator’s distribution. At a particular position they keep the prefix and the word being assessed, then sample continuations to reach the end of the sequence. Complete tweets go to the scoring module. The average of their scores estimates the reward for choosing that word at that position.
r(state = (w₁, …, wₜ₋₁), action = wₜ) = (1/N) ∑ᵢ₌₁ᴺ S(xᵢ)
Here r is the estimated action reward. The state is the prefix from w₁ through wₜ₋₁, where t is the current position and t−1 is the position just before it. The action is the choice of wₜ. N is the number of sampled completions, i indexes them, and xᵢ is the completed sequence from sample i for that choice. S is the scoring module applied to a complete sequence. The sum collects the scores from all sampled completions and the factor 1/N takes their average. At the final word, the completed sequence can go straight to S.
A choice can consequently receive favorable feedback even when the words up to that point contain little evidence about the category. Its reward reflects the distribution of tweets the generator can finish after making that choice. A promising opening can lead to weak completions, and those completions lower its estimated value. The same process gives intermediate words a share of the feedback that would otherwise be available only at the end.
Y ∈ ℝⁿ
Y is the resulting reward vector for a generated sequence. The membership symbol ∈ indicates that Y belongs to ℝⁿ, the space of real-valued vectors with n entries. Each entry holds the reward assigned to the action at its corresponding position.
Updating the generator
The generator seeks to maximize expected reward. The authors express its training objective as a loss to minimize by placing a negative sign before that expectation. The expectation extends over prefixes produced by the generator and its possible choices after those prefixes. A word with a high reward contributes according to the probability of choosing it in the current state.
Loss(α) = −∑ₜ₌₁ⁿ 𝔼[w₁:ₜ₋₁ ∼ Gα][𝔼[wₜ ∼ Gα][r(wₜ)]]
Loss is the generator objective evaluated at parameters α. The outer sum runs from the first position through n, where t is the position index. The symbol 𝔼 indicates an expectation, and ∼ indicates that the preceding sequence or word is drawn from the generator Gα. The prefix w₁:ₜ₋₁ contains the words already produced, and wₜ is the next word drawn in that context. The function r(wₜ) denotes the reward for that next word, with the prefix understood. The minus sign turns the objective of increasing expected reward into the objective of decreasing loss.
The authors approximate the reward in this objective using the scored continuations. The next expression makes the role of the generator’s word probabilities explicit for generated prefixes.
Loss(α) ≈ −∑ₜ₌₁ⁿ ∑[wₜ ∈ V] [Gα(wₜ | w₁:ₜ₋₁) (1/N) ∑ᵢ₌₁ᴺ S(xₜᵢ)]
The symbol ≈ marks an approximation. The sums run over positions t through sequence length n and choices wₜ in vocabulary V. The expression Gα(wₜ | w₁:ₜ₋₁) gives the probability, under parameters α, of choosing wₜ conditional on the prefix w₁:ₜ₋₁. The vertical bar means “given.” The index i runs over the N completions, and xₜᵢ denotes completion i after the first t words have been generated. Applying S to each yields its score. The factor 1/N averages the scores, giving an estimated reward to weight by the candidate word’s probability. Minimizing the negative sum favors choices associated with higher reward.
The policy gradient is applied to the generator’s distribution over words. The procedure uses samples as evidence about the consequences of choosing a word and updates the tendency to make that choice in similar states. This separates the parts of the computation that are available to the gradient from the discrete words or completed tweets that serve as outcomes. Sampling a new set of endings can give a different estimate, since the ends of the sequence themselves depend on choices drawn from the generator.
Updating the discriminator and combining the signals
The discriminator Dβ performs binary classification, with β denoting its trainable parameters. It sees real tweets and generator outputs. During its own training, a high score is desirable for a real tweet and a low score is desirable for a generated one. For the generator, a high discriminator score is a reward because it indicates that a synthetic tweet resembles the real examples according to the discriminator’s current criteria.
V(Gα, Dβ) = 𝔼[x ∼ P_data][log(Dβ(x))] + 𝔼[x ∼ P_Gα][log(1 − Dβ(x))]
Here V(Gα, Dβ) is the adversarial objective, with V used in this expression as the name of the objective. Gα is the generator with parameters α, and Dβ is the discriminator with parameters β. The variable x represents a tweet as a sequence of tokens. The expectation 𝔼 in the first term is over x drawn from the real data distribution P_data, and the second is over x drawn from the generator distribution P_Gα. The symbol ∼ denotes a draw from the named distribution. The logarithm log rewards high Dβ(x) for real tweets in the first term. The expression 1 − Dβ(x) is the complementary probability, so the logarithm in the second term rewards a low Dβ(x) for generated tweets. The plus sign combines the two terms.
Dβ* = arg max[β] V(Gα, Dβ)
Dβ* denotes the discriminator at a maximizing setting of its parameters. The notation arg max[β] means to choose β to maximize V(Gα, Dβ), the objective for generator Gα and discriminator Dβ. The generator’s parameters α determine the distribution of synthetic tweets for the discriminator’s current training problem.
The generator receives the discriminator’s score and a contribution from the fixed toxicity scorer. The paper expresses the completed-tweet reward as an additive combination.
r(x) = Discriminator(x) + σ ToxicityScorer(x)
In this expression, x is the completed input sequence, and r(x) is its scalar reward. Discriminator(x) measures how real x appears to the discriminator. ToxicityScorer(x) is the contribution calculated using the toxicity and identity attack outputs of the fixed scorer. The paper identifies the selected outputs and leaves their internal combination unspecified. The hyper-parameter σ scales the scorer’s contribution relative to the discriminator’s. In the action-reward expression, the scoring function S returns this kind of combined score for each completed tweet.
The additive form gives the generator a way to receive favorable feedback from both properties. A tweet may earn much of its reward by resembling the real tweet distribution, or the toxicity contribution may give it a higher reward than the discriminator score would on its own. The relative weight determines how much those content assessments influence word probabilities. The detector’s eventual hate labels enter at a later stage, when generated tweets are used as examples for the minority class.
From pretraining to augmentation
The authors report pretraining both the generator and discriminator before the reinforcement learning phase to make convergence easier. During the subsequent phase, they train the generator and discriminator iteratively. This gives the discriminator experience with generated sequences and gives the generator starting probabilities from which to sample plausible continuations. The separate toxicity scorer has already been trained by this point.
The experiments set the generation length to 20 and report an LSTM hidden-state size of 200. For CNN components, the authors use 150 filters at each of the filter sizes ranging from 1 to 3. They report dropout rates of 20% at embedding layers and 50% at fully connected layers. Dropout suppresses some activations during training to reduce reliance on individual features. The detection baselines initialize their embeddings with GloVe vectors of dimension 300, while the toxicity scorer uses the Word2Vec vectors learned on tweets.
The learning rate for HateGAN and the baselines is 0.0001. The authors use Adam, an optimizer that adjusts updates using information from previous gradients. The optimization reference is Adam: A Method for Stochastic Optimization. The paper identifies the HateGAN implementation as a GitLab release.
At the point where augmentation enters the detection experiment, the scores have already done their work in training the generator. The experimental treatment is to supply generated tweets as additional examples of hate during detector training. The researchers then measure how the detector performs on held-out tweets. That last step matters because a tweet can score well under both generator rewards and still add little to what a downstream classifier has already learned. The paper tests the value of the synthetic examples through changes in detection performance.
Experiments and results
Which datasets serve which stages?
The generator draws training material from WZ-LS, DT, FOUNTA and HateLingo. WZ-LS contains 13,202 tweets, with 3,435 in the hate class and 9,767 in the non-hate class. DT contains 24,783 tweets, of which 1,430 are hateful, 19,190 are offensive and 4,163 are in neither category. These are the two collections on which the paper evaluates detectors. Their label distributions make it possible to compare augmentation in a binary task and in a task where offensive speech has its own class.
FOUNTA contains 89,990 tweets. Its class counts are 53,011 normal, 19,232 abusive, 13,840 spam and 3,907 hate. The HateLingo collection contributes 11,763 tweets, all identified as hateful. Pooling collections for generator training is intended to provide more varied text and more examples of hateful tweets. The downstream tasks retain their own category systems, so a DT detector is evaluated on the three DT labels even though the generator has learned from a broader pool.
The authors give different reasons for leaving the latter collections out of the downstream comparison. HateLingo has only the hate class, so it cannot by itself supply a test of how well a detector distinguishes hate from other labels. For FOUNTA, the authors point to earlier work finding substantial inconsistency in annotation. The reported detector results therefore assess augmentation on WZ-LS and DT. The involvement of FOUNTA and HateLingo is through training the generator.
The comparisons and metrics
The paper compares three detector architectures. An LSTM reads tweets as sequences and builds a recurrent representation of the words. A convolutional neural network, or CNN, uses filters that respond to local patterns. The CNN-LSTM combines convolutional and recurrent processing. Each architecture appears in an ordinary training condition and in conditions that change the examples seen during training. This allows a reader to compare the effect of the data intervention within the same named architecture.
The sampling baselines address imbalance by changing how frequently the classifier sees examples from different classes. Upsampling increases representation through repeated use of existing examples from a smaller class. Downsampling reduces representation from larger classes. Both can change what the detector emphasizes during training. HateGAN also changes how much hate the detector sees, and the examples it adds are newly generated sequences. That distinction makes the sampling baselines relevant to the paper’s question about what more varied training material can contribute.
On DT, the authors include results from the earlier CNN-LSTM-GenAug and CNN-LSTM-ThreshAug approaches. GenAug creates sequences by training an LSTM to predict the next word. It is a natural comparison for the initial generative stage of HateGAN. ThreshAug uses similar words as substitutes within existing tweets. The authors take both sets of results from the earlier study because its augmentation code was unavailable to them. They leave out a word-swapping method, explaining that they expected repositioning words to damage fluency.
The paper reports averages from five-fold cross-validation for its experiments. In this evaluation, folds of the dataset take turns as the held-out portion, so performance can be summarized across different partitions of the data. The published values for the earlier DT augmentation methods are imported comparisons. The results for HateGAN, ordinary training and sampling provide the paper’s direct comparisons under its evaluation procedure.
Hate-class precision asks what share of the tweets predicted as hateful carry the hate label. Hate-class recall asks what share of the tweets carrying that label were predicted as hateful. A classifier can raise recall by labeling more tweets as hate, with a cost to precision if many additional predictions are wrong. Hate-class F1 combines precision and recall through their harmonic mean, so a weak value on one side constrains the combined score. Micro-F1 pools decisions over the full task. It reflects all labels and gives frequent classes more influence through their larger numbers of decisions. Together, the measures show whether a method changes identification of hate and what happens to classification across the dataset.
Results on WZ-LS
Every HateGAN-augmented architecture had higher hate-class F1 than its ordinary baseline on WZ-LS. LSTM went from 48.2 to 51.4. CNN went from 48.2 to 52.4. CNN-LSTM went from 49.0 to 53.2. The micro-F1 comparisons also favored augmentation within each architecture. The LSTM scores were 77.3 and 78.3, the CNN scores were 76.7 and 78.4, and the CNN-LSTM scores were 77.2 and 78.2, with the augmented result second in each pair.
For the CNN-LSTM, hate-class precision went from 64.8 in ordinary training to 65.2 with HateGAN. Recall went from 49.2 to 52.2. For LSTM, precision went from 66.0 to 68.0 and recall from 46.6 to 48.6. For CNN, precision went from 65.4 to 68.0 and recall from 47.8 to 49.2. Each architecture therefore improved on both hate-class measures in this dataset. The size of the change differed with architecture and metric.
WZ-LS hate-class F1 for CNN-LSTM training settings
Upsampling has the highest hate-class F1 in this comparison, while HateGAN improves on ordinary training.
The numbers
| System or setting | F1 |
|---|---|
| CNN-LSTM | 49.0 |
| CNN-LSTM with upsampling | 56.0 |
| CNN-LSTM with downsampling | 39.8 |
| CNN-LSTM with HateGAN (this paper) | 53.2 |
The WZ-LS CNN-LSTM results show how the metrics respond to different decisions about the training data. Upsampling had hate-class recall of 62.0 and precision of 59.6, producing the highest hate-class F1 for this architecture. Downsampling pushed recall to 72.5 and reduced precision to 42.6. Its micro-F1 fell to 38.3, compared with 77.2 under ordinary training and 78.2 with HateGAN. Judged on recall alone, downsampling recovered the most hate examples among these settings. The other measures show what accompanied that recovery.
The same pattern appears in the other two architectures. Upsampling raised hate-class F1 to 56.2 for LSTM and 56.2 for CNN. Downsampling gave the LSTM hate-class recall of 70.8 and the CNN recall of 73.8. Their corresponding precision scores were 44.4 and 43.0. With HateGAN both architectures reached precision of 68.0. The authors’ general claim about improved hate-class F1 is supported by comparisons with ordinary training. When the choice includes resampling, the preferred setting depends on which aspect of classifier behavior is being evaluated.
Results on DT
DT presents a different classification problem because a detector can give a tweet the offensive label as well as the hate label. Offensive tweets are the largest category in this dataset, and the paper emphasizes their similarity to some hateful tweets. HateGAN augmentation again raised hate-class F1 for each of the tested architectures compared with its original training condition. For LSTM the scores were 34.8 and 37.0. For CNN they were 35.2 and 39.2. For CNN-LSTM they were 25.2 and 37.2. The larger improvement in the hybrid classifier’s hate-class F1 accompanied an especially low recall under ordinary training.
Hate-class recall for the DT CNN-LSTM went from 18.6 to 31.4 after augmentation. Its precision went from 51.6 to 50.4. The improved hate-class F1 here reflects a higher recall alongside a small drop in precision. The DT CNN also coupled increased recall, from 28.4 to 33.2, with lower precision, from 53.6 to 50.8. The DT LSTM improved on both measures, with recall going from 27.4 to 28.6 and precision from 50.6 to 53.2. The results provide distinct examples of how a gain in F1 can arise from different changes in prediction behavior.
DT micro-F1 for CNN-LSTM training settings
HateGAN gives the hybrid classifier its highest micro-F1 among the reported training settings.
The numbers
| System or setting | F1 |
|---|---|
| CNN-LSTM | 88.7 |
| CNN-LSTM with upsampling | 87.4 |
| CNN-LSTM with downsampling | 82.6 |
| CNN-LSTM with HateGAN (this paper) | 89.4 |
The other DT classifiers followed the same pattern for micro-F1. The LSTM rose from 89.2 to 89.6 with HateGAN, and the CNN rose from 89.0 to 89.5. Both sampling strategies lowered micro-F1 from ordinary training for each of the DT architectures. Downsampling nonetheless yielded hate-class F1 of 56.2 for LSTM, 58.0 for CNN and 56.7 for CNN-LSTM. Those values exceed the corresponding HateGAN results. For the hybrid classifier, downsampling reached hate-class recall of 70.0 with precision of 49.2. These scores give a concrete example of the gap between a favorable result for the hate class and a favorable result over all the labels.
The published GenAug and ThreshAug scores offer a narrower comparison. They include recall on the hate class, where the table gives values for both methods and for HateGAN. The paper reports recall of 17.0 for GenAug and 23.0 for ThreshAug. The CNN-LSTM with HateGAN reached 31.4. The two earlier approaches have no corresponding micro-F1 results in the paper’s table, so the chart compares the settings for which that metric is available.
DT hate-class recall for CNN-LSTM text augmentation
HateGAN recovers more labeled hateful tweets than either earlier text augmentation approach in the published comparison.
The numbers
| System or setting | Recall |
|---|---|
| CNN-LSTM with GenAug | 17.0 |
| CNN-LSTM with ThreshAug | 23.0 |
| CNN-LSTM with HateGAN (this paper) | 31.4 |
Across the original and augmented classifiers, the authors describe an average improvement of 5% in hate-class F1. The dataset-level results indicate what that claim covers. It is a summary of gains relative to standard training across the tested classifiers, with a separate empirical question about the comparison against each sampling strategy. The result most consistent across architectures is that HateGAN raised micro-F1 and hate-class F1 together relative to the original training condition. The resampling results establish that other changes to the training distribution can produce larger gains on the hate class alone.
The confusion matrices give another view of the hybrid classifier’s predictions. A confusion matrix groups predictions by both the assigned label and the classifier’s predicted label. Looking at its entries can show which categories gain or lose correctly classified tweets. The authors report that the DT comparison showed a 12.8% increase in correctly predicted hate tweets and a 1.0% decrease in correctly predicted offensive tweets after augmentation. These are the authors’ reported changes for the confusion-matrix comparison. The classwise view complements micro-F1 by showing behavior in the large offensive category alongside the improvement on hate.
What the ablations show
What changes when the training examples change?
The paper does not report a component-by-component ablation of HateGAN, and its analyses instead compare classifier training conditions, vary the amount of synthetic data and inspect generated examples against similar real tweets.
The most direct comparison holds the classifier architecture in place and changes its training data. The ordinary CNN, for example, is compared with a CNN trained on data supplemented by HateGAN. Gains under this comparison show that the added data can change the performance of the same kind of detector. The authors repeat the comparison across a recurrent, a convolutional and a hybrid classifier. Their agreement on the direction of the micro-F1 and hate-class F1 changes makes it harder to attribute the overall result to a peculiarity of one architecture.
Resampling changes the same training problem in a different way. Its results demonstrate a possible route to higher recall: emphasizing the minority class can encourage the detector to predict hate more readily. For the WZ-LS LSTM, upsampling moves recall from 46.6 to 63.4 while reducing precision from 66.0 to 58.2. The authors interpret this pattern as evidence that the classifier tends to assign the hate label more frequently. The result is informative because recovery of labeled hate examples can improve even when the predictions associated with that label become less trustworthy.
The GenAug comparison bears on a different question. A recurrent generator that learns next-word prediction supplies a reference point for the more elaborate generation procedure. On DT, CNN-LSTM trained with HateGAN data has higher hate-class recall than the published CNN-LSTM-GenAug result. The authors see this as evidence that HateGAN supplies more useful examples. The comparison changes the generation procedure as a whole and comes from separately reported experiments. It leaves open how much of the result is attributable to the toxicity scorer, adversarial training, the continuation-based reward or differences in the way the generative data was obtained. Those effects would require comparisons that varied the relevant parts independently.
Changing the share of hate examples
The authors vary the proportion of hateful tweets in the CNN-LSTM’s training set to study how the intervention behaves as its scale changes. The paper plots hate-class precision and hate-class F1 for each dataset. The WZ-LS axis marks training hate shares of 10, 15, 20, 25 and 30 percent. The DT axis marks 34, 43, 52, 61 and 70 percent. These are proportions of the training set represented on the augmentation plot. They describe the exposure of the classifier to the hate class and are distinct from the counts of original tweets in the dataset table.
The authors observe that precision initially rises and then declines as more generated hate examples are added. At the rising part of the curve, additional sequences may expose the detector to a wider range of wording associated with hate. The authors suggest that further increases in the class share can encourage predictions of hate broadly enough to add more false alarms. This explanation fits the role of precision: once additional hate predictions include enough tweets from other classes, precision falls even if some previously missed hateful tweets are recovered.
Varying the share changes both the mix of training labels and the amount of generated material. More synthetic tweets may bring additional formulations, and a higher minority share may also change how the classifier divides ambiguous cases between classes. The plotted experiment varies those factors together. Its conclusion is that augmentation strength matters for detector behavior. It leaves the relative effects of shifts in frequency and additions in linguistic variety unresolved.
Both curves are relevant to choosing a training condition. Precision singles out the correctness of hate predictions. F1 also depends on whether the detector retrieves tweets carrying the hate label. A change in the same set of decisions can therefore favor different points on the curve depending on the metric used. The paper’s textual account describes the rise and fall of precision. It does not report individual precision and F1 coordinates for each of the plotted shares, so the direction of the trend is more securely supported than an exact choice of training proportion.
Comparing generated tweets with nearby real ones
The case studies investigate whether HateGAN produces examples that resemble real tweets while expressing their content in different ways. The researchers represent real and generated tweets using weighted word embeddings. They then calculate cosine similarity, which compares how closely the directions of the resulting vectors align. For each selected synthetic tweet they report the real tweet with the highest similarity. This makes the comparison concrete by showing a generated tweet alongside a real one selected by a stated procedure.
Several of the printed pairs have recognizable overlap in vocabulary while differing in phrasing. The nearest WZ-LS tweet is the same for distinct synthetic examples, a sign that closeness under the vector representation can group outputs with related vocabulary despite differences in how they are put together. Another example combines hostility with a reference to Americans. The authors use such cases to illustrate the presence of identifiable targets in the generated material. The pairs also give readers the opportunity to observe differences in phrasing directly, without equating a similarity score with literal duplication.
The neighbors come with their original labels. The examples include a DT neighbor labeled offensive and another printed as normal. A generated tweet paired with an offensive neighbor is especially pertinent to this study. The reward uses properties that can also occur in offensive language, and the vector procedure pairs texts using their representations. Those two mechanisms can bring a synthetic example close to real texts on different sides of the annotation boundary. The label shown for a real neighbor belongs to that real tweet. The example comparison supplies no separate human judgment of the synthetic tweet’s label.
The authors interpret the selected examples as evidence that HateGAN can produce varied and relevant text with coherent stretches of language. The comparison supports that interpretation at the level of the displayed examples. Some outputs are fragmentary in the way short posts can be, and the examples include content whose classification is ambiguous. The usefulness of the exercise is in showing what plausibility and relevance can look like in individual cases. The detector experiment supplies the separate evidence about whether adding the generated collection helped classification.
Limitations
Limits identified by the authors
The authors point to the difficulty of separating offensive language from hate speech. DT makes that difficulty visible in the class definitions, and the generated examples show why the problem carries over to augmentation. A tweet can contain insulting or otherwise offensive words and still be assigned the offensive label under the dataset’s annotations. The selected toxicity and identity attack scores give the generator a direction during training, but the underlying ambiguity remains in the examples the paper analyzes.
The paper also limits the evaluation to datasets the authors regarded as suitable for their detector experiments. HateLingo gives them material for generation because it contains hateful tweets. Its single label prevents it from providing the required contrast among classes. The authors likewise cite annotation inconsistency as the reason for using FOUNTA in the generation pool while leaving it out of the detector evaluation. Their results therefore concern WZ-LS and DT, with their respective labeling schemes and class distributions.
The conclusion identifies additional avenues for studying generation. The authors propose exploring variational autoencoders as another way to produce examples. They also suggest considering sentiment and topic as additional attributes, since a tweet can match the current reward while varying along dimensions of potential importance to a detector. They call for further methods of evaluating the generated content itself. In the paper, text quality is examined mainly through qualitative pairs and indirectly through the performance of classifiers trained on generated data.
Limits visible in the experimental setup
The generator’s signals are proxies for the properties of interest. The discriminator estimates resemblance to real tweets given the distinctions it has learned. The toxicity scorer estimates properties from labels learned on a comment dataset and with representations learned from pandemic-related tweets. The experiment then uses synthetic tweets to train classifiers whose labels come from other collections. Each stage relates to the same broad detection goal, but the categories and text populations differ. The reported experiment leaves the correspondence between the scorer’s outputs and each downstream dataset’s hate label unmeasured.
The amount of possible influence from each reward component is also unclear. The paper presents their weighted combination and describes σ as a hyper-parameter. It gives no separate downstream comparison for training with the discriminator alone or for omitting either selected toxicity dimension. It also leaves the internal rule for combining the toxicity and identity attack outputs unspecified. The results support the full training procedure used in the experiments. They provide limited evidence for assigning a share of the subsequent detector improvement to any particular component.
The training data boundaries matter to interpreting the cross-validation. The paper describes pooling the collections for generator training and using WZ-LS and DT for downstream evaluation with five folds. It gives no explicit account of whether the generator was retrained within each fold using only the corresponding training partition, or how tweets common to the generator’s sources and the detector’s held-out data were handled. That detail would determine whether the generator had access to tweets later used for evaluation. The paper leaves the degree of independence between those stages uncertain. The nearest-neighbor examples cannot settle the question for the complete generated collection.
The source of the baseline scores affects what can be inferred from them. Ordinary training, sampling and HateGAN augmentation appear as the authors’ classifier experiments. The DT results for GenAug and ThreshAug come from the earlier publication. These figures establish how the reported recall values compare. They provide a weaker basis for isolating a causal difference between generation methods than an experiment using identical data partitions and implementations. The table also provides incomplete metric coverage for those earlier conditions, limiting the comparison to the values actually reported.
The fold averages tell readers about the size and direction of observed differences. The results table gives no fold-level variation or uncertainty estimates. This matters especially for close comparisons, such as the LSTM’s DT micro-F1 scores of 89.2 with ordinary training and 89.6 after augmentation. The direction of the gain is available, while the stability of that difference across folds and training runs remains open. Seeing gains across architectures makes the pattern more consistent within the study. It cannot establish how frequently a similar gain would recur in a new experiment.
The qualitative inspection uses selected sequences and a particular definition of similarity. Two texts can share terms and have different targets or meanings. Two texts can also differ substantially in phrasing while making related claims. The nearest-neighbor procedure answers which texts are close according to the chosen vector representation, which is narrower than deciding whether a generated example is novel, coherent or correctly labeled. The examples illustrate what the method can produce. A dataset-wide estimate of novelty, labeling reliability or the range of topics and targets would require evidence beyond those pairs.
Finally, what counts as better depends on the intended use of the detector. HateGAN improved micro-F1 and hate-class F1 compared with ordinary training in these experiments. Several sampling settings recovered more hateful tweets, and some attained higher hate-class F1. Micro-F1 records what happens across all labels, including the dominant classes, while hate-class measures describe a narrower goal. The paper evaluates trained classifiers against existing labels in Twitter collections. The consequences of applying those classifiers to moderation decisions, including the costs of missed hateful posts and incorrect flags, remain outside its measurements.
What came after
Exploring Data Augmentation Strategies for Hate Speech Detection in Roman Urdu cites HateGAN and studies the broader question of how to augment data for hate speech detection in Roman Urdu. It brings the training-data question to a different language setting. The connection is the use of augmentation as an object of study in its own right. The citation and scope establish that relationship, while the choice of augmentation methods and any reuse of HateGAN’s generator or reward remain unspecified here.
A Survey on Combating Hate Speech through Detection and Prevention in English also cites HateGAN. Its scope places the detection task within a broader account of English-language research on detection and prevention. HateGAN contributes evidence about a specific part of that subject: how added synthetic examples affect supervised detection on labeled tweets. The survey’s citation establishes a connection to that literature. The available account of the survey leaves its specific treatment of the generator and its experimental results open.
Cite
Cite as Rui Cao and Roy Ka-Wei Lee. 2020. HateGAN: Adversarial Generative-Based Data Augmentation for Hate Speech Detection. Proceedings of the 28th International Conference on Computational Linguistics.
@inproceedings{cao2020hategan,
title = {{HateGAN: Adversarial Generative-Based Data Augmentation for Hate Speech Detection}},
author = {Rui Cao and Roy Ka-Wei Lee},
booktitle = {Proceedings of the 28th International Conference on Computational Linguistics},
year = {2020},
doi = {10.18653/v1/2020.coling-main.557},
url = {https://doi.org/10.18653/v1/2020.coling-main.557}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/cao-2020-hategan-adversarial-generative-based-data/