TL;DR
LLM text watermarks must survive two opposing threats: erasure (rewriting text to scrub the mark) and forgery (stealing the mark to plant it on fake text). When an attacker simply reads the published design of existing watermarks and picks whichever attack exploits its obvious weak spot, every current method fails. This paper introduces KeyedLex, a watermark keyed on the grammar of the previous sentence rather than specific words, achieving the best worst-case defense without degrading text quality.
What Problem Does This Paper Address?
As LLM outputs become indistinguishable from human writing, providers like Google, Anthropic, and OpenAI embed invisible statistical signals—watermarks—into generated text. Typically, before picking the next token, a secret key divides the model's vocabulary into a "green list" and a "red list," nudging the model slightly toward green tokens. Later, a detector counts green tokens to verify provenance.
However, a fundamental security rule—Kerckhoffs’s principle—states that a system must remain secure even if everything about its design is public except the secret key. In watermarking, how the system selects its green list creates a brutal tug-of-war:
- If the green list changes based on the last few tokens (like Google's SynthID), the context rarely repeats, making it nearly impossible for an attacker to count words and forge the mark. However, a simple paraphrase changes those tokens, desynchronizes the key, and erases the mark.
- If the green list is fixed or changes slowly (e.g., based on overall meaning), it survives paraphrasing. Yet an attacker can observe watermarked outputs, deduce the recurring green words, and forge the watermark onto harmful text the model never wrote.
Prior evaluations tested erasure and forgery in isolation, giving a false sense of security. If an attacker reads the paper describing a watermark, they won't bother trying to forge SynthID—they’ll just paraphrase it. Judged by their weaker axis, existing schemes break down.
Methods
The authors introduce KeyedLex, a standard green-list watermark during token generation, but with two novel twists in how lists are chosen and detected:
- Sentence-Level Grammatical Keys: Instead of hashing previous words, KeyedLex runs a fast part-of-speech tagger (spaCy) on a finished sentence to build a "grammatical profile"—the standardized proportion of nouns, verbs, determiners, etc. Using $k$-means clustering on public natural text, the space of grammatical profiles is divided into $k=4$ public "cells," each tied to one secret green list. All tokens in sentence $i$ are generated using the green list dictated by the grammar of sentence $i-1$.
- Key-Agnostic Detection: Standard detectors recompute the exact key from the text—so if an edit alters the context, detection fails. KeyedLex’s detector instead tests each sentence against all four secret lists using a log-likelihood ratio, using the previous sentence's grammar only as a soft weighting hint. It also trims the bottom 40% lowest-scoring sentences to ignore heavily edited parts without raising false positives.
Alongside KeyedLex, the authors introduce an adaptive evaluation framework that explicitly attacks each watermark through its disclosed context (e.g., word counting per context for forgery; paraphrasing or stripping punctuation for erasure) and scores each method strictly by whichever attack hurts it worse.
Datasets
- Fitting data: 20 documents from C4 (disjoint from evaluation prompts) are used once to fit the public $k$-means grammatical cells.
- Evaluation data: Prompts are drawn from C4-RealNewsLike and BookSum (used as a second domain), tested across two open-weight generators: OPT-1.3B and Mistral-7B. No new datasets are introduced.
Key Insights and Ideas
- One design choice per attack: Clean ablations reveal why KeyedLex holds together. Changing keys once per sentence prevents attackers from aligning token-by-token observations to count green words. Testing every list at detection stops edits from blinding the detector. Reading the key from grammar rather than words stops "key-averaging" attacks, because paraphrasing swaps out words almost every time, whereas grammatical structure shifts much less often.
- Separating public structure from secret content: Even when an attacker is handed the exact sentence-grouping algorithm, forgery rates barely budge (staying around 33%). Knowing when the list changes doesn't tell the attacker which words are inside each list.
- Punctuation is the Achilles' heel of sentence watermarks: Because sentence-keyed schemes rely on sentence boundaries, simply deleting all punctuation completely erases semantic sentence watermarks like SemStamp (100% signal lost) and turns out to be one of the strongest attacks against KeyedLex.
Key Results
Evaluated by their weaker axis (lower failure rate is better, representing either maximum signal erased or maximum forgery acceptance at a 5% false-positive rate):
- Every baseline fails on one axis: On OPT-1.3B, token-hashed methods resist forgery ($\le 9\%$) but collapse under erasure (66% erased for SynthID, 91% for DiPmark, 93% for KGW-4). Conversely, paraphrase-resilient methods get forged almost every time (100% for Unigram, 94% for KGW-1, 87% for SIR).
- KeyedLex wins on the weaker axis: KeyedLex achieves a worst-case score of 0.53 (53% erased, 33% forged) on OPT-1.3B and 0.60 (60% erased, 56% forged) on Mistral-7B—outperforming the next-best alternative (SynthID at 0.66 and 0.68, respectively).
- Quality and Speed: KeyedLex raises text perplexity ($\Delta\text{PPL}$ of 4.09) less than KGW-4 (4.93), Unigram (4.59), and SynthID (15.12). Tagging sentences slows generation by just 7%, compared to 24% for SynthID and 300% for SIR, while detection takes 18 ms per 200-token text.
Limitations and Future Work
- Scope of models and languages: Experiments are restricted to English text on two models (OPT-1.3B and Mistral-7B), and evaluate the open-source release of SynthID since Anthropic's and OpenAI's deployed schemes are proprietary.
- Punctuation reliance: Because stripping punctuation degrades KeyedLex's signal by roughly half, the authors highlight segmenting sentences without relying on punctuation—alongside extending grammatical profiling to non-English languages—as immediate next steps.
Summary updated