
https://raid-bench.xyz
打开排行榜。值得信赖的评价。强大的人工智能检测。
RAID 是用于评估 AI 生成的文本检测器的最大且最全面的数据集。它包含超过 1000 万份文档,涵盖 11 个法学硕士、11 个流派、4 种解码策略和 12 种对抗性攻击。它旨在成为对流行探测器进行值得信赖的第三方评估的首选地点。
安装 pip install raid-bench | |
| 用法示例 | |
|---|---|
from raid import run_detection , run_evaluation
from raid . utils import load_data
# Define your detector function
def my_detector ( texts : list [ str ]) -> list [ float ]:
pass
# Download & Load the RAID dataset
train_df = load_data ( split = "train" )
# Run your detector on the dataset
predictions = run_detection ( my_detector , train_df )
# Evaluate your detector predictions
evaluation_result = run_evaluation ( predictions , train_df ) | |
通过 RAID,您可以:
RAID 数据集包含以下类别的超过 1000 万代:
| 类别 | 价值观 |
|---|---|
| 型号 | ChatGPT、GPT-4、GPT-3 (text-davinci-003)、GPT-2 XL、Llama 2 70B(聊天)、Cohere、Cohere(聊天)、MPT-30B、MPT-30B(聊天)、Mistral 7B、米斯特拉尔 7B(聊天) |
| 域名 | ArXiv 摘要、食谱、Reddit 帖子、书籍摘要、纽约时报新闻文章、诗歌、IMDb 电影评论、维基百科、捷克新闻、德国新闻、Python 代码 |
| 解码策略 | 贪婪 (T=0)、采样 (T=1)、贪婪 + 重复惩罚 (T=0, θ=1.2)、采样 + 重复惩罚 (T=1, θ=1.2) |
| 对抗性攻击 | 文章删除、同形文字、数字交换、释义、同义词交换、拼写错误、添加空格、上下交换、零宽度空格、插入段落、替代拼写 |

RAID 是唯一涵盖不同模型、领域、采样策略和攻击的数据集
请参阅我们的 ACL 2024 论文,了解更详细的比较
我们提供的RAID数据集的分区细分如下:
| 标签? | 域名 | 数据集大小(无对抗性) | 数据集大小(带有对抗性) | |
|---|---|---|---|---|
| RAID 列车 | ✅ | 新闻、书籍、摘要、评论、Reddit、食谱、维基百科、诗歌 | 802M | 11.8G |
| RAID 测试 | ❌ | 新闻、书籍、摘要、评论、Reddit、食谱、维基百科、诗歌 | 81.0M | 1.22G |
| RAID-额外 | ✅ | 代码、捷克语、德语 | 275M | 3.71G |
要通过 pypi 包下载 RAID,请运行
from raid . utils import load_data
# Download the RAID dataset with adversarial attacks included
train_df = load_data ( split = "train" )
test_df = load_data ( split = "test" )
extra_df = load_data ( split = "extra" )
# Download the RAID dataset without adversarial attacks
train_noadv_df = load_data ( split = "train" , include_adversarial = False )
test_noadv_df = load_data ( split = "test" , include_adversarial = False )
extra_noadv_df = load_data ( split = "extra" , include_adversarial = False )您还可以使用wget手动下载数据
$ wget https://dataset.raid-bench.xyz/train.csv
$ wget https://dataset.raid-bench.xyz/test.csv
$ wget https://dataset.raid-bench.xyz/extra.csv
$ wget https://dataset.raid-bench.xyz/train_none.csv
$ wget https://dataset.raid-bench.xyz/test_none.csv
$ wget https://dataset.raid-bench.xyz/extra_none.csv
新功能:您现在还可以通过 HuggingFace 数据集下载 RAID?图书馆
from datasets import load_dataset
raid = load_dataset ( "liamdugan/raid" )要提交到排行榜,您必须首先获得测试集上检测器的预测。您可以使用 pypi 包或 CLI 来执行此操作:
import json
from raid import run_detection , run_evaluation
from raid . utils import load_data
# Define your detector function
def my_detector ( texts : list [ str ]) -> list [ float ]:
pass
# Load the RAID test data
test_df = load_data ( split = "test" )
# Run your detector on the dataset
predictions = run_detection ( my_detector , test_df )
with open ( 'predictions.json' ) as f :
json . dump ( predictions , f ) $ python detect_cli.py -m my_detector -d test.csv -o predictions.json
获得predictions.json文件后,您必须为提交编写元数据文件。您的元数据文件应使用此存储库中的模板,位于leaderboard/template-metadata.json 。
最后,分叉这个存储库。将生成文件添加到leaderboard/submissions/YOUR-DETECTOR-NAME/predictions.json ,将元数据文件添加到leaderboard/submissions/YOUR-DETECTOR-NAME/metadata.json ,并向此存储库发出拉取请求。
我们的 GitHub 机器人将自动对提交的预测进行评估,并将结果提交到leaderboard/submissions/YOUR-DETECTOR-NAME/results.json 。如果一切顺利,维护者将合并 PR,您的模型将出现在排行榜上!
笔记
您可以在单个 PR 中提交多个检测器 - 每个检测器应该有自己的目录。
如果您想运行我们已经实现的检测器或使用我们的数据集生成代码,您应该从源代码安装。为此,首先克隆存储库。然后安装在您选择的虚拟环境中
康达:
conda create -n raid_env python=3.9.7
conda activate raid_env
pip install -r requirements.txt
文夫:
python -m venv env
source env/bin/activate
pip install -r requirements.txt
然后,使用所需模块(OpenAI、Cohere、API 检测器等)的 API 密钥填充set_api_keys.sh文件。之后,运行source set_api_keys.sh设置 API 密钥环境变量。
要通过我们的 CLI 运行detect_cli.py和evaluate_cli.py将检测器应用于数据集。这些包含 pypi 包中的run_detection和run_evaluation函数。下面列出了选项。有关有效检测器名称的列表,请参阅detectors/detector.py 。
$ python detect_cli.py -h
-m, --model The name of the detector model you wish to run
-d, --data_path The path to the csv file with the dataset
-o, --output_path The path to write the result JSON file
$ python evaluate_cli.py -h
-r, --results_path The path to the detection result JSON to evaluate
-d, --data_path The path to the csv file with the dataset
-o, --output_path The path to write the result JSON file
-t, --target_fpr The target FPR to evaluate at (Default: 0.05)
例子:
$ python detect_cli.py -m gltr -d train.csv -o gltr_predictions.json
$ python evaluate_cli.py -i gltr_predictions.json -d train.csv -o gltr_result.json
evaluate_cli.py的输出将是一个 JSON 文件,其中包含目标误报率下 RAID 数据集每个分割上的检测器的准确性以及为检测器找到的阈值。
如果您想实现自己的检测器并仍然通过 CLI 运行它,则必须将其添加到detectors/detector.py中,以便可以通过命令行参数调用它。
如果您在研究中使用我们的代码或发现,请将我们引用为:
@inproceedings{dugan-etal-2024-raid,
title = "{RAID}: A Shared Benchmark for Robust Evaluation of Machine-Generated Text Detectors",
author = "Dugan, Liam and
Hwang, Alyssa and
Trhl{'i}k, Filip and
Zhu, Andrew and
Ludan, Josh Magnus and
Xu, Hainiu and
Ippolito, Daphne and
Callison-Burch, Chris",
booktitle = "Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
month = aug,
year = "2024",
address = "Bangkok, Thailand",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2024.acl-long.674",
pages = "12463--12492",
}
这项研究得到了国家情报总监办公室 (ODNI)、情报高级研究项目活动 (IARPA) 的部分支持,通过 HIATUS 计划合同#2022-22072200005。本文包含的观点和结论属于作者的观点和结论,不应被解释为必然代表 ODNI、IARPA 或美国政府的明示或暗示的官方政策。尽管其中有任何版权注释,美国政府仍有权出于政府目的复制和分发重印本。