Source-linked AI summary

All You Need is "Love": Evading Hate-speech Detection

Tommi Gröndahl, Luca Pajola, Mika Juuti, Mauro Conti, N. Asokan

arXiv:1808.09115v3cs.CL

TL;DR

Automatic hate-speech detection faces inconsistent definitions, labels, and limited evidence about how models generalize across datasets. The paper reproduces seven models and evaluates cross-dataset behavior and automated text attacks, finding that dataset and labeling criteria matter more than architecture while simple modifications can evade detection. Character-based models are more resistant than word-based models, but current approaches remain vulnerable.

  • Problem

    Hate-speech detection lacks systematic evidence about model and dataset comparability, while inconsistent labeling can conflate hate speech with offensive ordinary speech.

  • Method

    The paper reproduces seven prior hate-speech detection models, compares them across datasets, and evaluates automated word, boundary, and innocuous-word modifications.

  • Results

    Across datasets, model architectures perform similarly when trained and tested on the same dataset, but transfer poorly; simple attacks make all models vulnerable, with word-based models most severely affected.

  • Takeaways & Limitations

    Dataset construction and labeling deserve greater emphasis, while simple character-based models are preferable to word-based models for resisting text-transformation evasion.

  • Takeaways & Limitations

    Labels may vary across datasets and annotators, limiting general hate-speech detection and making cross-dataset agreement difficult to guarantee.

Abstract

from arXiv · show

With the spread of social networks and their unfortunate use for hate speech, automatic detection of the latter has become a pressing problem. In this paper, we reproduce seven state-of-the-art hate speech detection models from prior work, and show that they perform well only when tested on the same type of data they were trained on. Based on these results, we argue that for successful hate speech detection, model architecture is less important than the type of data and labeling criteria. We further show that all proposed detection techniques are brittle against adversaries who can (automatically) insert typos, change word boundaries or add innocuous words to the original hate speech. A combination of these methods is also effective against Google Perspective -- a cutting-edge solution from industry. Our experiments demonstrate that adversarial training does not completely mitigate the attacks, and using character-level features makes the models systematically more attack-resistant than using word-level features.

1 INTRODUCTION

The paper addresses the lack of systematic comparison among hate-speech detection models and shows that dataset context, labeling, and simple adversarial text changes strongly affect detection.

  • Problem: Hate speech is difficult to define consistently, differing from merely offensive or shocking content across legal and social contexts.The paper denotes non-hateful speech as “ordinary speech.”
  • Research gap: No systematic empirical evaluation had compared actual implementations of proposed hate-speech models and datasets.
  • Comparative evaluation: Seven reproduced models performed poorly across datasets when pretrained, but comparably when retrained and tested within the same dataset.The results suggest that dataset-specific features matter more than model architecture.
  • Comparative evaluation: The models also tended to classify offensive ordinary speech as hate speech.
  • Adversarial evaluation: The study tests three automatable attacks: changing words, changing word boundaries, and appending unrelated innocuous words.
  • Adversarial evaluation: Combining two effective attacks completely breaks word-based models and severely hinders character-based models, while also degrading Google Perspective’s toxicity scores.

2 REPLICATION AND MODEL COMPARISON

The replication finds that hate-speech classifiers perform similarly when trained and tested on the same dataset, but transfer poorly across datasets because labels and contexts differ. It also exposes confusion between hate and offensive speech and reports preliminary limits for transfer learning.

  • Replication and re-training: Seven replicated models perform comparably when trained and tested on the same dataset.The models include feature-based, recurrent, character-based, and word-based approaches.
  • Cross-application between datasets: Pre-trained models do not transfer well to other datasets, indicating that hate-speech indicators are not consistently retained across datasets.The authors suggest differences in shared vocabulary and relevant features across hate-speech subcategories as possible explanations.
  • Offensive speech vs. hate speech: Two-class models risk labeling offensive but non-hateful speech as hate, while the hate–offensive distinction itself is subjective and inconsistently labeled.The paper notes that crowd-sourced labels may disagree across datasets and may represent offensiveness more than hatefulness.
  • Offensive speech vs. hate speech: CNN+GRU trained on T3 was the only model to succeed on the offensive-speech task, but over 40% of test-set words mapped to <unk>, making the result reflect its small vocabulary.All other models performed at random or below-random levels.
  • Transfer learning: ULMFiT remained below the replicated-model baselines on Twitter datasets T1–T3 in preliminary experiments.Scores were 0.62, 0.75, and 0.80 versus baselines of 0.66, 0.84, and 0.86, respectively.
  • Replication and re-training: Model architecture and complexity have no major effect on performance compared with the effects of dataset-specific labels.The simplest character-level logistic regression performed comparably to more complex models, while complexity did not improve cross-dataset scalability.

3 ATTACKS

The paper evaluates six automated evasion attacks that alter hate-speech text while preserving its intended meaning for human readers. The attacks target word identities, word boundaries, or added innocuous words, with character models expected to resist some transformations better than word models.

  • Adversary model: The adversary modifies input to make hate speech appear ordinary while retaining its semantic content, without requiring white-box model access.One attack requires some knowledge of the training set.
  • Attack types: Six evasion attacks are organized into word changes, word-boundary changes, and word appending.The alternatives include typos, leetspeak, inserted or removed whitespace, and appended common or non-hateful words.
  • Attack mechanisms: Word changes make altered tokens likely to become unknown tokens in word-level models while preserving readability and meaning for humans.Word-boundary changes also alter word identities and target tokenization behavior.
  • Expected model sensitivity: Character models are expected to resist word-boundary changes and word changes better than word models because character n-grams remain available after transformations.Word-based models are expected to be vulnerable to these changes because they depend on word tokenization.
  • Evaluation: The attacks are applied to hate-class samples from each classifier’s respective test set.This evaluates whether altered hate speech is misclassified after automatic text transformations.

3.1 Word changes

Word changes alter spellings while preserving human readability, targeting both word and character representations. The paper evaluates typos and simplified leetspeak, alongside adversarial training and spell-checking defenses.

  • Word changes can make words unrecognizable to word-based models and alter character distributions in character-based classifiers.
  • Simplified leetspeak replaces characters with numbers and is generally readable to humans but unrecognizable to word models without matching training examples.
  • Typo generation aims to reduce detection while avoiding spell-check correction and preserving readability and the original meaning.
  • The typo attack switches two internal characters, favoring nearby positions near the word’s middle to limit readability damage.
  • Adversarial training augments the training data with stochastically transformed examples, while spell-checking is tested as preprocessing against typos.
  • The random typo algorithm scales poorly for long words because the number of possible typos increases.

3.2 Word boundary changes

Word-boundary attacks insert or remove whitespace to change tokenization while retaining varying degrees of recoverable content. They strongly target word models, whereas character models are less affected but require distinct mitigation considerations.

  • Tokenization attacks alter separators so word-based models assign different tokens while preserving word-internal characters.
  • Whitespace insertion has limited readability cost, whereas whitespace removal substantially harms surface readability but still leaves the original content recoverable.
  • Whitespace insertion splits words into parts that word models may map to <unk> tokens, while whitespace removal can collapse the input into one unknown token.
  • Adversarial training against whitespace insertion is analytically limited because all possible sentence splits create a combinatorial explosion.
  • Training with space removal is nearly useless for word models because it memorizes whole comments, while character models can use it with little change to predictive inputs.

3.3 Word appending

Word appending exploits the asymmetry that adding non-hateful material may not change hate-speech status but can shift a classifier toward the non-hate class. The attack appends unrelated words chosen from common language or training data.

  • Adding non-hateful material to hate speech may preserve its status while encouraging classifiers to assign the text to a non-hate class.
  • The attack assumes the appended material is distinguishable in discourse so readability and semantic retention are maintained.
  • The authors append 10–50 random words to hate-class test texts, using either common English words or words drawn from a non-hate training source.

4 RESULTS

Across replicated models and attacks, performance generally declined, with word-based models especially vulnerable to tokenization and character-based models generally more resilient. Dataset choice also strongly influenced transfer and attack resilience, while combined boundary-removal and “love” appending defeated word models and hindered character models and Perspective.

  • Experimental setup: The evaluation applies six attacks to seven replicated model–dataset combinations, with adversarial training used across attacks and additional defenses for typos and tokenization.
  • Overall attack results: Performance of all seven classifiers significantly decreased under most attacks; word models were most affected by tokenization, while character models were most affected by word appending.
  • Overall attack results: Word-based models were completely broken by at least one attack, whereas character-based models were never completely broken.
  • Dataset and model effects: The training dataset had a major influence on attack resilience, although model choice also affected resilience for models trained on the same dataset.
  • Word changes: Word models were more vulnerable than character models to leetspeak and typos, while adversarial training improved performance against both attacks, especially deterministic leetspeak.
  • Word-boundary changes: Neither character model was affected by whitespace insertion, but whitespace removal markedly reduced both models’ performance by eliminating word-boundary n-grams.
  • Word-boundary changes: Whitespace removal completely broke all word models, and adversarial training did not improve resistance; whitespace insertion was more effectively mitigated.

5 DISCUSSION

The discussion identifies dataset and labeling variation, classifier asymmetry, and simple text attacks as central weaknesses in hate speech detection.

  • Transferability and false positives: Seven classifiers perform roughly equally when trained and tested on the same dataset, but cross-dataset transfer is poor and labels differ across datasets.The authors link the first two deficiencies to the problematic and context-dependent concept of hate speech.
  • Evasion attacks: The “love” attack completely breaks word-based models, severely hinders character-based models, and lowers Google Perspective toxicity below 0.40 in all example sentences.The attack combines simple text transformations and affects both research classifiers and the external toxicity-scoring system.
  • Evasion attacks: Character-based models resist simple text-transformation attacks more effectively than word-based models, while space removal mitigates tokenization attacks with only a minor performance cost.The authors identify character models as the most effective protection against their attacks.
  • Evasion attacks: All models remain vulnerable to word appending because classification relies on class prevalence across the sentence rather than the presence of hateful material.Adding enough class-indicative material can force a particular prediction, even when hateful content remains present.
  • Future directions: The authors suggest reconceptualizing hate speech detection as anomaly detection, where hate speech is an anomalous variant of ordinary speech.This reframing separates detecting relevant hateful features from classifying the overall prevalence of competing features.
  • Evasion attacks: The attacks target textual content only, so they do not hinder detection methods based on user-behavior meta-features.The authors therefore identify meta-level approaches as a possible direction for future research.

6 ETHICAL CONSIDERATIONS

The replication used freely available online datasets and models, collected no new data, involved no human subjects, and withheld attack code from public release.

  • Ethical considerations: The study used only freely available online datasets and models for replication and cross-application, without collecting data or involving human subjects.The authors state that none of the tests involved human subjects.
  • Ethical considerations: The attack code is not open source, but the authors plan to provide it to bona fide researchers to support reproducibility.They withhold the code because it constitutes a series of attacks.

7 RELATED WORK

Related work covers feature families and neural architectures in hate speech detection, while positioning the paper’s attacks alongside text-obfuscation attacks in spam filtering.

  • Feature categories: Prior hate speech detection features are grouped into surface, generalized-word, sentiment, linguistic, knowledge-based, meta-information, and multimodal categories.The survey framework lists eight categories, with the supplied passages detailing seven named groups and omitting category (iv).
  • Feature categories: Character n-grams can detect similarities between spelling variants, motivating their reported advantage over word n-grams for simple surface features.The paper states that its results align with this prior argument.
  • Neural architectures: The evaluated neural models use word embeddings, initialized either randomly in the LSTM or with Google News embeddings in the CNN+GRU.Both architectures include an embedding layer at the beginning of the network.
  • Feature categories: Sentiment analysis can serve as a prior filter or direct classification feature, and the evaluated three-class logistic-regression model includes sentiment as a textual feature.The authors propose testing their attacks on state-of-the-art sentiment classifiers as future work.
  • Feature categories: Keyword lists, part-of-speech tags, and dependency relations are traditional linguistic features, although standalone hateful-word lists perform weakly compared with n-grams.The paper notes that linguistic features are often hand-crafted and may be combined with other features.
  • Future directions: The paper notes that reconsidering older keyword- and rule-based approaches may be warranted because of the observed attack results against neural classifiers.The supplied passage presents this as a direction for reconsideration rather than a demonstrated replacement.
  • Related attacks: The paper relates word-appending attacks to “good word attacks” on spam filters, where benign-looking words are injected to flip the classifier’s prediction.This connects the attack mechanism to established text-obfuscation work outside hate speech detection.

8 CONCLUSIONS AND FUTURE WORK

The conclusions prioritize dataset quality and labeling, favor character-based models against text transformations, and call for detection methods and training procedures that address classifier asymmetry.

  • Conclusions: Model architecture has no major impact on classifier performance, while dataset labels and their differing grounds explain cross-application problems.The simplest LR-char model performed comparably to more complex models, and complexity did not improve scalability across datasets.
  • Future work: Future work should focus on datasets and compare linguistic indicators across racism, sexism, personal attacks, and merely offensive speech.The authors call for more qualitative work on categories covered by the hate-speech umbrella.
  • Future work: Character-based models are preferable to word-based models, including DNNs, for resisting simple evasion methods based on text transformation.This recommendation is specifically about attack resistance, not overall classification performance.
  • Future work: The appending attack exposes an asymmetry: adding hateful material can make ordinary speech hateful, whereas adding benign material should not make hate speech ordinary.The authors argue that this principle is not built into ordinary classification and recommend methods that target hateful-feature presence.
  • Future work: Training-data augmentation may improve resistance to appending attacks by adding benign text to hate-speech examples and reducing irrelevant word-class correlations.The proposal builds on the authors’ adversarial-training experiments.
  • Recommendations: The authors summarize four recommendations: prioritize datasets, use character models, address class asymmetry, and augment training data against benign-word effects.These recommendations consolidate the paper’s conclusions for future hate-speech detection research.
Loading 1808.09115v3…