Team Ai
Modelpublic

CoderBak/editlens_roberta_modelkit

sourceHugging Facecc-by-nc-sa-4.0updated 20d agoView on Hugging Face
0likes267downloads
README.md167 linesDownload Raw Back to root
1---2license: cc-by-nc-sa-4.03language:4- en5base_model: pangram/editlens_roberta-large6datasets:7- pangram/editlens_iclr8library_name: transformers9pipeline_tag: text-classification10tags:11- roberta12- onnx13- editlens14- ai-detection15- quantization16- local-inference17inference: false18---19 20# EditLens RoBERTa Model Kit21 22**Community conversions of [Pangram's EditLens RoBERTa-large](https://huggingface.co/pangram/editlens_roberta-large), maintained by CoderBak. The original model and research are the work of Pangram and Katherine Thai, Bradley Emi, Elyas Masrour, and Mohit Iyyer.**23 24This repository packages their existing classifier for local inference. CoderBak performed format conversion, optional precision reduction, packaging, and numerical checks. **No new model was trained, and no improvement in detection accuracy is claimed.** This repository is not affiliated with or endorsed by Pangram or the research authors.25 26**License: [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/). Noncommercial use only under this license.** Public, ungated downloads do not waive attribution, noncommercial, share-alike, or any other applicable license terms. See the complete [LICENSE](LICENSE), [NOTICE](NOTICE), and preserved [original model card](upstream/README.md). Commercial-use rights must be obtained separately from the relevant rights holder. This model kit adds no research-only restriction beyond the original license.27 28## Provenance29 30- Original checkpoint: [`pangram/editlens_roberta-large`](https://huggingface.co/pangram/editlens_roberta-large).31- Pinned upstream commit: [`f93e1ace74528cfb48f337ab2fe946fb71a728cb`](https://huggingface.co/pangram/editlens_roberta-large/tree/f93e1ace74528cfb48f337ab2fe946fb71a728cb).32- Original weight SHA-256: `869f33df7928c447bbd150d3b5192b4ea90b1cbd2ee4aad97f5d51d59dfc8cfb`.33- Paper: [EditLens: Quantifying the Extent of AI Editing in Text](https://arxiv.org/abs/2510.03154), Thai et al., ICLR 2026.34- Research code: [pangramlabs/EditLens](https://github.com/pangramlabs/EditLens).35- Earlier base-model lineage: [FacebookAI/roberta-large](https://huggingface.co/FacebookAI/roberta-large).36- Training-dataset lineage, as declared upstream: [pangram/editlens_iclr](https://huggingface.co/datasets/pangram/editlens_iclr). No training or calibration dataset was used to produce these conversions.37 38The root `model.safetensors`, configuration, and tokenizer files are byte-for-byte copies of the pinned upstream files. Their hashes, build versions, ONNX graph information, and variant status are recorded in [manifest.json](manifest.json). [SHA256SUMS](SHA256SUMS) covers the published files except itself.39 40The upstream repository remains separately gated. Its archived access-form metadata in `upstream/README.md` documents the source; it does not impose an account gate on this repository or grant access to the upstream repository.41 42## Available artifacts43 44| Artifact | File | Size (decimal MB) | Intended use |45| --- | --- | ---: | --- |46| Original PyTorch FP32 | [`model.safetensors`](model.safetensors) | 1,421.5 | Unchanged source checkpoint; full-precision PyTorch/MPS/CUDA use |47| ONNX FP32 — default | [`onnx/model.onnx`](onnx/model.onnx) | 1,421.9 | Full-precision baseline |48| ONNX FP16 — optional | [`onnx/model_fp16.onnx`](onnx/model_fp16.onnx) | 711.3 | Smaller floating-point artifact; test on your accelerator |49| ONNX INT8 — experimental | [`onnx/model_int8.onnx`](onnx/model_int8.onnx) | 514.3 | Smaller CPU candidate; failed numerical parity gate |50 51**FP32 is the recommended default.** Device selection and precision selection are separate decisions. FP16 and INT8 are optional deployment profiles, not automatic replacements for FP32.52 53**INT8 is experimental and failed this release's numerical parity gate.** It changed the top class for 1 of 24 fixtures and moved one class probability by approximately 0.121 (12.1 percentage points). The changed prediction occurred on a repetitive-token stress input. This does not establish the error rate on real writing. The artifact is provided for explicit evaluation, must not be automatically selected by an installer, and should not replace FP32 without application-specific evaluation. Its failed result is retained in `validation/int8.json`.54 55FP16 retains integer inputs and FP32 output logits; the converter preserves unsupported operations using casts. INT8 dynamically quantizes constant-weight MatMul operations per channel and leaves embeddings and other unquantized operations in FP32. Neither option changes the number of layers, the four output classes, or the maximum sequence length.56 57## What was validated58 59| ONNX variant | Maximum absolute probability difference | Matching top classes | Numerical gate |60| --- | ---: | ---: | --- |61| FP32 | 0.00000402 | 24/24 | Passed |62| FP16 | 0.00267339 | 24/24 | Passed |63| INT8 | 0.12102217 | 23/24 | **Failed — experimental only** |64 65These are **24 synthetic, unlabeled examples across 12 cases**, including empty/minimal inputs, Unicode, formatting, mixed padding, repetition, and long inputs capped at 512 tokens. Edge cases such as empty input and non-English text are conversion stress tests, not recommended detector inputs. The fixtures, exact input tensors, PyTorch FP32 reference logits, and per-case measurements are in [validation/](validation/).66 67The acceptance thresholds were set before measuring the variants: maximum absolute class-probability differences of `0.0001` for FP32, `0.01` for FP16, and `0.05` for INT8, with zero class changes on this fixture set. These are engineering smoke-test thresholds, not calibrated detection-quality standards. A passed check establishes neither real-world accuracy nor equivalence on unseen inputs. A failed check remains recorded and must not be interpreted as a passed release gate.68 69All ONNX numerical checks used **ONNX Runtime CPU on macOS arm64**, with four intra-op threads. This release does **not** claim tested CUDA, CoreML, DirectML, Windows ML, Windows, or Linux performance. The timing fields are single-run diagnostics and must not be treated as a speed ranking. FP16 graph storage does not prove every underlying CPU operation executes in native half precision.70 71The lightweight inference example's tokenizer IDs and attention masks were checked against the Transformers tokenizer for every fixture. No model-specific preprocessing, emoji replacement, language gate, paragraph grouping, window aggregation, or new score calibration is bundled into the ONNX graphs. Applications must implement and evaluate their own preprocessing consistently.72 73## Choosing a runtime74 75| Scenario | Starting point | Qualification |76| --- | --- | --- |77| CPU | FP32 ONNX | Baseline; verify an ONNX Runtime build exists for your OS and architecture. |78| Apple Silicon / PyTorch MPS | Original FP32 checkpoint | Select `mps` explicitly; this conversion release's numerical reference was measured on CPU. |79| NVIDIA GPU | FP32 ONNX with CUDA, or original PyTorch FP32 | Requires compatible GPU runtime/driver; not tested here. |80| GPU memory or bandwidth constraints | Optional FP16 ONNX | Validate provider support and output differences on the deployment device. |81| CPU download/memory constraints | Optional experimental INT8 | Read its numerical report; do not assume unchanged decisions. |82| Intel Mac | FP32 with an explicitly supported runtime build | Newer ORT releases do not provide Intel-Mac binaries; this release does not supply a legacy runtime. |83 84An ONNX file is a model artifact, not a universal installer. Runtime availability, supported operators, quantized kernels, and acceleration vary by platform. In particular, an INT8 CPU graph should not be assumed to run efficiently through a GPU provider. Read the [ORT provider documentation](https://onnxruntime.ai/docs/execution-providers/) and your selected runtime's release notes.85 86## Download only the selected variant87 88Use an immutable commit revision in a production installer. The example below requires the caller to supply one from this repository's commit history; it does not download all variants.89 90```python91from huggingface_hub import snapshot_download92 93MODEL_KIT_REVISION = "<commit SHA from this repository>"94snapshot_download(95    repo_id="CoderBak/editlens_roberta_modelkit",96    revision=MODEL_KIT_REVISION,97    local_dir="editlens-modelkit",98    allow_patterns=[99        "config.json", "tokenizer.json", "tokenizer_config.json",100        "special_tokens_map.json", "vocab.json", "merges.txt",101        "onnx/model.onnx",  # FP32 default; select another explicit file if needed102        "examples/onnx_inference.py", "requirements-runtime.txt",103        "LICENSE", "NOTICE", "README.md", "manifest.json", "SHA256SUMS",104    ],105)106```107 108No HF token is needed for this public repository. Check downloaded files against the checksums associated with the pinned revision. Preserve `LICENSE` and `NOTICE` in redistributed bundles.109 110## Local ONNX inference111 112The example needs ONNX Runtime, NumPy, and the Hugging Face `tokenizers` package; it does not need PyTorch. `requirements-runtime.txt` records the tested versions, whose platform availability must be checked before installation.113 114```sh115python -m pip install -r editlens-modelkit/requirements-runtime.txt116python editlens-modelkit/examples/onnx_inference.py \117  --model-dir editlens-modelkit --variant fp32 --provider cpu \118  "The text to classify goes here."119```120 121The ONNX inputs are `input_ids` and `attention_mask`, both int64 with shape `[batch, sequence]`. Output `logits` has shape `[batch, 4]`. Batch and sequence axes are dynamic. The supported input length is **2–512 tokens including special tokens**; pad and truncate using the supplied tokenizer. The example truncates overlong inputs; applications analyzing entire documents must implement and disclose their own windowing policy.122 123The original generic label names and their order (`LABEL_0` through `LABEL_3`) are preserved. The example returns softmax class probabilities. They are **not a percentage of AI-written words**, and conversion supplies no new probability calibration. Consult the original research for interpretation.124 125## Original PyTorch checkpoint126 127The repository root remains compatible with `AutoModelForSequenceClassification` and `AutoTokenizer`:128 129```python130import torch131from transformers import AutoModelForSequenceClassification, AutoTokenizer132 133repo = "CoderBak/editlens_roberta_modelkit"134revision = "<commit SHA from this repository>"135tokenizer = AutoTokenizer.from_pretrained(repo, revision=revision)136model = AutoModelForSequenceClassification.from_pretrained(137    repo, revision=revision, dtype=torch.float32,138    attn_implementation="eager",139).eval()140# Select a supported device explicitly if desired: model.to("mps") or model.to("cuda").141```142 143## Reproduce the conversions144 145The build was performed using Python 3.13 and the exact versions in `requirements-build.txt`. Export tooling has platform-specific availability. Obtain the original pinned checkpoint through your own authorized upstream access, or use the verified original checkpoint in this repository.146 147```sh148python -m pip install -r requirements-build.txt149python scripts/build.py export --source .150python scripts/build.py fp16 --source .151python scripts/build.py int8 --source .152python scripts/build.py reference --source .153python scripts/validate.py fp32154python scripts/validate.py fp16155python scripts/validate.py int8156```157 158The INT8 validation command currently exits nonzero, intentionally reporting the documented parity failure. The FP32 and FP16 commands pass. Do not suppress a failed check or treat this release's experimental designation as approval for an application's accuracy requirements.159 160Export uses the PyTorch TorchScript exporter (`dynamo=False`) with eager attention and ONNX opset 17. FP16 uses `onnxconverter-common` with `keep_io_types=True` and its documented default clipping/operator policy. INT8 uses ONNX Runtime dynamic QInt8 weights, per-channel quantization, full range, and constant-weight MatMul operations only. No provider-specific graph fusion or hardware compilation is distributed. Reproduction can differ with other tool versions; verify outputs and hashes before substituting artifacts.161 162## Limitations and responsible interpretation163 164The upstream model is English-focused. Detection can produce false positives and false negatives, particularly outside its training distribution. Model output is not proof of authorship or misconduct. These conversions do not establish reliability for short posts, non-English text, OCR errors, scientific writing, or any particular real-world domain. Applications should preserve uncertainty and evaluate the original model and their complete input pipeline on representative data.165 166Please cite the original EditLens work using [CITATION.bib](CITATION.bib), retain Pangram's attribution and license, and separately identify any further changes you make.167