reneeice/editlens-ood-selective-guard-qwen3
editlens-ood-selective-guard-qwen3 — reliability guard for EditLens
A reliability guard for AI-edit detection. An out-of-distribution gate that abstains on inputs unlike the training distribution (domain shift, unseen models, non-native English), so the edit-score is only trusted where it's reliable.
Usage
A reliability guard: download ood_guard.npz, score each input's distance to the training distribution, and abstain when it's too far (route to a human, or withhold a verdict).
import numpy as np, torch
from transformers import AutoTokenizer, AutoModel
g = np.load("ood_guard.npz"); center, inv = g["center"], g["inv_cov"]
tok = AutoTokenizer.from_pretrained("reneeice/editlens-qwen3-0.6b-repro")
enc = AutoModel.from_pretrained("reneeice/editlens-qwen3-0.6b-repro", torch_dtype=torch.bfloat16).eval()
def ood_distance(text):
t = tok(text.lower(), truncation=True, max_length=512, return_tensors="pt")
h = enc(**t).last_hidden_state.mean(1)[0].float().numpy()
d = h - center
return float(d @ inv @ d) # high = out-of-distribution -> abstainSet the abstain threshold from the coverage/accuracy table below.
Performance — selective prediction
Abstaining on the most out-of-distribution inputs raises accuracy on the rest:
The project behind this model
This model is one of a family of three, the end of a single research thread that started from a classic question — can you tell human text from machine text? — and ended at a more realistic one — how much did AI edit this text, and can we trust that judgement?
The journey, start to finish:
- Reproduce "Human Texts Are Outliers." We first reproduced the core claim of arXiv:2510.08602 (NeurIPS 2025): instead of training a binary human-vs-machine classifier, model machine text as the in-distribution and treat human text as out-of-distribution (OOD) — an anomaly to be detected by distance from a learned center (DeepSVDD). A minimal end-to-end run on the RAID dataset hit AUROC 0.94, matching the paper.
- Meet EditLens. Binary detection is the wrong frame for the common case: people lightly edit their own drafts with AI. EditLens (Thai et al., 2025) reframes detection as a continuous "extent of AI editing" score in [0,1], and the community `editlens-qwen3-*-repro` models bring it to a modern Qwen3 backbone.
- Apply the OOD idea to the edit-detection setting. The insight of this work: take the OOD framing from step 1 and apply it to the edit-detection problem of step 2, on Qwen3. We pursued three concrete ways to do that — and shipped all three as a family:
Why three? They trade off cost and integration: A is a standalone model, B is a cheap add-on to an existing EditLens deployment, and C wraps either with an abstain-on-uncertainty safety layer. Pick the one that matches how you deploy.
One thing we learned the hard way
Our first frozen-embedding run scored an AUROC of 0.32 — not random, but inverted. On the EditLens embedding space the geometry is the opposite of the original RAID setup: human/clean text is the compact in-distribution and heavily-AI-edited text is the outlier (its embeddings are organized around extent of editing, not authorship). We flipped the in-distribution definition, switched from full Mahalanobis to a shrinkage-regularized / Euclidean distance on frozen features, and added an auto-orientation step that fixes the score's sign on a held-out slice so a detector is never reported upside-down. That correction is baked into this family.
How it was made
- Frozen backbone:
reneeice/editlens-qwen3-0.6b-repro(no fine-tuning). - Guard: a DeepSVDD detector (center + whitening) fit on the training distribution; inputs far from it are flagged out-of-distribution and abstained.
- Cost: one embedding pass + a closed-form fit.
License
Apache-2.0. Built on Qwen/Qwen3-*-Base. The supervision labels derive from the gated `pangram/editlens_iclr` dataset; please honor its terms. Method credit: Human Texts Are Outliers (2510.08602) and EditLens (2510.03154).
