Self-hosting an AI-text detector for LinkedIn
Anyone else a bit overwhelmed by obvious AI-bait posts being recommended by LinkedIn?
I tried to address this by self-hosting a free, open-source AI text detector (Pangram's RoBERTa) on my local machine and then using a Chrome extension that flags AI-sounding posts in your feed, so you can also mark them as "AI slop" on LinkedIn in one click.
Of course, the detector won't be state of the art (like Pangram Labs) and is limited, but I'm okay with a few false positives and false negatives either way, at frankly zero cost.
Sharing the write-up and code/Chrome plugin in case anyone finds it useful. You could also build your own by screenshotting this post and asking Opus 5.5 to build it (or copy the prompt here directly).
PS: I understand the irony of using AI to build something that detects AI text, but AI-generated text is, in my opinion, one of the least optimal ways to use AI.
Build me a Chrome extension that flags AI-sounding posts on LinkedIn and X, with the AI-text model running inside Chrome (no server). 1. Model: pangram/editlens_roberta-large on Hugging Face (gated: accept the terms; CC BY-NC-SA 4.0, personal use only). Export it to ONNX and quantize to int8 (onnxruntime dynamic quantization, about 360 MB). 2. In the extension (Manifest V3): run the model with onnxruntime-web (WASM) in an offscreen document. Enable cross-origin isolation in the manifest so WASM can use threads, and allow 'wasm-unsafe-eval'. Port the RoBERTa byte-level BPE tokenizer to JS and check its token IDs against the Python tokenizer. Lowercase and collapse whitespace like the EditLens preprocessing; split long text into 512-token chunks. Score = expected class of the model's 4 classes divided by 3. Verdicts: under 0.05 likely human, 0.05 to 0.30 can't tell, 0.30 and up likely AI, under 40 words too short. 3. Content script: find posts (LinkedIn [role="listitem"][componentkey] with text in [data-testid="expandable-text-box"]; X article[data-testid="tweet"] with [data-testid="tweetText"]), score only posts on screen through the background worker, cache by text, and show a small badge above each post (a red "AI 87" pill for likely AI). Add a button that opens the post's ... menu and clicks LinkedIn's "Seems like AI slop" or X's "Not interested in this post". 4. Before trusting it, test it on a few posts you know are human and a few you know are AI. Reference code: https://github.com/vibedatascience/local-ai-text-detector



Self-hosting
# 1. download aicheck.zip (254 MB, model included) and unzip it # 2. chrome://extensions > turn on Developer mode > Load unpacked > pick the unzipped folder # 3. open LinkedIn or X. First post takes a few seconds while the model loads.
Self-hosted vs Pangram's best model
| Test set | False positives human flagged as AI | False negatives AI not caught | ||
|---|---|---|---|---|
| Pangram 3.2 | Self-hosted | Pangram 3.2 | Self-hosted | |
| Pangram test set (2,038 human / 2,046 AI) | 0.0% | 0.2% | 0.0% | 0.3% |
| Enron emails, unseen domain (1,992 / 1,847) | 0.1% | 0.1% | 0.1% | 6.8% |
| Llama 3.3 70B, unseen model (2,038 / 2,038) | 0.0% | 0.2% | 0.0% | 2.5% |
| Human Detectors, Russell 2024 (150 / 150) | 0.0% | 2.0% | 0.0% | 6.0% |
| RAID 10k sample, Dugan 2024 (2,058 / 7,942) | 0.2% | 0.7% | 0.7% | 28.8% |
| Non-native English essays (91 human) | 0.0% | 9.9% | ||
| My test: current Claude text (200 human / 44 AI) | 0.5% | 36% | ||