Views
No views yet
distilbert-base-cased) sequence classifier that
detects AI-generated text in academic papers, essays, and reports. It is the
core AI-detection engine of the PaperGuard
multi-agent academic-integrity system.0 = ai, 1 = human (see config.json id2label).human_logit − ai_logit). PaperGuard
therefore scores AI-likelihood from a logistic calibration of the margin,
not the raw softmax. After calibration it flags clean/academic AI at ~70–90%
while keeping human text low (~10%).1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4tok = AutoTokenizer.from_pretrained("vediumsameer/paperguard-ai-detector")
5model = AutoModelForSequenceClassification.from_pretrained("vediumsameer/paperguard-ai-detector")
6
7text = "The rapid advancement of artificial intelligence has transformed modern education..."
8inputs = tok(text, return_tensors="pt", truncation=True, max_length=512)
9with torch.no_grad():
10 logits = model(**inputs).logits[0]
11
12# Recommended: score off the margin (softmax is saturated)
13margin = float(logits[model.config.label2id["human"]] - logits[model.config.label2id["ai"]])
14# lower margin -> more AI-like ; higher margin -> more human-like
15print("logit margin (human - ai):", margin)