Ai Text Detector V1.01
模型概述
該模型基於微調的microsoft/deberta-v3-large架構,專注於檢測AI生成的文本內容,適用於內容審核、學術誠信等領域。
模型特點
高精度檢測
在RAID AI檢測基準測試中表現領先,能夠準確區分人類和AI生成的文本。
魯棒性強
能夠有效應對不同領域的各類對抗攻擊,保持穩定的檢測性能。
基於DeBERTa架構
採用改進的BERT架構,通過解耦注意力和增強的掩碼解碼器實現更優性能。
模型能力
AI生成文本檢測
內容真實性驗證
文本分類
使用案例
教育
學術誠信檢查
檢測學生作業或論文中是否存在AI生成的內容,維護學術誠信。
幫助教育機構識別潛在的學術不端行為
內容審核
AI生成內容標記
在社交媒體或新聞平臺上標記AI生成的內容,提高內容透明度。
增強用戶對內容真實性的信任
新聞業
新聞真實性驗證
驗證新聞稿件是否為人類撰寫,防止AI生成的虛假信息傳播。
維護新聞行業的可信度和專業性
🚀 desklib/ai-text-detector-v1.01
這是Desklib開發的一款AI生成文本檢測模型,旨在將英文文本分類為人寫文本或AI生成文本。它目前在RAID AI檢測基準測試中名列前茅。該模型基於Transformer架構,是microsoft/deberta-v3-large的微調版本,具有高精度、魯棒性強的特點,能很好地應對不同領域的各種對抗攻擊。此模型在內容審核、學術誠信、新聞報道等對文本真實性要求較高的場景中非常實用。
Desklib提供基於AI的個性化學習和學習輔助工具,本模型是Desklib為學生、教育工作者和大學提供的眾多工具之一。
在線試用模型!:Desklib AI Detector
Github倉庫:https://github.com/desklib/ai-text-detector
🚀 快速開始
本模型可用於將英文文本分類為人寫文本或AI生成文本,適用於內容審核、學術誠信等場景。你可以通過以下鏈接在線試用模型:Desklib AI Detector ,也可以參考下面的使用示例在本地運行。
✨ 主要特性
- 高精度:在RAID基準測試中表現優異,目前處於領先地位。
- 魯棒性強:能很好地應對不同領域的各種對抗攻擊。
- 應用廣泛:適用於內容審核、學術誠信、新聞報道等對文本真實性要求較高的場景。
📦 安裝指南
文檔未提及具體安裝步驟,可參考以下通用步驟:
- 確保你已經安裝了Python和
transformers
庫。 - 克隆模型的GitHub倉庫:
git clone https://github.com/desklib/ai-text-detector.git
- 進入倉庫目錄並安裝依賴:
pip install -r requirements.txt
💻 使用示例
基礎用法
import torch
import torch.nn as nn
from transformers import AutoTokenizer, AutoConfig, AutoModel, PreTrainedModel
class DesklibAIDetectionModel(PreTrainedModel):
config_class = AutoConfig
def __init__(self, config):
super().__init__(config)
# Initialize the base transformer model.
self.model = AutoModel.from_config(config)
# Define a classifier head.
self.classifier = nn.Linear(config.hidden_size, 1)
# Initialize weights (handled by PreTrainedModel)
self.init_weights()
def forward(self, input_ids, attention_mask=None, labels=None):
# Forward pass through the transformer
outputs = self.model(input_ids, attention_mask=attention_mask)
last_hidden_state = outputs[0]
# Mean pooling
input_mask_expanded = attention_mask.unsqueeze(-1).expand(last_hidden_state.size()).float()
sum_embeddings = torch.sum(last_hidden_state * input_mask_expanded, dim=1)
sum_mask = torch.clamp(input_mask_expanded.sum(dim=1), min=1e-9)
pooled_output = sum_embeddings / sum_mask
# Classifier
logits = self.classifier(pooled_output)
loss = None
if labels is not None:
loss_fct = nn.BCEWithLogitsLoss()
loss = loss_fct(logits.view(-1), labels.float())
output = {"logits": logits}
if loss is not None:
output["loss"] = loss
return output
def predict_single_text(text, model, tokenizer, device, max_len=768, threshold=0.5):
encoded = tokenizer(
text,
padding='max_length',
truncation=True,
max_length=max_len,
return_tensors='pt'
)
input_ids = encoded['input_ids'].to(device)
attention_mask = encoded['attention_mask'].to(device)
model.eval()
with torch.no_grad():
outputs = model(input_ids=input_ids, attention_mask=attention_mask)
logits = outputs["logits"]
probability = torch.sigmoid(logits).item()
label = 1 if probability >= threshold else 0
return probability, label
def main():
# --- Model and Tokenizer Directory ---
model_directory = "desklib/ai-text-detector-v1.01"
# --- Load tokenizer and model ---
tokenizer = AutoTokenizer.from_pretrained(model_directory)
model = DesklibAIDetectionModel.from_pretrained(model_directory)
# --- Set up device ---
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
# --- Example Input text ---
text_ai = "AI detection refers to the process of identifying whether a given piece of content, such as text, images, or audio, has been generated by artificial intelligence. This is achieved using various machine learning techniques, including perplexity analysis, entropy measurements, linguistic pattern recognition, and neural network classifiers trained on human and AI-generated data. Advanced AI detection tools assess writing style, coherence, and statistical properties to determine the likelihood of AI involvement. These tools are widely used in academia, journalism, and content moderation to ensure originality, prevent misinformation, and maintain ethical standards. As AI-generated content becomes increasingly sophisticated, AI detection methods continue to evolve, integrating deep learning models and ensemble techniques for improved accuracy."
text_human = "It is estimated that a major part of the content in the internet will be generated by AI / LLMs by 2025. This leads to a lot of misinformation and credibility related issues. That is why if is important to have accurate tools to identify if a content is AI generated or human written"
# --- Run prediction ---
probability, predicted_label = predict_single_text(text_ai, model, tokenizer, device)
print(f"Probability of being AI generated: {probability:.4f}")
print(f"Predicted label: {'AI Generated' if predicted_label == 1 else 'Not AI Generated'}")
probability, predicted_label = predict_single_text(text_human, model, tokenizer, device)
print(f"Probability of being AI generated: {probability:.4f}")
print(f"Predicted label: {'AI Generated' if predicted_label == 1 else 'Not AI Generated'}")
if __name__ == "__main__":
main()
📚 詳細文檔
性能表現
該模型在提交時的RAID基準測試中取得了頂尖的成績:訪問RAID排行榜
模型架構
該模型基於微調後的microsoft/deberta-v3-large Transformer架構構建,核心組件包括:
- Transformer基礎模型:預訓練的
microsoft/deberta-v3-large
模型作為基礎。該模型採用了DeBERTa(具有解耦注意力的解碼增強BERT),它是BERT和RoBERTa的改進版本,結合瞭解耦注意力和增強的掩碼解碼器,以實現更好的性能。 - 均值池化層:該層聚合Transformer的隱藏狀態,創建輸入文本的固定大小表示。此方法通過注意力掩碼對詞元嵌入進行加權平均,以捕捉整體語義。
- 分類器頭:一個線性層作為分類器,接收池化後的表示並輸出單個對數幾率。該對數幾率表示模型對輸入文本是AI生成的置信度。對對數幾率應用Sigmoid激活函數以生成概率。
🔧 技術細節
本模型是基於Transformer架構的文本分類模型,通過微調microsoft/deberta-v3-large
模型來實現對英文文本的分類。在模型架構上,採用了均值池化層和線性分類器頭,以提高模型的性能和準確性。同時,模型在訓練過程中使用了RAID基準測試數據集,以確保模型在不同領域和對抗攻擊下的魯棒性。
📄 許可證
本模型採用MIT許可證。
Distilbert Base Uncased Finetuned Sst 2 English
Apache-2.0
基於DistilBERT-base-uncased在SST-2情感分析數據集上微調的文本分類模型,準確率91.3%
文本分類 英語
D
distilbert
5.2M
746
Xlm Roberta Base Language Detection
MIT
基於XLM-RoBERTa的多語言檢測模型,支持20種語言的文本分類
文本分類
Transformers 支持多種語言

X
papluca
2.7M
333
Roberta Hate Speech Dynabench R4 Target
該模型通過動態生成數據集來改進在線仇恨檢測,專注於從最差案例中學習以提高檢測效果。
文本分類
Transformers 英語

R
facebook
2.0M
80
Bert Base Multilingual Uncased Sentiment
MIT
基於bert-base-multilingual-uncased微調的多語言情感分析模型,支持6種語言的商品評論情感分析
文本分類 支持多種語言
B
nlptown
1.8M
371
Emotion English Distilroberta Base
基於DistilRoBERTa-base微調的英文文本情感分類模型,可預測埃克曼六種基本情緒及中性類別。
文本分類
Transformers 英語

E
j-hartmann
1.1M
402
Robertuito Sentiment Analysis
基於RoBERTuito的西班牙語推文情感分析模型,支持POS(積極)/NEG(消極)/NEU(中性)三類情感分類
文本分類 西班牙語
R
pysentimiento
1.0M
88
Finbert Tone
FinBERT是一款基於金融通訊文本預訓練的BERT模型,專注於金融自然語言處理領域。finbert-tone是其微調版本,用於金融情感分析任務。
文本分類
Transformers 英語

F
yiyanghkust
998.46k
178
Roberta Base Go Emotions
MIT
基於RoBERTa-base的多標籤情感分類模型,在go_emotions數據集上訓練,支持28種情感標籤識別。
文本分類
Transformers 英語

R
SamLowe
848.12k
565
Xlm Emo T
XLM-EMO是一個基於XLM-T模型微調的多語言情感分析模型,支持19種語言,專門針對社交媒體文本的情感預測。
文本分類
Transformers 其他

X
MilaNLProc
692.30k
7
Deberta V3 Base Mnli Fever Anli
MIT
基於MultiNLI、Fever-NLI和ANLI數據集訓練的DeBERTa-v3模型,擅長零樣本分類和自然語言推理任務
文本分類
Transformers 英語

D
MoritzLaurer
613.93k
204
精選推薦AI模型
Llama 3 Typhoon V1.5x 8b Instruct
專為泰語設計的80億參數指令模型,性能媲美GPT-3.5-turbo,優化了應用場景、檢索增強生成、受限生成和推理任務
大型語言模型
Transformers 支持多種語言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一個基於SODA數據集訓練的超小型對話模型,專為邊緣設備推理設計,體積僅為Cosmo-3B模型的2%左右。
對話系統
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基於RoBERTa架構的中文抽取式問答模型,適用於從給定文本中提取答案的任務。
問答系統 中文
R
uer
2,694
98