Downloads · 30 days
0
darkengross/qwen3-4b-detect
qwen3-4b-detect is a text classification model from darkengross. Use it when you need a label for a piece of text. It is set up for peft. The card lists the license as cc-by-nc-4.0.
Predicts a continuous score in [0, 1] for how much AI contributed to a document, rather than a binary AI/human verdict. A QLoRA fine-tune of Qwen3-4B with an 11-bin soft ordinal head: targets are Gaussian-smoothed ove…
Downloads · 30 days
0
Access
Public
Updated Aug 31, 2026
Repo size
144 MB
Likes
0
Public
Click a slice to open those files.
.safetensors132 MB · 92%
From the Hugging Face model README
Predicts a continuous score in [0, 1] for how much AI contributed to a document, rather than a binary AI/human verdict. A QLoRA fine-tune of Qwen3-4B with an 11-bin soft ordinal head: targets are Gaussian-smoothed over the bins, trained with KL divergence, and decoded by expected value.
| File | What it is |
|---|---|
lora_adapter/ | LoRA adapter (r=16, alpha=32) over Qwen3-4B, 4-bit NF4 base |
head.pt | The 11-bin scoring head plus backbone name and bin count |
tokenizer.json, etc. | Qwen3-4B tokenizer, as saved beside the checkpoint |
Pooling is last-token, not mean: under causal attention only the final position has seen the whole document.
Trained on 50k bin-stratified examples of giga-editlens, then evaluated out-of-domain on three sets it never saw.
| MAE | Spearman | |
|---|---|---|
| In-domain test | 0.0575 | 0.9592 |
| APT-Eval (AI-polished human text) | 0.1158 | 0.7986 |
| BEEMO (human-edited AI text) | 0.1977 | 0.7168 |
| CoAuthor (keystroke-level ground truth) | 0.1970 | 0.3907 |
For reference, a DeBERTa-v3-base encoder trained identically scores 0.9324 / 0.3059 / 0.5889 / 0.6029 on the same four. This model ranks better on every set, at ~5.5x the inference cost (~10 vs ~55 samples/s).
Read Spearman, not thresholded accuracy. Spearman is threshold- and calibration-free. Fixed Human/Mixed/AI cut points are misleading here because the predicted-score distribution sits differently on each domain.
Released for non-commercial research use (CC BY-NC 4.0). That reflects the training data's lineage rather than a preference:
ai_generated and ai_edited rows were produced by LLMs recorded in the
dataset's model column. If any generator's terms of service restrict
using its outputs to train competing models, that restriction flows through
to these weights.hf download Khushal2403/qwen3-4b-detect --local-dir ./qwen3-4b-detect
git clone https://github.com/darkengross/ai_detector && cd ai_detector/src
python eval/run_eval.py --arch decoder \
--checkpoint-dir ../../qwen3-4b-detect --batch-size 32
Scoring a single document:
import torch, sys; sys.path.insert(0, "ai_detector/src")
from common.checkpoints import load_model
from common.binning import bin_centers
from common.loop import predict_scores
device = torch.device("cuda")
model, tok, k = load_model("decoder", "./qwen3-4b-detect", device)
scores, _ = predict_scores(model, [my_text], tok, bin_centers(k, device=device), device)
print(f"AI contribution: {scores[0]:.3f}")