--- language: - en license: apache-2.0 library_name: sklearn pipeline_tag: text-classification datasets: - rasbt/human-vs-ai-50k metrics: - accuracy tags: - ai-text-detection - binary-classification --- # 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`](https://huggingface.co/datasets/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`](https://github.com/rasbt/ai-detector) repository.   ## Download and use ```bash hf download rasbt/ai-text-detector-logreg \ --local-dir models/ai-text-detector-logreg ``` ```python 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](https://huggingface.co/rasbt/ai-text-detector-distilbert) - [DistilBERT with LoRA](https://huggingface.co/rasbt/ai-text-detector-distilbert-lora) - [DistilBERT with MiCA](https://huggingface.co/rasbt/ai-text-detector-distilbert-mica) - [ModernBERT](https://huggingface.co/rasbt/ai-text-detector-modernbert) - [GPT-2 with a fixed-position readout](https://huggingface.co/rasbt/ai-text-detector-gpt2-fixed) - [GPT-2 with a variable-position readout](https://huggingface.co/rasbt/ai-text-detector-gpt2-variable) - [Qwen3 0.6B with a fixed-position readout](https://huggingface.co/rasbt/ai-text-detector-qwen3-0.6b-fixed) - [Qwen3 0.6B with a variable-position readout](https://huggingface.co/rasbt/ai-text-detector-qwen3-0.6b-variable)   ## 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.