Lightweight and Effective Coded-Slang Detection for Cyber-Drug Intelligence
Abstract
1. Introduction
- 1.
- Domain-specific dataset construction. We construct a dedicated corpus containing 10,000 annotated social media texts containing drug slang by integrating authentic judicial case files with continuous social media crawling. The authenticity and annotation consistency of the adversarial drug-slang samples are strictly ensured through double-blind annotation and Cohen’s Kappa verification.
- 2.
- Low-resource detection framework. To address the challenges of polysemy and coexistence of benign and illicit usages of drug slang, we propose a collaborative detection framework that couples an expanded domain-specific dictionary with a word-level multi-scale convolutional neural network. This approach effectively captures core coded expressions and their local contextual patterns within highly noisy short texts.
- 3.
- Systematic empirical evaluation. We benchmark our framework against both traditional statistical methods and compact Transformer models. Performance testing in a CPU-only edge-computing environment demonstrates that our lightweight model achieves an F1 score of 99.3%. It requires only 1.86 ms per sample while maintaining a compact model footprint, making it suitable for resource-constrained deployment.
2. Related Work
2.1. Linguistic Studies of Drug Slang
2.2. Word Embedding-Based Approaches
2.3. Deep Learning in Slang Detection
2.4. Large Language Models in Slang Detection
2.5. Scarcity of Chinese Datasets
2.6. Motivation and Core Problem Statement
3. Method
3.1. Overview
3.2. Construction and Annotation of Drug Slang Corpus
3.2.1. Data Sources
3.2.2. Data Preprocessing
3.2.3. Data Annotation
3.3. Model Architecture
3.3.1. Model Overview
3.3.2. Input Layer and Embedding Layer
3.3.3. Convolutional Layer Design and Domain-Specific Adaptation
3.3.4. Pooling Layer and Feature Fusion
3.3.5. Output Layer
3.3.6. Model Training Settings
4. Experiments
4.1. Experimental Setup
4.1.1. Implementation Environment
4.1.2. Evaluation Metrics
4.1.3. Datasets Description and Partitioning
4.2. Performance Evaluation of TextCNN
4.2.1. Quantitative Results on Test Set
4.2.2. Analysis of the Confusion Matrix
4.3. Comparative Analysis with Baseline Models
4.3.1. Performance Comparison on Classification Metrics
4.3.2. Analysis of False Negatives
4.3.3. Computational Efficiency and Deployment Costs
4.3.4. Discussion on Model Characteristics
4.3.5. Granularity Ablation: Word-, Character- and Subword-Level Tokenization
4.4. Ablation Study
4.5. Error Dissection and Case Study
4.6. Generalization Analysis
4.6.1. Cross-Platform and Temporal Robustness
4.6.2. Zero-Shot Out-of-Vocabulary (OOV) Stress Test
4.7. Summary
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Lin, S.Y.; Chien, S.Y.; Chen, Y.Z. Combating online malicious behavior: Integrating machine learning and deep learning methods for harmful news and toxic comments. Inf. Syst. Front. 2024. [Google Scholar] [CrossRef] [Scilit]
- Khan, U.; Khan, S.; Rizwan, A.; Atteia, G.; Jamjoom, M.M.; Samee, N.A. Aggression detection in social media from textual data using deep learning models. Appl. Sci. 2022, 12, 5083. [Google Scholar] [CrossRef] [Scilit]
- Nahar, S.; Any, O.H.; Afrin, M.; Laila, R. Understanding of drug addiction drug abuse and popular drug slang: A narrative review. J. Natl. Inst. Neurosci. Bangladesh 2022, 8, 84–89. [Google Scholar]
- Hu, C.; Yin, M.; Liu, B.; Li, X.; Ye, Y. Detection of illicit drug trafficking events on Instagram: A deep multimodal multilabel learning approach. In Proceedings of the 30th ACM International Conference on Information and Knowledge Management (CIKM 2021), Gold Coast, Australia, 1–5 November 2021; pp. 3838–3846. [Google Scholar]
- Mackey, T.K.; Kalyanam, J.; Katsuki, T.; Kuzmenko, E.; Gupta, R. Solution to detect, classify, and report illicit online marketing and sales of controlled substances via Twitter: Using machine learning and web forensics to combat digital opioid access. J. Med. Internet Res. 2018, 20, e10029. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Sundaram, A.; Subramaniam, H.; Ab Hamid, S.H.; Nor, A.M. A systematic literature review on social media slang analytics in contemporary discourse. IEEE Access 2023, 11, 132457–132471. [Google Scholar] [CrossRef] [Scilit]
- Liu, S.; Gui, D.Y.; Zuo, Y.; Dai, Y. Good slang or bad slang? Embedding internet slang in persuasive advertising. Front. Psychol. 2019, 10, 1251. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Holbrook, E.; Wiskur, B.; Nagykaldi, Z. Discovering drug slang on social media: A Word2Vec approach with Reddit data. arXiv 2024, arXiv:2405.01234. [Google Scholar]
- Deng, J.; Zhou, J.; Sun, H.; Zheng, C.; Mi, F.; Meng, H.; Huang, M. COLD: A benchmark for Chinese offensive language detection. In Proceedings of the Findings of the Association for Computational Linguistics: EMNLP 2022, Abu Dhabi, United Arab Emirates, 7–11 December 2022; pp. 3086–3100. [Google Scholar]
- Ren, R.; Zhao, J.; Sun, X.; Li, Q. NLP-based review for toxic comment detection tailored to the Chinese cyberspace. arXiv 2025, arXiv:2601.14721. [Google Scholar]
- Wu, L.; Morstatter, F.; Liu, H. SlangSD: Building, expanding and using a sentiment dictionary of slang words for short-text sentiment classification. Lang. Resour. Eval. 2018, 52, 839–852. [Google Scholar] [CrossRef] [Scilit]
- Gadusu, S.R.; McGinty, H. Semantic similarity for drug slang identification: A comparative analysis of Word2Vec and BERT. In Proceedings of the 13th Knowledge Capture Conference (K-CAP 2025), Austin, TX, USA, 2–4 December 2025; pp. 190–193. [Google Scholar]
- Asim, M.; Waqar, M.; Alam, I. A comparative analysis of deep learning methods for slang detection in Twitter data. Spectr. Eng. Sci. 2025, 3, 254–270. [Google Scholar]
- Minaee, S.; Kalchbrenner, N.; Cambria, E.; Nikzad, N.; Chenaghlu, M.; Gao, J. Deep learning-based text classification: A comprehensive review. ACM Comput. Surv. 2021, 54, 62. [Google Scholar] [CrossRef] [Scilit]
- Li, Q.; Peng, H.; Li, J.; Xia, C.; Yang, R.; Sun, L.; Yu, P.S.; He, L. A survey on text classification: From traditional to deep learning. ACM Trans. Intell. Syst. Technol. 2022, 13, 31. [Google Scholar] [CrossRef] [Scilit]
- Devlin, J.; Chang, M.W.; Lee, K.; Toutanova, K. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACL-HLT 2019), Minneapolis, MN, USA, 2–7 June 2019; pp. 4171–4186. [Google Scholar]
- Hu, H.; Phan, N.; Geller, J.; Iezzi, S.; Vo, H.; Dou, D.; Chun, S.A. An ensemble deep learning model for drug abuse detection in sparse Twitter-sphere. In Proceedings of the MedInfo 2019, Lyon, France, 25–30 August 2019; pp. 163–167. [Google Scholar]
- Tassone, J.; Yan, P.; Simpson, M.; Mendhe, C.; Mago, V.; Choudhury, S. Utilizing deep learning and graph mining to identify drug use on Twitter data. BMC Med. Inform. Decis. Mak. 2020, 20, 304. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Kim, Y. Convolutional neural networks for sentence classification. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP 2014), Doha, Qatar, 25–29 October 2014; pp. 1746–1751. [Google Scholar]
- Soni, S.; Chouhan, S.S.; Rathore, S.S. TextConvoNet: A convolutional neural network based architecture for text classification. Appl. Intell. 2023, 53, 14249–14268. [Google Scholar]
- Shiozawa, K.; Hayashi, H.; Akiyama, S.; Katsurai, M. Detecting slang on the dark web based on word co-occurrence relationships in anchor texts. In Proceedings of the 2026 40th International Conference on Information Networking (ICOIN 2026), Chiang Mai, Thailand, 14–16 January 2026; pp. 347–352. [Google Scholar]
- Hossain, N.; Tran, T.T.T.; Kautz, H. Discovering political slang in readers’ comments. In Proceedings of the 12th International AAAI Conference on Web and Social Media (ICWSM 2018), Stanford, CA, USA, 25–28 June 2018; pp. 596–599. [Google Scholar]
- Sun, Z.; Hu, Q.; Gupta, R.; Zemel, R.; Xu, Y. Toward informal language processing: Knowledge of slang in large language models. In Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACL-HLT 2024), Mexico City, Mexico, 16–21 June 2024; pp. 1683–1701. [Google Scholar]
- Carpenter, K.A.; Samori, I.A.; Kiang, M.V.; Humphreys, K.; Lembke, A.; Eichstaedt, J.C.; Altman, R.B. Large language models can disambiguate opioid slang on social media. arXiv 2026, arXiv:2603.10313. [Google Scholar]
- Patel, L.; Alsobeh, A. SlangLLM: Dynamic detection and context/filtering of slang in NLP applications. In Proceedings of the 1st International Conference on Secure IoT, Assured and Trusted Computing (SATC 2025), Orlando, FL, USA, 18–20 May 2025; pp. 1–6. [Google Scholar]
- Aloraini, A.M.; Batista-Navarro, R.T.; Nenadic, G.; Schlegel, V. The SlangTrack dataset: Supporting the detection of words used in slang senses. In Proceedings of the 6th International Workshop on Computational Approaches to Language Change (LChange 2026), Gothenburg, Sweden, 22–23 May 2026; pp. 1–19. [Google Scholar]
- Hu, C.; Liu, B.; Ye, Y.; Li, X. Fine-grained classification of drug trafficking based on Instagram hashtags. Decis. Support Syst. 2023, 165, 113896. [Google Scholar] [CrossRef] [Scilit]
- Wei, J.; Zou, K. EDA: Easy data augmentation techniques for boosting performance on text classification tasks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP 2019), Hong Kong, China, 3–7 November 2019; pp. 6383–6389. [Google Scholar]
- Mikolov, T.; Sutskever, I.; Chen, K.; Corrado, G.S.; Dean, J. Distributed representations of words and phrases and their compositionality. In Proceedings of the Advances in Neural Information Processing Systems (NeurIPS 2013), Lake Tahoe, NV, USA, 5–10 December 2013; pp. 3111–3119. [Google Scholar]
- Cui, Y.; Che, W.; Liu, T.; Qin, B.; Yang, Z.; Wang, S.; Hu, G. Pre-training with whole word masking for Chinese BERT. IEEE/ACM Trans. Audio Speech Lang. Process. 2021, 29, 3504–3514. [Google Scholar] [CrossRef] [Scilit]
- Zhang, Z.; Han, X.; Liu, Z.; Jiang, X.; Sun, M.; Liu, Q. ERNIE: Enhanced language representation with informative entities. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics (ACL 2019), Florence, Italy, 28 July–2 August 2019; pp. 1441–1451. [Google Scholar]







| Sentences Containing Drug Slang Terms | Source (Account) |
|---|---|
| I’m a pilot, he’s a captain, she’s a farmer. | WeChat Official Account (People’s Daily Online) |
| I’d like some dry pot, do you have any pork over there? | WeChat Official Account (Capital University Youth Red Ribbon) |
| I’m the captain. I’ve grown some grass. Any friends want to be pilots? | WeChat Official Account (Hubei Anti-Drug) |
| Electronic cigarettes, express delivery, high-altitude flight, no head rush, unconditional returns. | WeChat Official Account (Hubei Anti-Drug) |
| I’m the captain, I still have fuel here, looking for a few pilots. | Weibo (China Anti-Drug Online) |
| Do you have any “red wine” there? | Weibo (Oriental Red People’s Procuratorate) |
| Newly arrived trousers with great cut, and top-grade red wine, welcome to try. | Douyin (Xinjiang Anti-Drug) |
| Got some big meat—cold, hot, soft, hard, all kinds. | Douyin (Yuelu Anti-Drug) |
| Want a late-night snack? Got some pork. | Douyin (Guangzhou Anti-Drug) |
| Generated Sentences | Drug Slang Terms |
|---|---|
| Have some “3-plus-1” tonight, let’s have fun. | 3-plus-1 |
| My pigeons are great—dare to try? | Pigeons |
| This batch of “US dollars” is top quality, want some tonight? | US dollars |
| Want some G-water? Strong effects, give it a shot? | G-water |
| Bro, the “meow-meow” stock is plentiful lately—try some? | Meow-meow |
| This batch of “butterflies” is excellent—everyone try it. | Butterflies |
| Tonight, try this “Lamborghini”—guaranteed satisfaction. | Lamborghini |
| This batch of “Wuliangye” is absolutely top grade. | Wuliangye |
| Changzhijin is a harmful substance. | Changzhijin |
| Annotation Stage | Kappa Coefficient |
|---|---|
| Pre-annotation | 0.82 |
| Formal annotation | 0.91 |
| Sentence | Label |
|---|---|
| Want some new excitement? The effects are pretty good. | 1 |
| Coughed a couple of times this morning—mom and dad specially made cough syrup and brought it to school. | 0 |
| Heard this batch of cough syrup is premium quality, want to try some? | 1 |
| Bro, this batch of injections is way better than last time—let’s arrange for tonight. | 1 |
| Went to the square today and saw the pigeons—they were so cute! | 0 |
| Man, this “little white” is very pure, want some? | 1 |
| Interested in tasting some “wind is tight”? I heard the flavor is pretty good. | 1 |
| How does the convenience-store coffee I just grabbed taste like cough syrup? Awful. | 0 |
| I’ve got fresh goods here, quality is beyond question—give it a try. | 1 |
| Parameter | Value |
|---|---|
| Maximum sequence length | 100 |
| Word vector dimensionality | 100 |
| Convolutional kernel sizes | 3, 4, 5 |
| Number of kernels per size | 128 |
| Pooling method | Global max-pooling |
| Fully connected layer neurons | 128 |
| Dropout rate | 0.5 |
| Optimizer | Adam |
| Initial learning rate | 0.001 |
| Loss function | Cross-entropy loss |
| Batch size | 64 |
| Number of training epochs | 10 |
| Train:Val:Test split | 8:1:1 |
| Configuration | Specification |
|---|---|
| Operating System | Ubuntu 20.04 LTS |
| CPU | Intel Xeon Gold 5218 @ 2.30 GHz (Intel, Santa Clara, CA, USA) |
| GPU | NVIDIA Tesla V100 32 GB (NVIDIA, Santa Clara, CA, USA) |
| Memory | 128 GB |
| Deep Learning Framework | PyTorch 1.10.0 |
| Python Version | 3.8.10 |
| CUDA Version | 11.3 |
| Dataset | Sample Size | Proportion |
|---|---|---|
| Training Set | 8000 | 80% |
| Validation Set | 1000 | 10% |
| Test Set | 1000 | 10% |
| Metric | Value |
|---|---|
| Accuracy | 0.9930 |
| Precision | 0.9900 |
| Recall | 0.9960 |
| F1-Score | 0.9930 |
| AUC | 0.9997 |
| Model | Max Length | Tokenizer & Representation | Optimizer | Weight Decay | Batch Size | Epochs |
|---|---|---|---|---|---|---|
| TextCNN | 100 | Jieba (Word) | Adam | 0.01 | 64 | 10 |
| BERT-Base-Chinese | 512 | WordPiece (Subword) | AdamW | 0.005 | 16 | 5 |
| Chinese-RoBERTa-wwm-ext | 512 | WordPiece (Subword) | AdamW | 0.01 | 16 | 5 |
| TinyBERT | 512 | WordPiece (Char) | AdamW | 0.01 | 32 | 5 |
| MacBERT | 512 | WordPiece (Char) | AdamW | 0.01 | 16 | 5 |
| DistilBERT | 512 | WordPiece (Subword) | AdamW | 0.01 | 16 | 5 |
| SVM | – | Jieba + TF-IDF (5000-dim) | – | – | – | Single |
| Naive Bayes (NB) | – | Jieba + TF-IDF (5000-dim) | – | – | – | Single |
| Model | Accuracy | Precision | Recall | F1 Score | AUC |
|---|---|---|---|---|---|
| TextCNN | 0.9930 | 0.9900 | 0.9960 | 0.9930 | 0.9997 |
| BERT-Base-Chinese | 0.9890 | 0.9892 | 0.9890 | 0.9890 | 0.9998 |
| Chinese-RoBERTa-wwm-ext | 0.9890 | 0.9892 | 0.9890 | 0.9890 | 0.9998 |
| SVM | 0.9690 | 1.0000 | 0.9374 | 0.9677 | 0.9907 |
| Naive Bayes | 0.9680 | 0.9978 | 0.9374 | 0.9667 | 0.9920 |
| TinyBERT | 0.9910 | 0.9910 | 0.9910 | 0.9910 | 0.9998 |
| MacBERT | 0.9890 | 0.9892 | 0.9890 | 0.9890 | 0.9999 |
| DistilBERT | 0.9890 | 0.9892 | 0.9890 | 0.9890 | 0.9998 |
| Model | Parameters (M) | Model Size (MB) | Latency (ms) | Throughput (QPS) |
|---|---|---|---|---|
| BERT-Base-Chinese | 102.30 | 390.20 | 28.42 | 66.04 |
| Chinese-RoBERTa-wwm-ext | 102.30 | 390.20 | 34.64 | 60.10 |
| MacBERT | 102.30 | 390.20 | 29.67 | 69.37 |
| DistilBERT-Base-Multilingual | 135.33 | 516.27 | 14.63 | 144.46 |
| TinyBERT | 11.42 | 43.59 | 3.76 | 735.57 |
| TextCNN (Ours) | 0.22 | 0.84 | 1.26 | 2698.02 |
| SVM | — | 0.61 | 1.06 | 25,885.97 |
| Naive Bayes | — | 0.57 | 0.84 | 115,475.58 |
| Configuration | Accuracy | Precision | Recall | F1-Score | AUC |
|---|---|---|---|---|---|
| TextCNN (full Configuration) | 0.9930 | 0.9900 | 0.9960 | 0.9930 | 0.9997 |
| without Custom Tokenization Dictionary | 0.9880 | 0.9938 | 0.9818 | 0.9878 | 0.9997 |
| Kernel Size [2, 3, 4] | 0.9870 | 0.9872 | 0.9778 | 0.9867 | 0.9997 |
| Kernel Size [5, 6, 7] | 0.9900 | 0.9860 | 0.9939 | 0.9899 | 0.9997 |
| Filter Number = 64 | 0.9880 | 0.9910 | 0.9798 | 0.9878 | 0.9998 |
| Filter Number = 128 | 0.9900 | 0.9939 | 0.9859 | 0.9899 | 0.9998 |
| Filter Number = 256 | 0.9880 | 0.9930 | 0.9798 | 0.9878 | 0.9997 |
| Randomly Initialized Word Embeddings | 0.9910 | 0.9900 | 0.9879 | 0.9909 | 0.9998 |
| Original Text | True | Pred | Error Analysis | Error Type |
|---|---|---|---|---|
| I have some xiao hai here, want to try it? | 1 | 0 | Failure to recognize “xiao hai” as an explicit drug-related coded term | Coded language recognition failure |
| This batch of tin foil heats up really well, let’s all try it together. | 0 | 1 | Tin foil is used in both normal cooking and drug consumption contexts; the model over-sensitively classifies a culinary reference as drug-related | Context-induced misclassification |
| This green recipe is really simple and tastes great. | 0 | 1 | “green” may refer to vegetables (normal) or cannabis (drug); without sufficient context, the model favors the drug-related interpretation | Context-induced misclassification |
| Want to try the newly arrived school uniform? Works great. | 0 | 1 | “School uniform” (jiao fu) may serve as drug-related coded language in specific subcultures but carries no such meaning here; the model over-generalizes | Cultural expression misunderstanding |
| How many bones do you want? I have stock. | 0 | 1 | The model lacks the capacity to recognize humor and irony, defaulting to a literal interpretation of the utterance | Figurative language misinterpretation |
| I have some cold stuff here, very pure. Coming or not? | 0 | 1 | Likely a hyperbolic description of a normal item, but the model interprets it as drug-related coded language | Hyperbolic expression misinterpretation |
| Platform Type | Accuracy | Precision | Recall | F1-Score |
|---|---|---|---|---|
| Weibo (short-text) | 0.9983 | 0.9982 | 0.9984 | 0.9983 |
| WeChat Official Accounts (long-text) | 0.9978 | 0.9979 | 0.9977 | 0.9978 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Leng, T.; Dai, Y.; Yan, X. Lightweight and Effective Coded-Slang Detection for Cyber-Drug Intelligence. Electronics 2026, 15, 3138. https://doi.org/10.3390/electronics15143138
Leng T, Dai Y, Yan X. Lightweight and Effective Coded-Slang Detection for Cyber-Drug Intelligence. Electronics. 2026; 15(14):3138. https://doi.org/10.3390/electronics15143138
Chicago/Turabian StyleLeng, Tao, Yong Dai, and Xinyang Yan. 2026. "Lightweight and Effective Coded-Slang Detection for Cyber-Drug Intelligence" Electronics 15, no. 14: 3138. https://doi.org/10.3390/electronics15143138
APA StyleLeng, T., Dai, Y., & Yan, X. (2026). Lightweight and Effective Coded-Slang Detection for Cyber-Drug Intelligence. Electronics, 15(14), 3138. https://doi.org/10.3390/electronics15143138
