Run this model with HF Jobs
Run Lukkinen/ai-text-detector on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Lukkinen/ai-text-detector. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Lukkinen/ai-text-detector on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Lukkinen/ai-text-detector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Lukkinen/ai-text-detector with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Lukkinen/ai-text-detector")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Lukkinen/ai-text-detector", device_map="auto") - Notebooks
- Google Colab
- Kaggle
ai-text-detector (weights)
These are the trained weights of github.com/lucadagati/ai-text-detector. It is a local detector of LLM-generated academic text that works per paragraph and per sentence.
The service is an OR ensemble of three DeBERTa-v3-base classifiers. Each one mean-pools the encoder and outputs a single logit, where higher means more machine-like:
| Folder | Training data |
|---|---|
deberta-base-v2/ |
4,960 human paragraphs and abstracts from pre-2020 arXiv papers; 4,718 AI paragraphs from Claude (Sonnet, Opus, Haiku), gpt-oss-20b, Mistral-Small-24B, Qwen2.5-14B, Gemma-3-12B, Llama-3.1-8B and Phi-4. The AI texts are written from scratch, written "to sound human", or are polish, revision and multi-pass rewrites of the human paragraphs. |
deberta-base-v3/ |
The same data, plus the training split of the RAID abstracts domain (11 generators, 11 adversarial attacks). |
deberta-base-rev2/ |
The same data and RAID, plus about 2,900 adversarial AI paragraphs (AI texts rewritten by Claude and five open-weight models in loops against the detector itself, two rounds) and three LLM-written manuscripts, original and after agent-driven revisions against the detector (307 paragraphs), plus 323 sentence-feedback rewrites. |
A paragraph is flagged when any model exceeds its own threshold at 0.33% false positives, so the ensemble stays at 1%
or less overall. model.json holds the thresholds, the sentence-window thresholds and the norms of the
sentence-structure profile used for explanations.
Results
All results are at about 1% false positives, on held-out papers (split by paper). The test includes every rewrite mode and the adversarial texts of held-out papers. Measured false positives: 0.6% body paragraphs, 0.2% abstracts, 0.6% RAID, and 0.2% on a control set of 838 paragraphs from 140 arXiv papers of 2021 (before ChatGPT, current topics, never trained on).
| Claude | open-weight LLMs | adversarial rewrites (2 rounds) | AI-polished human text | RAID | |
|---|---|---|---|---|---|
| this ensemble (v2 + v3 + rev) | 94% | 96% | 93% / 96% | 91% | 89% |
| previous ensemble (v2 + v3) | 83% | 94% | 80% / 84% | 92% | 85% |
| MAGE (best open detector on RAID) | 0.5% | 2% | 69% (clean) |
Document level: 1 of 90 human papers is flagged "mixed", none "likely AI".
Different optimizer. Rewrites by LLM loops with sentence-level feedback from the previous ensemble (up to 6 rounds, stop when labelled human), not used for training at that time: 323 paragraphs, 2 evaded (0.6%, 95% upper bound 2.2%). They are in the training data of the current model.
Agent revision of an unseen manuscript. Revised against the previous ensemble, AI paragraphs fell from 20 to 7 of ~70 and structural distance from 17.9 to 11.2; the previous model flagged only 21% of the revised paragraphs. The current model adds that manuscript to training, so no held-out manuscript remains.
Partially edited text. Hybrid paragraphs of held-out papers (sentences of an AI paragraph swapped for human sentences of the same paper): the share flagged follows the share of AI text, 99.5% with all sentences kept, 80% with 75% kept, 31% with 50% kept, 8% with 25% kept; a human paragraph with 25% of its sentences replaced by AI is flagged in 11% of cases. This is a simulation, not real hand editing.
Agent optimizer on unseen manuscripts. LLM agents revised five manuscripts the model never saw, paragraph by paragraph with this ensemble as the target (up to 5 rewrites each). For the three manuscripts that were mostly flagged at the start (175 paragraphs) the share of paragraphs labelled human was 9% before and 9% after; for two manuscripts that were already about 40% human it rose from 37% to 57%.
Detector-guided manuscript revisions. Two Claude-written manuscripts revised paragraph by paragraph against this
detector were invisible to the earlier models (0% and 2% of paragraphs flagged). Trained on one manuscript, a model flags
54-57% of the other one (before: 0-4%), so the effect generalizes across topics; the final model is trained on both, so
its numbers on those two manuscripts are not a held-out test. Full benchmark, protocol and limits: bench/RESULTS.md in
the GitHub repository.
Use
The service in the GitHub repository downloads these weights on first start. To load one model directly:
from huggingface_hub import snapshot_download
from aidet.classifier import load_classifier # from the GitHub repository
path = snapshot_download("Lukkinen/ai-text-detector", allow_patterns=["deberta-base-rev2/*"])
model, tok = load_classifier(f"{path}/deberta-base-rev2")
The classifier class (MeanPoolClassifier) is defined in aidet/classifier.py. It is not a stock
AutoModelForSequenceClassification head.
Limits
- Trained and validated on English computer-science and engineering academic text.
- A score measures resemblance to LLM text. It is not proof of authorship.
- Detector-guided rewriting is the main threat. Only two manuscripts, one author and one revision procedure define the "revised against a detector" class, so a different optimizer can land elsewhere. The GitHub service adds a document-level structural-distance signal for such text, but a "human" verdict is not proof of authorship.
- Isolated flagged paragraphs occur in about 8% of human papers.
Model tree for Lukkinen/ai-text-detector
Base model
microsoft/deberta-v3-base