Skip to content

Duwak: Dual Watermarks in Large Language ModelsDuwak: Dual Watermarks in Large Language Models

arXiv· arXiv:2403.13000· Chaoyi Zhu, Jeroen Galjaard, Pin-Yu Chen, Lydia Y. ChenTU Delft; IBM ResearchIndexed by this site · 27 days ago· Originally publishedDefenses

Quick read

Defenses

Based on the paper PDF (AI-generated); refer to the original

The authors propose a dual watermarking scheme, Duwak; on Llama2-7b, the number of tokens required for detection is at most 70% lower than existing methods, and text quality is close to that of unwatermarked text.

Threat modelThe defender (the watermark owner) embeds a human-imperceptible, machine-detectable watermark in LLM-generated text to trace the source of the content; the attacker post-edits the generated text (nine categories including contraction, lowercase, misspelling, swap, synonym, translation, TypoAttack, GPT-3.5 paraphrase, etc.), and the detector, holding the private key and without knowing whether the text contains a watermark, performs a hypothesis test to decide.

Questions
LLM text watermarks need to remain reliably detectable on short texts and under post-editing attacks; the authors argue that existing single-watermark methods require a relatively high minimum number of tokens to reach detection significance, limiting practicality.
Methods
Duwak embeds two independent watermarks simultaneously in the token probability distribution (green-list logit bias) and in the sampling scheme (contrastive search); at detection time it computes the p-value for each and then combines them using Fisher's method; contrastive search samples low-similarity tokens to reduce repetition and maintain text quality.
Experiments and results
On Llama2-7b and Vicuna-7b-v1.5, 4 single watermarks and their combinations are compared: without attacks Duwak requires 94.5 tokens (KGW 113, EXP 89.5); under the paraphrase attack Duwak requires 193 tokens, lower than KGW 322 and EXP 238; the authors state a reduction of up to 70% in tokens.
Limitations and future work
The authors note: the effectiveness depends on the evaluated models such as Llama2, and applicability to other models remains to be verified; the evaluation is limited to text generation tasks, and extending to mathematical proofs and code generation remains to be studied; the two independent detections make detection time efficiency lower than that of single-watermark methods.
Experimental setupLlama2-7b、Vicuna-7b-v1.5 · WebText、MarkMyWords et al. · Diversity、MAUVE et al.
Evaluated models
Llama2-7bVicuna-7b-v1.5
Benchmarks
WebTextMarkMyWordsWikitext
Metrics
DiversityMAUVERatingDetection efficiencyempirical FPR
AI summaryDuwak embeds dual watermarks in the token probability distribution and sampling scheme of large language models, requiring at most 70% fewer tokens for detection than existing methods. To mitigate the degradation of expression biased toward specific tokens, its sampling-scheme watermark uses contrastive search, reducing token repetition and improving diversity. On Llama2, against post-editing attacks such as paraphrasing, Duwak achieves the highest watermark text quality with the fewest detection tokens, outperforming four state-of-the-art watermarking techniques.

Duwak embeds dual watermarks in the token probability distribution and sampling scheme of large language models, requiring at most 70% fewer tokens for detection than existing methods. To mitigate the degradation of expression biased toward specific tokens, its sampling-scheme watermark uses contrastive search, reducing token repetition and improving diversity. On Llama2, against post-editing attacks such as paraphrasing, Duwak achieves the highest watermark text quality with the fewest detection tokens, outperforming four state-of-the-art watermarking techniques.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The authors state that the minimum number of tokens required for detection by existing single-watermark LLM methods is relatively high, and propose the dual watermark Duwak to improve detection efficiency and text quality.

    Core question: how to reduce the minimum number of tokens required for reliable detection of LLM text watermarks without sacrificing the quality of the generated text.

    • Scenario and motivation: LLMs are widely used for copywriting, translation, question answering, and code generation. The authors argue that watermarks are needed to audit usage, trace the source of generation, and prevent misuse, and that government policies have also put forward related requirements.
    • Shortcomings of existing methods: The authors state that existing watermarks mostly embed a single pattern in the token probability distribution or in the sampling scheme, and that on short texts and post-edited texts the minimum number of tokens required to reach low false-positive-rate detection is relatively high, limiting practicality.
    • Core observation: The authors argue that adding a bias to the probability distribution distorts the distribution and degrades text quality; contrastive search samples low-self-similarity tokens, which can reduce repetition and improve diversity, making it suitable as a second watermark carrier to offset the quality loss.
    • Proposed method: They propose Duwak, which embeds two independent secret patterns in the token probability distribution and in the sampling scheme, and takes the union of the two watermarks at detection time; they also give a theoretical analysis of the interdependence of the two watermarks.
    • Threat model (defender's perspective):
      • Defender's goal: embed a watermark in generated text that is imperceptible to humans and detectable by machines, for the owner holding the private key to trace and audit.
      • Attacker capability: post-edit the generated text; the evaluation covers nine attack types including contraction, lowercase, misspelling, swap, synonym, translation, TypoAttack, and GPT-3.5 paraphrase.
      • Detector: uses the private key to perform a hypothesis test to decide whether the text contains the watermark, requiring a low false-positive rate (p-value threshold 0.02/0.05).
      • Victim/protected system: open-ended generation on Llama2-7b and Vicuna-7b-v1.5, and the MarkMyWords structured tasks.
  2. What related research exists?

    Related work falls into three categories: probability-distribution watermarks, sampling watermarks, and machine-generated text detection; this paper is the first scheme to embed dual watermarks on a single token (as claimed by the authors).

    Probability distribution (logit) watermarks

    • Kirchenbauer et al. (2023a)—KGW: uses a key to split the vocabulary into a green/red list and adds a bias δ to the green-list logits; it is the first LLM single-bit watermark according to the paper; Zhao et al. (2023) show that a global red-green split improves post-editing robustness, and Kirchenbauer et al. (2023b) instead use a min-hash token to determine the split.
    • Multi-bit watermarks (Wang et al., 2023b; Yoo et al., 2023; Fernandez et al., 2023)—split the red-green list according to a message to embed information such as copyright and timestamps; the paper notes that such methods segment the text and embed only one watermark in probability per segment, whereas Duwak embeds at most two watermarks on a single token.
    • Lee et al. (2023b), Wu et al. (2023), Takezawa et al. (2023)—other token-level probability-modifying watermarks, described by the paper only as a category.

    Sampling scheme watermarks

    • Aaronson (2022)—EXP: exponential sampling, deterministically selecting tokens using a random vector hashed from the preceding tokens and the key, without changing the probability distribution.
    • Christ et al. (2023)—BINARY: samples by comparing the predicted probability with a pseudorandom number; Kuditipudi et al. (2023)—ITS: uses a pseudorandom sequence longer than the text and randomly selects insertion positions; Hou et al. (2023)—the sentence-level rejection-sampling watermark SemStamp.

    Machine-generated text detection (contrasting direction)

    • GLTR, DetectGPT, RADAR, etc. (Solaiman et al., 2019; Gehrmann et al., 2019; Mitchell et al., 2023; Hu et al., 2023)—detect whether text was generated by an LLM; the paper notes that they cannot trace back to a specific model, limiting their application in synthetic text governance.

    Baselines and benchmarks: the compared baselines are the single watermarks KGW, EXP, BINARY, ITS, CS (this paper's contrastive search single watermark) and the two-watermark combinations KGW-EXP, EXP-CS; the evaluation uses WebText open-ended generation and MarkMyWords (book reports, story generation, fake news) tasks, and the attack suite also comes from MarkMyWords.

    The authors position this paper as the first scheme to embed independent watermarks simultaneously in the two channels of token probability distribution and sampling scheme and to jointly detect them using Fisher's method (per the authors).

  3. How does the paper address this problem?

    Duwak sequentially embeds a probability-distribution watermark and a contrastive-search sampling watermark; at detection time it computes p-values for each and then combines them into a chi-square statistic using Fisher's method.

    Overall approach: Duwak embeds two independent secret patterns in sequence when generating each token—first modifying the token probability distribution, then using contrastive search sampling to embed the second pattern; at detection time it performs a hypothesis test for each of the two watermarks and then combines the p-values using Fisher's method, thereby reaching the same detection confidence with fewer tokens.

    Token probability watermark

    • Using the private key κtp and the hash of the previous h tokens as the RNG seed, the vocabulary is pseudorandomly split into a green/red list; the logits of green-list tokens are increased by a bias δ, and the red list is unchanged.
    • The modified probability is p̂nt = exp(lnt + 1[n ∈ G]δ) / ∑i ∈ V exp(lit + 1[i ∈ G]δ), i.e., δ is added to the green-list logits and softmax is recomputed; the larger δ is, the greater the distribution distortion.
    • The authors state this module is compatible with any probability-modifying watermark, and in practice they use the algorithm of Kirchenbauer et al. (2023b); in the experiments the green-list proportion is fixed at γ = 0.5.

    Contrastive search watermark

    • Each token enters the contrastive search set C with probability η (pseudorandomly partitioned using a second private key κcs and the hash of the preceding tokens), otherwise standard multinomial sampling is used; in the experiments η = 0.5.
    • For positions in C, only the top-k candidates with the highest probability are considered, and the token maximizing the difference between the weighted probability and the self-similarity penalty is chosen: xt = argmaxv ∈ Vt(k) (1−α)p̂vt − α sL(xvt), where sL is the maximum cosine similarity with the hidden states of the previous L tokens and α balances the two terms.
    • The sliding window L limits the range of similarity computation; the authors state this both improves generation efficiency and improves robustness because the watermark depends only on a limited context; in the experiments L = 50.

    Detection and joint decision

    • Probability watermark: count the number of green-list tokens ϕtp among T tokens and perform a Z-test to obtain Ptp = 1 − Φ(ztp).
    • Contrastive search watermark: compare the self-similarity difference score ϕcs (Equation 3) when partitioning C/C using the correct private key κcs versus M random keys; Pcs is approximated as the proportion of random-key scores not lower than the correct-key score plus one, divided by M+1.
    • Combination: −2(ln Ptp + ln Pcs) follows a chi-square distribution with 4 degrees of freedom, giving the joint p-value P = 1 − Fχ2(x, 4); the null hypothesis H0 is that the text is not watermarked.

    Theoretical analysis

    • Theorem 3.1: approximating contrastive search as uniform sampling from the top-k candidates, when E|Vtk|G ≥ ν it gives the lower bound on the expectation of the green-list token count E|x|G ≥ (ν/k)T and an upper bound on the variance; the authors state this characterizes the interdependence of the two watermarks, i.e., that they can be combined efficiently.
    • Theorem A.1 in Appendix A gives another set of expectation and variance bounds under a sampling-without-replacement approximation.

    Implementation details

    • For fair comparison, the hash input of all algorithms uses only the previous token; the dual-watermark schemes (including the baseline combinations) all use the same χ2 combined detection.
  4. What experiments did the paper conduct?

    On Llama2-7b and Vicuna-7b-v1.5, 4 single watermarks and their combinations are compared; Duwak requires 94.5 tokens without attacks, and its advantage is larger under paraphrase.

    Experimental setup

    • Models evaluated: Llama2-7b, Vicuna-7b-v1.5 (reported in Table 2 and Table 3, respectively).
    • Tasks and data: WebText open-ended generation (40 prompts, each generating at most 200 tokens) and three MarkMyWords tasks (book reports, story generation, fake news); the false-positive-rate experiment uses 10,000 samples from Wikitext (average 260 tokens).
    • Baselines: single watermarks KGW, EXP, BINARY, ITS, CS (the components of this paper used alone); two-watermark combinations KGW-EXP, EXP-CS (Table 1).
    • Metrics: Diversity (2/3/4-gram repetition rate), MAUVE, Rating (GPT-3.5 Turbo scores on a 100-point four-dimension rubric), Detection efficiency (minimum number of tokens needed to reach p=0.02, lower is better).
    • Hyperparameters: γ = 0.5, η = 0.5, L = 50, hash window h = 1 for all algorithms; attacks are the nine post-editing types from MarkMyWords.
    • Number of repetitions: the paper does not report the number of repetitions per condition; detection efficiency is a median (explained in Appendix B.4).

    Main results

    Swipe horizontally to read the table

    MethodDiversity (↑)MAUVE (↑)Rating (↑)Detection tokens (↓)
    Human93.62100.0--
    No Watermark86.6682.3687.28-
    KGW81.4175.586.15113
    EXP39.5855.8782.5689.5
    BINARY44.5655.5787.10847
    ITS78.7279.0286.25>1024
    CS86.5380.7183.74>1024
    Duwak83.9882.1886.5194.5

    According to Table 2 (Llama2-7b); the two-watermark combination KGW-EXP detects at 79.5 tokens but has Diversity of only 17.90% and MAUVE 27.03%, and EXP-CS is 572 tokens; neither is listed in the table.

    • The authors state that Duwak ranks first or second on Diversity, MAUVE, and Rating, close to unwatermarked text; KGW-EXP degrades in quality because EXP sampling is stacked on top of the probability bias.
    • Vicuna-7b-v1.5 (Table 3): Duwak Rating 83.1%, detection 82.5 tokens, KGW 101.5, EXP 71, BINARY 252, ITS >1024; without attacks EXP still has the highest detection efficiency.
    • Figure 2: at p=0.02 and 0.05, Duwak has a slightly higher rating and smaller variance in the number of tokens required across different δ; the authors state it uses about 40 fewer tokens than the best KGW configuration.

    Robustness to post-editing attacks

    • What was measured: the number of detection tokens needed to reach p=0.02 under the nine attack types (Table 4, Llama2-7b; Table 5, Vicuna).
    • Results: on Llama2, under the paraphrase (GPT3.5) attack Duwak needs 193 tokens, lower than EXP 238 and KGW 322; under TypoAttack 10%, Duwak 301, EXP 389, KGW 337; the authors state that under attacks Duwak requires 6%–70% fewer tokens than the compared methods.
    • Exceptions: without attacks EXP is best (89.5 vs Duwak 94.5); on Vicuna, under some simple attacks (contraction, swap 10%, synonym 25%, etc.) EXP requires fewer tokens; under Vicuna paraphrase EXP needs 1024 tokens, Duwak 328.
    • Authors' interpretation: Duwak's advantage comes from the two watermarks not interfering with each other, and is more pronounced under strong attacks such as paraphrase and TypoAttack.

    Effect of contrastive search and false-positive rate

    • δ sweep (Figure 3): for δ ∈ {2.5, 3, 3.5}, Duwak's detection token count is lower than KGW under the same configuration; the authors state the advantage decreases as δ increases, and at δ = 3.5 the probability distortion is large and there is little room for contrastive search to improve; under the paraphrase attack the KGW curve goes to inf, while Duwak remains finite.
    • Empirical false-positive rate (Figure 5, Appendix B.2): on 10,000 Wikitext samples, the empirical FPR of each method is not higher than the theoretical p-value; the authors state that when p < 0.1 each method tends to overestimate the FPR, KGW especially so.

    Other ablations and analyses

    • Component ablation (Table 6, Llama2-7b): without attacks Duwak 83 tokens, KGW component alone 89, CS component alone 269; under paraphrase Duwak 184, KGW component 312, CS component 1012.
    • p-value sensitivity (Figure 6): as the p-value is tightened from 0.1 to 0.01, the number of tokens required by each method increases.
    • Rating and perplexity (Figure 4): across different δ, Duwak's rating is slightly higher than KGW and its perplexity curve is lower than KGW (the same trend holds in both the no-attack and paraphrase subfigures).
  5. What are some points that can be further explored?

    The authors list three limitations: model applicability, task scope, and detection time overhead; the experiments cover only two 7B models and text generation tasks.

    Limitations and future directions noted by the authors

    • Model applicability (Section 7 Limitation): the effectiveness depends on the characteristics of the evaluated LLM (mainly Llama2); Duwak's applicability to other models and later versions needs further exploration.
    • Task scope (Section 7): the evaluation is limited to text generation tasks; extending to tasks such as mathematical proofs and code generation still requires in-depth study.
    • Detection time overhead (Section 7): Duwak must detect the two watermarks separately, so its detection time efficiency is lower than that of single-watermark methods.

    Scope of experimental coverage

    • The models evaluated are Llama2-7b and Vicuna-7b-v1.5, 2 in total (Section 4.1).
    • Tasks cover WebText open-ended generation (40 prompts, at most 200 tokens) and three MarkMyWords tasks: book reports, story generation, fake news (Appendix C.1).
    • The attack evaluation covers the nine post-editing attacks from MarkMyWords; the paraphrase attack uses GPT-3.5 (Table 4, 5).
    • Text quality scores are given by GPT-3.5 Turbo according to the four-dimension 100-point rubric in Appendix C.3; the paper does not report the agreement between the scores and human judgment.
    • The paper does not report the number of repetitions per condition or the number of generated samples (detection efficiency is reported as a median, Appendix B.4); the empirical false-positive-rate experiment uses 10,000 Wikitext samples (Appendix B.2).
  6. Summarize the main content of the paper

    Duwak embeds dual watermarks in the probability distribution and the sampling scheme, achieves detection with fewer tokens, and remains robust under nine types of post-editing attacks.

    Duwak is a dual-watermark scheme for LLM text, whose goal is to reduce the minimum number of tokens required for reliable detection while maintaining generation quality.

    • Problem: the authors state that existing single watermarks (modifying the probability distribution or modifying sampling) require a relatively high number of tokens to reach low false-positive detection on short texts and post-edited texts.
    • Method: first, a green list partitioned by a private key is used to add a bias to the logits to embed a probability watermark; then, with probability η = 0.5, contrastive search (choosing among the top-k the one with the lowest self-similarity to the previous L = 50 tokens) is used to embed a sampling watermark; at detection time the two watermarks each compute a p-value, which are combined using Fisher's method into a chi-square statistic with 4 degrees of freedom; Theorem 3.1 gives bounds on the expectation and variance of the green-list token count, and the authors state the two watermarks do not interfere with each other.
    • Main results (Llama2-7b, Table 2): without attacks Duwak requires 94.5 tokens for detection (KGW 113, EXP 89.5, BINARY 847), with Diversity 83.98% and MAUVE 82.18%, close to the 86.66% and 82.36% of unwatermarked text.
    • Attack robustness (Table 4, 5): under the GPT-3.5 paraphrase attack, Duwak requires 193 tokens on Llama2 (EXP 238, KGW 322) and 328 on Vicuna (EXP 1024); the authors state that under attacks it requires 6%–70% fewer tokens than the compared methods, summarized in the abstract as a reduction of up to 70%.
    • Exceptions: without attacks and under some simple attacks EXP requires fewer detection tokens; the two-watermark combination KGW-EXP requires only 79.5 tokens but its Diversity drops to 17.90%.
    • Authors' conclusion: joint detection of two watermarks improves detection efficiency while maintaining text quality, especially under strong attacks such as paraphrase; limitations are that the effectiveness depends on the evaluated models, only text generation tasks were evaluated, and the two detections bring extra time overhead.

Related papers

Read originalarxiv.org