AI text detector (ONNX, browser ready)
A browser-ready ONNX conversion of desklib/ai-text-detector-v1.01, a DeBERTa-v3-large model that classifies English text as human-written or AI-generated.
What changed from the original
- Exported to ONNX (opset 17), including the mean pooling and the single-logit classifier, so the graph takes
input_idsandattention_mask(int64, shape[batch, sequence]) and returnslogits(shape[batch, 1]). Apply a sigmoid to get the probability that the text is AI-generated. - Matrix multiply weights stored as 8-bit (weight-only, block size 32), word embeddings stored as 8-bit, and precomputed relative position projections stored as 16-bit. Activations stay in 32-bit float. Size went from 1.74 GB to 524 MB.
tokenizer.jsonandtokenizer_config.jsonare the original files from the source repository.- The model is split into
model.onnx.part1andmodel.onnx.part2so each file stays small enough to share easily. Join them in order to getmodel.onnx(SHA-25618486ab6ecc62e67c2fb98b1f03928a2bbf68e5d553d7259e3c39e8c0d831b9d). The AI Detector website does this in the browser automatically.
Accuracy check
Compared against the original PyTorch model on 24 texts from 10 to 768 tokens, the largest probability difference was 0.0087 (under 1 percentage point). Running in onnxruntime-web 1.30.0 (WebAssembly) in Chromium gave the same scores within 1 percentage point.
Dynamic 8-bit quantization of activations was tested and rejected: it raised scores on human-written text by up to 80 points.
Use
Truncate to 768 tokens, keeping the final [SEP] token (id 2). The original model card recommends a 0.5 threshold.
License
MIT, same as the original model. All credit for training goes to Desklib.
Model tree for anusreevjn/ai-detector-onnx
Base model
microsoft/deberta-v3-large Finetuned
desklib/ai-text-detector-v1.01