🚀 SuperAnnotate - LLM内容检测器
SuperAnnotate的LLM内容检测器是一个基于RoBERTa Large微调的模型,旨在检测文本是否为生成的合成文本。该功能对于确定文本作者、保证训练数据质量以及检测科学和教育领域的欺诈和作弊行为至关重要。
🚀 快速开始
前置要求
安装 generated_text_detector,运行以下命令:
pip install git+https://github.com/superannotateai/generated_text_detector.git@v1.0.0
使用示例
from generated_text_detector.utils.model.roberta_classifier import RobertaClassifier
from transformers import AutoTokenizer
import torch.nn.functional as F
model = RobertaClassifier.from_pretrained("SuperAnnotate/roberta-large-llm-content-detector")
tokenizer = AutoTokenizer.from_pretrained("SuperAnnotate/roberta-large-llm-content-detector")
text_example = "It's not uncommon for people to develop allergies or intolerances to certain foods as they get older. It's possible that you have always had a sensitivity to lactose (the sugar found in milk and other dairy products), but it only recently became a problem for you. This can happen because our bodies can change over time and become more or less able to tolerate certain things. It's also possible that you have developed an allergy or intolerance to something else that is causing your symptoms, such as a food additive or preservative. In any case, it's important to talk to a doctor if you are experiencing new allergy or intolerance symptoms, so they can help determine the cause and recommend treatment."
tokens = tokenizer.encode_plus(
text_example,
add_special_tokens=True,
max_length=512,
padding='longest',
truncation=True,
return_token_type_ids=True,
return_tensors="pt"
)
_, logits = model(**tokens)
proba = F.sigmoid(logits).squeeze(1).item()
print(proba)
✨ 主要特性
- 文本检测功能:能够有效检测生成的合成文本,对于确定文本作者、保障训练数据质量以及防范欺诈和作弊行为具有重要意义。
- 模型校准良好:在训练过程中,不仅注重最大化预测质量,还避免了过拟合,获得了具有足够置信度的预测器。
📦 安装指南
运行以下命令安装 generated_text_detector:
pip install git+https://github.com/superannotateai/generated_text_detector.git@v1.0.0
📚 详细文档
模型详情
模型描述
模型来源
训练数据
训练数据来自两个开放数据集,按不同比例混合并经过过滤:
- HC3 | 63%
- IDMGSP | 37%
最终训练数据集包含约 20k 对文本 - 标签,且类别大致平衡。值得注意的是,数据集中的文本具有逻辑结构:人类编写和模型生成的文本都针对同一提示/指令,但提示本身在训练中未使用。
⚠️ 重要提示
此外,利用卡方检验识别出与目标标签相关性最高的关键n-gram(n范围为2到5),并将其从训练数据中移除。
特性
在训练过程中,一个重要目标不仅是最大化预测质量,还包括避免过拟合并获得一个有足够置信度的预测器。模型校准达到了以下状态:

训练细节
选择自定义架构是因为它能够进行二元分类,同时提供单个模型输出,并且损失函数中集成了可定制的平滑设置。
训练参数:
性能表现
该模型在由训练数据的保留子集和SuperAnnotate的封闭子集组成的基准测试中进行了评估。基准测试包含1k个样本,每个类别200个样本。以下是该模型与其他开源解决方案和流行API检测器的性能对比表:
📄 许可证
该模型使用SAIPL许可证。