ToxiTrace: Gradient-Aligned Training for Explainable Chinese Toxicity Detection
Organizations: School of Data Science and Engineering, East China Normal University · School of International Chinese Studies, East China Normal University
Abstract
Existing Chinese toxic content detection methods mainly target sentence-level classification but often fail to provide readable and contiguous toxic evidence spans. We propose ToxiTrace, an explainability-oriented method for BERT-style encoders with three components: (1) CuSA, which refines encoder-derived saliency cues into fine-grained toxic spans with lightweight LLM guidance; (2) GCLoss, a gradient-constrained objective that concentrates token-level saliency on toxic evidence while suppressing irrelevant activations; and (3) ARCL, which constructs sample-specific contrastive reasoning pairs to sharpen the semantic boundary between toxic and non-toxic content. Experiments show that ToxiTrace improves classification accuracy and toxic span extraction while preserving efficient encoder-based inference and producing more coherent, human-readable explanations. We have released the model at https://huggingface.co/ArdLi/ToxiTrace.
Figures & tables
| Models | COLD | ToxiCN | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Macro- | Macro- | |||||||||
| Qwen3-8B | ||||||||||
| LLaMA3.1-8B | ||||||||||
| DeepSeek-V3.2 | ||||||||||
| GPT-4o | ||||||||||
| RoBERTa | ||||||||||
| Models | Overlap | Character-level | Inference Time | |||||
|---|---|---|---|---|---|---|---|---|
| CRF Liu et al. (2021) | 44.48 | 78.01 | 56.66 | 39.24 | 81.85 | 53.05 | 36.10 | 01m 10s |
| LIME Ribeiro et al. (2016) | 41.45 | 35.99 | 38.53 | 81.62 | 33.93 | 47.93 | 31.52 | 27m 20s |
| Attention Yamada et al. (2020) | 39.01 | 36.15 | 37.52 | 25.43 | 47.68 | 33.17 | 19.88 | 00m 42s |
| IG Sikdar et al. (2021) | 58.30 | 60.01 | 59.14 | 36.99 | 76.46 | 49.86 | 33.21 | About 1.2 hours |
| Llama3.2-3B | 41.03 | 71.02 | 52.01 | 37.47 | 69.42 | 48.67 | 32.16 | 08m 06s |
| Models | Classification | Extraction | ||||||
|---|---|---|---|---|---|---|---|---|
| Macro- | ||||||||
| ToxiTrace | 83.84 | 86.19 | 76.14 | 80.85 | 83.68 | 86.36 | 70.95 | 77.90 |
| w/o CuSA | 83.26 | 83.77 | 76.27 | 79.85 | 82.90 | 65.61 | 79.67 | 71.96 |
| w/o ARCL | 83.13 | 86.71 | 74.72 | 80.27 | 83.12 | 82.55 | 68.99 | 75.16 |
| w/o GCLoss | 83.20 | 88.04 | 74.29 | 80.58 | 83.36 | 75.89 | 57.07 | 65.15 |
| RoBERTa | 82.75 | 86.43 | 74.24 | 79.87 | 82.76 | 71.27 | 59.87 | 65.08 |
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
Toxicity Detection
Toxicity detection identifies harmful language for moderation and predicts toxic effects of chemicals, drugs, or biological exposures.
See all 45 papers