Adaptive Text Watermark for Large Language Models

Yepeng Liu, Yuheng Bu

Introduction

As Large Language Models (LLMs) become increasingly integrated into daily digital interactions, the risks associated with their misuse—ranging from academic plagiarism to the automated generation of disinformation—have grown significantly. Digital watermarking has emerged as a critical defense mechanism, allowing for the identification of AI-generated content by embedding hidden signals during the text generation process. However, traditional watermarking techniques often struggle to balance the competing demands of robustness, security, and linguistic quality. This paper presents an adaptive watermarking strategy designed to address these challenges by selectively embedding signals in high-uncertainty tokens and utilizing semantic embeddings for key generation.

The Watermarking Trilemma

Existing watermarking methods typically face a "trilemma" where optimizing for one attribute often degrades the others:

  1. Robustness: The ability of the watermark to survive post-generation edits, such as paraphrasing or word swapping.
  2. Security: Resistance to reverse-engineering or "spoofing attacks," where an attacker attempts to deduce the watermarking rules (e.g., green-listed tokens) through frequency analysis.
  3. Text Quality: Maintaining the natural flow and coherence of the text. Forcing specific tokens into a sequence often increases "perplexity," making the output sound unnatural or repetitive.

Methodology

The proposed adaptive framework consists of three primary pillars designed to resolve this trilemma.

1. Adaptive Watermark Token Identification (AWTI)

Rather than applying a watermark to every token in a sequence, the AWTI module uses a small auxiliary "Measurement Model" (such as GPT-2) to calculate the entropy, or uncertainty, of the next token. If the model is highly certain about a specific token (low entropy), the system leaves it untouched to preserve the intended meaning and quality. The watermark is only embedded when the model faces multiple valid choices (high entropy), ensuring that the perturbation is less noticeable to the reader.

2. Semantic-based Logits Scaling Vector Extraction (SLSVE)

Traditional watermarking often relies on the hash of the previous token to generate a "key" for the current token. This approach is fragile; changing a single word can break the entire chain. The SLSVE method replaces simple hashes with a Sentence Embedding Model. By capturing the semantic meaning of the preceding text, the generated key remains stable even if the text is slightly paraphrased, significantly increasing robustness against editing attacks.

3. Adaptive Watermark Temperature Scaling (AWTS)

To further protect text quality, the researchers introduced AWTS. Instead of adding a fixed value to the probability of "green" tokens, this method scales the raw model outputs (logits) proportionally. This ensures that the watermark strength adapts to the original probability distribution, boosting likely tokens more than unlikely ones and preventing the model from outputting nonsensical text to satisfy the watermark requirement.

Experimental Evaluation

The researchers evaluated the framework using the C4 (RealNewsLike) dataset for general web text and the ELI5 (Explain Like I'm Five) dataset for long-form question answering. A specialized Sentence-Compression Dataset was also utilized to train the Semantic Mapping Model.

Key Results

  • Robustness: The method demonstrated exceptional resilience. Under heavy paraphrase attacks using models like GPT-3.5 or DIPPER, the system maintained a high ROC-AUC of up to 0.98. In contrast, the popular KGW baseline often saw performance drop below 0.80 under similar conditions.
  • Text Quality: Perplexity scores for the watermarked text were nearly identical to those of un-watermarked text. Human and automated evaluations found the adaptive text to be indistinguishable from standard AI-generated or human-written content in terms of fluency.
  • Security: The method proved highly resistant to spoofing. In simulations, the "decryption rate" (the attacker's ability to guess the watermark pattern) was only 0.571, a significant improvement over the 0.963 rate observed in simpler fixed-list methods.

Discussion and Future Work

The core insight of this research is that watermarking is most effective when it respects the underlying distribution of the language model. By using entropy as a quality guard and semantics as a robustness anchor, the adaptive approach overcomes the limitations of syntax-heavy watermarking.

However, the method does introduce some computational overhead due to the requirement of an auxiliary model (like GPT-2) running alongside the primary LLM. Additionally, hyperparameters such as the entropy threshold ($\alpha$) and watermark strength ($\delta$) currently require manual tuning for different models. Future research will focus on automating this tuning process and providing deeper theoretical guarantees for semantic-based watermarking performance.

BibTeX
@inproceedings{liu2024adaptive,
  author = {Yepeng Liu and Yuheng Bu},
  title = {{Adaptive Text Watermark for Large Language Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=7emOSb5UfX},
}
Figure