Cross-Platform Chinese Offensive Comment Detection via Dual-Threshold Hard Example Mining
Summary
This paper proposes a dual-threshold hard example mining strategy for cross-platform Chinese offensive comment detection, addressing performance degradation due to domain shift. The method fine-tunes a RoBERTa model on the COLD dataset and adapts it to four Chinese social media platforms with minimal labeled data.
View Cached Full Text
Cached at: 06/29/26, 05:23 AM
# Cross-Platform Chinese Offensive Comment Detection via Dual-Threshold Hard Example Mining
Source: [https://arxiv.org/html/2606.27629](https://arxiv.org/html/2606.27629)
Ruixing Ren[İD](https://orcid.org/0009-0000-1183-9512), Junhui Zhao[İD](https://orcid.org/0000-0001-5958-6622), , and Fangfang WangCorresponding author: Junhui Zhao\. Ruixing Ren, Junhui Zhao and Fangfang Wang are with the School of Electronic and Information Engineering, Beijing Jiaotong University, Beijing 100044, China\. \(e\-mail: renruixing0604@163\.com; junhuizhao@hotmail\.com; 24218346@bjtu\.edu\.cn\)
###### Abstract
Cross\-platform deployment of offensive comment detection for Chinese social media suffers performance degradation\. The paper proposes a dual\-threshold hard mining method to address this\. First, the clean\-Chinese\-base RoBERTa is fine\-tuned on COLD to establish a binary baseline for fair comparison\. Second, a three\-class fine\-labeled test set covering Weibo, Xiaohongshu, Tieba, and Zhihu is constructed, domain distances from the source are quantified using Jaccard and Proxy\-A Distance, as well as the degradation bottleneck of the baseline under domain shift is systematically revealed\. Herein, a dual\-threshold hard example mining strategy is proposed\. High\- and low\-confidence error\-prone samples are filtered from unlabeled corpora by prediction confidence\. The model is secondarily fine\-tuned under implicit contexts with merely a small set of manually labeled hard examples, realizing low\-cost cross\-platform domain adaptation\. Experiments reveal significant performance gains of the optimized model across four platforms\.
## IIntroduction
The booming of online social platforms enables free opinion expression and information sharing among netizens, yet breeds massive offensive, aggressive and hate speech\[[17](https://arxiv.org/html/2606.27629#bib.bib6),[22](https://arxiv.org/html/2606.27629#bib.bib5)\]\. Such content undermines healthy online ecosystems and triggers real\-world social issues including group polarization and psychological harm\[[15](https://arxiv.org/html/2606.27629#bib.bib2)\]\. Automatic detection of offensive comments on Chinese social media is an urgent research topic for network content governance and natural language processing\.
Early studies mostly relied on dictionary matching or traditional machine learning, using manually constructed sensitive lexicons, TF\-IDF and n\-gram shallow features for discrimination\. Despite high computational efficiency, such methods fail to identify implicit attacks including irony, metaphor and pun\-based sarcasm in Chinese contexts\[[13](https://arxiv.org/html/2606.27629#bib.bib3)\]\. Pre\-trained language models represented by BERT and RoBERTa capture deep contextual semantics via bidirectional Transformer architectures, offering new technical routes for offensive detection\[[7](https://arxiv.org/html/2606.27629#bib.bib4)\]\. Existing benchmarks such as the COLD dataset support Chinese scenarios yet mostly confine to single platforms and static data distributions, neglecting model generalization across platforms and time domains\[[4](https://arxiv.org/html/2606.27629#bib.bib7)\]\.
Social platforms differ greatly in user demographics, linguistic styles and community jargon, causing severe performance degradation when source\-domain models transfer to new platforms\[[11](https://arxiv.org/html/2606.27629#bib.bib1)\]\. Such degradation arises from domain shifts in linguistic styles, as well as strong context dependence and subjective annotation ambiguity of implicit offense\. Thus, low\-cost enhancement of model adaptability to heterogeneous multi\-platform contexts while preserving source\-domain detection performance poses urgent engineering and scientific challenges\.
To address these challenges, we build a binary baseline for offensive comment detection on the public COLD dataset based on chinese\-roberta\-wwm\-ext, validating the pre\-training and fine\-tuning paradigm\. The main contributions are summarized as follows\.
- •A cross\-platform evaluation dataset with fine\-grained three\-class annotations covering four platforms is constructed, and core bottlenecks of baseline degradation under domain shifts are revealed\.
- •A lightweight domain adaptation scheme combining dual\-threshold hard sample screening and implicit context fine\-tuning is proposed, which substantially improves multi\-platform generalization performance\.
- •Ablation experiments are performed to demonstrate that hard example mining outperforms random sampling under identical annotation budgets, verifying that sample difficulty rather than quantity dominates fine\-tuning effectiveness\.
The remainder of this paper is organized as follows\. Related studies are reviewed in Section[II](https://arxiv.org/html/2606.27629#S2)\. Baseline model construction and experiments are elaborated in Section[III](https://arxiv.org/html/2606.27629#S3)\. Cross\-platform evaluation and optimization strategies are discussed in Section[IV](https://arxiv.org/html/2606.27629#S4)\. Finally, conclusions are drawn and future research directions are prospected\.
## IIRelated Work
Research on Chinese offensive language detection is continuously advanced with the evolution of data resources and modeling approaches\.
### II\-ADatasets and Methods for Chinese Offensive Language Detection
Early detection methods for Chinese offensive content are mostly built on manually constructed sensitive lexicons and rule\-based matching strategies\. A detection and rephrasing system targeting profane language is presented in\[[12](https://arxiv.org/html/2606.27629#bib.bib8)\], where manually designed rules are adopted to identify and rewrite frequent profane expressions\. Such methods are computationally efficient yet heavily reliant on lexicon coverage, and poor generalization performance is exhibited\. Traditional machine learning and deep learning approaches are subsequently introduced by researchers\. A hybrid CNN\-Bi\-GRU model integrating character\-level and word\-level features is proposed by Zhang et al\.\[[18](https://arxiv.org/html/2606.27629#bib.bib9)\]to mitigate the impact of word segmentation errors on semantic comprehension of short texts\.
The development of this field is significantly promoted by the emergence of pre\-trained language models\. The Chinese offensive language detection benchmark COLD is constructed by Deng et al\.\[[4](https://arxiv.org/html/2606.27629#bib.bib7)\]\. Data of this dataset are collected from Zhihu and Weibo, covering three themes including race, gender and region, and a detector named COLDetector is obtained via fine\-tuning based on bert\-base\-chinese\. ToxiCN is further proposed by Lu et al\.\[[9](https://arxiv.org/html/2606.27629#bib.bib10)\]\. Samples of the dataset are collected from Zhihu and Baidu Tieba\. A hierarchical annotation framework that distinguishes general offensive content from hate speech is established, and coverage of implicit and reported expressions is enhanced\. Modeling methods are continuously improved in follow\-up works based on resources such as COLD\. A three\-level feature fusion model integrating character, word and sentence features is proposed by Li et al\.\[[8](https://arxiv.org/html/2606.27629#bib.bib11)\]to boost the recognition of offensive texts with complex semantics\. RoBERTa is combined with pointer networks by Hou et al\.\[[6](https://arxiv.org/html/2606.27629#bib.bib12)\], and attention is focused on offensive\-related critical fragments\. A two\-channel approach integrating BERT and topic models is proposed by Cao et al\.\[[2](https://arxiv.org/html/2606.27629#bib.bib13)\]to simultaneously capture semantic and topic features\. The effectiveness of the paradigm consisting of large\-scale pre\-training and downstream fine\-tuning for Chinese offensive detection is verified by these studies\. This paradigm is also followed by the baseline model of this paper\.
### II\-BRecognition of Implicit Offense and Context\-Dependent Attacks
Attacks with explicit abusive words are contrasted with implicit offenses disguised by irony, metaphor, homophones\. No violating words are contained in their literal expressions, yet strong offensive intentions are implied, and major difficulties in detection are caused accordingly\. Corpus construction and linguistic pattern modeling are devoted to by numerous existing studies in the field of irony detection\. The construction of traditional Chinese irony corpora and the analysis of ironic structures are completed in early research\[[14](https://arxiv.org/html/2606.27629#bib.bib14)\]\. Neural network methods integrating linguistic features are proposed subsequently\[[10](https://arxiv.org/html/2606.27629#bib.bib15)\]\. Retrospective reading models emphasizing contextual information and sarcasm recognition approaches incorporating news background are further developed\[[19](https://arxiv.org/html/2606.27629#bib.bib16)\]\[[5](https://arxiv.org/html/2606.27629#bib.bib17)\]\. It is demonstrated by all these works that the recognition of implicit expressions is highly dependent on context modeling\. A multi\-domain Chinese implicit hate dataset MCIHD is constructed by recent research\[[20](https://arxiv.org/html/2606.27629#bib.bib18)\], and domain\-enhanced prompt learning is put forward for implicit hate and euphemistic expressions\. TE\-Dataset targeting harmful euphemisms together with its contrastive learning framework is designed to specially cope with evasion methods such as metaphor, homophones and character deformation\[[21](https://arxiv.org/html/2606.27629#bib.bib19)\]\. It is demonstrated by all these studies that the recognition of implicit offenses needs to go beyond keyword matching and delve into contextual and semantic correlations\. Consistency with the motivation of this paper to strengthen implicit context modeling via hard example mining is therefore achieved\.
### II\-CCross\-Platform Generalization and Model Robustness
In practical deployment, target platforms with data distributions different from training data are often faced by models, and their generalization ability and robustness are thus concerned by researchers\. Generalization performance is improved by one category of works through data augmentation\. A million\-scale unsupervised dataset AugCOLD is constructed\[[3](https://arxiv.org/html/2606.27629#bib.bib20)\], and a multi\-teacher distillation framework is proposed\. Coverage of hard samples including implicit offenses and retaliatory remarks is significantly expanded, and the robustness of the detector is enhanced accordingly\. Anti\-evasion robustness evaluation is focused on by another line of research\. Perturbed samples are constructed via homophone replacement and emoji substitution in ToxiCloakCN\[[16](https://arxiv.org/html/2606.27629#bib.bib21)\]\. Structural perturbations such as character splitting and radical replacement are introduced in CangjieToxi\[[1](https://arxiv.org/html/2606.27629#bib.bib22)\]\. Significant performance degradation on perturbed samples is found in both datasets for existing models, and implicit offenses related to cultural backgrounds can hardly be understood\. The vulnerability of models trained on source domains under distribution shift is revealed by these studies\. However, most improvements are realized by relying on large\-scale data augmentation or optimization for specific perturbation types\. Systematic quantification of domain gaps under real multi\-platform scenarios and target\-platform adaptation with minimal labeling cost are rarely achieved in existing works\.
### II\-DPositioning of This Work
Remarkable progress in data resources, implicit offense modeling and robustness evaluation has been achieved by existing studies\. Nevertheless, three deficiencies still exist: First, evaluations are conducted on a single platform or static distribution in most works, and systematic quantification of real\-world cross\-platform domain shift is absent\. Second, although implicit offenses have attracted widespread attention, detailed diagnosis of their failure mechanisms during cross\-platform transfer is lacking\. Third, most schemes for boosting robustness are realized by large\-scale data augmentation, and high labeling costs are incurred accordingly\.
To address these limitations, a cross\-platform evaluation dataset covering four platforms with three classification categories is constructed in this paper\. Domain distances between each platform and the source domain COLD are quantified\. Meanwhile, a lightweight domain adaptation method based on dual\-threshold hard sample mining is proposed\. The cross\-platform recognition performance of implicit offenses is selectively improved with an extremely small labeling budget\.
## IIIConstruction of RoBERTa\-Based Baseline Model for Chinese Offensive Comment Detection
To obtain unbiased and fairly comparable fine\-tuning results, the clean Chinese pre\-trained backbone chinese\-roberta\-wwm\-ext is adopted\. Fine\-tuning is conducted from scratch on the COLD training set with binary cross\-entropy loss, and the baseline detector is obtained consequently\.
TABLE I:Sample Statistics of COLD DatasetDataset SubsetOffensive SamplesNormal SamplesTotalTrain127231300325726Validation321132206431Test210732165323Total180411943937480### III\-ASelection and Processing of Experimental Datasets
The COLD\[[4](https://arxiv.org/html/2606.27629#bib.bib7)\]is selected as the core experimental data\. It is specially constructed for harmful, offensive and malicious speech in Chinese online\. Mainstream social platforms including Zhihu and Weibo are covered, and controversial topics such as race, gender and region are included\. Better generalization ability of the model is facilitated accordingly\. The sample distribution of each subset of the COLD dataset is shown in Table[I](https://arxiv.org/html/2606.27629#S3.T1)\.
### III\-BText Preprocessing and Vectorization
Given the raw text sequenceSS, regular expression cleaning is implemented first\. Only Chinese characters within the Unicode range \[∖\\setminusu4e00,∖\\setminusu9fa5\] are retained, while irrelevant characters including punctuations, symbols, digits and foreign languages are eliminated\. The pure Chinese character sequence after cleaning is defined as:
Scleaned=fregex\(S\)=\{c\|c∈S,c∈\[\\u4e00,\\u9fa5\]\}S\_\{\\text\{cleaned\}\}=f\_\{\\text\{regex\}\}\(S\)=\\bigl\\\{c\\,\\big\|\\,c\\in S,\\ c\\in\[\\backslash\\text\{u4e00\},\\backslash\\text\{u9fa5\}\]\\bigr\\\}\(1\)Subsequently, word segmentation is performed on the cleaned string via the segmentation operator Cut\(⋅\\cdot\) based on prefix dictionaries and Hidden Markov Models, and the discrete word segmentation setWWis obtained:
W=\{w1,w2,…,wn\}=Cut\(Scleaned\)W=\\\{w\_\{1\},w\_\{2\},\\dots,w\_\{n\}\\\}=\\mathrm\{Cut\}\(S\_\{\\mathrm\{cleaned\}\}\)\(2\)Stop word removal is further carried out, whereVstopV\_\{\\text\{stop\}\}denotes the predefined set of Chinese stop words\. Double filtering is applied to the word segmentation setWW: stop words and single\-character words with length≤1\\leq 1are discarded\. Words satisfyingw∉Vstop∧Length\(w\)\>1w\\notin V\_\{\\mathrm\{stop\}\}\\land\\mathrm\{Length\}\(w\)\>1are retained to form the final valid feature sequence:
Wfinal=\{w∈W\|w∉Vstop∧Length\(w\)\>1\}W\_\{\\mathrm\{final\}\}=\\bigl\\\{w\\in W\\,\\big\|\\,w\\notin V\_\{\\mathrm\{stop\}\}\\land\\mathrm\{Length\}\(w\)\>1\\bigr\\\}\(3\)The indicator function𝐈\(⋅\)\\mathbf\{I\}\(\\cdot\)is adopted to count the occurrence frequency of each wordwwinWfinalW\_\{\\text\{final\}\}, and the indicator function satisfies:
I\(A\)=\{1,if conditionAholds0,if conditionAdoes not hold\\textbf\{I\}\(A\)=\\begin\{cases\}1,&\\text\{if condition \}A\\text\{ holds\}\\\\ 0,&\\text\{if condition \}A\\text\{ does not hold\}\\end\{cases\}\(4\)The word frequency calculation formula of vocabularywwis given as:
TF\(w\)=∑i=1\|Wfinal\|𝐈\(Wfinal,i=w\)\\mathrm\{TF\}\(w\)=\\sum\_\{i=1\}^\{\|W\_\{\\mathrm\{final\}\}\|\}\\mathbf\{I\}\(W\_\{\\mathrm\{final\},i\}=w\)\(5\)An evolution example of one sample through the above procedures is illustrated in Table[II](https://arxiv.org/html/2606.27629#S3.T2)\.
TABLE II:Example of Social Comment Evolution in Each Preprocessing StageProcessing StageData StatusText Features and Output ResultsRaw Input TextSSRaw long text with symbols都怪我我应该送花圈。这样以后也能用得上Regex CleaningScleanedS\_\{\\mathrm\{cleaned\}\}Pure Chinese sequence without punctuation都怪我我应该送花圈这样以后也能用得上Word SegmentationW=Cut\(Scleaned\)W=\\mathrm\{Cut\}\(S\_\{\\mathrm\{cleaned\}\}\)Full segmented word set\{都, 怪, 我, 我, 应该, 送, 花圈, 这样, 以后, 也, 能, 用得上\}Stopword & Length FilterWfinalW\_\{\\mathrm\{final\}\}Filtered core feature words\{应该, 送, 花圈, 这样, 以后, 用得上\}Term Frequency CalculationTF\(w\)\\mathrm\{TF\}\(w\)Word\-TF mapping应该: 1, 送: 1, 花圈: 1, 这样: 1, 以后: 1, 用得上: 1To feed the preprocessed text into deep neural networks, subword segmentation and numerical mapping are further performed to generate tensors with fixed dimensions\. It is worth noting that character\-level subword segmentation is executed by the built\-in Tokenizer of RoBERTa\. Special tokens\[CLS\]\[\\text\{CLS\}\]and\[SEP\]\[\\text\{SEP\}\]are appended to the start and end of the sequence respectively, and an ordered discrete token sequence is constructed accordingly, as follows\.
T=\[tCLS,t1,t2,…,tn,tSEP\],L=n\+2T=\\left\[t\_\{\\mathrm\{CLS\}\},t\_\{1\},t\_\{2\},\\dots,t\_\{n\},t\_\{\\mathrm\{SEP\}\}\\right\],\\quad L=n\+2\(6\)wherenndenotes the number of valid tokens in the original text, andLLstands for the total sequence length after inserting special tokens\. The hidden layer vector corresponding to the first positiontCLSt\_\{\\text\{CLS\}\}is adopted to aggregate the global semantic information of the entire sentence\.tSEPt\_\{\\text\{SEP\}\}is treated as the terminal boundary token to mark the end of a single text\.
Subsequently, with the aid of the vocabulary built into the model, each Token in the sequence is mapped to a unique integer index in the vocabulary via the lookup operatorflookup\(⋅\)f\_\{\\text\{lookup\}\}\(\\cdot\), and a one\-dimensional index vectorXids∈ℤL\\textbf\{X\}\_\{\\text\{ids\}\}\\in\\mathbb\{Z\}^\{L\}is obtained:
𝐗ids=\[flookup\(tCLS\),flookup\(ti\)∣i=1,…,n,flookup\(tSEP\)\]\\mathbf\{X\}\_\{\\mathrm\{ids\}\}=\[f\_\{\\mathrm\{lookup\}\}\(t\_\{\\text\{CLS\}\}\),f\_\{\\mathrm\{lookup\}\}\(t\_\{i\}\)\\mid\_\{i=1,\.\.\.,n\},f\_\{\\mathrm\{lookup\}\}\(t\_\{\\text\{SEP\}\}\)\]\(7\)Finally, the batch dimension is expanded by the tensor reshaping operatorftensorf\_\{\\text\{tensor\}\}\. The index vectors of individual samples are stacked to obtain the batch input tensorXthat can be fed into the neural network, as follows\.
X=ftensor\(Xids\)∈ℤb×L\\textbf\{X\}=f\_\{\\mathrm\{tensor\}\}\(\\textbf\{X\}\_\{\\mathrm\{ids\}\}\)\\in\\mathbb\{Z\}^\{b\\times L\}\(8\)wherebbis defined as the batch size for model training\.

Figure 1:Network Architecture of RoBERTa for Text Classification
### III\-CDesign of Classification Network
The batch input tensorX∈ℤb×L\\textbf\{X\}\\in\\mathbb\{Z\}^\{b\\times L\}is obtained through the preprocessing procedures described above\. Global semantic extraction is implemented by the bidirectional Transformer encoder of RoBERTa in this section, and a binary classification head is constructed\. The overall network architecture is illustrated in Fig\.[1](https://arxiv.org/html/2606.27629#S3.F1)\.
Global Semantic Feature Vector Extraction\.The pre\-trained model chinese\-roberta\-wwm\-ext adopted in this paper follows the RoBERTa architecture\. Multi\-layer bidirectional Transformer encoders are taken as the backbone for feature extraction, whose core component is multi\-head self\-attention mechanism\. The model is abbreviated as RoBERTa in the following text\. Linear projections are separately performed on input features by this mechanism to generate query matrix𝐐\\mathbf\{Q\}, key matrix𝐊\\mathbf\{K\}and value matrix𝐕\\mathbf\{V\}\. The calculation formula of scaled dot\-product attention is given as follows:
Attention\(𝐐,𝐊,𝐕\)=softmax\(𝐐𝐊Tdk\)𝐕\\mathrm\{Attention\}\(\\mathbf\{Q\},\\mathbf\{K\},\\mathbf\{V\}\)=\\mathrm\{softmax\}\\left\(\\frac\{\\mathbf\{Q\}\\mathbf\{K\}^\{\\mathrm\{T\}\}\}\{\\sqrt\{d\_\{k\}\}\}\\right\)\\mathbf\{V\}\(9\)wheredkd\_\{k\}denotes the feature dimension of key vectors, anddk\\sqrt\{d\_\{k\}\}is adopted as the scaling factor to constrain the value of inner product and avoid gradient vanishing\.hhgroups of mutually independent linear projections and attention calculations are conducted on features by multi\-head attention\. The outputs of each head are concatenated and fused via weight matrix𝐖O\\mathbf\{W\}^\{O\}:
MultiHead\(𝐐,𝐊,𝐕\)=Concat\(head1,…,headh\)𝐖O\\mathrm\{MultiHead\}\(\\mathbf\{Q\},\\mathbf\{K\},\\mathbf\{V\}\)=\\mathrm\{Concat\}\(\\mathrm\{head\_\{1\}\},\.\.\.,\\mathrm\{head\_\{h\}\}\)\\mathbf\{W\}^\{O\}\(10\)headi=Attention\(𝐐𝐖iQ,𝐊𝐖iK,𝐕𝐖iV\)\\mathrm\{head\_\{i\}\}=\\mathrm\{Attention\}\(\\mathbf\{Q\}\\mathbf\{W\}\_\{i\}^\{\\mathrm\{Q\}\},\\mathbf\{K\}\\mathbf\{W\}\_\{i\}^\{\\mathrm\{K\}\},\\mathbf\{V\}\\mathbf\{W\}\_\{i\}^\{\\mathrm\{V\}\}\)\(11\)
As illustrated in Fig\.[1](https://arxiv.org/html/2606.27629#S3.F1), 12 layers of the above Transformer encoder blocks are stacked in RoBERTa\. Benefiting from the bidirectional encoding property, contextual semantic information on both left and right sides can be fused simultaneously by any Token within the sequence\. After tensor𝐗\\mathbf\{X\}is fed into the RoBERTa encoder, a feature matrix with global context awareness is output:
𝐇\\displaystyle\\mathbf\{H\}=RoBERTa\(𝐗\)=\\displaystyle=\\mathrm\{RoBERTa\}\(\\mathbf\{X\}\)=\(12\)\[𝐡CLS,𝐡1,𝐡2,…,𝐡n,𝐡SEP\]∈ℝb×L×dhidden\\displaystyle\\bigl\[\\mathbf\{h\}\_\{\\mathrm\{CLS\}\},\\mathbf\{h\}\_\{1\},\\mathbf\{h\}\_\{2\},\\dots,\\mathbf\{h\}\_\{n\},\\mathbf\{h\}\_\{\\mathrm\{SEP\}\}\\bigr\]\\in\\mathbb\{R\}^\{b\\times L\\times d\_\{\\mathrm\{hidden\}\}\}wheredhiddend\_\{\\mathrm\{hidden\}\}denotes the hidden feature dimension of the model\. The feature vector𝐡i\\mathbf\{h\}\_\{i\}at arbitrary positioniiis jointly mapped from the semantics of all Tokens in the entire sentence, which is formulated as𝐡i=g\(T\)\\mathbf\{h\}\_\{i\}=g\(T\)\. The token\[CLS\]\[\\text\{CLS\}\]is endowed with the ability to aggregate the global semantics of the whole text during the pre\-training stage of RoBERTa\. For the binary classification task of single offensive text in this paper, only the feature vector at the first position𝐡CLS∈ℝdhidden\\mathbf\{h\}\_\{\\mathrm\{CLS\}\}\\in\\mathbb\{R\}^\{d\_\{\\text\{hidden\}\}\}is extracted as the global semantic representation of the entire comment text\.𝐡1,𝐡2,…,𝐡n\\mathbf\{h\}\_\{1\},\\mathbf\{h\}\_\{2\},\\dots,\\mathbf\{h\}\_\{n\}in the middle of the sequence are local semantic features of individual words, and the terminal vector𝐡SEP\\mathbf\{h\}\_\{\\mathrm\{SEP\}\}is only used to mark sentence boundaries\. Since this paper does not target word\-level offensive localization tasks, neither of them is involved in the subsequent calculation for sentence\-level classification\.
Design of Classification Head\.The classification module is composed of a single fully\-connected linear layer cascaded with the Softmax normalization function\. The mapping fromdhiddend\_\{\\mathrm\{hidden\}\}\-dimensional global features to the binary classification probability space is realized\. The extracted global vector𝐡CLS\\mathbf\{h\}\_\{\\text\{CLS\}\}is fed into the fully\-connected layer\. The raw scores of each category are calculated via learnable weight matrix𝐖\\mathbf\{W\}and bias term𝐛\\mathbf\{b\}:
𝐳=𝐖⋅𝐡CLS\+𝐛,𝐖∈ℝ2×dhidden,𝐛∈ℝ2\\mathbf\{z\}=\\mathbf\{W\}\\cdot\\mathbf\{h\}\_\{\\mathrm\{CLS\}\}\+\\mathbf\{b\},\\quad\\mathbf\{W\}\\in\\mathbb\{R\}^\{2\\times d\_\{\\mathrm\{hidden\}\}\},\\ \\mathbf\{b\}\\in\\mathbb\{R\}^\{2\}\(13\)The raw scores are then normalized into category probabilities within the interval\[0,1\]\[0,1\]via the Softmax activation function:
pi=ezi∑j=01ezj,zi∈𝐳,i∈\{0,1\}p\_\{i\}=\\frac\{e^\{z\_\{i\}\}\}\{\\sum\_\{j=0\}^\{1\}e^\{z\_\{j\}\}\},\\quad z\_\{i\}\\in\\mathbf\{z\},i\\in\\\{0,1\\\}\(14\)wherei=0i=0denotes normal non\-offensive texts, andi=1i=1denotes offensive harmful texts\. The label corresponding to the maximum probability is finally selected via theargmax\\mathrm\{argmax\}function as the prediction result of the model:
y^=argmaxi∈\{0,1\}pi\\hat\{y\}=\\mathop\{\\arg\\max\}\_\{i\\in\\\{0,1\\\}\}p\_\{i\}\(15\)
### III\-DModel Fine\-tuning and Training Configuration
Windows 11 is adopted as the operating system in all experiments of this paper, and NVIDIA GeForce RTX 4060 Ti with 16 GB video memory is used as the GPU\. Python 3\.8\.19 serves as the programming environment, PyTorch 2\.3\.0 is selected as the deep learning framework, and CUDA 12\.1 is configured for GPU acceleration\. To precisely control the convergence of the large\-scale pre\-trained model, intensive fine\-tuning is carried out with training steps as the core metric in this experiment\. The relevant hyperparameter settings are presented in Table[III](https://arxiv.org/html/2606.27629#S3.T3)\. The parameter count of each component and the total number of floating\-point operations of the entire model are listed in Table[IV](https://arxiv.org/html/2606.27629#S3.T4)\.
TABLE III:Model hyperparametersHyperparameterValueHidden dimension768Learning rate2×10−52\\times 10^\{\-5\}OptimizerAdamWMaximum sequence length128Weight decay0\.005TABLE IV:Model parameter counts and computational costsModuleParametersFLOPsRoBERTa encoder102\.2M5\.44BLinear classifier0\.001M0\.0001BBinary cross\-entropy loss is used for fine\-tuning supervision:
ℒ=−1N∑i=1N\[yilogpi\(1\)\+\(1−yi\)log\(1−pi\(1\)\)\]\\mathcal\{L\}=\-\\frac\{1\}\{N\}\\sum\_\{i=1\}^\{N\}\\Big\[y\_\{i\}\\log p\_\{i\}^\{\(1\)\}\+\(1\-y\_\{i\}\)\\log\\big\(1\-p\_\{i\}^\{\(1\)\}\\big\)\\Big\]\(16\)whereNNdenotes batch size,yi∈\{0,1\}y\_\{i\}\\in\\\{0,1\\\}denotes ground\-truth label, andpi\(1\)p\_\{i\}^\{\(1\)\}denotes the predicted probability of harmful text\. AdamW optimizer is adopted with the following update rule:
Θ\(t\+1\)=Θ\(t\)−η∇Θℒ\\Theta^\{\(t\+1\)\}=\\Theta^\{\(t\)\}\-\\eta\\nabla\_\{\\Theta\}\\mathcal\{L\}\(17\)whereη=2×10−5\\eta=2\\times 10^\{\-5\}, with weight decay of 0\.01 to mitigate overfitting\.

Figure 2:Training loss convergence curve
### III\-EAnalysis of baseline experimental results
Fig\.[2](https://arxiv.org/html/2606.27629#S3.F2)shows training loss convergence\. Loss declines rapidly: it drops from∼\\sim0\.7 to below 0\.1 within the first 2000 steps and stabilizes near zero after 4000 steps, indicating full convergence on the COLD\.

Figure 3:Confusion matrix and ROC curve on test setConfusion matrix and ROC on the test set are presented in Fig\.[3](https://arxiv.org/html/2606.27629#S3.F3)\. The matrix reveals 245 false\-negative offensive samples and 731 false\-positive normal samples\. The model achieves higher recall for offensive content to minimize missed harmful texts\. The ROC AUC reaches 0\.891, substantially exceeding the random baseline, demonstrating strong discriminative power between positive and negative samples\.
TABLE V:Performance comparison of different modelsModelAccuracyPrecisionRecallF1AUCLR0\.6200\.5590\.1900\.2840\.567SVM0\.6250\.5790\.1900\.2860\.570RF0\.6210\.5790\.1550\.2450\.564RoBERTa0\.8420\.7820\.8840\.7920\.891To verify RoBERTa’s superiority in deep semantic modeling, logistic regression, SVM and RF are adopted as baselines on the identical test set; evaluation metrics are listed in Table[V](https://arxiv.org/html/2606.27629#S3.T5)\. The three traditional models achieve∼\\sim0\.62 accuracy, F1 scores of 0\.25\-0\.29 and offensive\-sample recall near 0\.17\. Reliant on sparse TF\-IDF and N\-gram bag\-of\-word features, they only capture superficial lexical signals and fail to detect context\-dependent offensive language such as sarcasm and metaphor\. Imbalanced data further biases these conservative classifiers toward predicting most samples as non\-offensive\. By contrast, RoBERTa encodes global semantics via bidirectional Transformers, yielding an F1 improvement of 0\.508 over logistic regression and capturing subtle hostile intentions accurately\. This validates the efficiency of large Chinese corpus pre\-training followed by downstream fine\-tuning for offensive comment detection\.
## IVEvaluation and optimization of cross\-platform generalization
This section evaluates the transferability of the baseline detector across platforms, and optimizes few\-shot domain adaptation via dual\-threshold hard example mining\.
### IV\-ACross\-platform test set construction and annotation quality
The cross\-platform evaluation dataset consists of two subsets\. \(1\) Crawled comment data from trending topics on Weibo and Xiaohongshu; \(2\) Aggregated adversarial, long and implicit toxic texts from Tieba and Zhihu within the ToxiCN dataset\[[9](https://arxiv.org/html/2606.27629#bib.bib10)\]\. All data underwent three\-stage preprocessing \(structural noise removal, semantic purification, global deduplication\) to yield clean corpora\.
TABLE VI:Sample distribution of the cross\-platform test setPlatform012Weibo3378083Xiaohongshu33224144Tieba251123126Zhihu27087143Total1190314496To accurately distinguish different offensive patterns and refine the analysis of generalization errors during annotation, a refined three\-class labeling criterion is established: 0 denotes normal comments; 1 denotes explicit offensiveness, including overt insults, vulgarities and discriminatory content with exposed aggressive semantics; 2 denotes implicit offensiveness, which adopts sarcasm, metaphor and homophonic innuendoes to conceal hostile intentions without explicit toxic words\. Stratified random sampling of 500 samples per platform is conducted from full corpora\. A double\-blind cross\-labelling scheme with third\-party arbitration is used to build an independent cross\-platform test set\. This test set is excluded from all training and parameter tuning procedures\. Sample distributions across platforms are shown in Table[VI](https://arxiv.org/html/2606.27629#S4.T6)\.
Inter\-annotator agreement\.To guarantee reliable evaluation, we report the inter\-annotator agreement\. The overall Cohen’s/Fleiss’ Kappa reaches 0\.55 with a 77\.5% agreement rate, with obvious discrepancies across platforms: Zhihu achieves the highest agreement \(92\.5%\), while Tieba yields the lowest \(62\.5%\)\. These results reveal inherent subjectivity in identifying implicit offensive content, alongside larger mismatches between texts from platforms such as Tieba and the original labeling standards\. This motivates separate evaluation of implicit offensive samples and dedicated discussion of labeling inconsistencies\.
Error auditing protocol\.To quantify labeling error rates on the test set, stratified random sampling by platform and label was performed on samples with mismatches between baseline predictions and manual annotations\. Each sample was manually categorized as model misprediction, incorrect label, or ambiguous borderline case\. A total of 192 discrepant samples are audited manually: 114 \(59\.4%\) are model mispredictions, 43 \(22\.4%\) are ambiguous borderline cases, and only 35 \(18\.2%\) carry incorrect labels\. Nearly six\-tenths of inconsistencies stem from model limitations rather than annotation flaws, with genuine labeling errors accounting for merely around one\-fifth\. This result validates the high annotation quality of the cross\-platform test set\. As a preliminary sanity check, an additional set of 106 stratified samples \(with oversampling of implicit offensive instances\) is reviewed by a single annotator\. Around 97% matched the original labels, while clear labeling errors accounted for merely 3%, with disagreements concentrated on the borderline between implicit offensiveness and normal comments\.
TABLE VII:Quantification of domain discrepancies across platformsProxy\-A∖\\setminusJaccardWeiboXiaohongshuTiebaZhihuCOLDWeibo—0\.2190\.2160\.2150\.209Xiaohongshu0\.453—0\.1680\.1720\.173Tieba0\.911\.06—0\.3570\.344Zhihu1\.241\.330\.85—0\.385COLD1\.671\.691\.320\.96—Quantification of platform discrepancies\.To objectively characterize cross\-platform discrepancies instead of relying on subjective intuition, we adopt vocabulary Jaccard overlap and Proxy\-A\-distance as evaluation metrics\. The smaller the former, the greater the difference; the larger the latter, the greater the difference\. Quantitative results are summarized in Table[VII](https://arxiv.org/html/2606.27629#S4.T7)\. Xiaohongshu exhibits the largest domain gaps against all other platforms, while Tieba and Zhihu share the closest distribution, presumably due to their shared source within the ToxiCN dataset\. We further compute each platform’s relative distance to the COLD dataset to directly measure transfer difficulty\. Zhihu lies closest to COLD, followed by Tieba, whereas Xiaohongshu and Weibo show the largest domain gaps from COLD\. This indicates that Xiaohongshu, a platform entirely absent from the COLD dataset, has the largest domain gap with the source domain\. Although Weibo appears in COLD, its actual linguistic distribution deviates substantially, likely driven by differences in collection time, topic coverage and data preprocessing pipelines\.
TABLE VIII:Generalization performance statistics of the baseline model across social platformsPlatformAccuracyPrecisionRecallF1\-ScoreWeibo0\.7080\.5910\.3370\.430Xiaohongshu0\.6520\.4440\.1430\.216Tieba0\.5920\.6130\.4900\.545Zhihu0\.6180\.5950\.5300\.561
Figure 4:Cross\-domain confusion matrices of the baseline detector for each platform
### IV\-BCross\-platform performance of the baseline detector
The baseline detector is directly inferred on the four test subsets\. Metrics for each platform are listed in Table[VIII](https://arxiv.org/html/2606.27629#S4.T8), and confusion matrices are illustrated in Fig\.[4](https://arxiv.org/html/2606.27629#S4.F4)\. The results reveal obvious overall performance degradation of the detector on cross\-platform data compared with the source domain, with the most severe drop observed on Xiaohongshu\.
Combined with the confusion matrices in Fig\.[4](https://arxiv.org/html/2606.27629#S4.F4), cross\-domain transfer failure mainly stems from two factors\. First, the model exhibits weak detection capacity for implicit offensive content\. A large number of implicit offensive samples conveyed via irony and metaphor are falsely classified as normal, which constitutes the primary cause of low recall\. This issue is most prominent on Xiaohongshu, where 144 out of 168 offensive samples are missed\. The false negative counts for Zhihu and Tieba reach 108 and 127 respectively\. Second, cross\-domain transfer fails for platform\-exclusive jargon\. Some offensive texts contain no sensitive words from conventional swear word lexicons and deliver implicit insults through platform\-specific slang, while the source domain lacks analogous training instances\. This observation aligns with the analysis in Section[IV](https://arxiv.org/html/2606.27629#S4)A\. As a completely unseen domain with the largest distance from COLD, Xiaohongshu suffers the most severe performance degradation, consistent with the expectation that larger domain gaps lead to poorer transferability\.
### IV\-CDual\-Threshold Hard Example Mining and Implicit Context Model Calibration
This section designs a dual\-threshold dual\-channel hard sample screening strategy to mine cross\-domain hard examples, and perform secondary fine\-tuning calibration on implicit context based on the screened hard samples\.
\(1\) Dual\-Threshold Hard Example Mining
To accurately capture samples where the baseline model fails during cross\-platform inference, we establish a dual\-threshold hard sample screening rule based on prediction confidence\. Hard examples prone to model misclassification are mined from massive unlabeled candidate corpora and adopted as fine\-tuning data for subsequent model calibration\.
Since the well\-trained baseline model follows a binary classification setup, label space alignment is required as a preliminary step\. The original human annotations are three\-class ground\-truth labelsyhuman∈\{0,1,2\}y\_\{\\mathrm\{human\}\}\\in\\\{0,1,2\\\}\. We integrate them into binary training labelsybinaryy\_\{\\mathrm\{binary\}\}via a mapping operator, unifying explicit and implicit offensive instances into a single offensive class\. The conversion rule is formulated as follows:
ybinary=\{1yhuman≥10yhuman=0y\_\{\\mathrm\{binary\}\}=\\begin\{cases\}1&y\_\{\\mathrm\{human\}\}\\geq 1\\\\ 0&y\_\{\\mathrm\{human\}\}=0\\end\{cases\}\(18\)The baseline model outputs class\-wise confidence scores normalized by Softmax\. The maximum probability is taken as the per\-sample decision confidencecc, whose calculation is defined in the following formula:
c=maxk∈\{0,1\}\(ezkez0\+ez1\)c=\\max\_\{k\\in\\\{0,1\\\}\}\\left\(\\frac\{e^\{z\_\{k\}\}\}\{e^\{z\_\{0\}\}\+e^\{z\_\{1\}\}\}\\right\)\(19\)wherez0z\_\{0\}andz1z\_\{1\}denote the raw logits of the non\-offensive and offensive classes, respectively\. Accordingly, the confidence scoreccsatisfiesc∈\[0\.5,1\.0\]c\\in\[0\.5,1\.0\]\.
On the condition that the model predicted labely^\\hat\{y\}on the self\-built dataset disagrees with the binary ground\-truth labelybinaryy\_\{\\mathrm\{binary\}\}, two hard sample pools are divided according to confidence intervals\. We set the high\-confidence thresholdα\\alphaand the low\-confidence thresholdβ\\beta:
1. 1\.High\-Confidence Error Pool:y^≠ybinary∧c≥α\\hat\{y\}\\neq y\_\{\\mathrm\{binary\}\}\\land c\\geq\\alpha\. Most samples in this pool are implicit offensive texts concealed by irony and metaphor with amiable appearances, which are falsely predicted as normal with high confidence by the model\.
2. 2\.Low\-Confidence Error Pool:y^≠ybinary∧0\.50≤c≤β\\hat\{y\}\\neq y\_\{\\mathrm\{binary\}\}\\land 0\.50\\leq c\\leq\\beta\. Most samples in this pool contain platform\-specific slang and emerging internet buzzwords\. The model presents ambiguous decision boundaries for such texts, with prediction confidence fluctuating around 0\.5\.

Figure 5:Workflow of cross\-platform hard sample mining with dual thresholdsThe overall screening pipeline is illustrated in Fig\.[5](https://arxiv.org/html/2606.27629#S4.F5)\. For each platform, 500 texts are reserved to form an independent test set, while the remaining candidate corpus is fed into the baseline detector for automatic binary classification\. After that, high\-confidence and low\-confidence error pools are constructed separately following the dual\-threshold rules\. After stratified sampling, manual re\-screening and verification are carried out\. We fix 100 hard examples for each platform, including 50 false positive samples and 50 false negative samples with a 1:1 ratio of positive and negative hard cases\. A total of 400 cross\-platform hard samples aggregated from four platforms are adopted for secondary fine\-tuning\.
\(2\) Implicit Context Model Calibration
Secondary supervised fine\-tuning is conducted on the 400 screened cross\-platform hard samples to specifically compensate recognition blind spots of the baseline model on multi\-platform implicit offensive content and niche community slang\. The 400 hard samples are stratified and randomly split at a ratio of 8:2 to form the fine\-tuning training set and independent validation set\. A balanced 1:1 ratio of positive and negative samples is strictly maintained during stratification\. Incremental fine\-tuning is implemented on the aforementioned baseline detector\. Hyperparameters are adapted according to the characteristics of few\-shot fine\-tuning, with detailed configurations listed in Table[IX](https://arxiv.org/html/2606.27629#S4.T9)\.
TABLE IX:Hyperparameter Configuration for Fine\-tuningHyperparameterValueEpoch10Per\-device train batch size16Base learning rate2×10−52\\times 10^\{\-5\}Weight decay0\.01Evaluation strategyper epochα\\alpha,β\\beta0\.85, 0\.60Classification cross\-entropy loss is calculated on the validation set upon the completion of each training epoch\. A cross\-platform optimized model is finally generated through the implicit context fusion calibration pipeline for subsequent horizontal comparison of generalization performance\.
### IV\-DComparative Analysis of Optimized and Baseline Model
Offline inference is performed on four independent test sets excluded from fine\-tuning for the optimized model calibrated via hard sample fine\-tuning\. Horizontal performance comparison with the baseline model is conducted\.
TABLE X:Statistics of Cross\-platform Generalization Performance Before and After Context CalibrationPlatformModelAccuracyPrecisionRecallF1\-ScoreWeiboBaseline0\.7080\.5910\.3370\.430Optimized0\.6520\.4740\.6130\.535XiaohongshuBaseline0\.6520\.4440\.1430\.216Optimized0\.6300\.4540\.4940\.473TiebaBaseling0\.5920\.6130\.4900\.545Optimized0\.6540\.6320\.7310\.678ZhihuBaseline0\.6180\.5950\.5300\.561Optimized0\.6780\.6410\.6830\.661As shown in Table[X](https://arxiv.org/html/2606.27629#S4.T10), obvious improvements on F1 score and recall of harmful samples across four platforms are observed after implicit context calibration\. The performance gain on Xiaohongshu dataset is the most remarkable with nearly doubled metrics, which demonstrates that targeted hard sample calibration brings prominent effectiveness for brand\-new platforms not covered by COLD dataset and with severe domain shift\. In terms of recall, substantial growth in the recall of offensive samples is observed across all four platforms, which indicates that the missing alarm issue of the baseline model against implicit offensive content is significantly alleviated by the optimized model\.

Figure 6:Confusion Matrices for Classification Diagnosis of the Optimized Model on Each PlatformThe above performance variation can be further verified from the confusion matrix in Fig\.[6](https://arxiv.org/html/2606.27629#S4.F6)\. Taking the Xiaohongshu dataset as an example, the number of missed implicit offensive samples of the baseline model drops from 144 to 85, and the false negative rate decreases from 85\.7% to 50\.6%\. Reductions in missed samples are also observed on other platforms\. Substantial improvement in the recognition capacity for implicit offensive content such as irony and metaphor is validated for the optimized model\.
It is worth noting that a slight decline in precision is observed on partial platforms while the recall rate of harmful samples rises substantially\. This phenomenon corresponds to a reasonable performance trade\-off introduced when the classification decision boundary is moderately relaxed to reduce false negatives of offensive comments\.
TABLE XI:Cross\-platform Macro F1 under Different Sampling Strategies \(Mean±\\pmStd of 5 Runs\)StrategyBudgetMacro F1Improvement vs\. BaselineBaseline00\.438—Random\-3203200\.372±0\.0040\.372\\pm 0\.004\-0\.066Hard\-3203200\.540±0\.0170\.540\\pm 0\.017\+0\.102
### IV\-EAblation Study
Three control groups are set to verify that performance gain originates from hard example mining rather than simple expansion of 320 data samples: \(1\) Baseline without fine\-tuning; \(2\) Random\-320 with 320 randomly sampled data for fine\-tuning; \(3\) Hard\-320 with 320 hard examples mined via dual thresholds for fine\-tuning\. Consistent annotation sources are guaranteed, as samples of Hard\-320 and Random\-320 are labeled by the same annotator following unified labeling standards\.
Experimental results are presented in Table[XI](https://arxiv.org/html/2606.27629#S4.T11)\. The macro F1 of Hard\-320 reaches0\.540±0\.0170\.540\\pm 0\.017, which is significantly higher than0\.372±0\.0040\.372\\pm 0\.004of Random\-320\. It is demonstrated that hard example mining outperforms random sampling remarkably under identical annotation budget\. It is notable that the metric of Random\-320 is even lower than the untuned Baseline\. This is attributed to the fact that multi\-epoch fine\-tuning on such limited samples leads to severe overfitting to the local distribution of target subsets, which impairs discriminative capabilities learned from the source domain\. The positive gain brought by fine\-tuning fails to offset the damage, resulting in degraded overall performance\. In contrast, every hard sample in Hard\-320 carries explicit correction signals, and remarkable performance gains are thereby achieved\.
In addition, the proportions of real offensive content in the two original groups are 44\.4% and 29\.1%, respectively\. After downsampling both groups to identical size and class ratio \(93 positive and 178 negative samples for each\) and rerunning experiments, the macro F1 of Hard group \(0\.478±0\.0240\.478\\pm 0\.024\) remains higher than that of Random group \(0\.413±0\.0110\.413\\pm 0\.011\)\. It is verified that the superiority stems from sample difficulty rather than class proportion\.


Figure 7:Comparison of Cross\-platform Feature Word Clouds of Two Models \(Left: Baseline; Right: Optimized\)
### IV\-FFeature Word Clouds and Typical Cases
To intuitively compare shifts in model attention before and after optimization from the feature perspective, high\-frequency feature words of samples predicted as offensive by the two\-stage models are extracted respectively to generate feature word clouds, as illustrated in Fig\.[7](https://arxiv.org/html/2606.27629#S4.F7)\.
Among the high\-frequency features extracted from both models, besides explicit group and topic words such as discrimination and women, sentence structural words and oral function words including “就是\[just\]”, “觉得\[think\]”, “应该should”, “什么\[what\]” also occupy prominent weights\. It indicates that model discrimination does not merely rely on matching a small set of sensitive words, but also pays considerable attention to sentence patterns and contextual structures where words are located\. A comparison between the two word clouds reveals increased weights for literally neutral words frequently adopted for ironic or metaphorical attacks, such as ”仙女\[fairy\]”, ”外星人\[alien\]” and ”好看\[good\-looking\]”, in the word cloud of the optimized model\. This shift aligns well with the research target of calibrating the model with hard examples to detect implicit offensive content\.
It should be clarified that the two word clouds are generated from distinct sample sets labeled as offensive by each model respectively\. Thus, the visualization only serves as illustrative qualitative observation, and all valid conclusions are subject to the quantitative metrics presented above\.
TABLE XII:Comparison of Two Models on Typical Ironic and Metaphorical SamplesPlatformTypical Implicit OffensivenessBaselineOptimizedTieba都怪我我应该送花圈。这样以后也能用得上01Weibo那你知道自己最后还是要嘎掉的, 怎么不天天随身携带棺材01TABLE XIII:Comparison of Recognition of Context\-Sensitive Expressions by Two ModelsWordTextBaselineOptimized普通这是普通民众朴素的愿望00普通…如果出现在国男身上,就不是优点了,毕竟这些特征那么普通又那么自信01好看ai 漫剧挺好看的,但 ai 真人是真难看00好看豆包说你好看,可能长在它的审美上01保护保护我方输出00保护不要出生是对她们最好的保护01
### IV\-GIn\-depth Analysis of Representative Recovered Cases
To investigate improvements in semantic comprehension brought by implicit context calibration at the micro level, two types of typical samples are selected from the cross\-platform test set for comparison of prediction results between the baseline and optimized model\.
The first category consists of samples with ironic and metaphorical expressions, as shown in Table[XII](https://arxiv.org/html/2606.27629#S4.T12)\. Case 1 adopts funeral\-related imagery such as “花圈\[wreath\]” and “用得上\[will come in handy\]” for implicit sarcasm, while Case 2 carries out personal attacks via coffin metaphors\. Neither sample contains explicit abusive words on the surface\. The baseline model relies on superficial keyword matching and misclassifies these samples as non\-offensive, while the optimized model captures correlated semantics between imagery and sentence patterns to accurately identify offensive content\.
The second category refers to context\-sensitive expressions whose meaning heavily relies on context, as presented in Table[XIII](https://arxiv.org/html/2606.27629#S4.T13)\. Three pairs of samples with identical literal words yet opposite sentiment polarities are selected, covering the terms “普通\[ordinary\]”, “好看\[good\-looking\]” and “保护\[protect\]”\. Both models correctly label neutral usages as non\-offensive\. However, for implicit derogatory usages formed by contextual information, the baseline model suffers interference from the inherent neutral prior of these words and misses all such offensive samples\. The optimized model dynamically distinguishes word semantics based on context and delivers correct predictions\.
In summary, implicit context calibration shifts the model’s discrimination logic from reliance on local sensitive keywords to integrating sentence patterns and contextual semantic correlations, endowing it with the capability to detect implicit harmful speech such as irony, analogy and metaphor\.
## VConclusion
This paper constructed a reproducible and comparable baseline model for offensive text detection based on chinese\-roberta\-wwm\-ext\. On this basis, a four\-platform three\-class cross\-platform evaluation dataset was constructed\. By adopting domain distance metrics including Proxy\-A\-distance, two primary causes underlying the cross\-platform performance degradation of the baseline model were revealed\. To tackle these bottlenecks, this paper proposed an optimization scheme combining dual\-threshold hard example mining and secondary fine\-tuning with implicit context\. The approach achieved remarkable generalization performance across the four platforms with minimal labeling budget, and the performance gain was most prominent on Xiaohongshu, which suffered the largest domain gap\. Ablation experiments demonstrated that performance gains stem from sample difficulty rather than sample quantity\. After controlling the labeling budget and class distribution ratio, hard example mining consistently outperformed random sampling\. Furthermore, this paper verified the reliability of the evaluation dataset via annotation consistency analysis and error case auditing\.
## References
- \[1\]\(2025\)CangjieToxi: a Chinese offensive language detection benchmark with radical\-level perturbations\.InAnonymous ACL submission,Cited by:[§II\-C](https://arxiv.org/html/2606.27629#S2.SS3.p1.1)\.
- \[2\]\(2024\)A parallel dual\-channel chinese offensive language detection method combining bert and ctm topic information\.IEEE Access12,pp\. 95165–95184\.Cited by:[§II\-A](https://arxiv.org/html/2606.27629#S2.SS1.p2.1)\.
- \[3\]J\. Deng, Z\. Chen, H\. Sun, Z\. Zhang, J\. Wu, S\. Nakagawa, F\. Ren, and M\. Huang\(2023\)Enhancing offensive language detection with data augmentation and knowledge distillation\.Research6,pp\. 0189\.Cited by:[§II\-C](https://arxiv.org/html/2606.27629#S2.SS3.p1.1)\.
- \[4\]J\. Deng, J\. Zhou, H\. Sun, C\. Zheng, F\. Mi, H\. Meng, and M\. Huang\(2022\)COLD: a benchmark for chinese offensive language detection\.InProceedings of the 2022 Conference on Empirical Methods in Natural Language Processing,pp\. 11580–11599\.Cited by:[§I](https://arxiv.org/html/2606.27629#S1.p2.1),[§II\-A](https://arxiv.org/html/2606.27629#S2.SS1.p2.1),[§III\-A](https://arxiv.org/html/2606.27629#S3.SS1.p1.1)\.
- \[5\]X\. Gong, Q\. Zhao, J\. Zhang, R\. Mao, and R\. Xu\(2020\)The design and construction of a chinese sarcasm dataset\.InProceedings of the twelfth language resources and evaluation conference,pp\. 5034–5039\.Cited by:[§II\-B](https://arxiv.org/html/2606.27629#S2.SS2.p1.1)\.
- \[6\]B\. Hou, X\. Xie, D\. Zhang, L\. Zheng, and G\. Yan\(2024\)Chinese offensive language detection algorithm based on pre\-trained language model and pointer network augmentation\.In2024 5th International Seminar on Artificial Intelligence, Networking and Information Technology \(AINIT\),pp\. 800–805\.Cited by:[§II\-A](https://arxiv.org/html/2606.27629#S2.SS1.p2.1)\.
- \[7\]A\. Jiang, X\. Yang, Y\. Liu, and A\. Zubiaga\(2022\)SWSR: a chinese dataset and lexicon for online sexism detection\.Online Social Networks and Media27,pp\. 100182\.Cited by:[§I](https://arxiv.org/html/2606.27629#S1.p2.1)\.
- \[8\]N\. Li, S\. Li, and J\. Hong\(2023\)Offensive chinese text detection based on multi\-feature fusion\.In2023 4th International Symposium on Computer Engineering and Intelligent Communications \(ISCEIC\),pp\. 460–465\.Cited by:[§II\-A](https://arxiv.org/html/2606.27629#S2.SS1.p2.1)\.
- \[9\]J\. Lu, B\. Xu, X\. Zhang, C\. Min, L\. Yang, and H\. Lin\(2023\)Facilitating fine\-grained detection of Chinese toxic language: hierarchical taxonomy, resources, and benchmarks\.InProceedings of the 61st Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\),pp\. 16235–16250\.Cited by:[§II\-A](https://arxiv.org/html/2606.27629#S2.SS1.p2.1),[§IV\-A](https://arxiv.org/html/2606.27629#S4.SS1.p1.1)\.
- \[10\]X\. Lu and et al\.\(2019\)Irony recognition via CNN integrated with linguistic features\.Journal of Chinese Information Processing33\(5\),pp\. 31–38\.Cited by:[§II\-B](https://arxiv.org/html/2606.27629#S2.SS2.p1.1)\.
- \[11\]R\. Ren, J\. Zhao, X\. Sun, and Q\. Li\(2026\)NLP\-based review for toxic comment detection tailored to the chinese cyberspace\.arXiv\.External Links:2601\.14721,[Link](https://arxiv.org/abs/2601.14721)Cited by:[§I](https://arxiv.org/html/2606.27629#S1.p3.1)\.
- \[12\]H\. Su, Z\. Huang, H\. Chang, and C\. Lin\(2017\)Rephrasing profanity in chinese text\.InProceedings of the First Workshop on Abusive Language Online,pp\. 18–24\.Cited by:[§II\-A](https://arxiv.org/html/2606.27629#S2.SS1.p1.1)\.
- \[13\]X\. Tang and X\. Shen\(2020\-oct\.\)Categorizing offensive language in social networks: a Chinese corpus, systems and an explainable tool\.InProceedings of the 19th Chinese National Conference on Computational Linguistics,pp\. 1045–1056\.External Links:[Link](https://aclanthology.org/2020.ccl-1.97/)Cited by:[§I](https://arxiv.org/html/2606.27629#S1.p2.1)\.
- \[14\]Y\. Tang and H\. Chen\(2014\)Chinese irony corpus construction and ironic structure analysis\.InProceedings of COLING 2014, The 25th international conference on computational linguistics: Technical papers,pp\. 1269–1278\.Cited by:[§II\-B](https://arxiv.org/html/2606.27629#S2.SS2.p1.1)\.
- \[15\]Y\. Xiao, H\. Bouamor, and W\. Zaghouani\(2024\)Chinese offensive language detection:current status and future directions\.arXiv\.External Links:2403\.18314,[Link](https://arxiv.org/abs/2403.18314)Cited by:[§I](https://arxiv.org/html/2606.27629#S1.p1.1)\.
- \[16\]Y\. Xiao, Y\. Hu, K\. T\. W\. Choo, and R\. K\. Lee\(2024\)ToxiCloakCN: evaluating robustness of offensive language detection in Chinese with cloaking perturbations\.InProceedings of the 2024 Conference on Empirical Methods in Natural Language Processing,pp\. 6012–6025\.Cited by:[§II\-C](https://arxiv.org/html/2606.27629#S2.SS3.p1.1)\.
- \[17\]Q\. Yang, Y\. Chen, Z\. Xu, Y\. Shang, S\. Guo, and X\. Zhang\(2025\)SCCD: a session\-based dataset for Chinese cyberbullying detection\.InProceedings of the 31st International Conference on Computational Linguistics,pp\. 9533–9545\.Cited by:[§I](https://arxiv.org/html/2606.27629#S1.p1.1)\.
- \[18\]B\. Zhang and Z\. Wang\(2022\)Character\-level Chinese toxic comment classification algorithm based on CNN and Bi\-GRU\.InProceedings of the 5th International Conference on Computer Science and Software Engineering,pp\. 108–114\.Cited by:[§II\-A](https://arxiv.org/html/2606.27629#S2.SS1.p1.1)\.
- \[19\]L\. Zhang, X\. Zhao, X\. Song, Y\. Fang, D\. Li, and H\. Wang\(2022\)A novel chinese sarcasm detection model based on retrospective reader\.InInternational Conference on Multimedia Modeling,pp\. 267–278\.Cited by:[§II\-B](https://arxiv.org/html/2606.27629#S2.SS2.p1.1)\.
- \[20\]Y\. Zhang, T\. Zhong, T\. Yi, and H\. Li\(2024\)Domain\-enhanced prompt learning for chinese implicit hate speech detection\.IEEE Access12,pp\. 13773–13782\.Cited by:[§II\-B](https://arxiv.org/html/2606.27629#S2.SS2.p1.1)\.
- \[21\]G\. Zhou, H\. Wang, D\. Jin, W\. Wang, S\. Jiang, R\. Tang, and X\. Chen\(2025\)A toxic euphemism detection framework for online social network based on semantic contrastive learning and dual channel knowledge augmentation\.Information Processing & Management62\(4\),pp\. 104143\.Cited by:[§II\-B](https://arxiv.org/html/2606.27629#S2.SS2.p1.1)\.
- \[22\]J\. Zhou, J\. Deng, F\. Mi, Y\. Li, Y\. Wang, M\. Huang, X\. Jiang, Q\. Liu, and H\. Meng\(2022\)Towards identifying social bias in dialog systems: framework, dataset, and benchmark\.InFindings of the Association for Computational Linguistics: EMNLP 2022,pp\. 3576–3591\.Cited by:[§I](https://arxiv.org/html/2606.27629#S1.p1.1)\.Similar Articles
Multi-Stage Training for Abusive Comment Detection in Indic Languages
This paper proposes a multi-stage training pipeline using language-based preprocessing and an ensemble of models to detect abusive comments in Indic languages, aiming to minimize false positives while preserving freedom of expression.
Low-resource Language Discrimination Towards Chinese Dialects with Transfer learning and Data Augmentation
The paper proposes a novel framework (CDDTLDA) using transfer learning and data augmentation to improve Chinese dialects discrimination under low-resource conditions, achieving state-of-the-art results on two benchmark corpora.
Harder to Defend: Towards Chinese Toxicity Attacks via Implicit Enhancement and Obfuscation Rewriting
The paper introduces CITA, a framework for generating implicit toxicity attacks in Chinese to evaluate and improve LLM toxicity detectors, finding high attack success rates across tested models.
CFMS: Towards Explainable and Fine-Grained Chinese Multimodal Sarcasm Detection Benchmark
Researchers from Peking University introduce CFMS, the first fine-grained Chinese multimodal sarcasm detection benchmark with 2,796 image-text pairs and a triple-level annotation framework (sarcasm identification, target recognition, explanation generation), along with a novel RL-augmented in-context learning method (PGDS) that significantly outperforms existing baselines.
Multilingual Polarization Detection Using Transformer-Based Models with Class Weighting and Threshold Tuning
This paper describes a system for SemEval-2026 Task 9 on multilingual polarization detection, using RoBERTa for English and AfroXLMR for Swahili with class-weighted loss and threshold tuning, achieving competitive F1 scores on binary and multi-label subtasks.