# Watermark rewrite test What happens to a text watermark when a passage is rewritten by ClaudeRewrite, measured with open detectors. This is a vendor's test: we make the tool being tested. Everything needed to rerun it is in this folder. ## What it does and does not show Anthropic's detector for Claude's text watermark is not public, so nobody outside its approved list can test a passage against it. This test uses two open watermarks instead, with keys we made up: - **SynthID-Text**, the technique Google DeepMind published. Anthropic says its watermark uses the technique Google DeepMind introduced. - **KGW**, the "green list" scheme of Kirchenbauer et al. Both are the implementations that ship with Hugging Face `transformers`. The results show how rewriting affects watermarks of this kind on a small open model. They do not show what Anthropic's detector, which uses different keys, settings and a different model, would say about any text. ## Steps 1. `prompts.json`: 40 everyday writing prompts (client emails, product descriptions, policy summaries, explainers). 2. `generate.py`: a small open model (`Qwen/Qwen2.5-0.5B-Instruct`) answers each prompt three times: unmarked, SynthID-Text, KGW. Output: `results/generated.jsonl`. 3. `rewrite.mjs`: every passage goes through a ClaudeRewrite engine. `current` is `src/lib/rewrite.ts`. `previous` is the same file at commit `a34fda1`, which was live until November 27, 2026. 4. `make_partial.py`: builds the "part left untouched" conditions. The opening 20%, 40% or 60% of each marked passage is kept exactly as it was and only the rest is rewritten. 5. `detect.py`: scores every passage with both detectors. SynthID-Text uses the mean-score detector from the paper, turned into a z-value. KGW uses the library's z-score. 6. `summarize.py`: writes `results/summary.json`, which the article reads. A passage counts as detected when its z-value is above 2.326, the one-sided 1% false-positive level for a standard normal score. The unmarked passages are scored too, so you can see how often the detectors fire on text with no watermark. ## Run it ```bash python -m venv .venv && .venv/bin/pip install torch transformers accelerate .venv/bin/python generate.py prompts.json results/generated.jsonl # from the repository root, with OPENROUTER_API_KEY set npx tsx research/watermark-test/rewrite.mjs research/watermark-test/results/generated.jsonl research/watermark-test/results/rewritten-current.jsonl src/lib/rewrite.ts current .venv/bin/python make_partial.py results/generated.jsonl results/partial-input-40.jsonl 0.4 # rewrite.mjs again with the partial file and the label keep40, then: .venv/bin/python detect.py results/scores.jsonl results/generated.jsonl results/rewritten-*.jsonl .venv/bin/python summarize.py results ``` Run `detect.py` on the same kind of device that generated the text. The libraries build their random tables with a device-specific generator, so text generated on an Apple GPU scores as unmarked when checked on a CPU. ## Results of the November 27, 2026 run Passages detected, out of 40 per watermark: | Condition | 5-word sequences copied (median) | SynthID-Text | KGW | | --- | --- | --- | --- | | Before any rewrite | 100% | 39 | 39 | | Previous engine | 6% | 1 | 16 | | Current engine | 2% | 0 | 7 | | About 20% left untouched | 24% | 4 | 19 | | About 40% left untouched | 43% | 19 | 33 | | About 60% left untouched | 61% | 37 | 39 | On the 40 unmarked passages the SynthID-Text detector flagged none, before or after rewriting. The KGW detector flagged none before and 2 after rewriting by the current engine. ## Limits - Open watermarks, our own keys, a 0.5-billion-parameter model. Not Claude. - Passages of about 270 words. Longer text gives a detector more to work with. - The simple mean-score detector for SynthID-Text. The paper's trained detector is stronger. - 40 passages per watermark, English, business topics. - The passages were drafted by a small model, and both engines rewrote them more heavily than they rewrite polished text. On two polished passages written by Claude, the previous engine left 39% and 44% of 5-word sequences in place. The "part left untouched" conditions are there to show what a rewrite that light does to detection.