Elamur Research

Hate-Speech and Offensive Language Detection in Roman Urdu

Paper · 2020 · Hammad Rizwan, Muhammad Haroon Shakeel and Asim Karim

Summary

Recognizing a swear word and recognizing an attack are different decisions. A person can swear about a frustrating situation, use the same language to insult someone, or express hostility toward a group on the basis of gender or religion. In Roman Urdu, these distinctions have to be read through informal spellings, abbreviations, and frequent switches between Urdu and English. The authors turn this problem into a text classification benchmark for Urdu written in Latin script. They ask how well a system can flag hateful or offensive tweets and how well it can identify the kind of language that prompted the flag.

The benchmark, RUHSOLD, contains 10, 012 tweets. Its binary task separates Hate-Offensive from Normal. Its more detailed task retains Normal and distinguishes Abusive/Offensive, Sexism, Religious Hate, and Profane. The presence of an intended target helps distinguish Abusive/Offensive from Profane. To gather candidate tweets, the researchers search with a lexicon of 621 hateful terms and a separate collection of everyday Roman Urdu words. Everyday queries let them reach ordinary conversation as well as abuse expressed without an obvious trigger word. The authors release the lexicon, the benchmark splits, and RomUrEm, a set of word embeddings learned from more than 4.7 million tweets.

The study first compares representations that are kept fixed with representations adapted to the labeled tweets through fine-tuning. In the standalone coarse-grained test, fixed RomUrEm leads with a macro F1 of 0.84. This measure gives each class equal influence and rewards systems that both find examples of a class and label them accurately. After adaptation, BERT leads that comparison with 0.89. The authors then compare complete classifiers. Combining BERT with their convolutional architecture, CNN-gram, yields a macro F1 of 0.90 on the coarse test, level with the strongest baseline. On the fine-grained test, the same pairing reaches 0.75, ahead of the best baseline at 0.72.

The results make the case for adapting existing representations when labeled Roman Urdu examples are available. The benefit varies with the representation, the classifier that uses it, and the granularity of the labels. The authors’ inspection of individual predictions also shows why the finer test matters. Both leading classifiers sometimes assign Profane to a tweet that the annotators judged to be an insult aimed at someone. A coarse score gives credit for placing such a tweet on the offensive side of the decision. The fine-grained score registers the missed distinction.

Deep dive: Hate-Speech and Offensive Language Detection in Roman Urdu

The study builds a Roman Urdu tweet benchmark and tests how well CNN-gram and pretrained embeddings distinguish targeted abuse from general profanity. · about 35 minutes to read

The problem and its context

What a tweet can be doing with offensive language

The authors begin with the work that reporting and human review demand from social media platforms. A reviewer has to interpret informal messages quickly, recognize the slang of the people writing them, and understand which languages are being used. Delays are consequential when a post is part of a campaign against an individual or community. The authors also describe a risk in making the definition of offense too broad or applying it inconsistently. A review process can be used to suppress criticism, including criticism of authorities and religious beliefs, or to silence minority voices. Their motivation for automated detection therefore comes with a question about what judgments a detector should learn to make.

The events discussed in the paper anchor that question in Pakistan. The authors refer to online campaigns against political figures and social media personalities, harassment of women who express views publicly, and attacks on religious minorities. The examples involve different relationships between speaker, language, and target. A hostile message about someone’s religion and a rude dismissal of an individual can both merit attention while conveying different kinds of hostility. The paper treats the difference as something a benchmark should preserve. Its labels give researchers a way to see whether a classifier can retain that distinction when it reads an individual tweet.

Consider the evidence supplied by a vulgar word. Its presence can indicate the register of a tweet, but the reader still has to determine what the writer is using it to do. The word might intensify a complaint, or its role in the sentence might make it an insult. For a label based on religion or gender, the text has to support a further judgment about the grounds on which someone is attacked. A reference to a person or community matters differently depending on how it connects to the hostile language. These judgments explain why the study distinguishes a flag for problematic content from a description of the offense.

The paper’s experimental unit is a tweet with a reference label. This makes it possible to evaluate the same decision across competing classifiers. It also gives the target of the experiment a definite meaning. A classifier succeeds when its choice agrees with the category assigned under the annotation procedure. Questions about how Twitter should act on a post, how a reviewer should respond to a campaign, or what evidence belongs in a particular moderation decision extend beyond that unit of evaluation.

Why Roman Urdu needs its own evidence

Roman Urdu is Urdu written with Latin letters. The paper situates it in informal communication in Pakistan, where people can switch between Urdu and English during a conversation and within a message. This practice is called code-switching. A tweet can begin in English, use an Urdu expression at the point where it addresses someone, and continue in English. For a reader, the expression in Urdu may carry much of the force of the utterance. A classifier’s ability to process the English portion gives an incomplete picture of whether it has understood the exchange. This is a case of multilingual and cross-lingual NLP at the level of a short, mixed-language text.

The authors also emphasize the variability of the writing itself. Informal writers use their own abbreviations, choose among possible spellings, and produce sentences that may depart from standard grammar. These practices matter at several points in the study. At retrieval time, different spellings can determine whether a tweet turns up in a keyword search. At classification time, a different written form can change the units presented to the system. At annotation time, the reader may have to interpret a compressed expression with little surrounding material. A resource designed for this setting has to make room for those forms as they occur in use.

The shortage that the authors identify is task-specific. Earlier research had supplied examples, labeled datasets, and classifier designs for several languages. Roman Urdu had no publicly available dataset for this task that the authors knew of. In this sense it is a low-resource language for the detection problem, even though the authors describe the writing as prevalent. Tweets supply material from which to build a resource. Turning that material into comparable evidence requires a search procedure, an explicit definition of the categories, and examples judged according to those definitions.

There is a related question about what should be learned from those examples. One approach starts with a representation that has already learned from large collections of text and adapts it to Roman Urdu detection. Another uses a large collection of tweets to learn a representation specifically for Roman Urdu before training on the labeled task. The authors explore both routes. Their comparison brings together a language question, about what carries over to Roman Urdu, and a domain question, about what carries over to informal social media language and the kinds of hostility found there.

How earlier detection tasks drew their boundaries

The authors describe hate-speech detection as a field in which similar names had been used for different prediction problems. Waseem and Hovy studied racism and sexism on Twitter, and Waseem’s related work examined annotation in that setting. Davidson and colleagues studied the boundary between hate speech and offensive language on Twitter. De Gibert and colleagues worked with material from a white supremacy forum, separating hateful from non-hateful posts. The platform, the source population, and the definitions affect what it means to get a decision right. A dataset for racism and sexism and a dataset for offensive vocabulary with or without a target invoke different tests, even if both are discussed as hate-speech resources. Waseem and Hovy’s Twitter study · Waseem’s study of annotator influence · Davidson and colleagues’ study of hate speech and offensive language · De Gibert and colleagues’ forum dataset

The paper discusses work by Founta and colleagues that sought to clarify the relationships among overlapping categories. This background is relevant to RUHSOLD because its labels also sit close to each other. Profanity can occur in a personal insult, a religious attack, or a message without an intended target. Some categories can be combined for a broad test and retained separately for a finer one. The choice of resolution determines which mistakes an evaluation counts. It also determines what readers can learn about a classifier from the resulting score.

The authors place RUHSOLD alongside work extending the task beyond English. The HASOC shared task covered Hindi, German, and English. The paper also points to dataset work in Polish and German and to resources in Portuguese, Indonesian, and Hindi. A shared task brings systems onto common evaluation data for a specified decision. Language-specific datasets make that sort of comparison possible for the languages and categories they cover. The authors use both traditions when they define a Roman Urdu benchmark and bring in classifier designs that had been evaluated in other linguistic settings. Benchmarking Aggression Identification in Social Media · A Hierarchically-Labeled Portuguese Hate Speech Dataset

From counted features to learned representations

Earlier systems described in the paper often supplied a classifier with features defined in advance. The Davidson study used grammatical categories from part-of-speech tagging, emotion lexicons, TF-IDF, and n-grams. TF-IDF represents the prominence of a term in a document relative to how widely it occurs across documents. An n-gram is a sequence of adjacent units, such as consecutive words. Such features give a classifier ways to recognize characteristic wording and short patterns. The Roman Urdu authors argue that local evidence can be insufficient when an expression becomes hateful or insulting through its relation to more distant wording.

The background section describes a move towards neural classifiers capable of learning features from data. Some of the earlier approaches used convolution, which applies the same learned pattern detector at successive positions in a text. Others used recurrent processing, which carries a state through the sequence so that information from earlier positions can affect the treatment of later ones. The paper cites deep learning work on cyberbullying and describes how researchers combined methods to capture several kinds of evidence. Park and Fung, for instance, brought character-level and word-level convolution together. Other studies combined recurrent classifiers by voting or paired classifiers that emphasize short patterns with classifiers designed to process longer sequences. Deep Learning for Detecting Cyberbullying Across Multiple Social Media Platforms · Park and Fung’s study of abusive-language classification

The authors see a practical reason to explore a single architecture that can use different kinds of evidence. An ensemble combines predictions or features from multiple components and can require more computation and choices specific to a task. Work at HASOC provided a second reason to look beyond the earlier feature sets. The authors describe successful entries using ensembles or adapting a multilingual Transformer representation such as BERT. Pretraining provides an existing representation of text that can be carried into a new detection task. The issue for Roman Urdu is how useful that starting point is and what it takes to turn it into a classifier for the categories the authors define.

The method, step by step

Finding candidate tweets

The first task is to locate examples that annotators can examine. The authors follow earlier hate-speech studies in using search terms to retrieve relevant material. They report that the multilingual hate lexicon they consulted lacked Roman Urdu entries, so they assemble their own vocabulary through online searches and interviews. The terms include insults and derogatory expressions, with entries connected specifically to religious hate and sexism. This makes it possible to retrieve tweets containing words that may be relevant even before anyone has established the label of the full message. SemEval multilingual hate-speech detection task

A separate pool of common Roman Urdu words supplies queries with a different function. Such a query can return a harmless tweet because its defining feature is ordinary vocabulary. It can also return an insulting tweet whose words convey offense through their use in the exchange. The authors illustrate this with a message that tells someone to have women in their family take part in a march. They interpret the reference to the relatives as demeaning in that exchange. The example matters for collection because none of the words has to be a conventional slur for the assembled message to serve as an insult.

The researchers use the search material to gather 20, 000 tweets for an initial inspection. They look through the results for slang and abuses to add, and for ordinary terms that occur frequently enough to be useful. They discard terms that produce too few retrievable tweets. The finalized resource is a lexicon of 621 hateful terms. The revised search yields 50, 000 new tweets, and the authors take a random sample of around 10, 000 for annotation. The random draw concerns which of the collected tweets to label. The choice of queries has already determined what can appear in that draw.

The authors impose a maximum contribution of 120 tweets per user. This addresses a concern that prolific users could account for too much of the dataset. If many tweets come from the same person, the resource can reflect that individual’s spelling, habitual expressions, or chosen subjects to an unusual degree. Limiting contributions curbs the concentration at the collection stage. The procedure is part of the path from search results to the labeled dataset, before the examples are divided for training and evaluation.

Giving the tweets a reference label

The authors use independent linguistic annotation by three people. When the annotators disagree, the majority judgment settles the label. A tweet is removed if they cannot settle the disagreement or judge that there is insufficient information to label it. The researchers draw a replacement at random from the collected tweets. The retained instances thus have a reference decision that can be used to train a classifier and assess its predictions. The replacement procedure also means that the benchmark is made up of examples that survive a judgment about whether they can be categorized from the material available.

The coarse decision assigns either Hate-Offensive or Normal. The detailed decision preserves Normal and subdivides Hate-Offensive. The subdivision serves a purpose even if the same messages would be flagged under either scheme. A classifier that repeatedly mistakes targeted insults for profanity could agree with the coarse reference on those tweets while repeatedly missing a distinction in the finer annotation. By publishing both granularities, the authors give each type of judgment its own evaluation.

Abusive/Offensive is used when a person or group is the target of an insult conveyed through strongly rude, hurtful, or vulgar expression. Profane is for obscenity without an intended target. A message can contain direct address and profanity, so deciding between the labels involves examining the role of the address and where the offensive expression is directed. The annotators’ job is to interpret the use made of the language in the tweet. The retrieval procedure may have found it through a word found in both categories.

For Sexism, the grounds of the hostility are gender or sexual orientation. For Religious Hate, the definition covers hostility grounded in religious belief or the absence of it. It also covers appeals to religion in expressing hatred or inciting violence against a person or group. In the authors’ examples, a tweet can contain obscene insults together with hostility directed at people on the basis of their religion. A reader has to recognize what organizes the attack. Finding the obscene language is only part of the labeling decision. Warner and Hirschberg’s study of web hate speech

The authors retain Religious Hate and Sexism as separate categories. Both could be absorbed into a category for hate speech, and the authors cite work in which that broader concept is used. Keeping the labels separate gives the fine-grained task a way to ask what kind of group-based hostility is present. Normal covers tweets that fall outside the offensive categories. In one of the illustrations, a writer says that particular television outlets have done good work for the country. The presence of opinions and named institutions is compatible with a Normal label.

The final class assignments also guide the division of the dataset. The authors stratify the train, test, and validation splits on the fine-grained labels. Stratification allocates cases with reference to their classes to preserve the class proportions across the partitions. This helps ensure that uncommon labels are represented when the classifier learns, when the researchers choose settings, and when the test score is calculated. The paper reports making the standard splits and the search lexicon publicly available and identifies a companion code repository.

Preparing the numerical inputs

A word embedding is a vector, an ordered set of numerical components used to represent a word. For the tweet classifier, the representation determines what information is available at each position before the architecture starts combining positions. Using pretrained embeddings gives the system a starting point learned from a text collection beyond the labeled training examples. The input still has to undergo tokenization, which divides the tweet into units the representation can process. The authors use tokenizers from Hugging Face and specify the base version of BERT.

The pretrained comparison includes LASER, ELMo, and BERT. It also includes FastText and XLM-RoBERTa. These are different sources of text representations with different prior training. The experiment gives them a common task and evaluates the predictions they support. The authors refer to multilingual pretrained embeddings in describing the comparison. In the context of RUHSOLD, the relevant empirical question is how they handle informal Roman Urdu and the labels assigned to it. LASER · ELMo · FastText · XLM-RoBERTa

The authors create RomUrEm to give that comparison a representation drawn from the target domain. They use the Twitter API to gather 4, 770, 677 tweets, including randomly collected tweets and hate-speech tweets. They train embeddings of 200 dimensions using word2vec. The context window is set to 5, governing how far around a word the embedding training looks. The minimum word count is 2, defining the frequency threshold for inclusion, and the authors specify 10 iterations of pretraining. The resulting vectors are also made publicly available. Word2vec

There are two stages of learning to keep track of. Pretraining determines the starting representations from material collected separately for that purpose or from the original resources behind the existing embeddings. Fine-tuning lets the labeled detection task change the representation. A frozen representation keeps its numerical values during that task. Comparing its frozen and tuned conditions asks what changes when it can adapt to these judgments. In RomUrEm’s case, the starting point already contains exposure to Roman Urdu tweets and hateful language, so adaptation serves as further specialization within a domain the representation has encountered.

The paper distinguishes these representation experiments from the complete-system comparison with CNN-gram. Its standalone results describe the embedding setups without the downstream architectures being compared against the proposed system. A ranking in that experiment pertains to its own setup. The second comparison asks what happens when a representation is used with a classifier that learns to combine features in a particular way. That distinction becomes important when a strong standalone result is followed by a weaker result for a particular classifier pairing.

Following the signal through CNN-gram

CNN-gram receives the representations for a tweet as a matrix. The paper gives its shape as follows.

l × d

The symbol l denotes the number of words in the tweet, using the architecture section’s terminology. The symbol d denotes the number of components in each word’s embedding. The × sign separates the row and column dimensions of the matrix. Each position contributes a row, and the columns hold the numerical features for that position. The paper describes the operations that follow in words and names the training loss.

A convolutional filter learns to respond to a pattern in its input. It applies the same learned operation at successive positions and produces a feature map, a series of responses. In the first CNN-gram layer, the kernel size is 1. The kernel size is the width of the input covered by the filter at a given position. At this stage the filter looks at one row of the embedding matrix at a time. The paper uses a rectified linear unit, or ReLU, which keeps positive responses and sets negative ones to zero. The resulting values describe where in the tweet a learned cue activates the filter.

Each local feature map goes to max pooling and average pooling, with a pool size of 2. The two operations summarize the same neighborhood differently. Max pooling takes its largest activation. Average pooling takes the mean. If a feature fires strongly at one position and weakly next to it, its local maximum still records the strong response. The local mean reflects both positions. These summaries offer the later classifier information about the strength and spread of the evidence. The max-pooled map also has fewer positions for the next convolution to read.

The first max-pooled map goes to the second convolution, which uses a kernel size of 2. This filter combines neighboring entries in the shorter map. Each of those entries already summarizes a region in the previous map. Local max and average pooling follow again. The successive convolutional layers use the spans the authors associate with trigram and quad-gram patterns. At each stage, the maxima are the inputs carried forward down the convolutional sequence. The local averages and maxima from all stages are available for the final combination.

The architecture’s name comes from its use of progressively wider patterns. The authors qualify the relationship between the layers and ordinary n-grams. From the second stage onward, the windows slide over pooled features. Entries selected by neighboring pooling operations can come from different locations in their original windows. A response to several neighboring entries is consequently a response to several retained summaries, with its connection to the original words mediated by the earlier stages. A wider kernel lets the system use information from a wider span of its current input. The filter width describes that input more directly than it describes a literal phrase in the tweet.

How a tweet moves through CNN-gram

The steps in order.

How a tweet moves through CNN-gramStep 1: Arrange the tweet embeddings into a matrix1. Arrange the tweet embeddings into a matrixStep 2: Detect word-level cues with the first convolution2. Detect word-level cues with the first convolutionStep 3: Pool local responses by maximum and average3. Pool local responses by maximum and averageStep 4: Feed local maxima into progressively wider convolutions4. Feed local maxima into progressively wider convolutionsStep 5: Join pooled maps saved across the stages5. Join pooled maps saved across the stagesStep 6: Compute global maxima and averages6. Compute global maxima and averagesStep 7: Combine the summaries in fully connected layers7. Combine the summaries in fully connected layersStep 8: Assign the label through softmax8. Assign the label through softmax

Turning feature maps into a decision

The saved feature maps from the local pooling operations are concatenated, meaning they are joined to form the representation used at the next stage. One effect of this arrangement is that an early response can contribute to the final decision without having to produce a large activation at a later convolution. At the same time, responses formed farther along the network are retained. The classifier therefore receives evidence from detectors working on individual positions as well as evidence computed by combining features across broader regions.

The architecture applies global max pooling and global average pooling to the combined maps in parallel. The global operation summarizes a filter’s responses over its entire available map, whereas local pooling summarizes neighborhoods within a map. The global maximum reports the most intense response. The global average records the level of activation across the map. A strong match in a small part of the tweet can have a different effect on those summaries from moderate matches distributed across it. CNN-gram uses both kinds of values when it constructs the input to the dense classifier.

The two sets of global summaries are concatenated and sent through two fully connected layers. These layers combine the features and reduce the representation to smaller dimensions. The authors apply dropout and batch normalization after the fully connected layers. During training, dropout suppresses some activations so that a decision cannot depend on every feature always being present. Batch normalization adjusts the activations using statistics of a batch of examples. The final softmax converts the class scores into probabilities across the choices for the task.

Training uses categorical cross-entropy. This loss gets larger when the system assigns a low probability to the labeled class, giving the training process a signal about how to adjust the weights. It applies to the individual decisions from which the classifier learns. Macro F1, used to report performance, evaluates the resulting class predictions and gives each class equal weight in the average. A training objective and a reporting metric thus use the same reference labels in different ways, one to adjust the system and the other to describe how it performed.

Selecting training settings and weights

The paper says that the authors chose the numbers of convolutional filters and dense units empirically and show their choices in the architecture figure. For other settings, they carry out a grid search on the validation split using RomUrEm with its embeddings kept fixed. A grid search tries combinations of preset candidate values. The authors choose a dropout rate of 0.5 and a learning rate of 0.002. The learning rate governs the size of the updates to the trainable weights. They select Adam as the optimizer after considering Adadelta and SGD. The optimizer is the procedure that makes those updates using the training signal.

The authors implement the architecture in Python using Keras with a TensorFlow backend and report running it on an Nvidia 1080Ti. They describe initializing network weights randomly and using a fixed random seed across experiments. The seed controls the sequence of random choices. It makes this part of the training procedure consistent across the reported experiments. It supplies a particular run context for the comparisons, with variation across seeds left for a separate evaluation.

The training schedule allows 200 epochs, where an epoch is a pass through the training material. Training stops if validation error fails to decrease for 15 epochs. The authors also save a checkpoint at the epoch with the best validation performance and use that checkpoint for the test evaluation. The two decisions serve different purposes. Early stopping sets the point at which continued training is no longer pursued under the validation rule. Saving a checkpoint preserves the network from an earlier epoch if that epoch gave the best validation result. The test predictions therefore come from weights selected on validation evidence.

Experiments and results

The data and the score

The labeled RUHSOLD dataset contains 10, 012 tweets. Normal is the largest fine-grained category, with 5, 349. Abusive/Offensive accounts for 2, 402. The smaller categories contain 839 tweets labeled Sexism, 782 labeled Religious Hate, and 640 labeled Profane. These are counts for the full benchmark. The relative sizes matter because a score across individual tweets will be more influenced by a category that supplies more of them. In the coarse task, the offensive categories contribute to the shared Hate-Offensive label.

The authors give a train, test, and validation split ratio of 70,20,10, stratified by fine-grained class. They report 7, 209 training tweets, 2003 test tweets, and 801 validation tweets. The reported counts are inconsistent with the stated overall size and split proportions. The evaluations below refer to the test split as identified in the paper. The validation split is the one used for selection of settings and checkpoints.

The authors report accuracy, macro precision, macro recall, and macro F1. Accuracy is the proportion of individual tweets assigned their reference label. Precision for a class measures the reliability of predictions of that class. Recall measures how many of the reference examples for that class the system retrieves. F1 combines class precision and recall using the harmonic mean, which makes weak performance on either measure consequential. The macro versions average class-level values with equal weight per class. Macro F1 is therefore an average of class F1 values and reflects a different aspect of performance from accuracy.

Equal class weight is especially pertinent when moving from the binary task to the finer one. A sizable Normal category can contribute many correct decisions to accuracy. A smaller category has the same influence as Normal in the macro average. Treating more of the rare categories correctly can improve class-balanced performance even when the number of tweets involved is small relative to the full test set. Conversely, aggregate macro scores still combine several class outcomes. They cannot by themselves identify the difficult category or tell the reader which kinds of posts a system keeps missing.

The comparison systems

The authors select seven baselines because they had performed well in earlier studies or shared tasks. They reimplement them from companion code when available and otherwise from the descriptions. Thus the comparisons use the decisions measured by RUHSOLD, even when an original system had been built for different labels, data sources, or languages. The group includes recurrent classifiers, conventional convolutional classifiers, and systems using combinations of representations or learning algorithms.

LSTM+GBDT pairs a long short-term memory network with gradient-boosted decision trees. The recurrent network processes words in sequence, with a state that can retain information across positions. The tree method combines successive decision trees to learn a prediction rule. The original approach described in the paper uses random embeddings and had been studied on English Twitter data labeled for racism and sexism. BiLSTM with Attention is another recurrent approach. It processes the sequence in both directions and uses attention to weight the information from positions in that sequence. The paper points to earlier use of this design on news comments.

FastText+CNN was drawn from work on aggression detection with Hindi tweets in Roman and Devanagari script. Its convolutional classifier receives FastText representations. Domain Embeddings+CNN also uses convolution, starting with embeddings learned on social media material in the relevant domain. The original system used Hindi and Hinglish tweet material. To reproduce the design for Roman Urdu, the authors use RomUrEm. The result is another way to see what happens with the same domain-specific embedding source in a complete classifier.

The other baselines come from HASOC. BERT+LAMB uses pretrained BERT with the LAMB optimizer. BERT+LASER+GBDT combines representations from BERT and LASER and uses a boosted tree classifier. SVM+RF+AB combines a linear support vector machine, a random forest, and AdaBoost. The support vector machine separates classes using the features presented to it, the forest aggregates decisions from trees, and AdaBoost combines successive learners that put emphasis on examples that have been difficult to classify. The implementation described in the paper uses voting to combine decisions. The baselines give CNN-gram several different types of competitor on the same test material.

The coarse decision

The standalone comparison starts with the representations held fixed. RomUrEm records 0.84 macro F1 on the RUHSOLD coarse test, ahead of ELMo at 0.80. LASER reaches 0.74 and FastText 0.73. Fixed BERT reaches 0.67, and fixed XLM-RoBERTa reaches 0.35. The domain-specific representation is the strongest starting point in this setting. The authors relate its score to the presence of both random and hateful tweets in the material used to train it.

Once the representations can be adapted to RUHSOLD, BERT reaches 0.89 macro F1, the highest standalone coarse result. FastText and RomUrEm each reach 0.88. XLM-RoBERTa reaches 0.85. LASER reaches 0.76 and ELMo 0.79. The conditions yield different rankings. In particular, a representation that gives weak predictions while frozen can become competitive when the training procedure can change it to reflect the labeled task.

Selected classifiers on RUHSOLD coarse test macro F1

CNN-gram with BERT ties the leading voting ensemble, and its other embedding pairings score lower.

Selected classifiers on RUHSOLD coarse test macro F1BERT+CNN-gram (this paper): 0.90BERT+CNN-gram (this paper)0.90SVM+RF+AB: 0.90SVM+RF+AB0.90RomUrEm+CNN-gram: 0.89RomUrEm+CNN-gram0.89BERT+LAMB: 0.89BERT+LAMB0.89BERT+LASER+GBDT: 0.89BERT+LASER+GBDT0.89XLM-RoBERTa+CNN-gram: 0.88XLM-RoBERTa+CNN-gram0.88FastText+CNN-gram: 0.80FastText+CNN-gram0.80LSTM+GBDT: 0.38LSTM+GBDT0.38
The numbers
System or settingmacro F1
BERT+CNN-gram (this paper)0.90
SVM+RF+AB0.90
RomUrEm+CNN-gram0.89
BERT+LAMB0.89
BERT+LASER+GBDT0.89
XLM-RoBERTa+CNN-gram0.88
FastText+CNN-gram0.80
LSTM+GBDT0.38

In the complete-system experiment, the leading BERT+CNN-gram pairing and the voting ensemble SVM+RF+AB both reach 0.90 macro F1 on the coarse test. Both also reach 0.90 accuracy. The equality is at the reported precision of the metrics. Two baselines using BERT are close behind. BERT+LAMB and BERT+LASER+GBDT each reach 0.89 macro F1. Domain Embeddings+CNN reaches 0.88, FastText+CNN reaches 0.87, and BiLSTM with Attention reaches 0.85.

The weakest of the coarse baselines is LSTM+GBDT, with 0.38 macro F1 and 0.54 accuracy. The authors discuss whether this system’s capacity to encode order and longer dependencies yields sufficient information for the detection task. BiLSTM with Attention is much closer to the leading classifiers, so the results concern how the particular recurrent designs are used. The broader pattern is that several different systems can perform well on the binary decision, including systems that use BERT and the voting ensemble that leads the baselines.

Among the CNN-gram alternatives, RomUrEm gives 0.89 macro F1 and XLM-RoBERTa gives 0.88. FastText gives 0.80. FastText’s standalone result after tuning was 0.88, and pairing it with a conventional CNN gives a stronger complete-system score than pairing it with CNN-gram. The architecture and input representation should be read as a joint choice when interpreting those results. A score from one experiment measures what that configuration does with the representation under its own conditions.

The finer decision

In the standalone fine-grained experiment, ELMo and RomUrEm share the highest frozen macro F1 at 0.56. LASER reaches 0.46. BERT gives 0.37, FastText 0.35, and XLM-RoBERTa 0.14. The specialized tweet embedding remains among the leading frozen choices, though the task yields a tie at the top. The frozen scores across this comparison show the difficulty of using the starting representations to resolve the finer distinctions.

Effect of tuning on standalone RUHSOLD fine test macro F1

Adaptation puts XLM-RoBERTa first, while ELMo scores slightly higher when frozen.

Effect of tuning on standalone RUHSOLD fine test macro F1XLM-RoBERTa fixed: 0.14XLM-RoBERTa fixed0.14XLM-RoBERTa tuned (this paper): 0.72XLM-RoBERTa tuned (this paper)0.72BERT fixed: 0.37BERT fixed0.37BERT tuned: 0.67BERT tuned0.67RomUrEm fixed: 0.56RomUrEm fixed0.56RomUrEm tuned: 0.67RomUrEm tuned0.67ELMo fixed: 0.56ELMo fixed0.56ELMo tuned: 0.55ELMo tuned0.55
The numbers
System or settingmacro F1
XLM-RoBERTa fixed0.14
XLM-RoBERTa tuned (this paper)0.72
BERT fixed0.37
BERT tuned0.67
RomUrEm fixed0.56
RomUrEm tuned0.67
ELMo fixed0.56
ELMo tuned0.55

The fine-tuned standalone leader is XLM-RoBERTa at 0.72 macro F1. BERT and RomUrEm each reach 0.67, and FastText reaches 0.66. LASER reaches 0.54. ELMo ends at 0.55, below its fixed score. BERT moves from a weak frozen result to a place among the strongest tuned choices, and XLM-RoBERTa moves from the lowest frozen result to the lead. RomUrEm’s rise shows that a representation with prior exposure to the domain can also benefit from the labeled task.

When the comparison shifts to complete classifiers, BERT+CNN-gram has the strongest fine-grained macro F1, at 0.75. Its accuracy is 0.82. The best baseline, BERT+LAMB, records 0.72 macro F1 and 0.80 accuracy. The metrics give a more detailed picture of the comparison. Macro precision is 0.81 for BERT+CNN-gram and 0.72 for BERT+LAMB. Macro recall is 0.66 for BERT+CNN-gram and 0.73 for BERT+LAMB. Across the classes, the leading CNN-gram configuration thus has higher reported precision and lower reported recall than the baseline it leads on macro F1.

Classifiers on RUHSOLD fine test macro F1

The BERT pairing with CNN-gram leads the fine-grained comparison.

Classifiers on RUHSOLD fine test macro F1BERT+CNN-gram (this paper): 0.75BERT+CNN-gram (this paper)0.75BERT+LAMB: 0.72BERT+LAMB0.72BERT+LASER+GBDT: 0.71BERT+LASER+GBDT0.71FastText+CNN: 0.68FastText+CNN0.68SVM+RF+AB: 0.67SVM+RF+AB0.67BiLSTM with Attention: 0.65BiLSTM with Attention0.65Domain Embeddings+CNN: 0.55Domain Embeddings+CNN0.55LSTM+GBDT: 0.15LSTM+GBDT0.15
The numbers
System or settingmacro F1
BERT+CNN-gram (this paper)0.75
BERT+LAMB0.72
BERT+LASER+GBDT0.71
FastText+CNN0.68
SVM+RF+AB0.67
BiLSTM with Attention0.65
Domain Embeddings+CNN0.55
LSTM+GBDT0.15

BERT+LASER+GBDT also has an accuracy of 0.80 and reaches 0.71 macro F1. FastText+CNN reaches 0.68 macro F1, and SVM+RF+AB reaches 0.67. The voting ensemble’s position falls when the labels preserve different types of offensive language. This is a reminder that success on the coarse boundary and success at identifying the source of the offense can rank systems differently. The BERT-based baselines remain close to the leading systems in both comparisons.

The lowest baseline results on the fine task are 0.55 macro F1 for Domain Embeddings+CNN and 0.15 for LSTM+GBDT. LSTM+GBDT records 0.53 accuracy alongside that macro F1. Such a combination is possible because the accuracy metric reflects the frequency of the classes and macro F1 gives them equal influence. The two scores alone leave open the exact predictions responsible for the pattern.

There are conflicting reports for some of the fine-grained CNN-gram variants. For XLM-RoBERTa+CNN-gram, the table gives 0.68 macro F1 and the discussion gives 0.72. For FastText+CNN-gram, the table gives 0.61 and the discussion gives 0.42. The paper places 0.42 in the macro recall column for the RomUrEm variant, where it also gives RomUrEm+CNN-gram a macro F1 of 0.64. Both presentations put BERT first among the CNN-gram variants and place XLM-RoBERTa ahead of RomUrEm and FastText. The claimed tie between XLM-RoBERTa+CNN-gram and BERT+LAMB depends on the value in the prose. The table and discussion agree on the principal fine-grained result for BERT+CNN-gram.

What the ablations show

The paper reports no removal of individual CNN-gram components, and examines the system through comparisons of frozen and tuned embeddings, embedding substitutions, baseline comparisons, and selected fine-grained predictions.

How much the starting representation can change

The paired comparison of frozen and tuned conditions holds the source of the embedding constant while changing its ability to adapt to RUHSOLD. XLM-RoBERTa illustrates why the paired results matter. Its macro F1 on the coarse test goes from 0.35 when frozen to 0.85 when tuned, the largest change reported in that comparison. On the fine test, it is the lowest-ranked frozen representation and the highest-ranked tuned one. Its initial score measures the frozen condition’s fit to the task. The reported improvement shows how different the result can be when the classifier can learn from changes to the representation itself.

BERT also gains from fine-tuning and reaches the top of the standalone coarse comparison. Its narrower lead in the complete systems has a separate interpretation. XLM-RoBERTa has the best tuned representation result on the fine test, while BERT gives the strongest fine-grained result when paired with CNN-gram. These results show the value of testing adaptation and testing the pairing separately. They leave the particular semantic cues gained during adaptation unmeasured. For instance, there is no corresponding result that isolates improved treatment of variant spellings or better recognition of a target.

The RomUrEm results help distinguish exposure to the domain from training on the classification labels. Its frozen scores are already competitive, and it still gains from tuning. Its initial training contains tweets of the sort the task is intended to classify, whereas the labeled examples specify the boundaries between the categories. ELMo supplies a different outcome. It shares the top frozen result on the finer task, and its score is slightly lower after adaptation. The value of adapting an embedding varies with what it brings to the task and which judgment the system has to learn.

What the embedding substitutions establish

Using different embeddings with CNN-gram tests the dependence of the proposed architecture on its numerical inputs. BERT is the strongest input in the reported CNN-gram comparisons at both levels of label detail. RomUrEm comes close on the coarse test, while on the fine test it falls behind the BERT and XLM-RoBERTa variants. In this setting, the architecture can learn from several sources of embeddings, and the choice among them changes the result. That is the sense in which the comparison supports the BERT pairing specifically.

The complete-system baselines provide comparisons that share an embedding source with CNN-gram. BERT+LAMB is the most relevant comparator for the headline fine-grained score because both it and the leading CNN-gram variant start from BERT. RomUrEm also appears in the domain-embedding CNN baseline, which has a lower fine-grained macro F1 than the RomUrEm-based CNN-gram variant. These comparisons show that performance changes when the classifier using a representation changes. Several design and training choices can differ at the same time. Establishing a gain from local average pooling, the broader filters, or the combination of features across layers would require controlling those choices more tightly.

The tuning procedure likewise documents how the reported CNN-gram configuration was selected. It identifies a preferred optimizer, learning rate, and dropout rate in the validation search with fixed RomUrEm. The paper gives the selected values without a breakdown of the performance of each candidate. A reader can distinguish the settings that define the reported system from evidence about how much each contributed.

The decisions visible in the prediction examples

The authors compare individual fine-grained predictions from BERT+LAMB and BERT+CNN-gram. In one of the selected tweets, the writer rebukes people for how they treated someone during a show and follows the accusation with profanity. The annotation is Abusive/Offensive, and both classifiers predict Profane. A second tweet directs hostility at particular people using vulgar language, and both classifiers make the same substitution. The shared error preserves the general observation that the tweet contains offensive material while dropping the annotators’ judgment that the expression is directed at someone.

Other examples show disagreement between the leading baseline and the proposed classifier. One is a brief personal dismissal telling someone to be quiet and go away. The baseline predicts Normal, while CNN-gram assigns Abusive/Offensive, as the annotators do. In another, the writer insults someone while accusing that person of spreading myths. The baseline predicts Sexism, while CNN-gram chooses the reference category Abusive/Offensive. The examples involve different kinds of error. One misses the offense, while the other treats the insult as a category of attack defined by gender or sexual orientation.

A further tweet draws a shared false positive. In it, the writer makes a possessive remark and says they will tell the other person’s mother. The reference label is Normal, while both classifiers assign Abusive/Offensive. This example makes the presence of an addressee an especially informative feature to think about. Directly addressing someone supplies a possible target, but the annotation still depends on whether the author is using the expression as a hurtful attack. Evidence of an interpersonal exchange can appear in tweets on either side of the coarse boundary.

The prediction examples make the authors’ concern about targeted language concrete. Two tweets are classified as vulgar without a target when the reference identifies a directed offense. The error becomes visible only when the category retains that distinction. Selected cases can establish that the confusion occurs and illustrate what it looks like in context. They leave open its frequency in the full test split and how much of the reported F1 difference between systems arises from this particular boundary.

Limitations

Limits the authors acknowledge

The authors identify targeted abuse versus untargeted profanity as a problem for further study. The prediction examples show that the leading classifiers can identify a vulgar register and still assign the wrong role to it. Recognizing that an obscenity is present gives evidence for the Profane label only if the language lacks an intended target. Assigning Abusive/Offensive requires interpreting the expression as an attack, and the target may be understood from a short stretch of familiar or abbreviated language. The authors frame this as a semantic difficulty within the fine-grained task.

The authors also caution against giving RomUrEm’s results the same interpretation as results for representations transferred from other corpora. Its prior exposure includes hateful tweets. That exposure is part of the design of the comparison, since the authors want a reference embedding trained in the relevant domain. A strong frozen score for RomUrEm measures performance with that starting point, and the subsequent tuned score reflects further specialization. The results for the other representations show that task adaptation can reach or exceed the domain-specific alternative in certain configurations. The original pretraining collections and procedures differ, which leaves the source of the advantage incompletely isolated.

A limit in the description of CNN-gram also comes from the authors. The names for the wider convolutions refer to the feature patterns the researchers intend to learn. Because max pooling removes positions along the way, the inputs to those convolutions are already summaries. The widths specify how many such entries interact. The architecture can build broader features, but identifying one as a particular contiguous expression would require more information about which earlier responses survived pooling and how the later filter used them.

Limits of retrieval and annotation

The retrieval process determines the population represented by the benchmark. The ordinary-word queries expand the pool beyond tweets containing known abusive terms, and the random sample broadens coverage within that pool. A tweet still has to match the search procedure to have a chance of being sampled. Abuse conveyed by an unfamiliar spelling, by an indirect reference, or through a term outside the queries may be selected less readily. The class counts describe the collected and annotated data. Inferring the prevalence of the classes in Roman Urdu Twitter would require evidence about tweets beyond that collection.

Replacing unclear and unresolved tweets also affects what the scores represent. A majority decision yields a determinate label when annotators differ. If the disagreement cannot be resolved, or the tweet gives too little information, the procedure replaces it. This allows the test to use a definite answer for each instance, and it leaves uncertainty and disagreement outside the main evaluation. A tweet that needs a previous message to make its target clear can present a different practical challenge from the retained examples. The study supplies no separate result for such messages, even though the motivation for detection includes reviewing speech in social exchanges.

The cap on tweets per person limits the influence of frequent contributors. The split procedure is described in terms of fine-grained label proportions. It does not give a separate evaluation with all tweets from particular users withheld from training. A score on such a split would address the possibility that knowing recurring forms, expressions, or topics from an author helps classify that author’s other tweets. The reported test establishes performance for the released benchmark design. Generalization to an completely new set of authors, to another platform, or to Roman Urdu collected in a different period is outside those measurements.

The labeling scheme compresses some of the variation within tweets into a single reference decision. A post may use vulgar words to insult a person and at the same time attack that person on religious grounds. The benchmark asks for the assigned category. It leaves open the performance of a system that has to identify all applicable categories, mark the words that constitute the attack, or name the target. The difference matters for interpreting the outcome. A prediction of Religious Hate, for instance, indicates agreement about the class under the benchmark’s rules. It does not supply the identity of the target or the evidence that a reviewer would use to check the judgment.

Limits of the comparisons and scores

The strongest BERT+CNN-gram results show that the pairing is competitive on both resolutions of RUHSOLD. The paper’s broader description of robustness draws on performance across those resolutions and on the use of several embeddings. Both tasks still come from the same collection, and the labels in the coarse task combine those used in the fine task. They test different decisions while sharing the underlying tweets. The experiment leaves robustness to independent samples, platform changes, altered annotation rules, and shifts in usage open.

The use of a fixed seed controls a source of variation but supplies no observed range across seeds. The paper does not accompany the leading results with variability across repeated runs or independent splits. For instance, the best baseline and CNN-gram tie at the displayed coarse macro F1, while the fine results give CNN-gram the lead. The test figures establish those relationships for the reported experiments. They offer no estimate of how stable such relationships would be across repetitions. The discrepancies in the split counts and in some fine-grained CNN-gram scores further limit the precision with which readers can reconstruct the comparison from the report.

The baseline comparison also cannot allocate the gains to individual CNN-gram operations. Reimplementing established classifiers gives the experiment relevant competitors, but changing the complete classifier can change multiple choices together. Even the comparisons that share a representation do not give a matched test isolating the effects of the local averages, the forward passage of the maxima, or the final global pooling. The reported work shows how the complete design performs. The authors discuss the computational cost of ensembles as motivation, though the paper supplies no timed comparison from which to infer a training or inference advantage.

Finally, an aggregate score cannot determine how a classifier would serve a review process. A higher macro F1 can coexist with lower macro recall, as in the fine-grained comparison of BERT+CNN-gram and BERT+LAMB. A review process might be particularly sensitive to missing attacks of a given type, or to burdening reviewers with ordinary messages misclassified as abusive. Assessing either outcome would require evidence more specific than a single average over classes. RUHSOLD measures agreement with labeled tweet categories. Operational decisions about uncertain posts, acceptable errors, and their consequences for speakers and targets are beyond the reported experiment.

What came after

The 2026 work on prompt-driven offensive Urdu detection takes up the same broad detection problem with a different way of eliciting a decision. The Roman Urdu study compares representations, adapts them with labeled examples, and uses a downstream classifier such as CNN-gram to assign the tweet label. A prompt-driven approach frames the detection decision as a request to a system that responds to the prompt. The title and citation establish a continuation at the level of offensive Urdu detection and a change in the stated method. Details of dataset reuse, script coverage, the label inventory, and any comparison with CNN-gram are unspecified. Prompt-driven Detection of Offensive Urdu Language

The 2025 survey on cultural awareness cites the Roman Urdu paper in the context of a broader subject that includes text. The connection is visible in the original study’s design. The authors choose search terms used in a particular linguistic setting, include writing that moves between Urdu and English, and define distinctions they consider relevant for the people using Roman Urdu. The benchmark thereby gives cultural context a concrete role in what material is gathered and what judgments are evaluated. The citation establishes the study’s presence in that broader literature. The specific conclusions the survey draws from RUHSOLD are unspecified. Survey of Cultural Awareness

The work on resources for automated identification of online gender-related language cites the study in a line of research where RUHSOLD’s Sexism category is directly relevant. In the original benchmark, a gender-based attack receives a distinct label beside religious hostility, targeted abuse, and untargeted profanity. This makes the resource pertinent to research on how online gender-related hostility can be identified within a wider classification task. The citation connects the Roman Urdu study to work concerned with identification resources. It leaves open whether the later work includes RUHSOLD in an inventory, compares the definition of Sexism with another annotation scheme, or uses examples from the dataset. Resources for automated identification of gender-related online language

Cite

Cite as Hammad Rizwan, Muhammad Haroon Shakeel and Asim Karim. 2020. Hate-Speech and Offensive Language Detection in Roman Urdu. Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP).

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.18653/v1/2020.emnlp-main.197

@inproceedings{rizwan2020hate,
  title = {{Hate-Speech and Offensive Language Detection in Roman Urdu}},
  author = {Hammad Rizwan, Muhammad Haroon Shakeel and Asim Karim},
  booktitle = {Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)},
  year = {2020},
  doi = {10.18653/v1/2020.emnlp-main.197},
  url = {https://doi.org/10.18653/v1/2020.emnlp-main.197}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/rizwan-2020-hate-speech-offensive-language-detection/