Datasets:
Improve ChineseHarm-Bench dataset card with overview, usage, results, and detailed links
Browse filesThis PR enriches the `ChineseHarm-Bench` dataset card to provide more comprehensive information and practical guidance for users.
Key improvements include:
- **Expanded Metadata:** Added relevant tags (`harmful-content-detection`, `safety`, `moderation`, `benchmark`, `chinese`) for better discoverability.
- **Refined Links:** Clarified and added separate links for the project's GitHub repository (Code), the dedicated project website (Project Page), the associated paper (arXiv), and the Hugging Face collection.
- **Detailed Overview:** Integrated the "Overview" section from the project's GitHub README, offering a concise summary of the benchmark's purpose and key features.
- **Practical Usage Examples:** Included code snippets and instructions for performing single and batch inference, as well as evaluating predictions, making it easier for users to get started with the dataset.
- **Performance Insights:** Added the "Main Results" table, showcasing the performance of various models on the benchmark, which is crucial for researchers.
- **Community Engagement:** Added the "Contributors" section from the GitHub README.
These updates aim to make the dataset card a more valuable and self-contained resource for researchers and practitioners.
|
@@ -6,16 +6,23 @@ size_categories:
|
|
| 6 |
- 10K<n<100K
|
| 7 |
task_categories:
|
| 8 |
- text-classification
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
<h1 align="center"> ChineseHarm-bench</h1>
|
| 12 |
-
<h3 align="center"> A Chinese Harmful Content
|
| 13 |
|
| 14 |
> ⚠️ **WARNING**: This project and associated data contain content that may be toxic, offensive, or disturbing. Use responsibly and with discretion.
|
| 15 |
|
| 16 |
<p align="center">
|
| 17 |
-
<a href="https://github.com/zjunlp/ChineseHarm-bench">
|
| 18 |
<a href="https://arxiv.org/abs/2506.10960">Paper</a> •
|
|
|
|
| 19 |
<a href="https://huggingface.co/collections/zjunlp/chineseharm-bench-683b452c5dcd1d6831c3316c">Hugging Face</a>
|
| 20 |
</p>
|
| 21 |
|
|
@@ -26,6 +33,12 @@ task_categories:
|
|
| 26 |
<img src="chineseharm_case.png" width="80%"/></p>
|
| 27 |
</div>
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
## 🌟Benchmark
|
| 30 |
|
| 31 |
This folder contains the ChineseHarm-Bench.
|
|
@@ -38,6 +51,99 @@ Each file is a list of examples with:
|
|
| 38 |
* `"文本"`: the input Chinese text
|
| 39 |
* `"标签"`: the ground-truth label
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
## 🚩 Ethics Statement
|
| 42 |
|
| 43 |
We obtain all data with proper authorization from the respective data-owning organizations and signed the necessary agreements.
|
|
@@ -65,4 +171,8 @@ Please cite our repository if you use ChineseHarm-bench in your work. Thanks!
|
|
| 65 |
primaryClass={cs.CL},
|
| 66 |
url={https://arxiv.org/abs/2506.10960},
|
| 67 |
}
|
| 68 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
- 10K<n<100K
|
| 7 |
task_categories:
|
| 8 |
- text-classification
|
| 9 |
+
tags:
|
| 10 |
+
- harmful-content-detection
|
| 11 |
+
- safety
|
| 12 |
+
- moderation
|
| 13 |
+
- benchmark
|
| 14 |
+
- chinese
|
| 15 |
---
|
| 16 |
|
| 17 |
<h1 align="center"> ChineseHarm-bench</h1>
|
| 18 |
+
<h3 align="center"> A Chinese Harmful Content Detection Benchmark </h3>
|
| 19 |
|
| 20 |
> ⚠️ **WARNING**: This project and associated data contain content that may be toxic, offensive, or disturbing. Use responsibly and with discretion.
|
| 21 |
|
| 22 |
<p align="center">
|
| 23 |
+
<a href="https://github.com/zjunlp/ChineseHarm-bench">Code</a> •
|
| 24 |
<a href="https://arxiv.org/abs/2506.10960">Paper</a> •
|
| 25 |
+
<a href="https://zjunlp.github.io/project/ChineseHarm-Bench/">Project Page</a> •
|
| 26 |
<a href="https://huggingface.co/collections/zjunlp/chineseharm-bench-683b452c5dcd1d6831c3316c">Hugging Face</a>
|
| 27 |
</p>
|
| 28 |
|
|
|
|
| 33 |
<img src="chineseharm_case.png" width="80%"/></p>
|
| 34 |
</div>
|
| 35 |
|
| 36 |
+
## 🌟Overview
|
| 37 |
+
|
| 38 |
+
We introduce ChineseHarm-Bench, a professionally annotated benchmark for Chinese harmful content detection, covering six key categories. It includes a knowledge rule base to enhance detection and a knowledge-augmented baseline that enables smaller LLMs to match state-of-the-art performance.
|
| 39 |
+
|
| 40 |
+
The benchmark construction process is illustrated in the figure above and for more detailed procedures, please refer to our paper.
|
| 41 |
+
|
| 42 |
## 🌟Benchmark
|
| 43 |
|
| 44 |
This folder contains the ChineseHarm-Bench.
|
|
|
|
| 51 |
* `"文本"`: the input Chinese text
|
| 52 |
* `"标签"`: the ground-truth label
|
| 53 |
|
| 54 |
+
## Sample Usage (Inference)
|
| 55 |
+
|
| 56 |
+
Our inference scripts support both **Huawei Ascend NPUs and NVIDIA GPUs**, enabling flexible deployment across different hardware platforms. For the full scripts and details, please refer to the [GitHub repository](https://github.com/zjunlp/ChineseHarm-bench).
|
| 57 |
+
|
| 58 |
+
We release the following variants of our harmful content detection model:
|
| 59 |
+
|
| 60 |
+
- [**ChineseGuard-1.5B**](https://huggingface.co/zjunlp/ChineseGuard-1.5B)
|
| 61 |
+
- [**ChineseGuard-3B**](https://huggingface.co/zjunlp/ChineseGuard-3B)
|
| 62 |
+
- [**ChineseGuard-7B**](https://huggingface.co/zjunlp/ChineseGuard-7B)
|
| 63 |
+
|
| 64 |
+
🔹 Single Inference (Example)
|
| 65 |
+
|
| 66 |
+
Run single-input inference using the ChineseGuard-1.5B model:
|
| 67 |
+
|
| 68 |
+
```bash
|
| 69 |
+
SCRIPT_PATH="../infer/single_infer.py"
|
| 70 |
+
model_name="zjunlp/ChineseHarm-1.5B"
|
| 71 |
+
text="代发短信,有想做的联系我,无押金"
|
| 72 |
+
|
| 73 |
+
python $SCRIPT_PATH \
|
| 74 |
+
--model_name $model_name \
|
| 75 |
+
--text $text
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
🔸 Batch Inference (Multi-NPU or Multi-GPU)
|
| 79 |
+
|
| 80 |
+
To run inference on the entire ChineseHarm-Bench using ChineseGuard-1.5B and 8 NPUs:
|
| 81 |
+
|
| 82 |
+
```bash
|
| 83 |
+
SCRIPT_PATH="../infer/batch_infer.py"
|
| 84 |
+
model_name="zjunlp/ChineseHarm-1.5B"
|
| 85 |
+
file_name="../benchmark/bench.json"
|
| 86 |
+
output_file="../benchmark/bench_ChineseHarm-1.5B.json"
|
| 87 |
+
|
| 88 |
+
python $SCRIPT_PATH \
|
| 89 |
+
--model_name $model_name \
|
| 90 |
+
--file_name $file_name \
|
| 91 |
+
--output_file $output_file \
|
| 92 |
+
--num_npus 8
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
> For more configuration options (e.g., batch size, device selection, custom prompt templates), please refer to `single_infer.py` and `batch_infer.py` in the [code repository](https://github.com/zjunlp/ChineseHarm-bench/tree/main/infer).
|
| 96 |
+
>
|
| 97 |
+
> **Note:** The inference scripts support both NPU and GPU devices.
|
| 98 |
+
|
| 99 |
+
**Evaluation: Calculating F1 Score**
|
| 100 |
+
|
| 101 |
+
After inference, evaluate the predictions by computing the F1 score with the following command:
|
| 102 |
+
|
| 103 |
+
```bash
|
| 104 |
+
python ../calculate_metrics.py \
|
| 105 |
+
--file_path "../benchmark/bench_ChineseHarm-1.5B.json" \
|
| 106 |
+
--true_label_field "标签" \
|
| 107 |
+
--predicted_label_field "predict_label"
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
## Main Results
|
| 111 |
+
|
| 112 |
+
> 🔴:Without Knowledge Augmentation 🟢:With Knowledge Augmentation 🟦:Our Strong Baseline
|
| 113 |
+
|
| 114 |
+
| Model | Strategy | Knowledge | Gambling | Pornography | Abuse | Fraud | Illicit Ads | Non-Violation | Macro-F1 |
|
| 115 |
+
| :-------------------------: | :--------: | :-------: | :------: | :---------: | :---: | :---: | :---------: | :-----------: | :------: |
|
| 116 |
+
| **Deepseek-R1** | Prompting | 🔴 | 0.82 | 0.77 | 0.84 | 0.53 | 0.65 | 0.78 | 0.73 |
|
| 117 |
+
| | Prompting | 🟢 | 0.89 | 0.83 | 0.87 | 0.65 | 0.77 | 0.80 | 0.80 |
|
| 118 |
+
| **O3-mini** | Prompting | 🔴 | 0.56 | 0.55 | 0.74 | 0.57 | 0.22 | 0.45 | 0.51 |
|
| 119 |
+
| | Prompting | 🟢 | 0.70 | 0.55 | 0.73 | 0.60 | 0.40 | 0.46 | 0.57 |
|
| 120 |
+
| **GPT-4o** | Prompting | 🔴 | 0.78 | 0.75 | 0.83 | 0.59 | 0.53 | 0.79 | 0.71 |
|
| 121 |
+
| | Prompting | 🟢 | 0.89 | 0.75 | 0.82 | 0.60 | 0.75 | 0.86 | 0.78 |
|
| 122 |
+
| **GPT-4o-mini** | Prompting | 🔴 | 0.57 | 0.70 | 0.71 | 0.43 | 0.40 | 0.59 | 0.57 |
|
| 123 |
+
| | Prompting | 🟢 | 0.82 | 0.76 | 0.74 | 0.51 | 0.62 | 0.72 | 0.69 |
|
| 124 |
+
| **Gemini 2.0 Flash** | Prompting | 🔴 | 0.72 | 0.76 | 0.84 | 0.63 | 0.52 | 0.75 | 0.71 |
|
| 125 |
+
| | Prompting | 🟢 | 0.91 | 0.77 | 0.82 | 0.51 | 0.69 | 0.75 | 0.74 |
|
| 126 |
+
| **Claude 3.5 Sonnet** | Prompting | 🔴 | 0.76 | 0.76 | 0.79 | 0.11 | 0.57 | 0.80 | 0.63 |
|
| 127 |
+
| | Prompting | 🟢 | 0.87 | 0.81 | 0.78 | 0.36 | 0.72 | 0.78 | 0.72 |
|
| 128 |
+
| **BERT-Base-Chinese** | Finetuning | 🔴 | 0.49 | 0.60 | 0.73 | 0.49 | 0.50 | 0.68 | 0.58 |
|
| 129 |
+
| 🟦 | Finetuning | 🟢 | 0.74 | 0.65 | 0.76 | 0.68 | 0.68 | 0.70 | 0.70 |
|
| 130 |
+
| **Qwen--2.5-0.5B-Instruct** | Prompting | 🔴 | 0.00 | 0.21 | 0.00 | 0.00 | 0.00 | 0.30 | 0.09 |
|
| 131 |
+
| | Prompting | 🟢 | 0.00 | 0.11 | 0.00 | 0.00 | 0.00 | 0.30 | 0.07 |
|
| 132 |
+
| | Finetuning | 🔴 | 0.35 | 0.59 | 0.72 | 0.39 | 0.44 | 0.74 | 0.54 |
|
| 133 |
+
| 🟦 | Finetuning | 🟢 | 0.75 | 0.64 | 0.75 | 0.62 | 0.70 | 0.74 | 0.70 |
|
| 134 |
+
| **Qwen--2.5-1.5B-Instruct** | Prompting | 🔴 | 0.22 | 0.08 | 0.62 | 0.47 | 0.00 | 0.48 | 0.31 |
|
| 135 |
+
| | Prompting | 🟢 | 0.55 | 0.13 | 0.53 | 0.52 | 0.00 | 0.45 | 0.36 |
|
| 136 |
+
| | Finetuning | 🔴 | 0.36 | 0.61 | 0.74 | 0.43 | 0.48 | 0.81 | 0.57 |
|
| 137 |
+
| 🟦 | Finetuning | 🟢 | 0.77 | 0.71 | 0.77 | 0.70 | 0.74 | 0.79 | 0.75 |
|
| 138 |
+
| **Qwen-2.5-3B-Instruct** | Prompting | 🔴 | 0.38 | 0.53 | 0.58 | 0.38 | 0.36 | 0.50 | 0.46 |
|
| 139 |
+
| | Prompting | 🟢 | 0.62 | 0.55 | 0.46 | 0.58 | 0.10 | 0.49 | 0.47 |
|
| 140 |
+
| | Finetuning | 🔴 | 0.47 | 0.63 | 0.77 | 0.37 | 0.49 | 0.82 | 0.59 |
|
| 141 |
+
| 🟦 | Finetuning | 🟢 | 0.81 | 0.72 | 0.79 | 0.72 | 0.74 | 0.85 | 0.77 |
|
| 142 |
+
| **Qwen--2.5-7B-Instruct** | Prompting | 🔴 | 0.35 | 0.58 | 0.42 | 0.09 | 0.45 | 0.56 | 0.41 |
|
| 143 |
+
| | Prompting | 🟢 | 0.51 | 0.63 | 0.48 | 0.37 | 0.32 | 0.42 | 0.46 |
|
| 144 |
+
| | Finetuning | 🔴 | 0.35 | 0.64 | 0.72 | 0.38 | 0.49 | 0.82 | 0.57 |
|
| 145 |
+
| 🟦 | Finetuning | 🟢 | 0.82 | 0.70 | 0.75 | 0.75 | 0.75 | 0.82 | 0.77 |
|
| 146 |
+
|
| 147 |
## 🚩 Ethics Statement
|
| 148 |
|
| 149 |
We obtain all data with proper authorization from the respective data-owning organizations and signed the necessary agreements.
|
|
|
|
| 171 |
primaryClass={cs.CL},
|
| 172 |
url={https://arxiv.org/abs/2506.10960},
|
| 173 |
}
|
| 174 |
+
```
|
| 175 |
+
|
| 176 |
+
## 🎉Contributors
|
| 177 |
+
|
| 178 |
+
We will offer long-term maintenance to fix bugs and solve issues. So if you have any problems, please put issues to us.
|