A quantum-classical hybrid neural network for hate speech detection in Spanish
Francisco José Orts, Laura María Donaire, Gloria Ortega, Ester Martín Garzón · Expert Systems with Applications · 2025
• Hybrid quantum-classical model for Spanish hate speech detection. • Two-phase training stabilizes quantum circuit optimization. • Competitive with transformers; best results on HaterNet dataset. • Consistently outperforms classical and recurrent baselines. • Demonstrates viability of quantum NLP in real-world tasks. Hate speech detection in social media remains a pressing challenge in natural language processing, particularly for languages such as Spanish where annotated resources are limited. This work proposes a hybrid quantum-classical neural architecture that combines bidirectional gated recurrent units with attention and a variational quantum circuit used as a non-linear classifier. The model is trained in two phases: first the recurrent and attention-based layers are optimized to produce stable representations, then these are frozen and a quantum circuit is fine-tuned for classification. Evaluation on two benchmark corpora, HatEval and HaterNet, shows that the proposed hybrid approach achieves competitive performance with strong transformer baselines such as BETO and XLM-R, while consistently outperforming traditional machine learning and recurrent neural models. On HaterNet, the proposed model performs on par with, and in some metrics slightly better than, the transformer baselines, whereas on HatEval it attains slightly lower scores. Its strength lies in detecting hate speech under class imbalance, as reflected in solid F1 scores for the hate speech class. These findings provide an initial empirical assessment of quantum-enhanced NLP in a realistic hate speech detection scenario and suggest promising directions for further study as quantum hardware matures, without constituting evidence of quantum advantage.