rasbt / ai-text-detector-distilbert-lora

huggingface.co
Total runs: 17
24-hour runs: 4
7-day runs: 8
30-day runs: 9
Model's Last Updated: August 12 2026
text-classification

Introduction of ai-text-detector-distilbert-lora

Model Details of ai-text-detector-distilbert-lora

LoRA-Tuned DistilBERT AI-Text Detector

This repository contains a LoRA adapter for classifying human-written and AI-generated text with DistilBERT. It was trained on rasbt/human-vs-ai-50k . Human-written text has label 0 and AI-generated text has label 1.

The adapter uses rank 8 and targets the query and value projection layers. It uses a maximum sequence length of 512 tokens and temperature scaling during inference. The recorded best validation accuracy was 99.65%.

Download and use
hf download rasbt/ai-text-detector-distilbert-lora \
  --local-dir models/ai-text-detector-distilbert-lora
import json
from pathlib import Path

import torch
from peft import AutoPeftModelForSequenceClassification
from transformers import AutoTokenizer


model_dir = Path("models/ai-text-detector-distilbert-lora")
metadata = json.loads(
    (model_dir / "detector-config.json").read_text(encoding="utf-8")
)
tokenizer = AutoTokenizer.from_pretrained(model_dir)
model = AutoPeftModelForSequenceClassification.from_pretrained(model_dir)
model.eval()

text = "Paste the text to classify here."
inputs = tokenizer(
    text,
    truncation=True,
    max_length=metadata["max_length"],
    return_tensors="pt",
)

with torch.inference_mode():
    logits = model(**inputs).logits / metadata["temperature"]
    probabilities = logits.float().softmax(dim=-1)

ai_index = metadata["label_mapping"]["ai"]
ai_probability = probabilities[0, ai_index].item()
print({"score": round(100 * ai_probability, 4)})

Test-set confusion matrix

LoRA-tuned DistilBERT test-set confusion matrix

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

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.

Runs of rasbt ai-text-detector-distilbert-lora on huggingface.co

17
Total runs
4
24-hour runs
5
3-day runs
8
7-day runs
9
30-day runs

More Information About ai-text-detector-distilbert-lora huggingface.co Model

More ai-text-detector-distilbert-lora license Visit here:

https://choosealicense.com/licenses/apache-2.0

ai-text-detector-distilbert-lora huggingface.co

ai-text-detector-distilbert-lora huggingface.co is an AI model on huggingface.co that provides ai-text-detector-distilbert-lora's model effect (), which can be used instantly with this rasbt ai-text-detector-distilbert-lora model. huggingface.co supports a free trial of the ai-text-detector-distilbert-lora model, and also provides paid use of the ai-text-detector-distilbert-lora. Support call ai-text-detector-distilbert-lora model through api, including Node.js, Python, http.

ai-text-detector-distilbert-lora huggingface.co Url

https://huggingface.co/rasbt/ai-text-detector-distilbert-lora

rasbt ai-text-detector-distilbert-lora online free

ai-text-detector-distilbert-lora huggingface.co is an online trial and call api platform, which integrates ai-text-detector-distilbert-lora's modeling effects, including api services, and provides a free online trial of ai-text-detector-distilbert-lora, you can try ai-text-detector-distilbert-lora online for free by clicking the link below.

rasbt ai-text-detector-distilbert-lora online free url in huggingface.co:

https://huggingface.co/rasbt/ai-text-detector-distilbert-lora

ai-text-detector-distilbert-lora install

ai-text-detector-distilbert-lora is an open source model from GitHub that offers a free installation service, and any user can find ai-text-detector-distilbert-lora on GitHub to install. At the same time, huggingface.co provides the effect of ai-text-detector-distilbert-lora install, users can directly use ai-text-detector-distilbert-lora installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

ai-text-detector-distilbert-lora install url in huggingface.co:

https://huggingface.co/rasbt/ai-text-detector-distilbert-lora

Url of ai-text-detector-distilbert-lora

ai-text-detector-distilbert-lora huggingface.co Url

Provider of ai-text-detector-distilbert-lora huggingface.co

rasbt
ORGANIZATIONS

Other API from rasbt