Watermark Smoothing Attacks against Language Models

## Abstract

Abstract Watermarking is a technique used to embed a hidden signal in the probability distribution of text generated by large language models (LLMs), enabling attribution of the text to the originating model. We introduce smoothing attacks and show that existing watermarking methods are not robust against minor modifications of text. An adversary can use weaker language models to smooth out the distribution perturbations caused by watermarks without significantly compromising the quality of the generated text. The modified text resulting from the smoothing attack remains close to the distribution of text that the original model (without watermark) would have produced. Our attack reveals a fundamental limitation of a wide range of watermarking techniques.

## 1 Introduction

Large language models (LLMs) have made remarkable progress, posing the challenge of determining whether a text is generated by AI (specifically by a given LLM) or written by a human. One common solution to this challenge is text watermarking [, , , ], which involves subtly modifying the probability distribution over the sequence of tokens generated by a model. This subtle statistical modification can be detected and attributed to the secret watermark [, , , ] while remaining undetectable to human users. For example, at each step of generating the next token, the probability of a subset of watermarked tokens (called the “green list”) is slightly boosted. Watermarking the text generation process in LLMs faces two main technical challenges: maintaining text quality and preventing easy erasure of the watermark. We study the second challenge and examine the resilience of watermarking techniques against erasure attacks.

The adversary’s objective is not simply to erase the watermarks at any cost, as the watermarks can be easily removed by significantly altering the generated text []. Instead, we set the adversary’s goal to be recovering the text that the original model could have produced, rather than generating different text. Accordingly, the robustness of watermarking schemes should be evaluated based on the difficulty of sampling high-quality text that appears to be generated by the original model, without any traces of the watermark. In this paper, we introduce strong watermark smoothing attacks that successfully achieve this objective.

We assume the adversary has access to a weaker LLM compared to the target model. Due to the gap in their capabilities, we expect the two models to disagree on the distributions for sampling the next tokens. A negligible part of this disagreement is due to the watermarking method. We design an algorithm that uses the weaker LLM as a reference model to smooth out those differences between the two models that are invariant across different samples. Here, we view the two models (the target and the reference) as two ranking schemes over the tokens, and perform a statistical test to measure the persistent contribution of each token to the discrepancy between the rankings due to the watermarks. We repeatedly evaluate this persistent contribution across many randomized experiments to infer a token’s likelihood of being in the watermarked list. Based on this, our watermark smoothing method determines the probability of the next token using a weighted average of the target and reference models. The weighting favors the reference model for tokens inferred as watermarked, thereby bypassing watermark detection. Meanwhile, the produced text is of much higher utility than that of the reference model, justifying the adversary’s motivation.

Our method erases the traces of statistical watermarks [, , ], regardless of the magnitude of the shift in the probability of tokens due to the watermark. We achieve this on large models such as Llama-7b [] and OPT-6.7b [], when only having access to much weaker models such as TinyLlama-1.3B [] and OPT-125m. We show that our attack can infer watermarked tokens with over 0.9 AUC with only a few hundred queries. Our generated text maintains comparable utility to text from the unwatermarked model, despite completely defeating the watermark detection method.

## 2 Preliminaries and problem statement

#### Text generation of language models.

We use $M$ to denote a large language model (LLM) and $\mathcal{V}$ to denote its associated vocabulary set (namely, the collection of all tokens). During the generation, at each step $t$, the LLM is given a sequence of tokens and predicts the next token by first outputting a vector of logit scores $l_{t}\in\mathbb{R}^{|\mathcal{V}|}$ and then applying the softmax function [] to the vector to sample the next token.

#### Statistical watermarking.

The overall idea of statistical watermarking for LLMs [, , ] is to introduce small perturbations to the probability of tokens, in such a way that a detector algorithm can identify these perturbations from a long sequence of tokens, whereas humans cannot. In this method, the watermarking algorithm boosts the probability of sampling a fraction of tokens. This can be done in different ways. The major approach involves selecting a $\gamma$ fraction of the vocabulary set as the green set $\mathcal{G}_{t}$ (or watermarked set) and increasing their logit values, while keeping the logit values of the rest of the vocabulary (called the red tokens, $\mathcal{R}_{t}$) unchanged.

$$ $\displaystyle\tilde{l}_{t}^{v}=l_{t}^{v}+\delta\cdot\mathbbm{1}_{v\in\mathcal{G}_{t}}.$ (1) $$

The next token is sampled from $\tilde{l}_{t}$. The randomness of selecting green tokens can in general depend on $t$ and the $h$ previous tokens. In this way, a statistical watermark is embedded into the sampled tokens, as the output distribution is now biased towards tokens in the green list. We refer to the green tokens as watermarked tokens. We denote the watermarked model as $\tilde{M}$.

Provided with the pseudo-randomness for selecting the green list and a sequence of tokens of length $T$, the detector algorithm looks for evidence for disproportionate presence of watermarked (green) tokens. Roughly speaking, the detector counts the overall frequency of green tokens, and predicts the given sequence as watermarked if the frequency exceeds a certain threshold. As the partitioning of the green and red lists is random, it is very unlikely that a non-watermarked text will be misclassified as watermarked, given a long sequence of tokens.

In particular, when the generated text is watermark free, we should expect the number of green tokens in the generated text, denoted as $n_{green}$, to be close to $\gamma T$, for any sequence of length $T$. The detector computes the z-score as follows

$$ $\displaystyle z=\frac{(n_{green}-\gamma T)}{\sqrt{T\gamma(1-\gamma)}}.$ (2) $$

The detector predicts the given sequence as watermarked (i.e., rejects the null hypothesis) when the z-score is above some threshold $\tau$.

The partitioning of green and red lists depends on a context window of the previous $h$ tokens. When $h=0$, the partitioning is context-independent and is referred to as the Unigram watermark []. When $h=1$, the partitioning is dependent only on the previous token, and is referred to as the 2-gram watermark []. One could also increase the length $h$ of the context window further. In a method referred to as Self-Hash, the authors consider the case where the watermark depends on both previous $4$ tokens and also the token at position $t$ itself (which is to be generated) [].

#### Problem statement.

Our objective is to analyze the robustness statistical watermarks. Towards this end, we design an attack algorithm that outputs a text sequence that matches the utility of the original non-watermarked model $M$, while bypassing the watermark detector.

Here, we assume the adversary has full access to another (weaker) model, which we refer to as the reference model $M_{ref}$. In practice, this reference model should be weaker than the target model, since otherwise, the adversary has less motivation to attack the watermarked model. In particular, through $M_{ref}$, the adversary could obtain the generated text for any prompt during the generation process. As for the access to the watermarked model $\tilde{M}$, we mainly exploit the ranking between tokens. We also assume that the adversary knows which watermarking algorithm is used, including context window length $h$, but does not know the values of the watermarking shift $\delta$ and the fraction of green tokens $\gamma$.

## 3 Attack framework

Our attack framework consists of two phases. In the first phase, the adversary infers the green list, thereby identifying the embedded watermarks. In the second phase, the adversary smooths out the watermarks by shifting the probability of sampling green tokens towards that of the reference model, producing text that is watermark free, while achieving high utility, as if the text is generated from the target model $M$.

### 3.1 Phase I: Watermark Inference

#### Idea.

The key observation is that, given the semantics of the prefix, reasonable language models (despite their varying performance) would in general agree on top tokens. For instance, given the prefix “Why the sky is ”, the probability of token “blue” should be much higher than other tokens such as “@”. In other words, the relative ranking of each token among the vocabulary list given by different models should be similar. It might also be rare that models have consistent disagreement regarding a specific token across a wide range of prefixes. In contrast, for the watermarked model, due to the watermark perturbation, the tokens in the green list are pushed up, while the tokens in the red list are pulled down, *regardless of the semantic meaning of the prefix*. This consistent shift could be detected by comparing the relative positions of a token in the watermarked model and any other unwatermarked reference models (regardless of the model capacity).

Our approach begins by measuring the disagreement between two models regarding the placement of each token relative to the others. This is where rank correlation comes into play, aiming to assess the similarity between two rankings. The concept of rank correlation has been extensively studied [, , ]. Specifically, Spearman’s correlation [] is based on the sum of the squared differences between the ranks of each item. In our context, this would be the difference in relative positions assigned by the two models to the same tokens.

To accurately detect the watermark, we need to evaluate the contribution of each token to the overall correlation. This is important because green tokens and red tokens affect the rankings differently; green tokens are pushed up in the ranking, while red tokens are pulled down. By considering the contribution of each token, we can observe these opposing shifts. We account for the sign of this difference since green tokens are moved up and red tokens are moved down. Essentially, the difference in rankings for each token represents its contribution to the disagreement between the two models. This measure is then used as an indicator to determine whether a token is green or not.

#### Relative position.

We use $R^{t}_{M}(v)$ to denote the relative position of token $v$ compared to all other tokens in $\mathcal{V}$, evaluated by model $M$ at step $t$. This relative position metric $R^{t}_{M}$ assigns a higher value to the tokens that are more likely to be sampled. In the above example, the token “blue” is of the highest position when the prefix is “Why the sky is”.

Various relative position metrics can be considered in our attack framework. For example, when the adversary has access to output probability for all tokens, she/he can use the standard score for a token as its relative position, which measures the number of standard deviations by which the probability of the token is above or below the average probability over all the tokens. On the other hand, when the adversary only observes the information of top $K$ tokens (e.g., OpenAI returns the log of probability for the top 5 tokens), the adversary can leverage the logit bias trick, which allows users to add a bias on the logit for any tokens. Based on it, the adversary can recover the whole ranking for all tokens with $|\mathcal{V}|/(K-1)$ queries, as shown in [].

#### Relative position difference.

Relative position difference measures the difference of the relative positions of a token $v$ of the watermarked model $\tilde{M}$ and the reference model $M_{ref}$, expressed as $R^{t}_{\tilde{M}}(v)-R^{t}_{M_{ref}}(v)$. Since the embedded watermark pushes the green and red tokens toward *opposite* directions, we expect the relative position differences to be separable between the green and red tokens. In particular, for green tokens, the relative difference should be larger whereas for red tokens, the difference should be smaller.

#### Averaging out the model discrepancy.

Note that, there are two factors that contribute to the difference of relative positions in the watermarked model $\tilde{M}$ versus the reference model $M_{ref}$: (i) the shift caused by watermarks in $\tilde{M}$; and (ii) the discrepancy between the target model $M$ and the reference model $M_{ref}$. Here, we need to reduce the impact of model discrepancy, in order to boost the effectiveness in inferring the green list. Towards this end, we query both the watermarked model $\tilde{M}$ and the reference model $M_{ref}$ with different prefixes, explained as follows. Recall that the green list depends on the previous $h$ tokens. Thus, for any prefix, as long as the previous $h$ tokens are fixed, the shift caused by watermarks is the same. In contrast, the discrepancy between the two models on different prefixes differs. With this fact in mind, the natural way to reduce the impact of model discrepancy is to average the relative position difference across multiple prefixes but with the last $h$ tokens fixed. For example, considering $h=3$ and two prefixes of “Who was the president of the USA in 2010” and “Tell me about the best football player in 2010”, the watermarked model will produce the same green list, thus averaging out the model discrepancy between the model $M$ and the reference model $M_{ref}$.

#### Watermark inference score.

We use the $R^{t}_{\tilde{M}}(v|c_{1},\ldots c_{t-1})$ to denote the relative position of $v$ given by model $M$ with the prefix $(c_{1},\ldots c_{t-1})$. The watermark inference score, denoted as $s_{v}^{t}$, for a token $v$ at time $t$ is defined as the average relative position difference between the two models over the randomness first $t-h-1$ tokens in the prefix.

$$ $\displaystyle s_{v}=\mathbb{E}_{c_{1},\ldots,c_{t-h-1}}\left[R^{t}_{\tilde{M}}\left(v\big{|}c_{1},\ldots,c_{t-1}\right)-R^{t}_{M_{ref}}\left(v\big{|}c_{1},\ldots,c_{t-1}\right)\right]$ (3) $$

The adversary predicts token $v$ as green if its inference score is higher than a certain threshold and red otherwise.

### 3.2 Phase II: Watermark smoothing

With the inferred green list(s), next, we aim to estimate the output distribution of the unwatermarked model $M$. Namely, the objective is to “undo” the watermarking shift applied on the logit.
In the ideal case–the inference score for all green tokens is significantly higher than all red tokens, and the adversary knows the exact values of $\gamma$ (fraction of green tokens) and $\delta$ (the shift applied on logits of the green tokens), the adversary should simply reduce $\delta$ on the logits for the top $\gamma|\mathcal{V}|$ tokens who have the highest watermarking inference scores, as defined in equation [3](#S3.E3). However, this is not possible when $\delta$ and $\gamma$ are unknown, as specified in Section [2](#S2).

Our attack makes a soft prediction about whether a token is green or red. Specifically, we estimate the confidence about how likely each token is in the green list by comparing the score with other tokens. Comparing two tokens $v$ and $v^{\prime}$ which both sit on the top $\alpha$ portion among all tokens in terms of the inference score, we may be more confident about predicting $v$ as a green token rather than $v^{\prime}$, if $v$ is associated with a larger inference score $s_{v}$ than $v^{\prime}$.

#### Inference confidence.

For each token $v$, we denote the associated inference confidence as $w_{v}$, expressed as follows.

$$ $\displaystyle w_{v}=\frac{\sum_{v^{\prime}\in\mathcal{V}}\mathbbm{1}\{s_{v^{\prime}}\leq s_{v}\}}{|V|}.$ (4) $$

#### Smoothed logits.

With the inference confidence of a token $v$, the adversary can choose whether to use the logit for $v$ from the watermarked model or the reference model. In particular, if the adversary has high confidence that $v$ is green, he should use more of the output probability of the reference model instead of the watermark model. Here, the adversary applies a convex combination on the logits of the two models, formally expressed as follows. The logit score is computed as

$$ $\displaystyle\hat{l}_{v}^{attack}\leftarrow(1-w_{v})\cdot\tilde{l}_{v}^{\tilde{M}}+w_{v}\cdot\tilde{l}_{v}^{M_{ref}}.$ (5) $$

Despite that the above smoothing with convex combination seems simple, we will show its effectiveness in our extensive evaluation, presented next. An intuitive explanation is that, when the reference model and the unwatermarked model are sampled from some ideal parameter distribution for LLMs, the above operation of weighted averaging reduces the sampling variance as well as the bias caused by the watermarking shift, leading to high-utility texts while bypassing watermark detection.

## 4 Experiments

In this section, we show the effectiveness of our attack in removing the watermarks while preserving the quality of the text. We start with the introduction of setups and then present the effectiveness of watermark inference, followed by the evaluation of the text generated by our attack.

### 4.1 Setup

Our experiments are conducted on two NVIDIA TITAN RTX GPUs with 24GB memory for each.

#### Models.

We use Llama2-7B-Chat [] as the target model and use TinyLlama-1.3B [] as our reference model. For the Llama2 model, the size of the vocabulary is $32,000$. We also consider the OPT-6.8B [] as the target model and use the weaker model OPT-125m as the reference model. The vocabulary size is $50,272$. We evaluate the Two-gram Watermark [] and Unigram-Watermark []. For both watermark techniques, we follow the same implementation as in [] and set $\delta=2.0$ for the watermark technique and the $\gamma=0.5$.

#### Datasets.

Following prior work [], we evaluate both LFQA and OpenGen []. LFQA consists of 3000 question-and-answer pairs created from Reddit.
In particular, each question is paired with the corresponding longest human-written answer. We regard a question as the prompt and the corresponding human-written answer as the high-quality text that we aim to produce by attacking the watermarked LLM. OpenGen consists of 3000 two-sentence chunks sampled from the validation split of WikiText-103 []. Here we regard the first chunk as the prompt and the subsequent 300 tokens as the human-written continuation. All sentences are cropped to a length of 300 tokens.

#### Baselines.

The strongest post-hoc modification [] relies on a strong LLM that paraphrases the given text. In our case, since the adversary already has access to the reference model which does not have watermarks, the adversary can also directly use the reference model to paraphrase the generated text to remove the watermark. Specifically, we consider paraphrase attacks where we use the ”Q: Can you paraphrase the text in the parenthesis ({Responses from the watermarked model})? A:” prompt to provide the responses from the watermarked model to the reference model.

In addition, we also consider naive versions of our attacks, which modify the logit value by averaging the logit values from the target model and reference model, which we refer to as average attack.

#### Implementation.

To estimate the green list, we first query the target model and the reference model with $10$ prompts and each response has the maximal $300$ tokens. We employ Nucleus Sampling [] as the default decoding algorithm to introduce randomness (also called Top-$p$ sampling) with $p=0.9$, following [].

#### Metrics.

We measure the text quality and watermark strength for text generated by different sources. We follow the prior work and use the perplexity (PPL) as a way to measure the quality of the model. The perplexity measures the likelihood of generating a text under a language model. We use an oracle model, Mistral-7B [], for our measurement. In addition, we also compute the perplexity based on the un-watermarked model to evaluate how the generated text aligned with the original text. As for the watermark strength, the detection algorithm computes the z-score (defined in [2](#S2.E2)) to determine whether a text is generated from the watermarked model. Specifically, a larger z-score means that the detection algorithm is more likely to determine it as the generated text from the watermarked model. Conversely, the lower the z-score is, the more effective the attack is. Therefore, we report the z-score for our evaluation. In addition, we set the threshold for the watermark detection algorithm to ensure that less than 1% of unwatermarked text is misclassified. We report the positive prediction ratio (PPR), which is the fraction of samples detected as watermarked by the algorithm, for text generated in different settings. The adversary aims to achieve a lower PPR on the generated text.

Figure: Figure 1: Effectiveness on inferring watermark – Llama2-7b on LFQA. The left figures show the histogram of the watermark inference score defined in Equation [3](#S3.E3) based on the standard score of logits for tokens in green and red lists, averaged over $3000$ prefix. The middle figures show the ROC for distinguishing the tokens from the green list and red list using the watermark inference score based on the standard score on logits or ranking. The right figures show the AUC of watermark inference attacks with different numbers of queries.

### 4.2 Effectiveness of watermark inference

Figure [1](#S4.F1) shows the performance of watermark inference against the Unigram watermark. First, we show that the watermark inference score we designed in Equation [Equation 3](#S3.E3) is effective, as the green tokens and red tokens are clearly separable on this metric (left figure). As we increase the number of prefixes used for averaging, the AUC of the inference attack increases. With 3000 queries, the AUC can achieve 0.97, as shown in the right figure. Lastly, when we compare the results on the signal computed on the logits and the ranking, we find that those metrics result in similar performance. Those results indicate that our watermark inference attack can reconstruct the green list with high accuracy. We also show the effectiveness of OPT models and results on different datasets in the Appendix.

Figure [2](#S4.F2) shows the separability between the green tokens and red tokens for the other three watermark algorithms. We use the 50 permutations of the original text, with fixed tokens (which the watermark depends on). For Self-Hash, we fix the previous 4 tokens, and we consider 2-gram and 3-gram watermarks, which we fix the previous one token or the previous two tokens. Despite the difference between the watermark algorithms, they all change the relative position of green tokens and red tokens in different directions. Thus, by looking at our proposed watermark inference score, the adversary can easily identify the green tokens.

Figure: Figure 2: Watermark inference score on green tokens and red tokens for context-dependent watermarks – Llama2-7b on LFQA. The x-axis shows the watermark inference score (defined in [Equation 3](#S3.E3)), which is averaged over 100 different prefixes. The distribution is over different tokens.

**Table 1: Effectiveness of smoothing attacks on various datasets and models – Unigram. The results are on two models on two datasets (LFQA and OpenGen). The standard deviation across different examples is shown in the parentheses. We compare with the text generated by the unwatermarked, reference model and watermarked model, without any attacks. We also include the text generated by baseline attacks against the watermarked model.**
| Setting | Source | LFQA dataset | OpenGen dataset |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Llama-7b | OPT-6.7b | LLama-7b | OPT-6.7b |  |  |  |  |  |  |  |  |  |  |
| Perplexity | Z-score | PPR(%) | Perplexity | Z-score | PPR(%) | Perplexity | Z-score | PPR(%) | Perplexity | Z-score | PPR(%) |  |  |
| No attack | Unwatermarked | 2.34 (0.45) | -1.19 (1.67) | 0.78 | 19.65 (19.34) | -0.11 (1.11) | 0.78 | 4.29 (2.07) | -1.05 (2.82) | 1.20 | 9.27 (2.64) | 0.19 (1.22) | 0.99 |
| Reference | 9.20 (6.06) | -1.09 (1.66) | 0.00 | 15.95 (10.08) | -0.56 (1.52) | 0.00 | 11.32 (4.41) | -0.72 (1.47) | 0.52 | 24.23 (13.25) | 0.21 (1.55) | 0.76 |  |
| Watermarked | 2.57 (0.68) | 1.49 (1.73) | 20.98 | 19.19 (14.68) | 7.99 (3.08) | 20.98 | 5.91 (4.46) | 5.30 (2.41) | 69.47 | 11.14 (6.56) | 9.91 (2.04) | 97.99 |  |
| Paraphrase attack | Watermarked | 5.84 (3.67) | 0.48 (1.62) | 3.64 | 26.25 (16.12) | 1.45 (2.59) | 3.64 | 9.40 (6.71) | 2.60 (1.91) | 32.00 | 20.66 (7.81) | 1.11 (2.93) | 4.00 |
| Average attack | 2.44 (0.77) | 0.64 (1.60) | 11.85 | 18.07 (18.87) | 5.50 (2.15) | 11.85 | 4.62 (4.04) | 3.30 (1.96) | 39.44 | 12.85 (4.49) | 6.03 (2.21) | 92.00 |  |
| Our attack | 2.93 (0.58) | -5.09 (1.56) | 0.23 | 14.56 (13.54) | -2.76 (1.85) | 0.23 | 4.05 (1.34) | -2.61 (2.01) | 0.69 | 11.09 (3.52) | -3.83 (1.46) | 0.00 |  |

**Table 2: Effectiveness of smoothing attacks – Context-dependent watermarks, LFQA. The quality is measured by perplexity with respect to the oracle model and the detectability is measured by the z-score. The 2-gram and 3-gram watermarks depend on the previous 1 token and 2 tokens, respectively. The self-hash depends on the previous 4 tokens, including the token to be generated. For our attack, we fix the previous 1, 2, and 4 tokens, respectively to compute the watermark inference score over multiple prefixes (as defined in [Equation 3](#S3.E3))**
| Setting | Source | 2-gram | 3-gram | Self-Hash |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Perplexity | Z-score | Perplexity | Z-score | Perplexity | Z-score |  |  |
| No attack | Unatermarked model | 2.31 (0.14) | -0.51 (0.00) | 2.31 (0.14) | 0.24 (0.12) | 2.31 (0.14) | 2.45 (0.71) |
| Reference model | 7.35 (1.93) | -0.47 (0.87) | 7.35 (1.93) | 0.01 (1.39) | 7.35 (1.93) | 1.67 (0.51) |  |
| Watermarked model | 2.58 (0.11) | 2.61 (0.07) | 2.28 (0.17) | 1.38 (0.11) | 2.68 (0.20) | 3.90 (1.27) |  |
| Average attack | Watermarked model | 2.12 (0.03) | 1.71 (0.67) | 2.18 (0.02) | 2.93 (0.58) | 2.31 (0.02) | 4.24 (0.77) |
| Our attack | 3.99 (1.10) | -4.89 (0.99) | 2.97 (0.54) | -4.86 (0.27) | 2.82 (1.33) | 1.54 (0.61) |  |

### 4.3 Effectiveness of watermark smoothing

#### Overall results.

Table [1](#S4.T1) presents the perplexity (which measures text quality), z-score, and positive prediction ratio of the watermark detection algorithm (which measures attack performance) for various baselines and attacks on two different models targeting the Unigram watermark [] in the LFQA dataset. The threshold of the detection algorithm is set to ensure that fewer than 1% of the unwatermarked text is misclassified. The text generated by *our attack* maintains high quality while significantly reducing the z-score, even below that of the unwatermarked model. Consequently, detecting watermarks in text generated by our attack would require the detector to accept a high false positive rate. Specifically, on the OPT model for the OpenGen dataset, when the detector makes 0.99% errors on the unwatermarked text, the detectors correctly identify 97.99% of the watermarked text but fail to detect any text generated by our attack.

In contrast, the paraphrasing attack fails to maintain text quality, as evidenced by its high perplexity. Interestingly, paraphrasing using the reference model does not sufficiently reduce the z-score to match that of the reference model, suggesting that the watermark pattern persists in the generated text. However, our attack completely removes this watermark pattern, demonstrating its effectiveness.

Table [2](#S4.T2) shows the trade-offs for various context-dependent watermark algorithms. Similar to the unigram setting, our attack produces text with significantly better quality compared to text generated using only the reference model, while still evading detection. The results are consistent with those observed in the unigram case.

#### Benefit.

Figure [3](#S4.F3) compares the perplexity of generated text relative to both the oracle model and the unwatermarked model. Firstly, we observe that the paraphrasing attack results in text with high perplexity for both models, indicating poor quality and low association with the unwatermarked model. Additionally, the text generated by the adversary closely resembles the unwatermarked model, suggesting that the adversary benefits from the target model without being detected. Notably, this improvement in text quality does not increase detectability, as the z-score remains negative.

Figure: Figure 3: Effectiveness of our attacks on detectability and quality of the text - LFQA, Unigram-Watermark. The left figure shows the perplexity distribution with respect to the oracle model, which demonstrates the quality of the text. The middle figure shows the perplexity with respect to the watermark-free model, which demonstrates the association between the given text and the watermark-free model, from the quality aspect. The last figure shows the distribution of the z-score, which is used to detect whether a given text is watermarked or not.

Figure: Figure 4: Impact of watermark shift – LFQA, Unigram. The x-axis shows how much shift is added to the logits to embed the watermarks, i.e., $\delta$. The left figure shows how the AUC of the adversary for distinguishing the green or red tokens changes. The middle figure shows the fraction of positive prediction the detector made on watermarked examples and examples generated by our attack when the FPR is less than $1\%$. In this case, only 0.1% of text generated by our attack is detected as watermarked text by the detector. The right figure shows the perplexity increase compared to the unwatermarked text, for both watermarked text and text generated by our attack model.

Figure: Figure 5: Impact of reference model on watermark inference attack – Unigram, LFQA dataset with OPT-6.7b. The x-axis is the model watermark inference score defined in [Equation 3](#S3.E3). The adversary uses reference models with various sizes to infer the green list for the same watermarked model.

### 4.4 Ablation study

#### Effect of watermark strength.

Figure [4](#S4.F4) shows the impact of watermark shift on the accuracy of the detection, quality of the generated text, and effectiveness of our attack. First, we notice that, as we increase the shift, the detection algorithm achieves a higher true positive rate, indicating an increase in the effectiveness of the detection. At the same time, since the shift is larger, it becomes easier to distinguish the green and red tokens. The AUC of our attack also increases. As for the quality, increasing the shift leads to a more distorted output distribution compared to the watermark-free model. Thus, the quality is reduced, namely, the perplexity of the text generated by the watermarked model is higher than that of the watermark-free model. Surprisingly, the text generated by our achieves a better quality as the shift increases.

#### Effect of reference models.

Figure [5](#S4.F5) shows the difference in the logits between the target model (OPT-6.7b) and difference reference models, including OPT-125m, OPT-350m, and OPT-1.3b. The difference score is averaged over the $3000$ prefix. The AUC when using the OPT-125m, OPT-350m, and OPT-1.3b is 0.987, 0.978, and 0.999, respectively. As the size of the reference model increases, the model discrepancy between the reference model and the target model is reduced. Thus, the watermark inference score is mainly contributed by the watermark shift. As a result, as the reference model becomes similar to the target model, the accuracy of inferring the green list increases.

## 5 Related Works

#### Watermarking LLMs.

A watermark is a way to encode the information to identify the source of the text, which is the type of *steganography* with a one-bit message. It has a long history. Prior works inject the watermarks based on pre-defined rules, e.g., changing synonyms [, , , , ], adding visually indistinguishable tokens [], altering sentence structures [, ]. Different approaches have been proposed, such as encoding messages by context-aware lexical substitution [] or using mask-infilling models for editing text []. Recent works [, , , ] study statistical watermarks which modify the logit of language models during token generation and embedding invisible watermarks in the decoding process. An alternative approach is to plant cryptographic watermarks [, ], which at a high level, embed the watermark in the sampling process, leaving the output distribution untouched. Recently, there have been other ways to embed the watermarks [, ], e.g., combing cryptographic watermarks and statistical watermarks. In this paper, we focus on the statistical watermarks and leave the exploration for other types of watermarks as future work.

#### Attacking watermarked LLMs.

There has also been a parallel exploration of methods for altering and removing the watermarks in LLMs, including attacks that inject invisible characters and homoglyphs [, , , ], generative attacks that prompted the model to change the output in a predictable and easily reversible way, e.g., emoji attack [].
Among the generative attacks, paraphrasing attacks leverage strong LLMs to remove the watermark [, , ]. Instead, we consider a more realistic setting where the adversary has a weaker reference model to launch the attack. Otherwise, the adversary does not have the incentive to attack the watermarked model.

Recently, Jovanović et al. [] also leverage a reference model for estimating the green token list, with a focus on spoofing attacks, where the adversary aims to fool the detector into making a large FPR error (misclassifying the text as generated by the watermarked model). The scrubbing attack proposed in the paper still removes the watermarks using post-hoc modifications, similar to []. In addition, we focus on the case where the adversary has the ranks between tokens when generating each token (which can be achieved even using OpenAI API) while [] considers the case where only the sampled token is available to the adversary.

#### Post-hoc Detection.

This line of work focuses on determining if a text is generated from *any* language models or written by humans. Those methods are based on the hand-crafted or learned “statistical patterns” that differ for human-written text and machine-generated text [, , , , ]. However, with the improvement of the LLMs, the machine-generated text is becoming increasingly similar to human-generated text, making it more challenging to detect. Moreover, these detections might also be biased toward non-native English writers []. We refer interested readers to Jawahar et al. [].

## 6 Conclusions

In this work, we present the smoothing attacks to examine the robustness of existing statistical watermark techniques in LLMs. Our attack, by leveraging a reference model, can effectively remove the watermarks while preserving the quality of the generated text. Different from existing work that leverages stronger LLMs to attack weaker ones, our attack leverages a much weaker reference model compared with the target LLM. We have validated the effectiveness of our method on a wide spectrum of models, settings, and multiple watermark algorithms. Our findings highlight significant vulnerabilities in existing watermarking techniques given the rapid development and call for improvements.

Regarding future work, there are two possible directions. One direction is to reduce the cost of performing the attack, namely, reducing the number of queries made to the watermarked model. Another direction is to design more robust watermarking techniques as well as other measures to facilitate and enforce the responsible usage of LLM.

## Appendix A Additional Results

### A.1 Effectiveness of reconstructing the green list

Figure [6](#A1.F6),[7](#A1.F7) show the performance of reconstructing the green list for different watermark techniques on different datasets and with different models. Specifically, we observe that the histogram of scores for the tokens in the green list and red list are separable. In addition, by leveraging the averaging score over a few prompts, the AUC of the adversary in distinguishing the tokens from the green and red list increases. The results are consistent with the results in Figure [6](#A1.F6) and Figure [1](#S4.F1).

Figure: Figure 6: Effectiveness on estimating the green list – OPT-6.7b on LFQA with Unigram watermark.

Figure: Figure 7: Effectiveness on estimating the green list – Llama-7b on OpenGen with Unigram Watermark.

## Peer Reviews

confidence: 4
contribution: 1
initial_rating: 1
presentation: 3
questions: What are the main differences between this work and that of Zhang et al. (2023)? (see Weaknesses section)
soundness: 3
strengths: The paper proposes a heuristic to estimate which tokens contribute the most to the overall watermark signal and removes the watermark by editing these tokens using another language model. The idea is interesting, and the paper empirically validates the effectiveness of their attack across different watermarks, language models, and datasets. These results clearly establish the effectiveness of the attack in practice.
summary: The paper proposes an automatic method for editing watermarked text from a language model to evade watermark detection using another (weaker) language model. The paper mainly considers the "red-green list" watermark of Kirchenbauer et al. and variants thereof, though the techniques should presumably generalize to other watermarks.
weaknesses: The paper distinguishes its main contributions from prior work by arguing that prior work on automatically removing watermarks involved using language models that were at least as strong as the original watermarked language model. However, one notable exception is the work of Zhang et al. [1], who seem to also focus on removing watermarks using weaker language models. This work is cited in the present paper but not discussed in any detail. It would be great if the authors can update their paper with a discussion of how their work differs from [1]. Otherwise, the novelty/significance of the main contributions over prior work is not clear.


[1] Zhang et al. (2023) Watermarks in the Sand: Impossibility of Strong Watermarking for Generative Models. https://arxiv.org/abs/2311.04378

---

confidence: 3
contribution: 3
initial_rating: 6
presentation: 3
questions: - Can the authors provide a baseline that uses the local reference model to do the paraphrase attack?
- What could be potential adaptive defenses for this attack?
soundness: 2
strengths: - I find the proposed method very interesting and quite different from the previous work. Meanwhile, the method doesn't require a strong oracle model like a paraphrasing attack, which makes the threat model more realistic.
- I really enjoy reading this paper, especially section 3.1, which gives readers a lot of insights.
- The results look positive and a lot of different watermarking schemes are covered (most results are presented in the appendix).
summary: In this paper, the authors introduce a novel watermark-removal attack that requires only a small watermark-free reference model. The attacker first estimates the probability of the generated token at position i being in the watermark's green list, which correlates with the relative confidence of the most likely token among the top k tokens. According to the confidence score, the attacker then combines the probability distributions at position i from both the watermarked model and the reference model to sample the token. This approach effectively evades watermark detection while maintaining high text quality.
weaknesses: - The proposed method relies on using the logits/output probabilities of the watermarked model. This might limit the attack to some API models that may not return the logits/probabilities or only return top-k probabilities or even calibrated probabilities.
- The paper uses perplexity or loss to measure the text quality, but I think it's not enough to show the quality of the text. For example, the model can generate an answer for a math question with a very low perplexity, but the answer is completely wrong. So, I think it will be more helpful if the authors can include more text quality metrics like P-SP used in [1] or even a model-based evaluation like asking a large oracle model which generation is preferable.
- I think it's also helpful to the paper if the answers can show the results under different data distributions instead of overall c4.

[1] Kirchenbauer, J., Geiping, J., Wen, Y., Shu, M., Saifullah, K., Kong, K., Fernando, K., Saha, A., Goldblum, M., & Goldstein, T. (2023). On the Reliability of Watermarks for Large Language Models. ArXiv, abs/2306.04634.

---

confidence: 3
contribution: 2
initial_rating: 3
presentation: 3
questions: 1. In Table 1, Watermark (smoothing) has a lower perplexity than Watermark (or even Unwatermark) in some cases (e.g., Llama2-7b). In other words, the attack can even improve the quality of the text, which seems counterintuitive as the reference model is weaker. This also raises a concern about whether perplexity is the right measure to look at the quality of a text here. The authors may want to include other text quality metrics in the numerical studies.
2. I would like to know if the authors can discuss the potential pitfalls of their methods, e.g., provide concrete examples or scenarios where their smooth attack might fail, and discuss the implications of such failures
soundness: 2
strengths: Many existing methods for statistical watermarking have primarily concentrated on the generation and detection of watermarks. This paper takes a different approach by examining statistical watermarking from a new perspective. This perspective is interesting and may also aid in the development of improved watermark generation and detection techniques.
summary: This work develops a smooth attack in the “green-red list” watermarking framework. The paper shows that a smooth attack makes it easier to bypass the detector while still preserving the quality of the text.
weaknesses: 1. The significance level $S_t$ is unobserved and was estimated using a surrogate quantity, $c_t$. Though the authors showed that there is generally a negative correlation between $c_t$ and $S_t$, this is only a weak justification. It is possible that a small $c_t$ would correspond to a large $S_t$ in some situations, e.g., when $K$ is small. 
2. The method only applies to the “green-red list” watermarking scheme, which is known to be biased because it does not preserve the original text distribution. In contrast, there are unbiased watermarking methods (e.g., Kuditipudi et al., 2023; Aaronson, 2023). It is unclear if the proposed method applies to unbiased watermarking schemes. Perhaps the authors can provide more discussions about how their method might be adapted or extended to work with unbiased watermarking schemes.
3. The paper lacks a rigorous theoretical analysis of the effect of the smooth attack on the text quality, e.g., bounds on how much the smoothing attack can affect certain text quality metrics.

---

confidence: 4
contribution: 2
initial_rating: 3
presentation: 2
questions: 1. Why in Figure 1, top-p sampling (right figure) has some points with the total variation distance being 0 or 1, but top-k sampling (middle figure) does not?
2. How many queries (prefixes) do you use for computing the bin index as described in Lines[261-266]?
soundness: 2
strengths: 1. The writing is easy to follow.

2. Propose a smoothing attack scheme against statistical watermarking, and show that the significance level $S_t$ is highly correlated with the total variation distance.
summary: The paper introduces a "smoothing attack" that bypasses statistical watermarking in large language models (LLMs). By blending outputs from the watermarked model with a weaker reference model, it removes watermarks without impacting text quality on PPL.
weaknesses: 1. The applicability of this method is limited, as obtaining a high-quality reference model is often not possible (e.g. for GPT-4). Additionally, it requires access to token logits, meaning it is not a purely black-box approach as claimed.

2. In line 146. The authors overclaim that their attack is universally applicable to all statistical watermarking schemes. However, many watermarking schemes [1,2,3] do not use a green list, and their proposed method cannot be applied.

3. Additional metrics are needed to better reflect the quality of the generated text. PPL tends to favor a distribution similar to that of the oracle model, which can introduce bias. It would be more informative to include straightforward metrics, such as BLEU in machine translation, to provide a clearer evaluation.

4. The paper lacks key baseline results needed to demonstrate the effectiveness of the proposed method.  Naive smoothing using $\lambda \tilde{P}(x)+(1-\lambda) P^{ref}(x)$ can also remove the watermark while preserving part of the text quality.

5. The choice of z-score threshold used in the experiments is unclear. It would be more straightforward to present the true positive rates at specific theoretical false positive rates, providing a clearer understanding of the method’s performance.

6. The experimental settings for certain tests are suboptimal. For instance, in Table 2, the z-score for XSIR and SIR is too low, indicating that the watermark strength in the original watermarked model is insufficient.

[1] Kuditipudi, R., Thickstun, J., Hashimoto, T. and Liang, P., 2023. Robust distortion-free watermarks for language models. arXiv preprint arXiv:2307.15593.

[2] Hu, Z., Chen, L., Wu, X., Wu, Y., Zhang, H. and Huang, H., 2023. Unbiased watermark for large language models. arXiv preprint arXiv:2310.10669.

[3] Dathathri, S., See, A., Ghaisas, S., Huang, P.S., McAdam, R., Welbl, J., Bachani, V., Kaskasoli, A., Stanforth, R., Matejovicova, T. and Hayes, J., 2024. Scalable watermarking for identifying large language model outputs. Nature, 634(8035), pp.818-823.

Meta-review: **Paper Summary:**

The paper proposes an attack on distortionary text watermarks, using text from an unwatermarked weak LM to rewrite text from a strong watermarked LM in a way that erases the watermark.

**Strengths:**

The attack is interesting and it is simple: a token-level intervention, as opposed to more complicated paraphrasing attacks studied in prior work, e.g., Zhang et al. (ICML,  2024).

**Weaknesses:**

Reviewers a4FL and NfPb note that the attack relies on access to top-k probabilities of the watermarked language model. These are often, but not always available.

Reviewers f25P, NfPb, and RzfD observe that this attacked is not applicable to distortion-free watermarks.

Decision: Reject