Instructions to use rasbt/ai-text-detector-logreg with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use rasbt/ai-text-detector-logreg with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("rasbt/ai-text-detector-logreg", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
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
- DistilBERT
- DistilBERT with LoRA
- DistilBERT with MiCA
- ModernBERT
- GPT-2 with a fixed-position readout
- GPT-2 with a variable-position readout
- Qwen3 0.6B with a fixed-position readout
- Qwen3 0.6B with a variable-position readout
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
- -