--- library_name: transformers.js base_model: batmac/gradient-ai-text-detector-onnx base_model_relation: quantized pipeline_tag: text-classification language: [en] license: mit tags: [onnx, webgpu, ai-generated-text-detection, deberta-v2] --- # Gradient AI-text detector, static 8x256 for WebGPU A browser-oriented build of [ShantanuT01/gradient-ai-text-detector](https://huggingface.co/ShantanuT01/gradient-ai-text-detector) (DeBERTa-v3-large, MIT), made from the 4-bit ONNX export [batmac/gradient-ai-text-detector-onnx](https://huggingface.co/batmac/gradient-ai-text-detector-onnx) at revision `776d0164ba0de631036c70f6a146d68a7cd4ea4e`. The weights are unchanged. Two graph changes make it fast on onnxruntime-web's WebGPU provider: 1. Each relative-attention `GatherElements(data, Expand(idx))` becomes an equivalent flat `Gather` with an `[L, L]` index, so no `[batch*heads, L, L]` int64 tensor is built each run. 2. The input shape is fixed at **batch 8 x 256 tokens** and all shape arithmetic is constant-folded, so nothing round-trips GPU -> CPU mid-run. In Firefox this takes a full batch from ~5.3 s to ~3.5 s, about 0.44 s per passage. ## Usage Inputs must be exactly `input_ids` and `attention_mask` of shape `[8, 256]` (int64). Right-pad with token 0 and mask 0. Output `logits` is `[8, 1]`; apply a sigmoid yourself. The score is the raw classifier output, not a calibrated probability. Built by `scripts/build-model.sh` in the Deckard (in-browser) Firefox extension. Not endorsed by the model authors or Microsoft. Do not use as the sole basis for high-stakes decisions.