Watermark stealing in large language modelsWatermark Stealing in Large Language Models
The authors propose the watermark stealing attack: querying the API of a watermarked LLM reverse-engineers the watermark rule, and the authors claim that at a cost below 50 USD it achieves over 80% spoofing and scrubbing success rates against schemes such as KGW2-SelfHash.
The attacker has only blackbox access to the model owner's watermarked model LMmo (only obtaining the complete generated text), knows all parameters of the watermark scheme but not the key ξ, and can use an auxiliary model LMatt; detector access is split into No access (D0) and API access (D1), and base response is split into Unavailable (B0) and Available (B1); the main experiments adopt the strictest (D0, B0).
- LLM text watermarking is considered usable for identifying AI-generated content and is approaching deployment. The authors argue that the robustness of existing schemes against adversarial attacks is overestimated, and propose watermark stealing as a fundamental threat: querying a watermarked API is enough to reverse-engineer the watermark rule.
- The attacker queries the watermarked model with C4 prompts, computes the ratio of token conditional probabilities under the watermarked and base distributions, and constructs a scoring function s* that estimates each token's confidence of belonging to the green list; then, when the auxiliary model generates text, it adjusts the logits according to s*, with a positive shift achieving spoofing and a negative shift enhancing the paraphraser to achieve scrubbing.
- The authors report: the spoofing success rate against KGW2-SelfHash exceeds 80% (MISTRAL-7B as the attack model, FPR*@1e-3); for scrubbing, DIPPER is raised from about 0 to an average above 80%, while baselines are all below 25%; the theft cost is about 42 USD (n=30,000 queries).
- The authors note: the top-1 self-selection heuristic without detector access performs inconsistently; multi-key defenses have no mature instances yet, and the attack still has a 73% success rate at k=4; the experiments cover only distribution-modifying watermarks, and no attack experiments were conducted on sampling-modification schemes.
- Evaluated models
- LLAMA-7BLLAMA-13BMISTRAL-7BLLAMA2-7B
- Benchmarks
- C4 RealNewsLikeDolly-CWHarmfulQ+AdvBenchMMW BookReportsMMW FakeNewsReddit WritingPrompts
- Metrics
- FPR*@fFNR*@fmedian p-valuePPLGPT4 scoreP-SP
ETH Zurich researchers propose a watermark stealing attack against LLM watermarks, using about 30,000 API queries to reverse-engineer and approximate the watermark rule, at a one-time cost of less than 50 US dollars; the authors state this is the first automated watermark stealing algorithm. On the mainstream distribution-modifying scheme KGW2-SelfHash, with Mistral-7B as the attack model, more than 80% of generated text is of acceptable quality and detected as watermarked; the authors state this is the first practical attack against this previously considered secure scheme; combined with a weakly aligned model, it can also mass-forge watermarks on harmful text to frame the model owner. Watermark stealing also greatly strengthens erasure attacks, raising the removal success rate of the DIPPER paraphraser from close to 0% to above 80% in the long-text setting, far exceeding all baselines, challenging the view that current watermark schemes are deployable and that forgery and erasure robustness are interchangeable. The authors state that there is currently no known real-world deployment of watermarks, so the attack has no realistic path to abuse for now; code is at https://watermark-stealing.org。
Why it was selectedThe paper proposes an automated watermark stealing attack that, at a cost of less than 50 US dollars, gives a previously considered secure scheme a success rate above 80% under forgery and erasure attacks.
Paper analysis
What problem does this paper attempt to solve?
The authors propose the watermark stealing threat: querying the API of a watermarked LLM is sufficient to reverse-engineer the watermark rule, and thereby carry out spoofing and scrubbing attacks.
Core problem: API queries to a watermarked LLM leak the watermark rule, enabling an attacker to reverse-engineer an approximate watermark model and thereby spoof or scrub the watermark.
- Problem setting: LLM watermarks are regarded as a means of detecting AI-generated text; the authors note that companies such as OpenAI, Meta, and Alphabet have committed to deploying watermarks, and that a US executive order and the EU AI Act also involve watermarks; some prior work considers existing schemes close to deployable.
- Insufficient existing understanding: the authors believe that the robustness of current watermarking schemes to adversarial behavior "remains poorly understood and is overestimated." Previously, spoofing had only a proof of concept, and KGW2-SelfHash was considered secure; Kirchenbauer et al. (2024) considered distribution-modifying schemes essentially robust to scrubbing on long text.
- Core observation: the authors state that watermark theft enables not only spoofing (previously hypothesized) but also greatly improves scrubbing—a point not previously noted; and that the common belief that spoofing and scrubbing robustness cannot be achieved simultaneously does not hold.
- Paper contributions: the authors state that they propose the first automated watermark theft algorithm and conduct the first systematic study of spoofing and scrubbing against multiple SOTA schemes under realistic settings; the authors state that the one-time cost of stealing each mainstream distribution-modifying watermark is under 50 USD (at January 2024 ChatGPT API pricing).
- Threat model (Sec. 3):
- Attacker goal: build an approximate model of the watermark rule determined by the key ξ using as few queries as possible (theft), then use it for spoofing (generating text judged as watermarked) or scrubbing (removing the watermark).
- Knowledge: only blackbox access to LMmo (only the complete generated text is available); per Kerckhoffs's principle, knows all parameters of the watermarking scheme but not ξ.
- Capabilities: can use an auxiliary model LMatt; detector access is divided into No access (D0) and API access (D1, binary judgment); base responses are divided into Unavailable (B0) and Available (B1).
- Victim system: a proprietary instruction-tuned model LMmo deployed with a distribution-modifying watermark.
What related research exists?
Related work falls into four categories: distribution-modifying watermarking schemes, spoofing and scrubbing attacks, two concurrent works, and other watermarking and detection directions.
LLM watermarking schemes
- Kirchenbauer et al. (2023) proposed KGW-Hard/KGW-Soft, which use a PRF to divide the vocabulary into green/red based on the hash of the previous token and the key ξ and shift logits; Kirchenbauer et al. (2024) extended this to long contexts and self-seeding, recommended KGW2-SelfHash (h=3), and proposed a spoofing-scrubbing tradeoff in which one comes at the expense of the other.
- Zhao et al. (2024) proposed Unigram (h=0, fixed green list), claiming benefits for text quality and scrubbing robustness, and assuming the spoofing threat is minor—this paper includes it in experimental testing.
- Other lines: semantic information (Hou et al., 2024; Liu et al., 2024b; Ren et al., 2024), sampling modification (Kuditipudi et al., 2024; Hu et al., 2024; Christ et al., 2023), neural-network-modeled watermarks (Liu et al., 2024a), multi-bit watermarks (Wang et al., 2024; Yoo et al., 2024s).
Spoofing and scrubbing attacks
- Scrubbing has previously been studied on the schemes covered here (Krishna et al., 2023; Kirchenbauer et al., 2023; Liu et al., 2024b; Zhao et al., 2024). The paper notes that Kirchenbauer et al. (2024) concluded "essentially robust on long text," which this paper refutes; and no prior work studies querying LMmo before an attack to enhance scrubbing.
- Sadasivan et al. (2023) first discussed spoofing in depth, giving a manually constructed proof of concept for KGW-Soft; the paper notes that their method targets small completion models and does not apply to instruction-tuned LMs. Subsequent work (Liu et al., 2024a;b; Gu et al., 2024) emphasizes the importance of spoofing but does not center on it.
- The paper cites surveys (Ghosal et al., 2023; Liu et al., 2023) noting that no prior work successfully spoofs KGW2-SelfHash under realistic settings (chat LM, low FPR, high-quality text, automated attacker, low one-time query cost), nor recognizes that the threat of watermark theft extends beyond spoofing.
Concurrent work
- Pang et al. (2024) study spoofing without a high-quality constraint and with access to a z-score detector, as well as scrubbing with logprobs access and in the multi-key case—settings this paper does not consider.
- Wu & Chandrasekaran (2024) independently note the connection between theft and scrubbing, but their scrubbing attack requires an additional query for each generated token.
Other directions
- Model weight watermarks (Zhao et al., 2022; 2023; He et al., 2022b;a; Peng et al., 2023) and post-hoc detection (Mitchell et al., 2023; Tian & Cui, 2023; Hu et al., 2023; Pu et al., 2023; Verma et al., 2024; Mao et al., 2024) are more distant from this paper.
Baselines and benchmarks: scrubbing baselines are DIPPER, PEGASUS, ChatGPT rewriting, and Recursive DIPPER (5 rounds); evaluation data come from Dolly-CW, HarmfulQ+AdvBench, MMW (the benchmark of Piet et al., 2023), and Reddit WritingPrompts. The authors position this paper as the first work to systematically study spoofing and scrubbing under realistic settings and to formalize watermark theft as an independent threat.
How does the paper address this problem?
Two-step attack: first query the API to compute token distribution differences and construct a green confidence score s*, then use s* to adjust the auxiliary model's logits to achieve spoofing or scrubbing.
Overall approach: the attacker queries the watermarked model LMmo, compares the conditional probabilities of tokens in the watermarked and base distributions, and constructs a scoring function s* to estimate the confidence that each token belongs to the green list given its context; then, when the auxiliary model LMatt generates text, it shifts the logits according to s*, with positive shifts for spoofing and negative shifts for scrubbing. The paper states that this method can be directly applied to schemes other than KGW2-SelfHash, sometimes using only some of the features.
Background: distribution-modifying watermarks
- KGW-Soft uses the hash of the previous token and a key ξ as the PRF seed, divides the vocabulary into green/red at ratio γ, and adds δ to the logits of green tokens; KGW2-SelfHash uses a context of h=3 plus self-seeding, with the PRF seed being min{H(Tt−h),...,H(Tt−1),H(Tt)} · ξ · H(Tt), i.e., the minimum hash value of the context and the candidate token participates in seed computation.
- For detection, the number of green tokens is counted and a z-statistic is computed, and a threshold is chosen according to the target FPR to decide whether the text is watermarked.
Step one: stealing the watermark (constructing s*)
- Distribution estimation: query LMmo with n prompts to obtain responses, tokenize with LMatt's tokenizer (without assuming knowledge of LMmo's tokenizer); for each 4-gram context subset ctx, maintain a conditional distribution estimate p̂w(T|ctx); the base distribution p̂b is estimated under the B0 setting using LMatt's outputs on the same prompts. Because the PRF seed is permutation-invariant, order within ctx is ignored to improve sample efficiency.
- Scoring: s(T, ctx) takes the ratio of p̂w to p̂b, records 0 when the ratio is less than 1, truncates with a clipping value c, and linearly normalizes to [0,1], representing the confidence that T is green.
- Sparsity issue: for the full context (|ctx|=3), score samples are few and unreliable. The paper's handling: when samples are too few, set the score to 0 (indicating lack of evidence rather than a judgment of red); and use partial-context scores (|ctx|<3,样本更多)补充信号。
- 部分上下文启发式:PRF 种子只依赖哈希最小的那个 token,故用余弦相似度找出 Tmin,把 s(T,{Tmin}) 与 s(T,{}) 按权重并入:s* = [s(T,{T1,T2,T3}) + w1·s(T,{Tmin}) + w2·s(T,{})]/z,KGW2-SelfHash 取 w1=0.5、w2=0.25,其他方案置零不适用项。
第二步:发起下游攻击
- Spoofing:LMatt 生成时把候选 token 的 logit 改为 lT + δatt·s*(T, 上下文),δatt>0, tending to select tokens more likely to be green; for schemes that ignore repeated (h+1)-grams, the logits of tokens that would form a repetition are first divided by ρatt and then s* is added.
- Scrubbing: the same procedure with δatt<0 reduces the probability of outputting green tokens, used to enhance a paraphraser (such as DIPPER) in removing watermarks.
- The paper emphasizes that stealing and the downstream attack are decoupled: any stealing algorithm that can output s* can be plugged into this attack pipeline.
Success criteria and evaluation method
- Spoofing metric: FPR*@f, i.e., the proportion of attacker text judged as watermarked under a detector calibrated to FPR=f on non-adversarial text; texts with a GPT4 quality score below 6.5 are not counted.
- Scrubbing metric: FNR*@f, i.e., the proportion of rewrites judged as not watermarked; rewrites with P-SP below 0.7 are not counted (following Kirchenbauer et al., 2024).
- All experiments take f ≤ 10^-3; the authors believe that only low FPR matches real deployment scenarios where false positives are costly; median p-values, average GPT4/P-SP scores and PPL (computed with LLAMA2-13B) are also reported.
What experiments did the paper conduct?
The authors report: the spoofing success rate against KGW2-SelfHash exceeds 80%, scrubbing raises DIPPER from about 0 to an average above 80%, and the theft cost is about 42 USD.
Experimental setup
- Models under test (LMmo): LLAMA-7B and LLAMA-13B (instruction-tuned), loaded with five watermarks: KGW-Soft, KGW-Hard, KGW2-SelfHash, KGW2-Sum, and Unigram, with defaults γ=0.25 and δ=4.
- Attack models (LMatt): MISTRAL-7B, LLAMA2-7B, GEMMA-7B, GEMMA-2B; the main setting is LMmo different from LMatt, B0 (no base responses), and D0 (no detector access).
- Data: C4 RealNewsLike for theft (n=30,000 responses, token length ≤800), with no overlap with evaluation data; evaluation uses 4 datasets of 100 items each: Dolly-CW, HarmfulQ+AdvBench, MMW BookReports, MMW FakeNews; scrubbing additionally uses 100 Reddit WritingPrompts, with target texts averaging over 1000 tokens.
- Baselines: scrubbing baselines are DIPPER, PEGASUS, ChatGPT rewriting, and Recursive DIPPER (5 rounds).
- Evaluation method: GPT4 scores Style/Consistency/Accuracy from 1–10 and takes the average, with a threshold of 6.5; rewrite quality uses P-SP with a threshold of 0.7; PPL is computed with LLAMA2-13B.
- Repetitions: 5 attacks per prompt are averaged; attack parameters ρatt=1.6, δatt=7.5, clipping c=2.
Main results
Spoofing (KGW2-SelfHash, B0/D0, FPR*@1e-3, per Table 1):
Swipe horizontally to read the table
LMatt LMmo=LLAMA-7B Dolly CW LMmo=LLAMA-7B MMW BookReports LMmo=LLAMA-13B Dolly CW LMmo=LLAMA-13B MMW BookReports MISTRAL-7B 0.81 0.81 0.86 0.80 LLAMA2-7B 0.91 0.79 0.73 0.76 GEMMA-7B 0.89 0.95 0.87 0.94 GEMMA-2B 0.87 0.55 0.84 0.86 Spoofing across schemes (LMatt=MISTRAL-7B, FPR*@1e-3, per Table 2, Dolly CW / HarmfulQ+AdvBench):
Scheme LMmo=LLAMA-7B LMmo=LLAMA-13B Unigram 0.79 / 0.85 0.80 / 0.82 KGW-Hard 0.89 / 0.90 0.97 / 0.94 KGW-Soft 0.82 / 0.89 0.93 / 0.96 KGW2-SelfHash 0.81 / 0.83 0.86 / 0.87 KGW2-Sum 0.54 / 0.63 0.77 / 0.77 - The authors state that KGW2-SelfHash was previously considered secure against spoofing, whereas in the experiments over 80% of attack texts met the quality threshold and were judged as watermarked; results do not degrade on harmful queries (MISTRAL-7B refusal rate 4%, and a well-aligned LMmo can be made to spoof harmful text).
- The authors state that KGW2-Sum is harder to spoof (some attack features were designed for KGW2-SelfHash), but the success rate still exceeds 50%.
Scrubbing experiments
- What was measured: enhancing DIPPER/PEGASUS rewriting of long text with the stolen s* (KGW2-SelfHash, B0/D0, FNR*@1e-3, per Table 3).
- Results: on LMmo=LLAMA-7B, Dolly CW, the DIPPER baseline is 0.02 and DIPPER+Ours is 0.90; on Reddit WritingPrompts it rises from 0.00 to 0.79; on LLAMA-13B the two datasets go from 0.02→0.84 and 0.03→0.76. PEGASUS+Ours reaches a maximum of 0.84 (baseline maximum 0.15). The best baseline, Recursive DIPPER, averages no more than 0.32.
- Authors' interpretation: the authors state that the vulnerability of KGW2-SelfHash to scrubbing in the long-text setting, previously considered secure, far exceeds prior understanding.
Cross-scheme scrubbing and tradeoff
- What was measured: erasure by DIPPER±Ours against four schemes (per Table 4, FNR*@1e-3).
- Results: the DIPPER baseline averages at most about 0.30 on Unigram/KGW-Soft/KGW2-SelfHash, and already reaches 0.71–0.92 on KGW2-Sum; after adding s*, KGW2-Sum rises to 0.96–0.98, and the other three schemes average over 0.81 (e.g., LLAMA-7B Dolly CW: Unigram 0.94, KGW-Soft 0.85, KGW2-SelfHash 0.90).
- Authors' interpretation: the authors state that the tradeoff between spoofing and scrubbing robustness does not hold—the vulnerability introduced by theft enables both attacks simultaneously.
Other ablations and analyses
- Query count (Figure 3): after about 10,000 queries the success rate converges to the level in Table 1; n=30,000 corresponds to a cost of 42 USD.
- Partial-context ablation (Figure 3): removing partial-context scores (w1=w2=0) lowers the average success rate from about 80% to below 50% at n=30,000.
- top-1 selection (Table 7): under D1, selecting top-1 using detector feedback reaches 0.98–1.00; under D0 the self-filtering heuristic is inconsistent, which the authors leave for future work.
- Multi-key (Table 14): changing the key per response, at k=4 Dolly CW is 0.68 and HarmfulQ+AdvBench is 0.73; the authors consider multi-key not a viable defense at present.
- Clipping parameter (Table 13): at c=4 Dolly CW reaches 0.90 (higher than 0.82 with c=2 in the main experiments); the authors did not rerun due to compute.
- Other: results are consistent under the B1 setting (Tables 9, 12) and key rotation (Table 10, n=10,000); high success rates are maintained at f=10^-6 (Table 5); the spoofing variant that imprints a watermark on existing text with DIPPER has a success rate ≥74%.
What are some points that can be further explored?
The authors discuss two defense directions, multi-key and sampling-modification, and note shortcomings such as the self-filtering heuristic; the experiments cover only distribution-modifying watermarks.
Limitations and future directions noted by the authors
- Self-filtering heuristic is inconsistent (App. B.1): under the D0 setting, the self-filtering method that selects top-1 without detector feedback "is not consistently effective," and the authors leave improvement to future work.
- Multi-key defense is not yet mature (App. C): the authors note that multi-key schemes lack in-depth study of concrete instances, and existing results are all negative (k=2 per-token key rotation is unusable; per-response key rotation is easier to scrub); in their own experiments k=4 still has a 73% success rate, and the authors consider multi-key not a viable defense at present and encourage research on more mature defenses.
- Sampling-modification watermarks remain to be explored (App. C): this paper studies only the distribution-modifying class; the authors suggest that the distortion-free property may help resist theft (since this paper's attack relies on the watermark's effect on the distribution), but that this property holds only in expectation, and the theory-practice gap may be exploitable; they encourage future research on attacks and defenses in this setting.
- Score normalization can be improved (Sec. 5, App. B.4): the authors state that finer normalization or tuning c may further improve results (c=4 is better but was not rerun).
- Scheme-specific attacks can be stronger (Sec. 6.1): the authors believe that attacks customized for a single scheme may further improve results on KGW2-Sum.
- Ethical leakage in GPT4 evaluation (App. D.1): the authors note that GPT4's ethical concerns about harmful content bleed into other scoring dimensions and may underestimate attack text quality, but they do not address this further.
Scope of experimental coverage
- The models under test are two LMmo, LLAMA-7B and LLAMA-13B, and the attack models are four, MISTRAL-7B, LLAMA2-7B, GEMMA-7B, GEMMA-2B (Table 1).
- Five distribution-modifying schemes are covered: KGW-Soft, KGW-Hard, KGW2-SelfHash, KGW2-Sum, Unigram; no attack experiments were conducted on the sampling-modification class (App. C).
- There are 5 evaluation datasets of 100 items each; 5 attacks per prompt are averaged; theft queries n=30,000 (n=10,000 for the key-consistency experiment).
- Main results are under the D0/B0 setting; D1 (top-1 selection) and B1 are given in the appendix; the setting where the detector returns an exact z-score is explicitly not considered (Sec. 3).
- The paper does not report human evaluation or a consistency experiment between human and GPT4 evaluation, nor does it report the actual wall-clock time of the attack.
Summarize the main content of the paper
The authors claim the first automated watermark theft algorithm, achieving over 80% spoofing and scrubbing success rates against SOTA watermarks at a cost below 50 USD.
An attack paper on LLM watermark security; the authors claim to propose the first automated watermark stealing algorithm and to conduct the first systematic study of spoofing and scrubbing under realistic settings.
- Problem: The authors argue that the robustness of current distribution-modifying watermarks against adversarial attacks is overestimated; an attacker only needs blackbox queries to a watermarked API to reverse-engineer the watermark rule determined by the secret key ξ.
- Method: Using n=30,000 C4 prompt queries, they estimate the conditional probability ratio between the watermarked and base distributions and construct a green confidence score s* (including a partial-context heuristic); then they use s* to shift the logits of an auxiliary model LMatt, positively to achieve spoofing and negatively to strengthen a paraphraser to achieve scrubbing.
- Spoofing results: KGW2-SelfHash (previously considered secure) under the strict B0/D0 setting, with MISTRAL-7B as the attack model, reaches FPR*@1e-3 of 0.80–0.86 (Table 1); KGW2-Sum is the hardest to spoof, at 0.54–0.77 (Table 2).
- Scrubbing results: Under the long-text setting, DIPPER+Ours raises the scrubbing success rate from about 0 to an average above 80% (e.g., 0.02→0.90 on LLAMA-7B Dolly CW, Table 3), while all baselines average no more than about 0.30.
- Cost and scaling: The stealing cost is about 42 USD (ChatGPT API pricing), and it converges at about 10,000 queries; under D1, top-1 selection reaches about 100%; with k=4 multiple keys, the success rate is still 73%.
- Authors' conclusion: The authors claim that the common view of a trade-off between spoofing and scrubbing robustness does not hold, and that the vulnerability introduced by stealing enables both attacks simultaneously; they recommend that future evaluations treat watermark stealing as a first-class threat and remain open to more robust schemes (including sampling-modification ones).