A Deep Prompt-Based Chain-of-Thought Approach to Harmful Euphemism Detection in Social Networks Authors: Siyu Xie, Gang Zhou, Haizhou Wang Published: 2026 ABSTRACT In recent years, cyberspace governance has become a critical component of national security strategies worldwide. Although social network platforms provide users with convenient channels for expression and information acquisition, unregulated, harmful euphemisms have become increasingly prevalent. These euphemisms disrupt the order of the digital space and trigger secondary harms such as cyberbullying and regional discrimination. Currently, researches on Chinese harmful euphemism detection face three key challenges: the lack of large-scale annotated datasets, the cognitive reasoning deficit in lightweight models, and the latency constraints of Large Language Models (LLMs), which collectively constrain detection performance and real-world generalization. To address these issues, this study first collected a large corpus from social networking platforms and constructed a fine-grained annotated harmful euphemism dataset. Then, a representation learning framework was designed by integrating deep prompt-based chain-of-thought reasoning with multi-head contrastive learning. This framework introduces external knowledge from LLMs to enhance the diversity and precision of semantic representations. Finally, a multi-dimensional semantic perception fusion framework was proposed. It incorporates multiple semantic perception channels and a cross-channel dynamic fusion mechanism, enabling the model to better capture implicit semantics and integrate external contextual knowledge. Experimental results show that our approach significantly outperforms state-of-the-art lightweight models. While large-scale LLMs exhibit superior zero-shot transferability in cross-domain tasks, our proposed model maintains highly competitive performance with substantially lower inference latency and computational overhead. This research provides a novel methodological and technical foundation for detecting harmful euphemisms in social networks. 1. Introduction The rapid growth of social networking platforms has greatly facilitated information dissemination, but it has also led to a surge in malicious content, posing significant challenges to the online ecosystem [1]. Among various forms of harmful content, harmful euphemisms constitute a particularly elusive category, in which illegal, discriminatory, or violent intentions are conveyed covertly. Such expressions employ linguistic strategies—including homophones, abbreviations, metonymy, and metaphor—to superficially “sanitize” sensitive content and evade both automated moderation and manual review. Harmful euphemisms were initially prevalent in the dark web and underground forums—often referred to as “underground jargon” [2]—where they facilitated illicit activities such as drug trafficking, human exploitation, and the illegal arms trade. However, with the widespread adoption of social media and the increasing “gamification” of online discourse, these expressions have gradually permeated mainstream platforms. They have evolved into more subtle, dynamic, and socially embedded forms. Against this backdrop, harmful euphemism detection has emerged as a critical research direction in cyberspace content security. Nevertheless, due to their cryptic semantics and rapid evolution, existing detection models struggle to effectively identify such implicit harmful content. These challenges can be summarized as follows:1.Data Scarcity: There is a lack of large-scale, fine-grained datasets with contextual semantic annotations, which limits models’ semantic understanding and generalization capabilities.2.Cognitive Reasoning Deficit in Lightweight Models: Existing methods largely rely on keywords or explicit features extracted by conventional pre-trained language models (PLMs). However, euphemistic expressions often depend heavily on contextual semantics and sociocultural backgrounds. Current lightweight models possess limited capacity for external knowledge integration and explicit logical deduction. This limitation significantly hinders detection accuracy and robustness when countering complex rhetorical disguises.3.Latency Constraints of Large Language Models (LLMs): While modern LLMs possess strong zero-shot reasoning abilities capable of deciphering implicit intents, their large parameter sizes incur prohibitive computational overhead. This renders direct LLM deployment infeasible for the microsecond-level, high-concurrency real-time moderation demanded by modern social networks. 1.Data Scarcity: There is a lack of large-scale, fine-grained datasets with contextual semantic annotations, which limits models’ semantic understanding and generalization capabilities. Data Scarcity: There is a lack of large-scale, fine-grained datasets with contextual semantic annotations, which limits models’ semantic understanding and generalization capabilities. 2.Cognitive Reasoning Deficit in Lightweight Models: Existing methods largely rely on keywords or explicit features extracted by conventional pre-trained language models (PLMs). However, euphemistic expressions often depend heavily on contextual semantics and sociocultural backgrounds. Current lightweight models possess limited capacity for external knowledge integration and explicit logical deduction. This limitation significantly hinders detection accuracy and robustness when countering complex rhetorical disguises. Cognitive Reasoning Deficit in Lightweight Models: Existing methods largely rely on keywords or explicit features extracted by conventional pre-trained language models (PLMs). However, euphemistic expressions often depend heavily on contextual semantics and sociocultural backgrounds. Current lightweight models possess limited capacity for external knowledge integration and explicit logical deduction. This limitation significantly hinders detection accuracy and robustness when countering complex rhetorical disguises. 3.Latency Constraints of Large Language Models (LLMs): While modern LLMs possess strong zero-shot reasoning abilities capable of deciphering implicit intents, their large parameter sizes incur prohibitive computational overhead. This renders direct LLM deployment infeasible for the microsecond-level, high-concurrency real-time moderation demanded by modern social networks. Latency Constraints of Large Language Models (LLMs): While modern LLMs possess strong zero-shot reasoning abilities capable of deciphering implicit intents, their large parameter sizes incur prohibitive computational overhead. This renders direct LLM deployment infeasible for the microsecond-level, high-concurrency real-time moderation demanded by modern social networks. To address these issues, we propose a harmful euphemism detection model based on multi-dimensional semantic-aware fusion. The specific contributions of this work are as follows:•We construct a large-scale Chinese harmful euphemism dataset with fine-grained semantic annotations. The dataset is built from the Bilibili platform and covers multiple dimensions, including topic categories, attack types, euphemistic expressions, and their corresponding explanations. To the best of our knowledge, this is the first dataset to incorporate explicit semantic explanations of harmful euphemisms.•We propose a novel representation learning framework that integrates chain-of-thought (CoT) prompting with multi-head contrastive learning. By leveraging external knowledge from LLMs in an offline manner, the framework enhances the diversity and precision of semantic representations while avoiding the computational overhead of online inference.•We develop a multi-dimensional semantic-aware detection model with dynamic fusion. The proposed architecture captures implicit semantics and contextual dependencies more effectively. It achieves strong performance while maintaining low inference latency. •We construct a large-scale Chinese harmful euphemism dataset with fine-grained semantic annotations. The dataset is built from the Bilibili platform and covers multiple dimensions, including topic categories, attack types, euphemistic expressions, and their corresponding explanations. To the best of our knowledge, this is the first dataset to incorporate explicit semantic explanations of harmful euphemisms. We construct a large-scale Chinese harmful euphemism dataset with fine-grained semantic annotations. The dataset is built from the Bilibili platform and covers multiple dimensions, including topic categories, attack types, euphemistic expressions, and their corresponding explanations. To the best of our knowledge, this is the first dataset to incorporate explicit semantic explanations of harmful euphemisms. •We propose a novel representation learning framework that integrates chain-of-thought (CoT) prompting with multi-head contrastive learning. By leveraging external knowledge from LLMs in an offline manner, the framework enhances the diversity and precision of semantic representations while avoiding the computational overhead of online inference. We propose a novel representation learning framework that integrates chain-of-thought (CoT) prompting with multi-head contrastive learning. By leveraging external knowledge from LLMs in an offline manner, the framework enhances the diversity and precision of semantic representations while avoiding the computational overhead of online inference. •We develop a multi-dimensional semantic-aware detection model with dynamic fusion. The proposed architecture captures implicit semantics and contextual dependencies more effectively. It achieves strong performance while maintaining low inference latency. We develop a multi-dimensional semantic-aware detection model with dynamic fusion. The proposed architecture captures implicit semantics and contextual dependencies more effectively. It achieves strong performance while maintaining low inference latency. 2. Related Work With the rapid growth of user bases and information flow on social networks, harmful euphemisms have increasingly exhibited greater concealment, morphological variation, and rapid diffusion across various platforms, which pose severe challenges to automated detection. The existing research has predominantly focused on explicit harmful speech [3], while less attention has been given to implicit and euphemistic harmful expressions disguised through homophones, metaphors, and encoding [4]. Early works mostly relied on keyword- or rule-based detection techniques, such as sensitive lexicons, blocklists, and allowlist/denylist mechanisms [5,6]. These methods struggle to model the deep semantics and contextual dependencies of complex and ever-changing euphemistic expressions, and thus exhibit clear limitations. Subsequent research has gradually evolved from simple vocabulary matching to more comprehensive methodological frameworks, oriented toward semantic representation learning, external knowledge modeling, and multimodal fusion. Table 1 summarizes key existing studies, comparing the datasets, backbone models, and their use of external knowledge. Overall, the existing research follows a clear evolutionary trajectory. 2.1. Semantics-Driven Representation of Harmful Euphemisms To address the limitations of rule- and lexicon-based methods in handling novel and concealed euphemistic expressions, a line of research has shifted toward distributed semantic modeling. Early works mostly utilized static word embeddings such as Word2Vec to capture word co-occurrence patterns in corpora via distributed representations. Yuan et al. [7] developed neural models based on static word embeddings to analyze dark web illicit trade corpora, identifying euphemisms with significant semantic deviations and inferring their true meanings through semantic mapping. Taylor et al. [8] combined word embeddings with PageRank, using community detection methods to identify novel harmful euphemisms generated by extremist communities. Magu et al. [25] integrated word embeddings with network structure analysis to expand unknown euphemisms and related harmful texts based on known argots, demonstrating a hybrid semantic–graph-based detection paradigm. Targeting Chinese scenarios, Wang et al. [26] systematically evaluated various typical word embedding models, automatically discovering novel harmful euphemisms through semantic similarity measurement. They further introduced features such as pronunciation and glyphs, as well as domain-incremental training strategies. With the development of deep learning and pre-trained language models, research has gradually shifted from static word embeddings to contextualized representations. Zhu et al. [9] first introduced BERT into the content moderation task, enabling the detection of euphemistic expressions in a self-supervised manner. Huang et al. [10] proposed DJPD, a low-frequency euphemism detection model, leveraging Transformer architectures to better model low-frequency and rare euphemistic expressions. Guan et al. [11] further constructed JargonFM, a multi-mode euphemism interpreter supporting category prediction, similar expression discovery, and representative text selection, thereby forming a unified framework for identifying and interpreting harmful euphemisms. However, despite the continuous optimization of representation structures in the aforementioned models, the underlying supervised training heavily relies on binary labels and lacks access to fine-grained Chinese datasets with deep semantic annotations. This issue is particularly evident in dynamic social contexts such as Bilibili, which features a unique danmaku (bullet-screen comment) culture, existing datasets lack detailed topic classification and interpretation of true meanings. This results in insufficient prior knowledge of the underlying malicious motives of euphemisms during model learning, limiting the effectiveness of semantic representation learning. 2.2. Contrastive Learning for Implicit Semantics Although dynamic word representations have significantly improved semantic modeling capabilities, relying solely on supervised learning and traditional sampling strategies often makes it difficult to construct high-quality annotated datasets covering diverse forms of euphemistic expressions [27,28,29]. Therefore, some studies have begun to introduce contrastive, self-supervised, and semi-supervised mechanisms to alleviate the issues of data scarcity and high annotation costs. Regarding the evolution of general contrastive learning frameworks, in the field of computer vision, MoCo [30] and SimCLR [31] form a representative dual-track paradigm for contrastive learning, where MoCo introduced a momentum contrast mechanism to ensure the feature stability of the negative sample dictionary. The natural language processing field subsequently developed variants based on text characteristics. SimCSE [32] introduces latent space perturbations via dropout to construct positive sample pairs, improving the Spearman correlation coefficient by 23.6% over traditional methods in the STS-B semantic similarity task. Targeting supervised learning scenarios, Gunel et al. [33] proposed a joint loss function that combines cross-entropy and contrastive loss using a weighting coefficient, improving average accuracy by 2.9% on the GLUE benchmark. The more innovative DualCPC framework [34] achieved multi-granularity contrast through a two-level optimization strategy involving instance-level bidirectional prediction and cluster-level inter-cluster contrast, further improving model accuracy. When applying the aforementioned theories to implicit euphemistic semantic detection, contrastive learning shows strong generalization potential. Kim et al. [12] proposed the contrastive learning method ImpCon, which shortens the representation distance between the “implicit meaning” and the corresponding post, encouraging the model to learn their semantic relationship, thereby enhancing cross-dataset generalization. Lu et al. [13] proposed a dual contrastive learning framework combining self-supervised contrastive learning with supervisory signals to capture high-level semantic information while addressing challenges such as data imbalance, subjectivity, and contextual dependency. Building upon this, Deng et al. [14] constructed the large-scale unsupervised dataset AugCOLD and employed a multi-teacher knowledge distillation method, where multiple independently trained teacher models provide soft labels for the student model, extracting supervisory signals from unlabeled data, thereby improving the model’s robustness and generalization. Meanwhile, some studies focus on the interpretability of the model’s decision-making process and the impact of training data on prediction results. For example, testing with Concept Activation Vectors has been used to evaluate the model’s sensitivity to specific semantic concepts, combined with data augmentation to enhance robustness against novel euphemisms [35]; TrackIn [15], a gradient-based method, was designed to analyze the contribution of training samples to the prediction results of test samples, improving model robustness from a data-centric perspective. Despite the potential of contrastive learning in alleviating data scarcity, the existing mechanisms are highly susceptible to semantic collapse when processing harmful euphemisms. Because euphemisms exhibit highly similar surface forms but opposite polarities in normal versus malicious contexts, traditional single-view contrastive learning struggles to accurately capture such subtle semantic shifts, leading to semantic collapse and representation homogenization issues. 2.3. Enhancement Methods Fusing External Knowledge Since the true meaning of text often depends on external background knowledge, domain conventions, and syntactic complexity, various research directions have incorporated external knowledge and explicit structural information to enhance detection performance. In terms of explicit structure modeling and multimodal fusion, Pavlopoulos et al. [16] constructed the TOXICSPANS dataset, annotating harmful spans within text, and trained sequence labeling models based on this to achieve finer-grained, span-level identification of harmful expressions. Wang et al. [17] introduced adapter modules on top of pre-trained models to fuse multi-source features such as phonology, glyphs, and vocabulary into BERT. Huang et al. [18] proposed a two-stage framework that first generates euphemism candidates based on pre-trained language models, and then models the structural relationships between words using a syntactic dependency graph via syGCN, establishing mappings between euphemisms and their semantic interpretations, effectively improving both identification and interpretation capabilities. On the other hand, to more fully utilize contextual settings and user-level information, Ghosh et al. [19] proposed CoSyn, a context-synergized neural network that jointly models dialogue context, user history, and social relationships to detect harmful euphemisms in online conversations, significantly improving detection accuracy in complex interactive scenarios. As internet content expands from pure text to modalities like memes, Zhang et al. [20] proposed a topology-aware optimal transport framework to model harmful euphemistic content in Internet memes, highlighting the importance of multimodal information for interpreting implicit expressions. In expanding implicit reasoning capabilities, Prompt-based Chain-of-Thought (Prompt CoT) provides a promising direction for mining deep semantics. Jason Wei et al. [21] address challenges in complex reasoning tasks by introducing chain-of-thought prompting, confirming that this method is particularly effective on large-scale language models. Zhang et al. [36] explored the application of Automated Chain-of-Thought (Auto CoT) in large language models, aiming to improve reasoning ability by automatically generating reasoning steps; Kojima et al. [22] demonstrated the feasibility of zero-shot reasoning in LLMs to new tasks. However, external knowledge injection alone is insufficient to ensure reasoning accuracy. Zhou et al. [37] pointed out that irrelevant reasoning rationales can affect the model’s robustness; Wu et al. [38] further revealed through structural causal models that biased information in pre-training data might impair the reasoning capabilities of LLMs. To address these challenges, Zhao et al. [23] proposed KG-CoT, an innovative knowledge enhancement paradigm utilizing small-scale step-by-step graph reasoning models to reason over knowledge graphs, generating high-confidence reasoning chains for large-scale LLMs; Mondal et al. [24] proposed the KAM-CoT framework, which deeply integrates CoT reasoning, knowledge graphs, and multimodal features, providing comprehensive support for understanding multimodal harmful content while controlling computational costs. Chen et al. [39] proposed the SCCN framework for fake news detection, which effectively leverages social contextual cues. Although existing methods attempt to utilize large models for knowledge injection, most remain at the stage of shallow text concatenation. Current research has yet to achieve organic fusion; it is unable to utilize the external knowledge of large models for high-confidence logical reasoning, nor can it adaptively avoid data homogenization in the feature space, which limits the upper bound of representation quality for harmful euphemism detection. 2.4. Multi-Task Learning and Debiasing Research Multi-Task Learning (MTL), as an effective learning paradigm, improves model generalization by sharing knowledge across related tasks [40], and has been successfully applied in scenarios such as hate speech classification [41], dialogue system development [42], and sentiment analysis [43]. The core of multi-task learning lies in the design of the parameter sharing mechanism, which currently follows two main paths: hard sharing and soft sharing. Regarding hard sharing, models typically employ a unified bottom network supplemented by task-specific head modules, such as the BERT-based multi-task neural network proposed by Liu et al. [44]. Inspired by ensemble learning, Ma et al. [45] designed a Multi-gate Mixture-of-Experts (MMoE) model, where the shared bottom consists of multiple neural network experts, using gating mechanisms to control knowledge sharing, thereby effectively mitigating conflicts between tasks. Comparatively, soft sharing offers higher flexibility by sharing only a small number of parameters across tasks. For instance, Duong et al. [46] introduced regularization terms between task-specific networks to constrain parameter differences, enabling cross-task knowledge transfer while avoiding negative transfer from over-sharing. At the task design level, multi-task learning has been introduced to strengthen the model’s modeling of multi-dimensional attributes. Flor et al. [47] found that when harmful category discrimination is jointly trained with related sub-tasks, the model can better distinguish different types of offensive euphemisms, improving overall detection performance across categories. Meanwhile, to alleviate bias issues in harmful content detection, Manzini et al. [48] approached the problem from the perspective of word embedding debiasing, proposing new bias evaluation metrics andconstructing a bias subspace via principal component analysis to robustly reduce bias risks in multi-classification tasks at the representation level. Such works provide a reference for introducing multi-task learning and fairness constraints for harmful euphemism detection. However, despite current strategies like multi-task learning enriching the reference features of models, existing detection models still suffer from the fundamental limitation of single-dimensional perception in their architectural design. Most existing systems treat text as a single linear sequence for feature extraction, or merely rely on rigid feature concatenation and shallow bottom-layer parameter sharing during fusion. This coarse fusion strategy is prone to spurious correlations, which in turn leads to overfitting on high-frequency lexical patterns. In summary, although detection models have evolved from static lexicons to dynamic representation learning, contrastive learning mechanisms, and multi-task frameworks, existing paradigms still encounter two fundamental bottlenecks when processing harmful euphemisms:1.Single-Dimensional Perception and Shallow Feature Fusion: Existing traditional and lightweight frameworks predominantly rely on single-dimensional text sequences. Even when external features or multi-task sharing mechanisms are introduced, they are typically integrated through rigid and shallow concatenation. When confronted with highly obscure rhetorical disguises, this structural limitation inherently causes the aforementioned cognitive reasoning deficit, inevitably leading to semantic collapse. Consequently, traditional models frequently generate spurious correlations and overfit to high-frequency surface words, rather than structurally decouple underlying syntactic, contextual, and rhetorical anomalies.2.Deployment Dilemmas and Shallow Integration of LLMs: Recently, LLMs have shown strong zero-shot reasoning capabilities via CoT prompting. However, current LLM-augmented methods typically inject external knowledge by appending generated reasoning rationales to prompts during online inference. This shallow, text-level fusion fails to organically reshape the model’s latent cognitive space. Furthermore, relying on massive LLMs for direct online inference is highly susceptible to pre-training biases and noisy rationales, while also incurring the prohibitive computational overhead and latency mentioned earlier. This makes them impractical for real-time moderation in dynamic, high-throughput social platforms. 1.Single-Dimensional Perception and Shallow Feature Fusion: Existing traditional and lightweight frameworks predominantly rely on single-dimensional text sequences. Even when external features or multi-task sharing mechanisms are introduced, they are typically integrated through rigid and shallow concatenation. When confronted with highly obscure rhetorical disguises, this structural limitation inherently causes the aforementioned cognitive reasoning deficit, inevitably leading to semantic collapse. Consequently, traditional models frequently generate spurious correlations and overfit to high-frequency surface words, rather than structurally decouple underlying syntactic, contextual, and rhetorical anomalies. Single-Dimensional Perception and Shallow Feature Fusion: Existing traditional and lightweight frameworks predominantly rely on single-dimensional text sequences. Even when external features or multi-task sharing mechanisms are introduced, they are typically integrated through rigid and shallow concatenation. When confronted with highly obscure rhetorical disguises, this structural limitation inherently causes the aforementioned cognitive reasoning deficit, inevitably leading to semantic collapse. Consequently, traditional models frequently generate spurious correlations and overfit to high-frequency surface words, rather than structurally decouple underlying syntactic, contextual, and rhetorical anomalies. 2.Deployment Dilemmas and Shallow Integration of LLMs: Recently, LLMs have shown strong zero-shot reasoning capabilities via CoT prompting. However, current LLM-augmented methods typically inject external knowledge by appending generated reasoning rationales to prompts during online inference. This shallow, text-level fusion fails to organically reshape the model’s latent cognitive space. Furthermore, relying on massive LLMs for direct online inference is highly susceptible to pre-training biases and noisy rationales, while also incurring the prohibitive computational overhead and latency mentioned earlier. This makes them impractical for real-time moderation in dynamic, high-throughput social platforms. Deployment Dilemmas and Shallow Integration of LLMs: Recently, LLMs have shown strong zero-shot reasoning capabilities via CoT prompting. However, current LLM-augmented methods typically inject external knowledge by appending generated reasoning rationales to prompts during online inference. This shallow, text-level fusion fails to organically reshape the model’s latent cognitive space. Furthermore, relying on massive LLMs for direct online inference is highly susceptible to pre-training biases and noisy rationales, while also incurring the prohibitive computational overhead and latency mentioned earlier. This makes them impractical for real-time moderation in dynamic, high-throughput social platforms. 3. Methodology This section presents the dataset construction module, the representation learning module, and the detection model in detail. Dataset Construction Module: This module is responsible for collecting comment data from Bilibili and annotating it according to predefined standards, thereby providing data support for subsequent research. Representation Learning Module: The core function of this module is to effectively extract and model external knowledge from LLMs for harmful euphemisms, using deep prompt CoT and multi-head contrastive learning. This improves the quality of representation learning for harmful euphemisms and strengthens the semantic fidelity and expressiveness of the resulting representations. Detection Model: This module first converts the input sentences into word vector representations to extract fundamental semantic information. Subsequently, a triple semantic perception module extracts syntactic, contextual, and rhetorical features, respectively. Finally, the extracted multi-dimensional semantic features are adaptively fused, and a classifier is used for final harmful euphemism detection. 3.1. Dataset Construction During the data construction phase, we selected Bilibili, a major video-sharing platform in China, as the primary source of raw harmful euphemism data. The proposed dataset construction methodology encompasses the following stages: (1) Seed Keyword Selection. To construct a comprehensive harmful euphemism dataset for social networks, we designed the data collection pipeline based on the principles of topic diversity and category balance. Initially, we manually identified four primary categories of seed keywords: political content, vulgar language, general insults, and targeted group attacks. The representative examples of the initial seed keywords are presented in Table 2. Subsequently, based on these seed keywords, we used the Bilibili search engine to select seed videos from diverse content categories, ensuring the diversity of comment sources. A web crawler was deployed to collect comments in batches from the corresponding video sections. Simultaneously, video popularity was evaluated using metrics such as view counts, likes, coin donations, comments, and shares, to ensure the representativeness and broad coverage of the dataset. (2) Data Crawling and Bias Control. We employed a Breadth-First Search (BFS) strategy for data collection. First, to control data bias and avoid bias toward a single “echo chamber”, we implemented stratified sampling across diverse Bilibili video partitions (e.g., news, entertainment, gaming, and lifestyle), extracting comments from target videos and storing them in a database. Notably, to capture the temporal evolution of emerging harmful content on contemporary internet platforms, we did not rely on a static search strategy. Instead, we dynamically selected and updated seed videos based on popularity metrics such as views, likes, and trending indices. Furthermore, time-sensitive variants, such as meme-based expressions, were incorporated. During BFS traversal, the crawler calculated video popularity and selected the top 10 recommended videos as child nodes for the next iteration, while performing exact-match deduplication to remove redundant nodes. Over four traversal iterations, the crawler collected approximately 8 million comments from 5000 videos. Next, to ensure data quality and establish rigorous inclusion criteria, we filtered the raw comment corpus using the initial seed dictionary and applied a length filter to remove comments shorter than two characters. Ultimately, following rigorous manual annotation and multiple rounds of expert review, we constructed a high-quality Bilibili comment dataset consisting of approximately 26,517 samples. (3) Data Annotation. To improve annotation accuracy and mitigate subjective bias, we carefully designed the annotation workflow. First, to ensure diversity in perspectives, we recruited annotators of different genders and regional cultural backgrounds, and provided each participant with systematic training on euphemistic contexts. Second, rather than imposing fixed annotation rules, our annotation guidelines were iteratively formulated through progressive analysis of the collected Bilibili corpus. We conducted several rounds of small-scale pilot annotations and intensive discussions of edge cases to refine fine-grained annotation standards. During the formal annotation phase, three core principles were strictly enforced: (1) annotators must independently execute their tasks based on the established guidelines; (2) post-annotation consistency must be verified by an independent third party; and (3) highly inconsistent annotations require mandatory re-evaluation. Acknowledging that cultural backgrounds induce variations in comprehending harmful euphemisms, annotators were required to interpret euphemistic terms strictly based on their objective contextual scenarios. Furthermore, independent evaluation and tagging of euphemism labels were mandatory. Finally, random spot checks were conducted to enforce quality control and ensure annotation consistency. Major discrepancies in euphemism labels were resolved through collaborative team reviews and consensus discussions. To quantitatively evaluate and verify annotation reliability, we calculated the Fleiss’ Kappa statistic across the entire dataset. The overall coefficient reached 0.82, indicating substantial agreement among annotators and ensuring the high quality of the dataset. Based on this rigorous dataset construction strategy, we observed that harmful euphemisms distort normal, healthy discourse through means such as morphological variations, metaphors, and sarcasm to convey harmful information like racial discrimination, child pornography, and group hatred. Based on the analysis of the dataset samples, their characteristics can be summarized as follows: (1) the intent of the comment is inconsistent with its literal interpretation; (2) the use of uncommon phrases or combinations of special characters and numbers; (3) a noticeable shift in tone or emotion compared to the normal context; (4) seemingly illogical yet contextually consistent expressions. Detailed statistics of the constructed HECD dataset are presented in Table 3. It contains 26,517 samples, covering 4 topic types and 8 different attack methods of harmful euphemisms, providing fine-grained annotations for subsequent research on harmful euphemism detection and identification. As shown in Table 3, the HECD dataset exhibits a moderate class imbalance between harmful (11,481) and harmless (15,036) samples, with harmless data comprising 56.7% of the corpus. This ratio of approximately 1:1.31 reflects the natural distribution of social media content, where benign expressions are generally more prevalent. This moderate imbalance remains within a controllable range and does not constitute a severe skew that would dominate classifier behavior. Furthermore, an uneven distribution is observed at the topical level, with categories such as “Group Attacks” containing more samples than “Political Content” and “Everyday Insults”. While such topical imbalance may bias training toward high-frequency topics and affect classification accuracy, we deliberately preserved this real-world distribution. Because the topical differences do not represent an order-of-magnitude skew, artificial re-balancing was avoided to prevent the introduction of synthetic noise. 3.2. Representation Learning To address the issues of inaccurate representation and insufficient generalization of harmful euphemisms, we propose a harmful euphemism Representation Learning Framework via Deep Prompt COT and Multi-head Contrastive Learning (HER-MCL). This framework is a representation learning method for harmful euphemistic semantics that integrates the generalized knowledge of large models with self-supervised learning, enabling a more accurate extraction of semantic representation vectors of harmful euphemisms from pre-trained corpora, as illustrated in Figure 1. 3.2.1. Seed Lexicon Matching Stage To enhance the ability of LLMs to mine external knowledge of harmful euphemisms, we design a seed word prompt sample selection algorithm based on an adaptive threshold, integrating the semantic relationship between harmful euphemisms and their corresponding explanatory words for harmful meanings. Suppose the local harmful euphemism lexicon set is O, where oi represents a word in the local harmful euphemism lexicon. Additionally, there are corresponding explanatory words for their harmful meanings, denoted as ei. For each seed word and its corresponding explanatory word, their vector representations are obtained. Cosine similarity is used to measure their similarity, while an adaptive threshold is employed to ensure that the seed words accurately represent their harmful meanings. Based on the calculated adaptive threshold, a set of seed words highly correlated with the target seed words and mapped words is filtered out. Finally, an iteratively optimized seed word set is output, containing seed words that are highly relevant to the target harmful euphemisms and possess diversity, capable of comprehensively covering the semantic space of the selected terms. 3.2.2. Chain-of-Thought Template Generation Stage The deep prompt CoT refers to a prompt template generated by LLMs, which integrates prior knowledge and encodes a complete and structured reasoning process. First, an initial CoT template is constructed based on a locally curated harmful euphemism lexicon and its associated metadata. Second, the design of the template incorporates the proposed five cognitive dimensions of harmful euphemisms, namely: topic category, attack strategy, reasoning chain, attack variant, and structured mapping relations. These elements are introduced to ensure that the reasoning process aligns with the cognitive characteristics of euphemistic expressions. Third, the initial template is further refined and expanded through interaction with an open-source LLM API. During this stage, both the extracted local knowledge and the five cognitive dimensions are jointly integrated and enriched, resulting in a more comprehensive and structurally grounded deep CoT template. Finally, the generated deep CoT template guides the LLM in effectively eliciting auxiliary external knowledge from the original harmful euphemistic expressions, thereby enhancing semantic enrichment and implicit intent extraction. In this section, we define the design principles of the deep CoT template and specify the objective of each reasoning stage. The corresponding template structures for different reasoning stages are presented in Table 4. 3.2.3. Three-Fold Data Augmentation Stage The goal of this stage is to generate multiple similar samples that are semantically close to the original sentence but differ in surface form, thereby enhancing the model’s robustness against harmful euphemism noise and its variations, and reducing the risk of overfitting during representation training. The specific methods are as follows:(1)Mapping-based Augmentation: The original harmful euphemisms in the samples are replaced with their corresponding harmful meaning mapped words from the lexicon, generating similar augmented samples of the original harmful euphemisms.(2)Substitution-based Augmentation: Utilizing the morphological variants of harmful euphemisms generated by the deep prompt CoT, the original harmful euphemisms in the sentence samples are replaced with these variants to generate similar augmented samples.(3)Randomized Augmentation: Three randomization strategies commonly used in traditional contrastive learning frameworks are comprehensively applied, namely dropout, cutoff (dimensional clipping), and character shuffling. (1)Mapping-based Augmentation: The original harmful euphemisms in the samples are replaced with their corresponding harmful meaning mapped words from the lexicon, generating similar augmented samples of the original harmful euphemisms. Mapping-based Augmentation: The original harmful euphemisms in the samples are replaced with their corresponding harmful meaning mapped words from the lexicon, generating similar augmented samples of the original harmful euphemisms. (2)Substitution-based Augmentation: Utilizing the morphological variants of harmful euphemisms generated by the deep prompt CoT, the original harmful euphemisms in the sentence samples are replaced with these variants to generate similar augmented samples. Substitution-based Augmentation: Utilizing the morphological variants of harmful euphemisms generated by the deep prompt CoT, the original harmful euphemisms in the sentence samples are replaced with these variants to generate similar augmented samples. (3)Randomized Augmentation: Three randomization strategies commonly used in traditional contrastive learning frameworks are comprehensively applied, namely dropout, cutoff (dimensional clipping), and character shuffling. Randomized Augmentation: Three randomization strategies commonly used in traditional contrastive learning frameworks are comprehensively applied, namely dropout, cutoff (dimensional clipping), and character shuffling. 3.2.4. Multi-Head Contrastive Learning Stage Multi-head Contrastive Learning (MCL) utilizes a pre-trained language model and multi-dimensional projection heads to encode harmful euphemisms into token embedding representations. These representations are then projected by multiple heads into low-dimensional vector spaces at different hierarchical levels. Ultimately, contrastive loss is applied across projection subspaces to bring similar samples closer and push dissimilar ones apart. Specifically, MCL constructs positive and negative pairs through a three-part data augmentation scheme. The positive samples consist not only of the original sentences but also substitution-based augmented samples generated via the Deep Prompt Chain of Thought and the generalized knowledge of large language models, mapping-based augmented samples derived from explicit harmful meanings, and randomized augmented samples generated by three randomization strategies. This enables the model to learn consistent semantics across different views. Conversely, negative samples are drawn from other instances within the same mini-batch, which reinforces the model’s discriminative capacity between distinct semantics. By minimizing distances between positive pairs and maximizing distances to negative samples, MCL achieves self-supervised optimization of semantic representations. A dynamic weight adjustment mechanism is also introduced, enabling semantic differences across various subspaces to be adaptively balanced during training. This ensures that each projection head is fully utilized, yielding representation vectors that are both semantically rich and accurate. The framework is trained end-to-end, jointly optimizing the three types of contrastive samples via backpropagation, thereby improving the model’s accuracy and robustness in capturing the implicit information concealed within harmful euphemisms. The MCL stage employs a multi-head projection architecture. To maintain structural symmetry with the 12 inherent self-attention heads of the foundational pre-trained textual encoder (RoBERTa), this framework precisely configures 12 projection heads. These 12 projection heads are systematically partitioned into 3 groups of projection subspaces with varying dimensions (4 heads per group), mapping the sentence representation matrices obtained from the pre-trained encoder into multidimensional vector subspaces for contrastive optimization. Let the sentence representation output by the pre-trained encoder be denoted as x∈RL×dencoder, where dencoder is the hidden layer dimension. For each projection head h∈{1,2,…,12}, a linear projection is applied: (1)ph=Whx¯ where x¯=1L∑i=1Lxi represents the sentence-level mean-pooled representation, and the specific projection dimension for a given group is denoted as dh. To ensure training stability and prevent gradient vanishing or exploding during the initial stages of contrastive optimization, the weight matrices Wh of all 12 projection heads are strictly initialized using Xavier Uniform initialization. These 12 projection heads are not pre-assigned to specific data augmentation types (i.e., mapping-based, substitution-based, or randomized augmentations). Instead, all 12 heads globally process the representations of both the original sentence and its three corresponding augmented views simultaneously. This non-assignment strategy is designed: pre-assigning heads would artificially isolate linguistic features and restrict the receptive field of each subspace. By allowing every head to globally compute distances across all three augmentation types, the framework relies entirely on the contrastive loss and the dynamic weight adjustment mechanism to implicitly and organically decouple the multi-dimensional rhetorical disguises across the 12 orthogonal latent subspaces. Within each projection space, the relationships among samples are evaluated through three distance metrics: heterogeneous similarity distance, homogeneous similarity distance, and homogeneous difference distance. These correspond to the average Euclidean distance between the original sentence and its three augmented samples, the average distance among the three augmented samples themselves, and the average distance between the original sentence and the set of negative samples. Heterogeneous similarity distance metric: (2)dhet=13∑i=13porig−psim,i2 Homogeneous similarity distance metric: (3)dhom=13∑i