Tatar detoxification dataset
收藏资源简介:
该数据集是由斯科尔科沃科学技术学院等机构为低资源鞑靼语文本去毒任务构建的专项语料库,旨在扩充现有CLEF竞赛数据。其内容包含701条人工标注的平行文本对,涵盖从社交媒体采集的原始毒性语句及其中性化改写版本,平均字符长度约55,并标注了毒性等级与去毒方法。数据通过遵循CLEF指南的双标注者加审核流程创建,特别处理了鞑靼语字母替代现象。该数据集主要用于训练和评估鞑靼语文本去毒模型,解决低资源语言在内容安全领域缺乏监督数据的问题。
This specialized corpus was developed by the Skolkovo Institute of Science and Technology and other institutions for the low-resource Tatar text detoxification task, with the goal of expanding the existing CLEF competition dataset. It comprises 701 manually annotated parallel text pairs, including original toxic sentences and their neutralized rewritten variants collected from social media, with an average character length of around 55. Annotations for toxicity levels and detoxification methods are included for each sample. The dataset was constructed following a dual-annotator plus review process specified in the CLEF guidelines, with special handling of the Tatar alphabet substitution phenomenon. This dataset is primarily utilized for training and evaluating Tatar text detoxification models, addressing the gap of supervised data for low-resource languages in the content safety domain.
数据集概述
Tatoxa 是一个针对低资源语言(鞑靼语)的文本去毒化系统,旨在减轻文本中的有害性(毒性)。该项目包含一个扩展的鞑靼语去毒化数据集。
数据集构成
- 来源:基于 CLEF-2025 竞赛的鞑靼语数据集,并额外添加了 701 条人工标注示例。
- 标注:由两名标注员独立标注,并由一名审核员审查,遵循 CLEF-2025 组织者提供的指南。标注任务为:在尽可能少修改原文、保留原意的条件下,将文本去毒化。
- 文件:
Datasets/文件夹包含:- CLEF-2025 数据集(在实验中用作验证集)。
- 人工标注数据集(在实验中用作测试集)。
- 重要说明:用于跨语言实验的 MultiParaDetox 数据集 的测试子集不包含在本仓库中。如需访问,需联系以下论文的作者:
- Dementieva, Daryna, Nikolay Babakov, and Alexander Panchenko. "MultiParaDetox: Extending text detoxification with parallel data to new languages." Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 2: Short Papers). 2024. 论文链接
数据处理与生成
数据集是通过一个四阶段流水线构建的:
- 翻译模型微调:使用 LoRA 方法微调多语言模型
facebook/nllb-200-3.3B,以改善俄语↔鞑靼语的翻译质量。训练数据来自AigizK/tatar-russian-parallel-corpora。 - 合成数据集生成:将俄语去毒化数据集(
ru_paradetox、multilingual_paradetox、rudetoxifier、toxic_dvach)中的“有毒→中性”对翻译为鞑靼语,并使用sentence-transformers/LaBSE过滤语义相似度低于 0.7 的句子对,生成鞑靼语平行语料库tatar_detox_ds。 - 去毒化模型训练:基于指令微调的多语言模型
s-nlp/mt0-xl-detox-orpo,使用 3 折交叉验证训练三个独立的 LoRA 适配器。 - 推理与重排序:加载基座模型和三个适配器,对每条输入句子生成最多 60 个候选,并基于以下加权分数选择最佳候选:
- 毒性:使用分类器
textdetox/xlmr-large-toxicity-classifier-v2评估“中性”类的概率。 - 意义:使用 LaBSE 计算与源文本的余弦相似度。
- 毒性:使用分类器
可用实验脚本
项目中提供了多个实验脚本,用于在不同数据集上微调 mT0 模型:
- 跨语言设置:
script_crosslingual_train.py、script_crosslingual_test.py、script_crosslingual_all.py,分别用于在 MultiParaDetox 数据集的训练子集、测试子集和完整数据集上进行微调。 - 训练集规模影响:
script_size_impact.py,用于在 ParaDetox 数据集上测试不同训练样本数量(如 12000 条)对模型性能的影响。通过修改load_training_data函数可在 ParaDetox 和 Ru-ParaDetox 数据集之间切换。
所有脚本的参数包括:--finalpath(输出文件路径)、--logpath(日志路径)、--valpath(验证集路径)、--testpath(测试集路径),以及 --epochs、--batch-size、--learning-rate、--lora-rank、--lora-alpha、--early-stopping-patience 等可选参数。script_crosslingual_test.py 额外需要 --trainset 参数,script_size_impact.py 额外需要 --train-samples 参数。

- 1The Tatoxa System for Text Detoxification in Low-Resource Languages: The Case of Tatar斯科尔科沃科学技术学院; 高等经济学院; 国立信息技术、机械学与光学研究型大学; 鞑靼斯坦科学院应用符号学研究所; 喀山联邦大学; 人工智能研究所 · 2026年



