TF-IDF Logistic Regression AI-Text Detector

This is a binary classifier for distinguishing human-written and AI-generated text. It combines word-level TF-IDF features with logistic regression and applies Platt scaling to the output scores.

The model was trained on rasbt/human-vs-ai-50k. Human-written text has label 0 and AI-generated text has label 1. The recorded cross-validation accuracy was 98.17%.

logreg-ai-detector.json contains the training and calibration metadata. The recommended inference implementation is provided in the rasbt/ai-detector repository.

 

Download and use

hf download rasbt/ai-text-detector-logreg \
  --local-dir models/ai-text-detector-logreg
from pathlib import Path

from joblib import load


model_dir = Path("models/ai-text-detector-logreg")
classifier = load(model_dir / "logreg-ai-detector.joblib")

text = "Paste the text to classify here."
ai_column = list(classifier.classes_).index(1)
ai_probability = classifier.predict_proba([text])[0, ai_column]

print({"score": round(100 * float(ai_probability), 4)})

 

Related models

 

Limitations

Performance may change for text from generators, domains, languages, and editing workflows not represented in the training set. Short or partly AI-assisted text may also be harder to classify. The score should not be treated as definitive evidence that a person did or did not write a text.

The .joblib file uses Python serialization. Only load it from a repository you trust.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train rasbt/ai-text-detector-logreg

Collection including rasbt/ai-text-detector-logreg