Toxicity is a prevalent social behavior that involves the use of hate speech, offensive language, bullying, and abusive speech. While text-based approaches for toxicity detection are common, there is limited research on processing speech signals in the physical world. Detecting toxicity in the physical world is challenging due to the difficulty of integrating AI-capable computers into the environment. We propose a lightweight transformer model based on wav2vec2.0 and optimize it using techniques such as quantization and knowledge distillation. Our model uses multitask learning and achieves an average macro F1-score of 90.3\% and a weighted accuracy of 88\%, outperforming state-of-the-art methods on DeToxy-B and a public dataset. Our results show that quantization reduces the model size by almost 4 times and RAM usage by 3.3\%, with only a 1\% F1 score decrease. Knowledge distillation reduces the model size by 3.7 times, RAM usage by 1.9, and inference time by 2 times, but decreases accuracy by 8\%. Combining both techniques reduces the model size by 14.6 times and RAM usage by around 4.3 times, with a two-fold inference time improvement. Our compact model is the first end-to-end speech-based toxicity detection model based on a lightweight transformer model suitable for deployment in physical spaces. The results show its feasibility for toxicity detection on edge devices in real-world environments.
翻译:毒性是一种普遍存在的社会行为,涉及仇恨言论、冒犯性语言、霸凌和辱骂性言论。虽然基于文本的毒性检测方法较为常见,但在物理世界中处理语音信号的研究仍然有限。由于难以将具备人工智能能力的计算机集成到环境中,在物理世界中检测毒性具有挑战性。我们提出了一种基于wav2vec2.0的轻量级Transformer模型,并通过量化、知识蒸馏等技术对其进行优化。我们的模型采用多任务学习,实现了90.3%的平均宏F1分数和88%的加权准确率,在DeToxy-B和一个公开数据集上优于现有方法。结果表明,量化将模型大小缩小了近4倍,RAM使用率降低3.3%,而F1分数仅下降1%。知识蒸馏将模型大小缩小3.7倍,RAM使用率降低1.9倍,推理时间减少2倍,但准确率下降8%。结合两种技术,模型大小缩小14.6倍,RAM使用率降低约4.3倍,推理时间提升两倍。我们的紧凑型模型是首个基于轻量级Transformer的端到端语音毒性检测模型,适用于部署在物理空间中。结果表明,该模型在真实环境中的边缘设备上进行毒性检测具有可行性。