A Study on the Application of Large Language Models Based on LoRA Fine-Tuning and Difficult-Sample Adaptation for Online Violence Recognition
Abstract
1. Introduction
2. Related Research
2.1. State of the Art of Violent Speech Recognition Research
2.2. Research on the Application and Fine-Tuning of Large Language Models
2.3. Current Status of Research on Difficult-Sample Mining
3. Methodology
3.1. Model Selection
3.2. Prompt Design
3.3. LoRa Fine-Tuning
3.4. Small-Scale Hard-Example Adaptive Training Framework
3.5. Data Preparation and Evaluation Indicators
3.6. Experimental Setup with Comparison Experiments
4. Experiments and Analysis of Results
4.1. Analysis of Experimental Results
4.2. Ablation Study
- (1)
- The LoRA fine-tuning module;
- (2)
- The prompt module;
- (3)
- The hard-sample mining mechanism.
4.2.1. Experimental Setup
4.2.2. Results and Analysis
- Contribution of the LoRA module: Compared to the full model, the PT variant shows a decline in all metrics, indicating that LoRA fine-tuning plays a key role in optimizing model parameters, especially in significantly enhancing the overall discriminative ability of the model.
- Contribution of the Prompt + Mining mechanism: The performance of Meta-Llama-3-8B-Instruct-LoRA is also relatively poor, demonstrating that the prompt mechanism and hard-example mining are important for improving the model’s ability to recognize minority classes.
- Significant collaborative effect: The full model (S-HAT) significantly outperforms the other two ablation variants across all metrics, verifying that the combined effect of the three components is superior to the use of any single module alone.
4.3. Case Studies and Interpretive Enquiry
5. Limitations
“Hey fellow, want a manhole cover? A bearded man smiles at you.”
This intended to discuss aquatic ecology and fish behavior, with no hostile or abusive meaning. However, the model misclassifies it as violent (output = 1) due to keywords like “get rid of” and “ferocious,” which are perceived as violent in isolation. This indicates the model’s inadequate contextual disambiguation as it fails to distinguish between neutral or scientific usage and genuinely violent content. It lacks deep semantic reasoning and contextual comprehension, making it prone to misjudging neutral or even technical discourse.“Can I put it with the tilapia… it should get rid of the cleaner fish, right?”
- Lack of understanding and perception of implicit discrimination, satire, and regional stereotypes embedded in sociocultural expressions;
- Limited semantic parsing ability, making it difficult to distinguish between genuinely aggressive semantics and non-aggressive uses of violent-sounding terms;
- Inability to dynamically adapt to polysemous expressions, metaphorical language, and evolving internet slang.
- Incorporating external knowledge enhancement mechanisms: Integrate encyclopedic knowledge, regional dictionaries, and slang databases as retrieval-based or embedded modules to help the model identify culturally embedded metaphors, regional discrimination, and stereotypical expressions, thereby improving its understanding of deeper semantic meanings.
- Applying contrastive learning for semantic disambiguation: Train the model to recognize fine-grained semantic boundaries by constructing positive and negative-sample pairs (e.g., “violent use” vs. “neutral use” of the word “eliminate”), enhancing its ability to differentiate pragmatic meanings of the same word across different contexts.
- Integrating dynamic vocabulary adaptation mechanisms: Build a “dynamic online corpus pool” from real-time social media data and use vocabulary transfer learning techniques to update word embeddings, allowing the model to adapt to newly emerging slang, puns, homophones, and other ambiguous expressions in online discourse.
- Multilingual and cross-cultural fine-tuning: In multilingual social contexts, incorporate annotated datasets in multiple languages and embed cultural adaptation signals (e.g., regional tags and contextual markers) during training to improve the model’s ability to generalize and transfer across different cultural expression strategies.
6. Conclusions and Future Work
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Raj, C.; Agarwal, A.; Bharathy, G.; Narayan, B.; Prasad, M. Cyberbullying Detection: Hybrid Models Based on Machine Learning and Natural Language Processing Techniques. Electronics 2021, 10, 2810. [Google Scholar] [CrossRef]
- Rao, X.; Zhang, Y.; Jia, Q.; Liu, X.; Rao, X.; Zhang, Y.; Peng, S.; Jia, Q.; Liu, X. A Study on Chinese Hate Speech Detection Method Based on RoBERTa. (Chinese Hate Speech detection method Based on RoBERTa-WWM). In Proceedings of the 22nd Chinese National Conference on Computational Linguistics, Harbin, China, 3–5 August 2023; Sun, M., Qin, B., Qiu, X., Jiang, J., Han, X., Eds.; Chinese Information Processing Society of China: Harbin, China, 2023; pp. 501–511. [Google Scholar]
- Xu, Z. RoBERTa-Wwm-Ext Fine-Tuning for Chinese Text Classification. arXiv 2021, arXiv:2103.00492. [Google Scholar] [CrossRef]
- Wulczyn, E.; Thain, N.; Dixon, L. Ex Machina: Personal Attacks Seen at Scale. In Proceedings of the 26th International Conference on World Wide Web, WWW ’17, Perth, Australia, 3–7 April 2017; International World Wide Web Conferences Steering Committee: Geneva, Switzerland, 2017; pp. 1391–1399. [Google Scholar] [CrossRef]
- Subramani, S.; Michalska, S.; Wang, H.; Du, J.; Zhang, Y.; Shakeel, H. Deep Learning for Multi-Class Identification From Domestic Violence Online Posts. IEEE Access 2019, 7, 46210–46224. [Google Scholar] [CrossRef]
- Fortuna, P.; Nunes, S. A Survey on Automatic Detection of Hate Speech in Text. ACM Comput. Surv. 2018, 51, 85:1–85:30. [Google Scholar] [CrossRef]
- Ayo, F.E.; Folorunso, O.; Ibharalu, F.T.; Osinuga, I.A. Machine Learning Techniques for Hate Speech Classification of Twitter Data: State-of-the-Art, Future Challenges and Research Directions. Comput. Sci. Rev. 2020, 38, 100311. [Google Scholar] [CrossRef]
- Salminen, J.; Hopf, M.; Chowdhury, S.A.; Jung, S.; Almerekhi, H.; Jansen, B.J. Developing an Online Hate Classifier for Multiple Social Media Platforms. Hum. Cent. Comput. Inf. Sci. 2020, 10, 1. [Google Scholar] [CrossRef]
- Mozafari, M.; Farahbakhsh, R.; Crespi, N. A BERT-Based Transfer Learning Approach for Hate Speech Detection in Online Social Media. In Complex Networks and Their Applications VIII; Cherifi, H., Gaito, S., Mendes, J.F., Moro, E., Rocha, L.M., Eds.; Springer International Publishing: Cham, Switzerland, 2020; pp. 928–940. [Google Scholar] [CrossRef]
- Wiedemann, G.; Yimam, S.M.; Biemann, C. UHH-LT at SemEval-2020 Task 12: Fine-Tuning of Pre-Trained Transformer Networks for Offensive Language Detection. arXiv 2020, arXiv:2004.11493. [Google Scholar] [CrossRef]
- Risch, J.; Krestel, R. Bagging BERT Models for Robust Aggression Identification. In Proceedings of the Second Workshop on Trolling, Aggression and Cyberbullying, Marseille, France, 16 May 2020; Kumar, R., Ojha, A.K., Lahiri, B., Zampieri, M., Malmasi, S., Murdock, V., Kadar, D., Eds.; European Language Resources Association (ELRA): Marseille, France, 2020; pp. 55–61. [Google Scholar]
- Miok, K.; Škrlj, B.; Zaharie, D.; Robnik-Šikonja, M. To BAN or Not to BAN: Bayesian Attention Networks for Reliable Hate Speech Detection. Cogn. Comput. 2022, 14 1, 353–371. [Google Scholar] [CrossRef]
- Safi Samghabadi, N.; Patwa, P.; PYKL, S.; Mukherjee, P.; Das, A.; Solorio, T. Aggression and Misogyny Detection Using BERT: A Multi-Task Approach. In Proceedings of the Second Workshop on Trolling, Aggression and Cyberbullying, Marseille, France, 6 May 2020; Kumar, R., Ojha, A.K., Lahiri, B., Zampieri, M., Malmasi, S., Murdock, V., Kadar, D., Eds.; European Language Resources Association (ELRA): Marseille, France, 2020; pp. 126–131. [Google Scholar]
- Talat, Z.; Thorne, J.; Bingel, J. Bridging the Gaps: Multi Task Learning for Domain Transfer of Hate Speech Detection. In Online Harassment; Golbeck, J., Ed.; Springer International Publishing: Cham, Switzerland, 2018; pp. 29–55. [Google Scholar] [CrossRef]
- Ousidhoum, N.; Lin, Z.; Zhang, H.; Song, Y.; Yeung, D.-Y. Multilingual and Multi-Aspect Hate Speech Analysis. arXiv 2019, arXiv:1908.11049. [Google Scholar]
- Guzman-Silverio, M.; Balderas-Paredes, Á.; López-Monroy, A.P. Transformers and Data Augmentation for Aggressiveness Detection in Mexican Spanish. Available online: https://ceur-ws.org/Vol-2664/mexa3t_paper9.pdf (accessed on 11 July 2025).
- Rizos, G.; Hemker, K.; Schuller, B. Augment to Prevent: Short-Text Data Augmentation in Deep Learning for Hate-Speech Classification. In Proceedings of the 28th ACM International Conference on Information and Knowledge Management, Beijing, China, 3–7 November 2019; CIKM ’19; Association for Computing Machinery: New York, NY, USA, 2019; pp. 991–1000. [Google Scholar] [CrossRef]
- Kocoń, J.; Cichecki, I.; Kaszyca, O.; Kochanek, M.; Szydło, D.; Baran, J.; Bielaniewicz, J.; Gruza, M.; Janz, A.; Kanclerz, K.; et al. ChatGPT: Jack of All Trades, Master of None. Inf. Fusion 2023, 99, 101861. [Google Scholar] [CrossRef]
- Paaß, G.; Giesselbach, S. Improving Pre-Trained Language Models. In Foundation Models for Natural Language Processing: Pre-trained Language Models Integrating Media; Paaß, G., Giesselbach, S., Eds.; Springer International Publishing: Cham, Switzerland, 2023; pp. 79–159. [Google Scholar] [CrossRef]
- Eriksson, D.B.T. Fine-Tuning a LLM Using Reinforcement Learning from Human Feedback for a Therapy Chatbot Application. Diva-portal.org. Available online: https://www.diva-portal.org/smash/get/diva2:1782678/FULLTEXT01.pdf (accessed on 11 July 2025).
- Chen, Y.; Zhang, S.; Qi, G.; Guo, X. Parameterizing Context: Unleashing the Power of Parameter-Efficient Fine-Tuning and In-Context Tuning for Continual Table Semantic Parsing. Adv. Neural Inf. Process. Syst. 2023, 36, 17795–17810. [Google Scholar]
- Fichtl, A. Evaluating Adapter-Based Knowledge-Enhanced Language Models in the Biomedical Domain. Ph.D. Thesis, Technical University of Munich, Munich, Germany, 2024. Available online: https://wwwmatthes.in.tum.de/file/1lfggh41pzur1/Sebis-Public-Website/-/Master-s-Thesis-Alexander-Fichtl/Fichtl%20Master%20Thesis.pdf (accessed on 21 June 2025).
- Liang, C.; Zuo, S.; Zhang, Q.; He, P.; Chen, W.; Zhao, T. Less Is More: Task-Aware Layer-Wise Distillation for Language Model Compression. In Proceedings of the 40th International Conference on Machine Learning, Honolulu, HI, USA, 23–29 July 2023; pp. 20852–20867. [Google Scholar]
- Kirchenbauer, J.; Barns, C. Hallucination Reduction in Large Language Models with Retrieval-Augmented Generation Using Wikipedia Knowledge. 2024. Available online: https://files.osf.io/v1/resources/pv7r5/providers/osfstorage/6657166cd835c421594ce333?format=pdf&action=download&direct&version=1 (accessed on 21 June 2025).
- Welz, L.; Lanquillon, C. Enhancing Large Language Models Through External Domain Knowledge. In Artificial Intelligence in HCI.; Degen, H., Ntoa, S., Eds.; Springer Nature Switzerland: Cham, Switzerland, 2024; pp. 135–146. [Google Scholar] [CrossRef]
- Zhou, L.; Chen, Y.; Li, X.; Li, Y.; Li, N.; Wang, X.; Zhang, R. A New Adapter Tuning of Large Language Model for Chinese Medical Named Entity Recognition. Appl. Artif. Intell. 2024, 38, e2385268. [Google Scholar] [CrossRef]
- Lu, J.; Xu, B.; Zhang, X.; Min, C.; Yang, L.; Lin, H. Facilitating Fine-Grained Detection of Chinese Toxic Language: Hierarchical Taxonomy, Resources, and Benchmarks. arXiv 2023, arXiv:2305.04446. [Google Scholar] [CrossRef]
- Shrivastava, A.; Gupta, A.; Girshick, R. Training Region-Based Object Detectors with Online Hard Example Mining. In Proceedings of the 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 27–30 June 2016. [Google Scholar]
- Ma, X.; Huang, H.; Wang, Y.; Romano, S.; Erfani, S.; Bailey, J. Normalized Loss Functions for Deep Learning with Noisy Labels. In Proceedings of the 37th International Conference on Machine Learning, Virtual, 13–18 July 2020; pp. 6543–6553. [Google Scholar]
- Liu, P.; Yuan, W.; Fu, J.; Jiang, Z.; Hayashi, H.; Neubig, G. Pre-Train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processing. ACM Comput. Surv. 2023, 55, 195:1–195:35. [Google Scholar] [CrossRef]
- Hu, E.J.; Shen, Y.; Wallis, P.; Allen-Zhu, Z.; Li, Y.; Wang, S.; Wang, L.; Chen, W. LoRA: Low-Rank Adaptation of Large Language Models. arXiv 2021, arXiv:2106.09685. [Google Scholar] [CrossRef]
Importation | Generate A Prompt To Determine If The Content Is Violent Online Speech |
---|---|
Output Prompts | Below is a hint word that applies to text review and determining whether content is violent online speech: Prompt: “Please analyse the following text and determine whether it contains expressions of cyberviolence. Cyberviolence includes, but is not limited to, insults, personal attacks, malicious defamation, threats, harassment, incitement to hatred or other injurious statements. If the text contains cyberviolence, please indicate the specific content and explain why it is cyberviolent. Also, if possible, provide a friendlier or constructive means of expression.” |
Dataset | Number of Positive Samples | Number of Negative Samples | Positive-to-Negative Sample Ratio | Sample ID | Social Media Comments | Label |
---|---|---|---|---|---|---|
ToxiCN | 6461 | 5550 | 1.164 | 1 | 这是事实吧,证据明摆着,我昨天看到真是气得不行囧 This is a fact, isn’t it? The evidence is clear. I was so angry when I saw it yesterday. >_< | 0 |
2 | 我185,但这幕刃是鲨bee I’m 185 cm tall, but this sword is a Shark Bee. | 1 | ||||
3 | 是男挙定义宠女人的男人为狗,什么叫喜欢当狗。 A man who spoils a woman is called a dog by some guys. What does it mean to “like being a dog”? | 1 |
Dataset | Number of Positive Samples | Number of Negative Samples | Positive-to-Negative Sample Ratio | Sample ID | Social Media Statements | Label and Analysis Process |
---|---|---|---|---|---|---|
Hard-sample dataset | 12 | 12 | 1 | 1 | 我将给你一段文本,请分析该文本,并判断它是否包含网络暴力言论。如果文本包含网络暴力,仅输出1,如果文本不包含网络暴力,仅输出0。文本:你别回复我了,不知道谁在张口就来???? I will give you a piece of text. Please analyze the text and determine whether it contains online abusive language. If the text contains online abuse, output only 1; if it does not contain online abuse, output only 0. Text: Don’t reply to me anymore, I don’t know who just talks nonsense??? | 0。Analysis process: First, identify the keywords and emotions in the text. The phrase “Don’t reply to me anymore” may indicate that one party does not want to receive further replies, while “I don’t know who just talks nonsense” expresses doubt about the speaker’s identity or behavior. Next, analyze the tone and potential aggressiveness. Although there is skepticism and a tense tone, there is no direct use of insults, threats, or personal attacks. Therefore, based on this analysis, the text does not contain online abusive language. |
2 | 我将给你一段文本,请分析该文本,并判断它是否包含网络暴力言论。如果文本包含网络暴力,仅输出1,如果文本不包含网络暴力,仅输出0。文本:你应该可怜那些地域歧视的人 他们就是活在网络上的蛀虫 I will give you a piece of text. Please analyze the text and determine whether it contains online abusive language. If the text contains online abuse, output only 1; if it does not contain online abuse, output only 0. Text: You should pity those who discriminate based on region—they are like parasites living on the internet. | 1。Analysis process: First, identify the keywords and emotional tone in the text. The text mentions “pity” and “people who discriminate based on region,” indicating sympathy toward a certain behavior or group. Next, observe the metaphor “parasites living on the internet,” which conveys a negative judgment of these people, using a derogatory metaphor to describe them. Finally, considering all factors, the text contains negative criticism of “regional discrimination” and uses a demeaning metaphor toward the related group, which can be understood as part of online abusive language. Therefore, based on this analysis, the text is judged to contain online abusive language. | ||||
3 | 我将给你一段文本,请分析该文本,并判断它是否包含网络暴力言论。如果文本包含网络暴力,仅输出1,如果文本不包含网络暴力,仅输出0。文本:营口市中心医院,核酸检测的挂号处那个男的说话语气巨差无比,说的我想揍他,但是又没人捞我 I will give you a piece of text. Please analyze the text and determine whether it contains online abusive language. If the text contains online abuse, output only 1; if it does not contain online abuse, output only 0. Text: At Yingkou Central Hospital, the guy at the nucleic acid testing registration desk spoke with an extremely bad tone. I felt like hitting him, but no one would back me up. | 1。Analysis process: First, identify the keywords and emotional tone in the text. The text mentions “spoke with an extremely bad tone,” indicating a negative evaluation of someone’s manner or attitude. Next, observe the emotional expression “I felt like hitting him,” which shows the speaker’s strong negative emotional reaction, possibly including anger or disgust. Finally, considering all factors, the descriptions and emotional expressions point to a negative judgment and a potential inclination toward violence against someone, which can be regarded as part of online abusive language. Therefore, based on this analysis, the text is judged to contain online abusive language. |
Model | Precision |
---|---|
BiLSTM | 73.7 |
BERT | 80.0 |
RoBERTa | 80.8 |
S-HAT | 84.1 |
Model | Precision |
---|---|
PT | 63.7 |
Meta-Llama-3-8B-Instruct-LoRA | 77.3 |
S-HAT | 84.1 |
Input and Output | Input Content and Output Content |
---|---|
Importation | I will give you a text, please analyse the text and determine whether it contains cyber-violent speech. Cyber violence includes, but is not limited to, insults, personal attacks, malicious defamation, threats, harassment, incitement to hatred, or other hurtful speech. If the text contains cyberviolence, output only 1, if the text does not contain cyberviolence, output only 0. Text: Flush these filial sons and daughters! |
Output results and the analysis process | 1. Analysis process: First, identify the keywords and descriptions in the text. The text mentions “flush out these filial sons and daughters”, which can be interpreted as a description or name of a certain group of people. Next, observe the tone and context of the text. Although “blast” may suggest a strong emotional or confrontational attitude, in this context, it is linked to “these filial sons and daughters,” which may suggest a negative evaluation or attack on a particular group of people. Finally, considering all factors, the description or name-calling in the text negatively evaluates a specific group of “filial sons and daughters”, which may be interpreted as a personal attack or insult to a certain group of people, and meets the definition of cyberviolent speech. Therefore, it is judged that the text contains expressions of cyber violence. |
Type of Error | Positive Classes Are Recognized as Negative Classes | Negative Classes Are Recognized as Positive Classes |
---|---|---|
Importation | I will give you a text, please analyse the text and determine whether it contains cyber-violent speech. Cyber violence includes, but is not limited to, insults, personal attacks, malicious defamation, threats, harassment, incitement to hatred, or other hurtful speech. If the text contains cyber-violence, only output 1; if the text does not contain cyber-violence, only output 0. Text: old folks, do you want a manhole cover? A bearded man looks at you with a big smile on his face. | I will give you a text, please analyse the text and determine whether it contains cyber-violent speech. Cyber violence includes, but is not limited to, insults, personal attacks, malicious defamation, threats, harassment, incitement to hatred, or other hurtful speech. If the text contains cyber violence, output only 1. If the text does not contain cyber violence, output only 0. Text: Would it be okay to put in tilapia, that fish is at least tasty, and it is also a very vicious fish. It should be able to destroy the scavengers. |
Output results and the analysis process | The process of analysis: firstly, identify the key words and emotional colours in the text. The text mentions “hometown”, which indicates that the dialogue is between acquaintances or fellow countrymen. Next, observe the tone and description of the text. The fact that the text describes a person with a big smile on his face suggests that the person may be in a good mood and smiling. Finally, taking all things into consideration, the text does not contain insults, personal attacks, malicious defamation, threats, harassment, incitement to hatred or other injurious remarks, so it is judged that the text does not contain cyberviolence. | 1. Analysis process: Firstly, keywords and descriptions in the text are identified. The text mentions “tilapia”, “ferocious “, and “scavengers”, which may be related to certain groups or individuals. Next, analyse the context and tone of the text. The text mentions that “tilapia” can “wipe out scavengers”, which may imply the “removal” or “wiping out” of specific groups or individuals, which may be perceived as the “removal” or “wiping out” of certain groups or individuals. “This could be perceived as an attack or threat against certain groups or individuals. Finally, the text was considered and found to contain expressions of cyberviolence. |
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. |
© 2025 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 (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Gao, Z.; Jing, S.; Zhang, L. A Study on the Application of Large Language Models Based on LoRA Fine-Tuning and Difficult-Sample Adaptation for Online Violence Recognition. Symmetry 2025, 17, 1310. https://doi.org/10.3390/sym17081310
Gao Z, Jing S, Zhang L. A Study on the Application of Large Language Models Based on LoRA Fine-Tuning and Difficult-Sample Adaptation for Online Violence Recognition. Symmetry. 2025; 17(8):1310. https://doi.org/10.3390/sym17081310
Chicago/Turabian StyleGao, Zhengguang, Shenjia Jing, and Lihong Zhang. 2025. "A Study on the Application of Large Language Models Based on LoRA Fine-Tuning and Difficult-Sample Adaptation for Online Violence Recognition" Symmetry 17, no. 8: 1310. https://doi.org/10.3390/sym17081310
APA StyleGao, Z., Jing, S., & Zhang, L. (2025). A Study on the Application of Large Language Models Based on LoRA Fine-Tuning and Difficult-Sample Adaptation for Online Violence Recognition. Symmetry, 17(8), 1310. https://doi.org/10.3390/sym17081310