[ MASK ] ED - Language Modeling for Explainable Classification and Disentangling of Socially Unacceptable Discourse. (2025)

Abstract: Analyzing Socially Unacceptable Discourse (SUD) online is a critical challenge for regulators and platforms amidst growing concerns over harmful content. While Pre-trained Masked Language Models (PMLMs) have proven effective for many NLP tasks, their performance often degrades in multi-label SUD classification due to overlapping linguistic cues across categories. In this work, we propose an artifact-guided pre-training strategy that injects statistically salient linguistic features, referred to as artifacts, into the masked language modelling objective. By leveraging context-sensitive tokens, we guide an importance-weighted masking scheme during pre-training to enhance generalization across discourse types. We further use these artifact signals to inform a lightweight dataset curation procedure that highlights noisy or ambiguous instances. This supports targeted relabeling and filtering, enabling more explainable and consistent annotation with minimal changes to the original data. Our approach provides consistent improvements in 10 datasets extensively used in SUD classification benchmarks.*Disclaimer: This article contains some extracts of unacceptable and upsetting language.*

## introduction in an era defined by global crises, rising inequality, and the proliferation of extreme online content, regulators at different levels pressingly need to adopt effective machine learning (ml) solutions to detect socially unacceptable discourse (sud). the ever-changing and evolving nature of social discourse not only presents significant challenges to understanding it but also limits the capabilities of the available discourse analysis tools. analyzing sud on the other hand is an even more challenging task that requires context-aware models capable of understanding its subtleties and nuances. * these authors contributed equally. pre-trained masked language models (pmlms) have proven effective in different nlp tasks, including accurate classification of inadequate content @xcite @xcite @xcite @xcite @xcite . these models however, face multiple challenges when used for online discourse analysis @xcite @xcite , where they require to learn from noisy data containing multiple distributions annotated with shallow categories @xcite . in this scenario, counting on inaccurate content labelling can in turn lead to severe (or too weak) censorships that may disadvantage content creators or contributing to information gaps @xcite . we also notice that pmlms under-perform when required to generalize over different label distributions (multiclass) and thus have to specialize over different types of speech that hereafter we refer to as sud @xcite @xcite . masked language models (mlms) are often trained with a random masking schema over a generic corpus, where a model learns to predict randomly masked (and/or replaced) tokens considering their surrounding context @xcite . intuitively, we can expect that the same linguistic pattern or keywords can appear in different types of discourse, breaking the assumption that a given class has a unique structure and vocabulary. in such a case, the language model ability to recognize and disentangle a given language feature depends on the model's understanding of the context around recurrent textual fragments that statistically represent a given class. to discover such patterns, an mlm must learn the heterogeneous contexts surrounding the pivotal textual feature. this begs the question: could we improve the performance of mlms by selectively focusing on more representative sud tokens/features during the pre-training? recent research efforts @xcite @xcite have highlighted the advantage of leveraging relevant textual features to enhance the language model generalization benefits to downstream task such as sud classification. we thus study the possibility of injecting statistical knowledge of sud features at the mlms pre-training stage. furthermore, such a strategy permits us to obtain interpretable cues over the model decision space that we can also leverage to estimate noisy labels and perform data curation over the analyzed corpora. we notice that such a strategy is so-far overlooked in the automatic sud analysis literature. contribution: in this work we propose a new sud classification framework that selectively focuses on and ranks informative tokens related to sud categories. in turn, it leverages such a knowledge to train unsupervised and supervised mlms. the proposed approach uses the contextual significance of tokens, to weight the training loss and to estimate noisy labels. we extensively evaluate our contribution in building a sud classification benchmark with 13 different datasets. a wide range of annotated datasets has been developed to support this task @xcite @xcite @xcite @xcite @xcite @xcite @xcite @xcite , with hatespeechdata 1 serving as a centralized resource for such datasets. increasing attention has been also devoted to cross-dataset and cross-domain generalization @xcite @xcite ; markov and 1 https://hatespeechdata.com/ daelemans, 2021b; @xcite @xcite @xcite , multilingual detection @xcite @xcite , and multiclass or multi-label classification targeting finegrained categories and underrepresented populations @xcite @xcite . in this context, @xcite and @xcite introduced a novel corpus combining texts from diverse platforms (social media, forums, news comments) and annotation schemes. building on this resource, @xcite conducted a comprehensive benchmark of state-of-the-art methods, exposing inconsistencies in existing datasets, such as divergent contextual interpretations of the same labels, and highlighting annotation biases, showing that models trained on single-domain data can experience performance drops of up to 28% in cross-domain evaluations. explainable hate speech detection several explainable hate speech detection efforts have focused on developing frameworks that combine detection accuracy with interpretable reasoning. @xcite introduce explainable models that leverage narrative structures to capture subtle, implicit hateful expressions and adversarial language, while also releasing toxigen, a largescale machine-generated dataset for implicit hate speech detection. the hare framework @xcite complements this by using large language models (llms) with chain-of-thought prompting to generate detailed rationales that improve detection accuracy and explanation quality. by addressing logical inconsistencies across human-annotated datasets, hare achieves both improved detection performance (3.8% f1 increase over baselines) and enhanced generalizability. a complementary direction of work enriches explanations with external knowledge and toxicity attributes. for example, @xcite present a knowledge-informed encoder-decoder framework that integrates multiple sources of external knowledge to generate nuanced explanations of stereotypes in biased language, outperforming prior state-of-the-art approaches. similarly, @xcite propose tox-bart, a generative model that leverages explicit toxicity attributes to interpret implicit hate speech. benchmark corpora have been critical in advancing this line of research. the social bias frames dataset (sbic) @xcite emphasizes reasoning about the pragmatic frames in which social biases and stereotypes are projected, while the la-tenthatred dataset @xcite provides fine-grained annotations of implicit hate speech based on a six-class taxonomy, supporting evaluation of models on subtle and indirect forms of toxicity. likewise, the hatexplain dataset @xcite incorporates word-and phrase-level human rationales across 20k posts, enabling simultaneous assessment of classification accuracy and explanation faithfulness, and revealing that high-performing models often diverge from human reasoning. beyond dataset-driven advances, explainable detection has also leveraged deep learning architectures in conjunction with post-hoc interpretability methods, such as attention and attribution analyses, which provide insights into model behavior @xcite . in contrast to these approaches, our work focuses on mitigating bias and improving cross-domain generalization (without requiring additional annotations), offering interpretable cues tied to model confidence in large-scale, heterogeneous settings where label noise is prevalent. ## proposed approach this section outlines our methodology for enhancing sud classification. in figure 1 , we show the overall architecture of our sud classification framework composed by three novel blocks : i) token scoring, ii) pre-training strategy based on weighted loss according important tokens (a.k.a. artifacts), iii) post classification token diagnostic that supports label noise detection and dataset relabelling. in the following parts, we provide a linguistically grounded definition of sud describing the details of each architecture building block. ## experimental setup in this section, we present the experimental framework employed to evaluate our artifactaware pretraining approach, detailing the datasets and model configurations. model training and evaluation were carried out using key libraries such as transformers, datasets, pytorch, and tensorflow. comprehensive information on package versions and the computational environment is available in our repository to facilitate reproducibility: https://github.com/rayaneghilene/mlm _pretraining . ## results in this section we present and discuss the results of the proposed sud classification framework. ## conclusion the results of this study offer several insights into the role of sud artifacts in guiding pretraining and improving dataset quality for the task of sud classification. while standard masked language modeling provides only limited improvements in downstream performance across model architectures, introducing artifact-weighted loss consistently yields better results. by assigning greater importance to semantically important tokens, the model is encouraged to focus on contextually challenging regions. beyond model performance, our curation strategy, based on token-level relabeling and filtering, proves valuable for interpretability. with minimal changes to the data, the method reveals annotation inconsistencies, offering a lightweight mechanism for surfacing potential labeling issues. this enables more transparent error analysis and targeted refinement.