🚀 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許可證。