EditLens RoBERTa Model Kit

Community conversions of Pangram's 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.

This 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.

License: CC 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, NOTICE, and preserved original model card. Commercial-use rights must be obtained separately from the relevant rights holder. This model kit adds no research-only restriction beyond the original license.

Provenance

The 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. SHA256SUMS covers the published files except itself.

The 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.

Available artifacts

Artifact File Size (decimal MB) Intended use
Original PyTorch FP32 model.safetensors 1,421.5 Unchanged source checkpoint; full-precision PyTorch/MPS/CUDA use
ONNX FP32 — default onnx/model.onnx 1,421.9 Full-precision baseline
ONNX FP16 — optional onnx/model_fp16.onnx 711.3 Smaller floating-point artifact; test on your accelerator
ONNX INT8 — experimental onnx/model_int8.onnx 514.3 Smaller CPU candidate; failed numerical parity gate

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.

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.

FP16 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.

What was validated

ONNX variant Maximum absolute probability difference Matching top classes Numerical gate
FP32 0.00000402 24/24 Passed
FP16 0.00267339 24/24 Passed
INT8 0.12102217 23/24 Failed — experimental only

These 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/.

The 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.

All 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.

The 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.

Choosing a runtime

Scenario Starting point Qualification
CPU FP32 ONNX Baseline; verify an ONNX Runtime build exists for your OS and architecture.
Apple Silicon / PyTorch MPS Original FP32 checkpoint Select mps explicitly; this conversion release's numerical reference was measured on CPU.
NVIDIA GPU FP32 ONNX with CUDA, or original PyTorch FP32 Requires compatible GPU runtime/driver; not tested here.
GPU memory or bandwidth constraints Optional FP16 ONNX Validate provider support and output differences on the deployment device.
CPU download/memory constraints Optional experimental INT8 Read its numerical report; do not assume unchanged decisions.
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.

An 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 and your selected runtime's release notes.

Download only the selected variant

Use 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.

from huggingface_hub import snapshot_download

MODEL_KIT_REVISION = "<commit SHA from this repository>"
snapshot_download(
    repo_id="CoderBak/editlens_roberta_modelkit",
    revision=MODEL_KIT_REVISION,
    local_dir="editlens-modelkit",
    allow_patterns=[
        "config.json", "tokenizer.json", "tokenizer_config.json",
        "special_tokens_map.json", "vocab.json", "merges.txt",
        "onnx/model.onnx",  # FP32 default; select another explicit file if needed
        "examples/onnx_inference.py", "requirements-runtime.txt",
        "LICENSE", "NOTICE", "README.md", "manifest.json", "SHA256SUMS",
    ],
)

No 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.

Local ONNX inference

The 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.

python -m pip install -r editlens-modelkit/requirements-runtime.txt
python editlens-modelkit/examples/onnx_inference.py \
  --model-dir editlens-modelkit --variant fp32 --provider cpu \
  "The text to classify goes here."

The 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.

The 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.

Original PyTorch checkpoint

The repository root remains compatible with AutoModelForSequenceClassification and AutoTokenizer:

import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer

repo = "CoderBak/editlens_roberta_modelkit"
revision = "<commit SHA from this repository>"
tokenizer = AutoTokenizer.from_pretrained(repo, revision=revision)
model = AutoModelForSequenceClassification.from_pretrained(
    repo, revision=revision, dtype=torch.float32,
    attn_implementation="eager",
).eval()
# Select a supported device explicitly if desired: model.to("mps") or model.to("cuda").

Reproduce the conversions

The 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.

python -m pip install -r requirements-build.txt
python scripts/build.py export --source .
python scripts/build.py fp16 --source .
python scripts/build.py int8 --source .
python scripts/build.py reference --source .
python scripts/validate.py fp32
python scripts/validate.py fp16
python scripts/validate.py int8

The 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.

Export 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.

Limitations and responsible interpretation

The 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.

Please cite the original EditLens work using CITATION.bib, retain Pangram's attribution and license, and separately identify any further changes you make.

Downloads last month
8
Safetensors
Model size
0.4B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for CoderBak/editlens_roberta_modelkit

Quantized
(2)
this model

Dataset used to train CoderBak/editlens_roberta_modelkit

Paper for CoderBak/editlens_roberta_modelkit