Open Access iconOpen Access

ARTICLE

Detection of Maliciously Disseminated Hate Speech in Spanish Using Fine-Tuning and In-Context Learning Techniques with Large Language Models

Tomás Bernal-Beltrán1, Ronghao Pan1, José Antonio García-Díaz1, María del Pilar Salas-Zárate2, Mario Andrés Paredes-Valverde2, Rafael Valencia-García1,*

1 Departamento de Informática y Sistemas, Universidad de Murcia, Campus de Espinardo, Murcia, 30100, Murcia, Spain
2 Tecnológico Nacional de México/I.T.S. Teziutlán, Fracción I y II, Teziutlán, 73960, Puebla, Mexico

* Corresponding Author: Rafael Valencia-García. Email: email

Computers, Materials & Continua 2026, 87(1), 10 https://doi.org/10.32604/cmc.2025.073629

Abstract

The malicious dissemination of hate speech via compromised accounts, automated bot networks and malware-driven social media campaigns has become a growing cybersecurity concern. Automatically detecting such content in Spanish is challenging due to linguistic complexity and the scarcity of annotated resources. In this paper, we compare two predominant AI-based approaches for the forensic detection of malicious hate speech: (1) fine-tuning encoder-only models that have been trained in Spanish and (2) In-Context Learning techniques (Zero- and Few-Shot Learning) with large-scale language models. Our approach goes beyond binary classification, proposing a comprehensive, multidimensional evaluation that labels each text by: (1) type of speech, (2) recipient, (3) level of intensity (ordinal) and (4) targeted group (multi-label). Performance is evaluated using an annotated Spanish corpus, standard metrics such as precision, recall and F1-score and stability-oriented metrics to evaluate the stability of the transition from zero-shot to few-shot prompting (Zero-to-Few Shot Retention and Zero-to-Few Shot Gain) are applied. The results indicate that fine-tuned encoder-only models (notably MarIA and BETO variants) consistently deliver the strongest and most reliable performance: in our experiments their macro F1-scores lie roughly in the range of approximately 46%–66% depending on the task. Zero-shot approaches are much less stable and typically yield substantially lower performance (observed F1-scores range approximately 0%–39%), often producing invalid outputs in practice. Few-shot prompting (e.g., Qwen 3 8B, Mistral 7B) generally improves stability and recall relative to pure zero-shot, bringing F1-scores into a moderate range of approximately 20%–51% but still falling short of fully fine-tuned models. These findings highlight the importance of supervised adaptation and discuss the potential of both paradigms as components in AI-powered cybersecurity and malware forensics systems designed to identify and mitigate coordinated online hate campaigns.

Keywords

Hate speech detection; malicious communication campaigns; AI-driven cybersecurity; social media analytics; large language models; prompt-tuning; fine-tuning; in-context learning; natural language processing

Cite This Article

APA Style
Bernal-Beltrán, T., Pan, R., García-Díaz, J.A., del Pilar Salas-Zárate, M., Paredes-Valverde, M.A. et al. (2026). Detection of Maliciously Disseminated Hate Speech in Spanish Using Fine-Tuning and In-Context Learning Techniques with Large Language Models. Computers, Materials & Continua, 87(1), 10. https://doi.org/10.32604/cmc.2025.073629
Vancouver Style
Bernal-Beltrán T, Pan R, García-Díaz JA, del Pilar Salas-Zárate M, Paredes-Valverde MA, Valencia-García R. Detection of Maliciously Disseminated Hate Speech in Spanish Using Fine-Tuning and In-Context Learning Techniques with Large Language Models. Comput Mater Contin. 2026;87(1):10. https://doi.org/10.32604/cmc.2025.073629
IEEE Style
T. Bernal-Beltrán, R. Pan, J. A. García-Díaz, M. del Pilar Salas-Zárate, M. A. Paredes-Valverde, and R. Valencia-García, “Detection of Maliciously Disseminated Hate Speech in Spanish Using Fine-Tuning and In-Context Learning Techniques with Large Language Models,” Comput. Mater. Contin., vol. 87, no. 1, pp. 10, 2026. https://doi.org/10.32604/cmc.2025.073629



cc Copyright © 2026 The Author(s). Published by Tech Science Press.
This work is licensed under a Creative Commons Attribution 4.0 International License , which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
  • 350

    View

  • 73

    Download

  • 0

    Like

Share Link