Cascading versus Joint Modeling for Hierarchical Offensive Language Detection
Summary
This paper compares cascaded and joint multi-task modeling for hierarchical offensive language detection, finding that cascaded architectures achieve higher accuracy at the cost of increased parameters and inference latency, and that class-imbalance handling strategies should be verified via ablation.
View Cached Full Text
Cached at: 07/21/26, 06:43 AM
# Cascading versus Joint Modeling for Hierarchical Offensive Language Detection
Source: [https://arxiv.org/html/2607.16790](https://arxiv.org/html/2607.16790)
Ruixing Ren, Junhui Zhao, Xiaoke Sun\(Corresponding author: Junhui Zhao\.\)Ruixing Ren, Junhui Zhao are with the School of Electronic and Information Engineering, Beijing Jiaotong University, Beijing 100044, China\. Xiaoke Sun is with the National Computer Network Emergency Response Technical Team/Coordination Center of China \(CNCERT/CC\), Beijing 100029, China\.
###### Abstract
Fine\-grained offensive language detection organizes labels into a hierarchical structure, for which two modeling paradigms exist: cascaded decomposition and joint multi\-task modeling\. Prior work rarely provides a direct, controlled comparison of the two paradigms in terms of accuracy, parameter count, and inference latency, and rarely verifies whether a chosen class\-imbalance handling strategy is actually optimal\. This paper proposes a three\-level cascaded detection system whose training strategy is customized per subtask, together with two verification mechanisms\. First, a controlled ablation study determines the best class\-imbalance handling strategy for each subtask\. Second, a joint multi\-task model with a shared encoder is trained as an architectural control, yielding real measurements along the dimensions of accuracy, parameter count, and inference latency\. Experiments show that the cascaded system attains macro\-F1 scores of 0\.795, 0\.716, and 0\.557 on the three subtasks of the official test set\. The ablation study reveals that configuring the loss function purely by imbalance\-severity intuition is suboptimal; reconfiguring based on the ablation results improves both performance and stability\. End\-to\-end cascade evaluation shows that roughly one\-fifth of the errors in the cascade pipeline originate from the first\-stage filter and cannot be corrected by subsequent stages\. Relative to the joint multi\-task model, the cascaded architecture achieves higher accuracy on all three subtasks, with a 7\.1\-point macro\-F1 gain on the most severely imbalanced subtask, at the cost of three times the parameters and 1\.67 times the inference latency\. Together, these results establish an explicit, quantifiable trade\-off between the accuracy advantage of cascaded architectures and their deployment cost\.
## IIntroduction
Automatic detection of offensive content on social media platforms remains a core technical challenge for content safety governance\[[1](https://arxiv.org/html/2607.16790#bib.bib1)\]\. Detection methods in this area have progressively moved from traditional machine learning to fine\-tuning pretrained language models such as BERT, yet research remains heavily concentrated on English, and fine\-grained, multi\-level offensive\-language judgments receive markedly less systematic validation than coarse\-grained binary classification\[[2](https://arxiv.org/html/2607.16790#bib.bib2)\]\. Compared with a simple binary judgment, fine\-grained detection, that is, jointly determining whether content is offensive, whether the offense targets an identifiable entity, and whether the target is an individual or a group, can provide moderators with more actionable guidance\[[3](https://arxiv.org/html/2607.16790#bib.bib3),[4](https://arxiv.org/html/2607.16790#bib.bib4)\]\. Such fine\-grained label schemes naturally form a hierarchical structure, and how to choose an appropriate modeling paradigm for this structure, as well as how to handle the increasingly severe class imbalance found deeper in the hierarchy, remains an underexplored engineering problem\.
On the task side, the OLID dataset and its three\-level annotation scheme, introduced by Zampieri et al\.\[[5](https://arxiv.org/html/2607.16790#bib.bib5),[6](https://arxiv.org/html/2607.16790#bib.bib6)\], are among the most widely used benchmarks in this direction, and a later multilingual extension\[[7](https://arxiv.org/html/2607.16790#bib.bib7)\]further confirmed the generality of this annotation framework\. Around similar fine\-grained offensive content judgment tasks, recent systems have continued to combine ensembling with fine\-tuning\. Ganguly et al\.\[[8](https://arxiv.org/html/2607.16790#bib.bib8)\]used XLM\-RoBERTa together with a multi\-model ensemble in the 2024 multimodal hate speech detection task, ranking third on both the identification and the target localization subtasks; Guragain et al\.\[[9](https://arxiv.org/html/2607.16790#bib.bib9)\]ensembled several multilingual BERT variants for Devanagari hate speech detection in 2025 and applied back\-translation augmentation specifically to address class imbalance\. All of these systems are designed for a single hierarchy level and do not address the choice of modeling paradigm for the hierarchy itself\.
Two modeling paradigms exist for hierarchical label structures, a distinction formalized in the survey of hierarchical classification by Silla and Freitas\[[10](https://arxiv.org/html/2607.16790#bib.bib10)\]: local classifier approaches, corresponding to cascaded decomposition, train a separate classifier for each level, where the prediction at one level determines whether a sample proceeds to the next, while global classifier approaches, corresponding to joint multi\-task modeling, instead use a single model to predict all levels simultaneously\. Dai et al\.\[[11](https://arxiv.org/html/2607.16790#bib.bib11)\]proposed a shared\-encoder joint multi\-task method for the same three\-level OLID task addressed in this paper, exploiting mutually reinforcing supervision across subtasks to achieve results close to the best system of that year using only OLID\[[5](https://arxiv.org/html/2607.16790#bib.bib5)\]data\. Mnassri et al\.\[[12](https://arxiv.org/html/2607.16790#bib.bib12)\]combined joint multi\-task learning with external emotion features, using BERT and multilingual BERT to address offensive content detection in monolingual and cross\-lingual settings respectively, alleviating the imbalance and scarcity of labeled data\. Saha et al\.\[[13](https://arxiv.org/html/2607.16790#bib.bib13)\]further extended joint modeling to the simultaneous prediction of type, target, and severity in the 2025 Bangla hate speech identification task, a structure closely resembling the three\-level OLID scheme\. These works all validate the effectiveness of joint modeling, but the real trade\-off between joint modeling and cascaded decomposition in terms of accuracy, parameter count, and inference latency has not previously been directly examined\.
At the same time, deeper levels of the hierarchy tend to have fewer samples and more severe class imbalance; the second level of the OLID three\-level scheme already reaches an imbalance ratio of 7\.5 to 1\. Class imbalance is a long\-studied problem in machine learning, and Johnson and Khoshgoftaar\[[14](https://arxiv.org/html/2607.16790#bib.bib14)\]survey the range of deep\-learning remedies, which broadly fall into resampling the training distribution, exemplified by the SMOTE oversampling method of Chawla et al\.\[[15](https://arxiv.org/html/2607.16790#bib.bib15)\], and reweighting the loss contribution of each sample, as in the Focal Loss proposed by Lin et al\.\[[16](https://arxiv.org/html/2607.16790#bib.bib16)\]\. The system of Guragain et al\.\[[9](https://arxiv.org/html/2607.16790#bib.bib9)\]mentioned above likewise designs a dedicated augmentation scheme for this problem\. However, how to choose an appropriate strategy for different levels and different degrees of imbalance is, in most prior work, left to intuition about the imbalance ratio rather than being verified through systematic ablation\.
These three gaps, namely the absence of a genuine, multi\-dimensional comparison between hierarchical modeling paradigms, the absence of systematic verification of class\-imbalance handling strategies, and the absence of a quantitative analysis of error propagation through the hierarchy, together motivate this work\. Table[I](https://arxiv.org/html/2607.16790#S1.T1)compares representative prior work with this paper along five dimensions\.
TABLE I:Comparison with Representative Prior WorkWorkCascadeJoint ComparisonLoss AblationE2E ErrorParams/LatencyZampieri et al\.\[[5](https://arxiv.org/html/2607.16790#bib.bib5),[6](https://arxiv.org/html/2607.16790#bib.bib6)\]Hierarchical protocol×\\times×\\times×\\times×\\timesDai et al\.\[[11](https://arxiv.org/html/2607.16790#bib.bib11)\]×\\timesJoint model only×\\times×\\times×\\timesMnassri et al\.\[[12](https://arxiv.org/html/2607.16790#bib.bib12)\]×\\timesJoint model only×\\times×\\times×\\timesSaha et al\.\[[13](https://arxiv.org/html/2607.16790#bib.bib13)\]×\\timesJoint model only×\\times×\\times×\\timesThis work✓✓✓✓✓To address this gap, this paper proposes a three\-level cascaded offensive language detection system whose training strategy is customized per subtask, and systematically validates the effectiveness of its design choices\. The contributions of this paper are summarized as follows\.
- •A task\-adaptive class\-imbalance handling scheme\. The loss function is selected independently for each subtask, and the class weighting of Focal Loss is vectorized rather than left as a scalar; combined with a controlled\-variable ablation protocol, this corrects the practice of configuring the strategy purely by imbalance\-severity intuition\.
- •A joint multi\-task control model with task gating\. A gating term that depends on the ground\-truth label of the upper level masks out invalid loss contributions, making the cascaded architecture and the joint model comparable under identical experimental conditions and yielding real measurements along the dimensions of accuracy, parameter count, and inference latency\.
- •A two\-tier evaluation protocol\. Beyond the existing per\-task standard evaluation, an end\-to\-end cascade evaluation is introduced, in which the model’s own predictions are propagated level by level, attributing the system’s final errors to a specific subtask stage\.
The remainder of this paper is organized as follows\. Section[II](https://arxiv.org/html/2607.16790#S2)describes the data, model architecture, and experimental design\. Section[III](https://arxiv.org/html/2607.16790#S3)presents the experimental results and analysis\. Section[IV](https://arxiv.org/html/2607.16790#S4)concludes the paper and discusses its limitations\.
## IIMethod
### II\-AMethod Overview
The proposed offensive language detection system consists of three components that work together, with the data flow and training pipeline shown in Fig\.[1](https://arxiv.org/html/2607.16790#S2.F1)\. At the data level, input text is organized under the OLID three\-level annotation scheme \(Section[II\-B](https://arxiv.org/html/2607.16790#S2.SS2)\) into three hierarchically dependent subtasks: determining offensiveness, determining whether the offense targets an identifiable entity, and determining the type of target\. At the model level, each subtask has an independent classification head that takes the semantic representation produced by the shared backbone \(Section[II\-C](https://arxiv.org/html/2607.16790#S2.SS3)\) and, as described in Section[II\-D](https://arxiv.org/html/2607.16790#S2.SS4), maps it to a class probability distribution; this distribution then serves as the input to the task\-adaptive loss function of Section[II\-E](https://arxiv.org/html/2607.16790#S2.SS5), which drives the gradient updates of the classification head, with the specific form of the loss function for each subtask determined by the ablation protocol of Section[II\-H](https://arxiv.org/html/2607.16790#S2.SS8)\. As a quantitative control, Section[II\-F](https://arxiv.org/html/2607.16790#S2.SS6)introduces a joint multi\-task model with task gating that keeps every other setting fixed and varies only the architecture, so that any difference in accuracy can be explicitly attributed to the modeling paradigm\. Section[II\-G](https://arxiv.org/html/2607.16790#S2.SS7)gives the training details shared by all models\. Finally, the two\-tier evaluation protocol of Section[II\-I](https://arxiv.org/html/2607.16790#S2.SS9)quantifies system performance from both the standard benchmark perspective and the end\-to\-end cascade perspective\.
### II\-BData and the Three\-Level Label Scheme
This paper uses the OLID\[[5](https://arxiv.org/html/2607.16790#bib.bib5)\]dataset, which after cleaning contains 13,203 English tweets, split 9:1 into training and validation sets of 11,882 and 1,321 examples respectively, with a separate official test set used for final reporting containing 860, 240, and 213 examples for subtasks A, B, and C\. The dataset follows a three\-level annotation scheme: subtask A determines offensiveness, with labels OFF or NOT, at 33\.3% and 66\.7% of the training set; subtask B is annotated only for OFF examples and determines whether the offense targets an identifiable entity, with labels TIN or UNT at 88\.2% and 11\.8%; subtask C is annotated only for TIN examples and determines the type of target, with labels IND, GRP, or OTH, representing an individual, a group, or other, at 62\.3%, 27\.3%, and 10\.3% respectively\. The imbalance ratios of the three subtasks are approximately 2 to 1, 7\.5 to 1, and 6 to 1, all different from one another, and this difference is the direct motivation for customizing the training strategy per task in this paper\.
### II\-CBackbone Model
This paper usesbert\-base\-uncased\[[17](https://arxiv.org/html/2607.16790#bib.bib17)\]as the shared semantic backbone, encoding the input text into a fixed\-dimensional contextual representation; the classification heads of the three subtasks are trained independently\. The backbone does not participate in the hierarchical decision logic described in Section[II\-B](https://arxiv.org/html/2607.16790#S2.SS2)and only supplies a unified semantic feature for each classification head to use; the classification head structure and probability mapping are given in Section[II\-D](https://arxiv.org/html/2607.16790#S2.SS4)\.
### II\-DCascaded Classification Heads and Probability Computation
The three subtasks share the same classification head structure, whose input is the\[CLS\]representationh∈ℝ768h\\in\\mathbb\{R\}^\{768\}produced by the backbone described in Section[II\-C](https://arxiv.org/html/2607.16790#S2.SS3), and whose output is the class probability distribution for that subtask\. The classification head first applies Dropout\[[18](https://arxiv.org/html/2607.16790#bib.bib18)\]and then a fully connected layer, mappinghhto a raw score vectorzzof lengthKK, which is then converted by the Softmax function into a class probability distribution𝐩=\[p1,…,pK\]\\mathbf\{p\}=\[p\_\{1\},\\dots,p\_\{K\}\]:
z=Wh\+b,pi=ezi∑j=1Kezjz=Wh\+b,\\qquad p\_\{i\}=\\frac\{e^\{z\_\{i\}\}\}\{\\sum\_\{j=1\}^\{K\}e^\{z\_\{j\}\}\}\(1\)whereKKis the number of classes for that subtask, equal to 2 for subtasks A and B and 3 for subtask C\. This probability distribution𝐩\\mathbf\{p\}serves two purposes\. During training, it is the input to the loss function described in Section[II\-E](https://arxiv.org/html/2607.16790#S2.SS5), which measures the deviation between the prediction and the ground truth and drives the gradient update of the model parameters; during inference, the class index attaining the maximum value is taken as the prediction for that subtask and determines, under the cascaded structure, whether the next subtask is invoked\. The full cascade inference procedure is given in Algorithm[1](https://arxiv.org/html/2607.16790#alg1), whereargmax\(⋅\)\\text\{argmax\}\(\\cdot\)returns the class index with the highest probability andMAM\_\{A\},MBM\_\{B\},MCM\_\{C\}denote the trained models for the three subtasks\.
Algorithm 1Three\-Level Cascade Inference0:Input text
xx; subtask models
MA,MB,MCM\_\{A\},M\_\{B\},M\_\{C\}
0:Three\-level prediction
\(y^A,y^B,y^C\)\(\\hat\{y\}\_\{A\},\\hat\{y\}\_\{B\},\\hat\{y\}\_\{C\}\)
1:
𝐩A←MA\(x\)\\mathbf\{p\}\_\{A\}\\leftarrow M\_\{A\}\(x\)
2:
y^A←argmax\(𝐩A\)\\hat\{y\}\_\{A\}\\leftarrow\\text\{argmax\}\(\\mathbf\{p\}\_\{A\}\)
3:
y^B←∅;y^C←∅\\hat\{y\}\_\{B\}\\leftarrow\\varnothing;\\ \\hat\{y\}\_\{C\}\\leftarrow\\varnothing
4:if
y^A=OFF\\hat\{y\}\_\{A\}=\\text\{OFF\}then
5:
𝐩B←MB\(x\)\\mathbf\{p\}\_\{B\}\\leftarrow M\_\{B\}\(x\)
6:
y^B←argmax\(𝐩B\)\\hat\{y\}\_\{B\}\\leftarrow\\text\{argmax\}\(\\mathbf\{p\}\_\{B\}\)
7:if
y^B=TIN\\hat\{y\}\_\{B\}=\\text\{TIN\}then
8:
𝐩C←MC\(x\)\\mathbf\{p\}\_\{C\}\\leftarrow M\_\{C\}\(x\)
9:
y^C←argmax\(𝐩C\)\\hat\{y\}\_\{C\}\\leftarrow\\text\{argmax\}\(\\mathbf\{p\}\_\{C\}\)
10:endif
11:endif
12:return
\(y^A,y^B,y^C\)\(\\hat\{y\}\_\{A\},\\hat\{y\}\_\{B\},\\hat\{y\}\_\{C\}\)
Algorithm[1](https://arxiv.org/html/2607.16790#alg1)explicitly reflects two properties of the cascaded architecture proposed in this paper\. First, the number of models a sample passes through adapts to its content complexity; a NOT example needs only a single forward pass to return a result, which lowers average inference latency\. Second, a prediction error at an earlier stage cannot be corrected by a later stage: ify^A\\hat\{y\}\_\{A\}misclassifies a truly OFF example as NOT,MBM\_\{B\}andMCM\_\{C\}are never invoked, and that example permanently loses any chance of correction on subtasks B and C\. This property directly motivates the end\-to\-end cascade evaluation protocol of Section[II\-I](https://arxiv.org/html/2607.16790#S2.SS9)\.
### II\-ETask\-Adaptive Class\-Imbalance Optimization
The imbalance ratios of the three subtasks shown in Section[II\-B](https://arxiv.org/html/2607.16790#S2.SS2)are approximately 2 to 1, 7\.5 to 1, and 6 to 1, all different from one another; this difference means that a single loss function is unlikely to be simultaneously optimal for all three subtasks, and an appropriate class\-imbalance handling strategy must be chosen for each\. This paper considers two representative loss functions, which share the same inverse\-frequency class weighting and differ only in whether they include a hard\-example focusing mechanism\.
Given the class probability𝐩\\mathbf\{p\}output by the classification head via Eq\. \([1](https://arxiv.org/html/2607.16790#S2.E1)\), class\-weighted cross\-entropy reweights the contribution of each class by the inverse of its frequency in the training set, mitigating the extent to which the majority class dominates the direction of the gradient update:
ℒCE=−∑c=1Kwcyclogpc,wc=NK×nc\\mathcal\{L\}\_\{\\text\{CE\}\}=\-\\sum\_\{c=1\}^\{K\}w\_\{c\}\\,y\_\{c\}\\log p\_\{c\},\\qquad w\_\{c\}=\\frac\{N\}\{K\\times n\_\{c\}\}\(2\)whereNNis the total number of training samples,ycy\_\{c\}is the one\-hot encoding of the ground\-truth label,ncn\_\{c\}is the number of samples in classcc, andwcw\_\{c\}is the weight assigned to classcc\. Equation \([2](https://arxiv.org/html/2607.16790#S2.E2)\) adjusts only the overall contribution of each class and treats easy and hard examples within the same class identically\. For more severely imbalanced settings, Focal Loss\[[16](https://arxiv.org/html/2607.16790#bib.bib16)\]builds on this by introducing a hard\-example focusing mechanism that further downweights easy examples:
ℒfocal=−αy\(1−pt\)γlogpt\\mathcal\{L\}\_\{\\text\{focal\}\}=\-\\alpha\_\{y\}\(1\-p\_\{t\}\)^\{\\gamma\}\\log p\_\{t\}\(3\)whereptp\_\{t\}is the model’s predicted probability for the true class andγ\\gammais the focusing parameter, set to 2\.0 in this paper\. To let Eq\. \([3](https://arxiv.org/html/2607.16790#S2.E3)\) share the same class\-weighting abstraction as Eq\. \([2](https://arxiv.org/html/2607.16790#S2.E2)\) and thereby support a rigorous comparison, this paper setsαy\\alpha\_\{y\}to the same per\-class weight vector aswcw\_\{c\}in Eq\. \([2](https://arxiv.org/html/2607.16790#S2.E2)\), rather than letting it degenerate into a global scalar; only in this form does the loss function simultaneously provide class reweighting and hard\-example focusing\. Which loss function each subtask should use is not specified directly by its imbalance ratio, but is instead determined independently for each subtask through the ablation protocol of Section[II\-H](https://arxiv.org/html/2607.16790#S2.SS8), with results reported in Section[III\-B](https://arxiv.org/html/2607.16790#S3.SS2)\.
Figure 1:The cascaded architecture \(top\) and the joint multi\-task control model \(bottom\), sharing a unified evaluation protocol\.
### II\-FJoint Multi\-Task Control Model
To directly compare the cascaded architecture of Section[II\-D](https://arxiv.org/html/2607.16790#S2.SS4)with the joint modeling paradigm under identical experimental conditions, this paper constructs a joint multi\-task model that differs from the cascaded architecture only at the architectural level\. Its encoder is shared across the three subtasks while the classification heads remain independent; the input text is encoded once by the shared encoder into a single\[CLS\]representation, which is then fed to all three classification heads to obtain the class probabilities for all three subtasks\. Because a lower\-level label is available for a given training example only when the corresponding hierarchical dependency is satisfied, subtask B only when the subtask A label is OFF, and subtask C only when the subtask B label is TIN, the three loss terms cannot be computed uniformly for every example\. To address this, a task\-gating term that depends on the ground\-truth label of the upper level is introduced into the joint loss to mask out inapplicable loss contributions:
ℒjoint=ℒA\+ℒB⋅mB\+ℒC⋅mC\\mathcal\{L\}\_\{\\text\{joint\}\}=\\mathcal\{L\}\_\{A\}\+\\mathcal\{L\}\_\{B\}\\cdot m\_\{B\}\+\\mathcal\{L\}\_\{C\}\\cdot m\_\{C\}\(4\)whereℒA\\mathcal\{L\}\_\{A\},ℒB\\mathcal\{L\}\_\{B\},ℒC\\mathcal\{L\}\_\{C\}are each computed using the same loss function described in Section[II\-E](https://arxiv.org/html/2607.16790#S2.SS5),mBm\_\{B\}equals 1 when the subtask A label of the example is OFF and 0 otherwise, andmCm\_\{C\}equals 1 when the subtask B label is TIN and 0 otherwise\. This gating design preserves the representation\-sharing effect of the shared encoder while avoiding the noise that would be introduced by driving gradient updates with invalid labels\. This joint model uses the same backbone, the same training data, and the same evaluation protocol as the cascaded architecture of Section[II\-D](https://arxiv.org/html/2607.16790#S2.SS4); the only difference is that the three tasks share a single encoder rather than being trained independently, so that the differences in accuracy, parameter count, and inference latency observed in Section[III\-D](https://arxiv.org/html/2607.16790#S3.SS4)can be attributed directly to the modeling paradigm itself\.
### II\-GOptimizer and Training Setup
This paper follows the general fine\-tuning recipe for BERT\-based text classification established by Sun et al\.\[[19](https://arxiv.org/html/2607.16790#bib.bib19)\]\. Training uses the AdamW optimizer\[[20](https://arxiv.org/html/2607.16790#bib.bib20)\]with a discriminative learning rate\[[21](https://arxiv.org/html/2607.16790#bib.bib21)\],2×10−52\\times 10^\{\-5\}for the encoder and1×10−41\\times 10^\{\-4\}for the classification heads, together with a schedule that linearly warms up over the first 10% of training steps and then decays linearly\. Training length is controlled by early stopping with a patience of 3, monitored on validation macro\-F1, with a batch size of 16, a maximum sequence length of 128, and FP16 mixed precision enabled throughout training\.
### II\-HAblation Design
To verify the choice of class\-imbalance handling strategy, this paper tests three loss functions on each of the three subtasks: plain cross\-entropy, the class\-weighted cross\-entropy of Eq\. \([2](https://arxiv.org/html/2607.16790#S2.E2)\), and the Focal Loss of Eq\. \([3](https://arxiv.org/html/2607.16790#S2.E3)\), giving3×3=93\\times 3=9configurations\. Each configuration is independently repeated 3 times, with the random seed reset before every repetition, and the mean and standard deviation are reported to avoid a single run’s outcome misleadingly driving the conclusion\.
### II\-IEvaluation Protocol
This paper adopts two complementary evaluation protocols\. The per\-task standard evaluation is carried out on each subtask’s own official test set and is directly comparable with results reported in prior work\. The end\-to\-end cascade evaluation instead follows the inference procedure of Algorithm[1](https://arxiv.org/html/2607.16790#alg1)on the validation set, propagating the model’s own predictions, rather than the ground truth, through subtasks A, B, and C in sequence, and counts an example as end\-to\-end correct only when all three predicted levels match the ground truth; this quantifies the real impact of error propagation through the cascaded structure described in Section[II\-D](https://arxiv.org/html/2607.16790#S2.SS4)\. This protocol uses the validation set rather than the official test set because the official test set is released separately per subtask, so no public subset of examples carries ground\-truth labels for all three levels simultaneously\.
Because all three subtasks exhibit some degree of class imbalance, plain accuracy would be dominated by the majority class and fail to reflect the model’s ability to discriminate minority classes; both protocols therefore use macro\-F1, which weighs the performance on each class equally, as the core metric:
F1macro=1K∑i=1K2Precisioni⋅RecalliPrecisioni\+Recalli\\text\{F1\}\_\{\\text\{macro\}\}=\\frac\{1\}\{K\}\\sum\_\{i=1\}^\{K\}\\frac\{2\\,\\text\{Precision\}\_\{i\}\\cdot\\text\{Recall\}\_\{i\}\}\{\\text\{Precision\}\_\{i\}\+\\text\{Recall\}\_\{i\}\}\(5\)whereKKis the number of classes in the task being evaluated, andPrecisioni\\text\{Precision\}\_\{i\}andRecalli\\text\{Recall\}\_\{i\}are the precision and recall for classii\.
## IIIExperiments and Results
### III\-AExperimental Setup
Experiments were carried out on a single NVIDIA RTX 4060 Ti with 16GB of memory, running PyTorch 2\.3\.0\+cu121\. Fig\.[1](https://arxiv.org/html/2607.16790#S2.F1)shows the structure of the cascaded architecture and the joint multi\-task control model, which share the same evaluation protocol to ensure strictly comparable results\.
Table[II](https://arxiv.org/html/2607.16790#S3.T2)and Fig\.[2](https://arxiv.org/html/2607.16790#S3.F2)report the final results of the cascaded system on the official test set, given as the mean and standard deviation over 5 independent repetitions, each using a different random seed reset before training so that the results are mutually independent\. The macro\-F1 scores of subtasks A, B, and C are 0\.795, 0\.716, and 0\.557 respectively, all significantly above the majority\-class baselines of 0\.42, 0\.47, and 0\.21; subtasks A and B are on the same order as the 0\.83 and 0\.76 achieved by the best official systems of OffensEval 2019\[[6](https://arxiv.org/html/2607.16790#bib.bib6)\], while subtask C still trails the 0\.66 achieved by the best official system, which is directly related to this subtask having the fewest training examples and the hardest three\-way decision boundary\. The standard deviation for subtask B reaches 0\.037, markedly larger than the 0\.004 for subtask A, which is directly related to subtask B having both the smallest official test set, only 240 examples, and the most severe class imbalance; small test sets are more sensitive to individual prediction errors\.
Figure 2:Macro\-F1 of the three subtasks on the official test set, compared with the majority\-class baseline and the best official OffensEval 2019 system; error bars show the standard deviation over 5 independent repetitions\.TABLE II:Main Results: Macro\-F1 on the Official Test Set, Mean±\\pmStandard Deviation over 5 Independent RepetitionsSubtask ASubtask BSubtask CMajority baseline0\.420\.470\.21This work0\.795±\\pm0\.0040\.716±\\pm0\.0370\.557±\\pm0\.020OffensEval Top0\.830\.760\.66Fig\.[3](https://arxiv.org/html/2607.16790#S3.F3)shows the confusion matrices of the three subtasks on the official test set, taken from a representative repetition that attains the mean level reported in Table[II](https://arxiv.org/html/2607.16790#S3.T2)\. Errors on subtask A are concentrated in the direction of offensive examples being misclassified as non\-offensive; errors on subtask C mainly occur between GRP and the other two classes, indicating that the boundary between group targets and individual or other targets is more easily confused at the level of surface text features\.
Figure 3:Confusion matrices of the three subtasks on the official test set\.
### III\-BLoss\-Strategy Ablation
Table[III](https://arxiv.org/html/2607.16790#S3.T3)and Fig\.[4](https://arxiv.org/html/2607.16790#S3.F4)report the ablation results\. The results show that the intuition\-based strategy of assigning a simpler loss to a less\-imbalanced subtask and a more complex loss to a more\-imbalanced one does not hold: the optimal strategy for each of the three subtasks disagrees with this intuition\-based configuration\. The best strategy for both subtasks A and B is class\-weighted cross\-entropy, improving over the intuition\-based configuration by 0\.6 and 1\.2 points respectively while also reducing the standard deviation; the best strategy for subtask C is Focal Loss, improving by 0\.9 points and reducing the standard deviation to one\-fifth of its previous value\. These results indicate that the choice of class\-imbalance handling strategy must be verified experimentally for each specific task rather than inferred from the imbalance ratio alone\.
TABLE III:Loss\-Strategy Ablation Results: Validation Macro\-F1, Mean±\\pmStandard Deviation,n=3n=3Cross\-EntropyClass\-WeightedFocalSubtask A0\.768±\\pm0\.0130\.774±\\pm0\.0040\.770±\\pm0\.004Subtask B0\.594±\\pm0\.0240\.606±\\pm0\.0140\.596±\\pm0\.004Subtask C0\.547±\\pm0\.0130\.559±\\pm0\.0150\.568±\\pm0\.003Figure 4:Validation macro\-F1 of the three loss\-function strategies on the three subtasks; error bars show the standard deviation over 3 independent repetitions\.To ensure the statistical comparability and reliability of the ablation study above, every independent run used an independently reset random seed within an isolated run context, preventing the order in which different configurations consume randomness from interfering across configurations111In an early pilot version, a random seed fixed only at the outer loop caused the random state to drift cumulatively with the order of configurations, producing a cross\-configuration bias that made the baselines incomparable; this issue has been fixed through the isolation strategy described above\.\. The final results in Table[III](https://arxiv.org/html/2607.16790#S3.T3)and Table[II](https://arxiv.org/html/2607.16790#S3.T2)were both measured under this strict isolation condition\. Based on the ablation results in Table[III](https://arxiv.org/html/2607.16790#S3.T3), this paper adopts the configuration identified as optimal, namely class\-weighted cross\-entropy for subtasks A and B and Focal Loss for subtask C, as the training configuration used to report official test set performance in Table[II](https://arxiv.org/html/2607.16790#S3.T2)\.
### III\-CEnd\-to\-End Cascade Error Propagation
An end\-to\-end cascade evaluation was carried out on the validation set of 1,321 examples, in which the model’s own predictions, rather than the ground truth, are propagated through subtasks A, B, and C in sequence\. The end\-to\-end strict accuracy, requiring all three predicted levels to match the ground truth, is 0\.717, with errors originating from subtask A accounting for 19\.6% of all errors\. This proportion indicates that roughly one\-fifth of the final errors in the cascaded structure already occur at the first\-stage filter; no matter how much the discriminative accuracy of subtasks B and C is improved, these errors cannot be corrected, and they constitute an upper bound on the error propagation inherent to the cascaded architecture itself\.
### III\-DCascaded Architecture versus Joint Multi\-Task Model
Table[IV](https://arxiv.org/html/2607.16790#S3.T4)and Fig\.[5](https://arxiv.org/html/2607.16790#S3.F5)give a direct comparison, on the official test set, between the cascaded architecture and the joint multi\-task model of Section[II\-F](https://arxiv.org/html/2607.16790#S2.SS6)\. The cascaded architecture achieves higher accuracy on all three subtasks; the gains on subtasks A and C are smaller, 1\.4 and 0\.7 points respectively, while the gain on subtask B reaches 7\.1 points, the largest of the three\. This difference is directly related to subtask B having the most severe class imbalance: the cascaded architecture assigns this subtask an independent model with a dedicated class\-weighted loss that can be optimized entirely for this one task, whereas the shared encoder of the joint model must balance the gradient signals of all three tasks at once, so the negative\-transfer effect of representation sharing is most pronounced on the task with the most severe imbalance and the greatest learning difficulty\.
TABLE IV:Cascaded Architecture versus Joint Multi\-Task Model on the Official Test SetCascadeJoint MTLDifferenceSubtask A Macro\-F10\.7940\.780\+1\.4ppSubtask B Macro\-F10\.7090\.638\+7\.1ppSubtask C Macro\-F10\.5900\.583\+0\.7ppParameters328\.5M109\.5M3\.00×\\timesInference latency12\.40±\\pm0\.69ms7\.41±\\pm0\.14ms1\.67×\\timesFigure 5:Comparison between the cascaded architecture and the joint multi\-task model along accuracy, parameter count, and inference latency\.Fig\.[6](https://arxiv.org/html/2607.16790#S3.F6)shows the training dynamics of the joint multi\-task model\. Subplot \(a\) shows that while the training loss continues to decrease, the combined validation metric peaks around epoch 4 and then declines, a typical overfitting signature; subplot \(b\) breaks this down by subtask and shows that the validation curve for subtask B fluctuates the most, corroborating the result in Table[IV](https://arxiv.org/html/2607.16790#S3.T4)that this subtask suffers the largest accuracy loss under the joint model: on the subtask with the most severe class imbalance, the shared encoder not only attains lower final accuracy but is also less stable during training\.
Figure 6:Training dynamics of the joint multi\-task model\. Subplot \(a\) shows overall training dynamics; subplot \(b\) shows the validation macro\-F1 of each of the three subtasks\.Taking the three dimensions of Table[IV](https://arxiv.org/html/2607.16790#S3.T4)together, there is no absolute winner between the cascaded architecture and the joint multi\-task model; rather, they present a quantifiable engineering trade\-off\. If a deployment scenario is highly sensitive to parameter count and inference latency, the joint multi\-task model trades a modest accuracy cost for a one\-third reduction in parameters and nearly a 40% reduction in latency\. If a deployment scenario instead prioritizes detection accuracy on class\-imbalanced subtasks, the additional deployment cost of the cascaded architecture buys a meaningful accuracy gain, with the largest benefit on severely imbalanced subtasks such as subtask B\.
### III\-ELimitations
The loss\-strategy ablation in this paper uses 3 independent repetitions, a relatively limited sample; the optimal strategy for subtask C is determined mainly from validation set results, and the official test set, which is small, only 213 examples with the smallest class OTH containing only 35 examples, showed observations under some configurations that were not fully consistent with the validation set, which is reported honestly in the text\. The comparison between the cascaded architecture and the joint multi\-task model is currently based on a single training run for each, without multiple repetitions to obtain confidence intervals, which is a statistical limitation of this paper left for future work\.
## IVConclusion
This paper proposed a three\-level cascaded offensive language detection system whose training strategy was customized per subtask, validated the choice of class\-imbalance handling strategy through ablation, quantified the accuracy advantage and deployment cost of the cascaded architecture relative to the shared\-representation paradigm through a genuinely trained joint multi\-task model, and quantified the real impact of error propagation through the cascaded structure through an end\-to\-end evaluation protocol\. The results showed that configuring the loss function purely by imbalance\-ratio intuition was suboptimal and had to be verified through controlled ablation; the cascaded architecture outperformed the joint multi\-task model on all three subtasks, with the largest advantage on the subtask with the most severe class imbalance, at the cost of three times the parameters and higher inference latency; and roughly one\-fifth of the end\-to\-end errors in the cascaded structure originated from the first\-stage filter, constituting an upper bound on error propagation\. These results provided a quantifiable engineering basis for architecture selection in offensive language detection systems: whether to allocate an independent model to the subtask with the most severe class imbalance should be decided by weighing that subtask’s accuracy gain against the system’s overall constraints on parameter count and latency\.
## References
- \[1\]R\. Ren, J\. Zhao, X\. Sun, and Q\. Li, “NLP\-based review for toxic comment detection tailored to the Chinese cyberspace,”*arXiv preprint arXiv:2601\.14721*, 2026\.
- \[2\]G\. Ramos, F\. Batista, R\. Ribeiro, P\. Fialho, S\. Moro, A\. Fonseca, and C\. Silva, “A comprehensive review on automatic hate speech detection in the age of the transformer,”*Social Network Analysis and Mining*, vol\. 14, no\. 1, Art\. no\. 204, 2024\.
- \[3\]J\. Lu, B\. Xu, X\. Zhang, C\. Min, L\. Yang, and H\. Lin, “Facilitating fine\-grained detection of Chinese toxic language: Hierarchical taxonomy, resources, and benchmarks,” in*Proc\. 61st Annual Meeting of the Association for Computational Linguistics \(ACL\)*, 2023, pp\. 16235–16250\.
- \[4\]J\. Deng, J\. Zhou, H\. Sun, C\. Zheng, F\. Mi, H\. Meng, and M\. Huang, “COLD: A benchmark for Chinese offensive language detection,”*arXiv preprint arXiv:2201\.06025*, 2022\.
- \[5\]M\. Zampieri, S\. Malmasi, P\. Nakov, S\. Rosenthal, N\. Farra, and R\. Kumar, “Predicting the type and target of offensive posts in social media,” in*Proc\. NAACL\-HLT*, 2019, pp\. 1415–1420\.
- \[6\]M\. Zampieri, S\. Malmasi, P\. Nakov, S\. Rosenthal, N\. Farra, and R\. Kumar, “SemEval\-2019 task 6: Identifying and categorizing offensive language in social media \(OffensEval\),” in*Proc\. 13th Int\. Workshop on Semantic Evaluation*, 2019, pp\. 75–86\.
- \[7\]M\. Zampieri, P\. Nakov, S\. Rosenthal, P\. Atanasova, G\. Karadzhov, H\. Mubarak, L\. Derczynski, Z\. Pitenis, and Ç\. Çöltekin, “SemEval\-2020 task 12: Multilingual offensive language identification in social media \(OffensEval 2020\),” in*Proc\. 14th Workshop on Semantic Evaluation*, 2020, pp\. 1425–1447\.
- \[8\]A\. Ganguly, A\. N\. B\. Emran, S\. S\. C\. Puspo, M\. N\. Raihan, D\. Goswami, and M\. Zampieri, “MasonPerplexity at multimodal hate speech event detection 2024: Hate speech and target detection using transformer ensembles,” in*Proc\. 7th Workshop on Challenges and Applications of Automated Extraction of Socio\-political Events from Text \(CASE\), EACL*, 2024\.
- \[9\]A\. Guragain, N\. Poudel, R\. Piryani, and B\. Khanal, “NLPineers@ NLU of Devanagari script languages 2025: Hate speech detection using ensembling of BERT\-based models,” in*Proc\. CHIP\-SAL Workshop, COLING*, 2025\.
- \[10\]C\. N\. Silla Jr\. and A\. A\. Freitas, “A survey of hierarchical classification across different application domains,”*Data Mining and Knowledge Discovery*, vol\. 22, no\. 1–2, pp\. 31–72, 2011\.
- \[11\]W\. Dai, T\. Yu, Z\. Liu, and P\. Fung, “Kungfupanda at SemEval\-2020 Task 12: BERT\-based multi\-task learning for offensive language detection,” in*Proc\. 14th Workshop on Semantic Evaluation*, 2020, pp\. 2060–2066\.
- \[12\]K\. Mnassri, P\. Rajapaksha, R\. Farahbakhsh, and N\. Crespi, “Hate speech and offensive language detection using an emotion\-aware shared encoder,” in*Proc\. IEEE Int\. Conf\. Communications \(ICC\)*, 2023\.
- \[13\]S\. Saha, K\. M\. N\. Asib, and M\. M\. Hoque, “Retriv at BLP\-2025 Task 1: A transformer ensemble and multi\-task learning approach for Bangla hate speech identification,” in*Proc\. 2nd Workshop on Bangla Language Processing \(BLP\), IJCNLP\-AACL*, 2025\.
- \[14\]J\. M\. Johnson and T\. M\. Khoshgoftaar, “Survey on deep learning with class imbalance,”*Journal of Big Data*, vol\. 6, no\. 1, Art\. no\. 27, 2019\.
- \[15\]N\. V\. Chawla, K\. W\. Bowyer, L\. O\. Hall, and W\. P\. Kegelmeyer, “SMOTE: Synthetic minority over\-sampling technique,”*Journal of Artificial Intelligence Research*, vol\. 16, pp\. 321–357, 2002\.
- \[16\]T\.\-Y\. Lin, P\. Goyal, R\. Girshick, K\. He, and P\. Dollár, “Focal loss for dense object detection,” in*Proc\. IEEE Int\. Conf\. Computer Vision \(ICCV\)*, 2017, pp\. 2980–2988\.
- \[17\]J\. Devlin, M\.\-W\. Chang, K\. Lee, and K\. Toutanova, “BERT: Pre\-training of deep bidirectional transformers for language understanding,” in*Proc\. NAACL\-HLT*, 2019, pp\. 4171–4186\.
- \[18\]N\. Srivastava, G\. Hinton, A\. Krizhevsky, I\. Sutskever, and R\. Salakhutdinov, “Dropout: A simple way to prevent neural networks from overfitting,”*Journal of Machine Learning Research*, vol\. 15, no\. 56, pp\. 1929–1958, 2014\.
- \[19\]C\. Sun, X\. Qiu, Y\. Xu, and X\. Huang, “How to fine\-tune BERT for text classification?” in*Proc\. China National Conf\. Chinese Computational Linguistics \(CCL\)*, 2019, pp\. 194–206\.
- \[20\]I\. Loshchilov and F\. Hutter, “Decoupled weight decay regularization,” in*Proc\. Int\. Conf\. Learning Representations \(ICLR\)*, 2019\.
- \[21\]J\. Howard and S\. Ruder, “Universal language model fine\-tuning for text classification,” in*Proc\. 56th Annual Meeting of the Association for Computational Linguistics \(ACL\)*, 2018, pp\. 328–339\.Similar Articles
The Cross-Domain Generalization Cost of Offensive Language Detection
This paper proposes a diagnosis and optimization framework for cross-domain and cross-lingual generalization in offensive language detection, decomposing performance degradation into dataset and language effects, and quantifying the trade-off between multilingual capability and source-task performance.
Detecting and Controlling Sycophancy with Cascading Linear Features
Presents an iterative data generation pipeline to isolate cascading linear features responsible for sycophancy in language models, enabling detection, scoring, and steering with lower computational cost than baselines.
Mitigating The Effect of Class Imbalance in Data with Hierarchical and Dependable Structure
Proposes a Hierarchy-Aware RoBERTa framework for classifying cybersecurity vulnerabilities in the CWE taxonomy, demonstrating that hierarchy-aware representation learning is more effective than oversampling techniques for handling class imbalance.
Benchmarking Large Language Models on Multi-Sensor Physical Hazard Assessment
The paper benchmarks five large language models on multi-sensor physical hazard assessment, revealing that all tested models fail to produce precautionary warnings when multiple sensors are simultaneously elevated below their individual safety limits, while achieving near-perfect accuracy on single-sensor violations.
Decomposing the Basic Abilities of Large Language Models: Mitigating Cross-Task Interference in Multi-Task Instruct-Tuning
This paper proposes Badit, a method that decomposes large language model parameters into orthogonal high-singular-value LoRA experts to mitigate cross-task interference during multi-task instruction tuning.