AI Detector PGX

BERT-based classifier for detecting AI-generated text in student essays. Trained on PG assignments.

Quick Start

Python

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

model_id = "darwinkernelpanic/ai-detector-pgx"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)

text = "The mitochondria is the powerhouse of the cell..."
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)

with torch.no_grad():
    outputs = model(**inputs)
    probs = torch.softmax(outputs.logits, dim=1)
    ai_prob = probs[0][1].item()

print(f"AI Probability: {ai_prob:.2%}")

JavaScript (ONNX)

import * as ort from 'onnxruntime-web';

const session = await ort.InferenceSession.create('model.onnx');
// Tokenize with @xenova/transformers, then run inference
const results = await session.run({ input_ids, attention_mask });
const logits = results.logits.data;
const aiProb = Math.exp(logits[1]) / (Math.exp(logits[0]) + Math.exp(logits[1]));

Model Details

  • Base: prajjwal1/bert-tiny (4.4M params)
  • Classes: human (0), ai (1)
  • Sequence length: 512 tokens
  • ONNX size: 255MB

Limitations

Trained on academic essays โ€” may not generalize to all text types.

Downloads last month
23
Safetensors
Model size
66.4M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support