Publicly-Detectable Watermarking for Language Models

Jaiden Fairoze, Sanjam Garg, Somesh Jha, Saeed Mahloujifar, Mohammad Mahmoody, Mingyuan Wang

Abstract

This paper introduces a publicly detectable watermarking scheme for Large Language Models (LLMs) that allows any party to verify if a text was AI-generated using a public key. Unlike traditional private watermarking, this approach does not require access to the model's private weights or secret keys. By combining cryptographic signatures with error-correcting codes (ECC) and rejection sampling, the authors develop a "distortion-free" system where watermarked text is statistically indistinguishable from standard model output, even in low-entropy sequences.

Introduction

As Generative AI becomes ubiquitous, the ability to distinguish between human-written and AI-generated content is critical for mitigating misinformation and academic dishonesty. Current detection methods generally fall into two categories: post-hoc "black-box" classifiers and private watermarking. Classifiers often suffer from high false-positive rates as model outputs improve. Private watermarking, while more reliable, requires a shared secret key, creating privacy risks and potential conflicts of interest where the model provider is the sole arbiter of detection.

To address these issues, the authors propose a Publicly-Detectable Watermarking Scheme (PDWS). This method allows a model provider to sign outputs with a private key while enabling the public to verify the watermark using a standard public key infrastructure.

Methodology

The core of the PDWS is a three-step "gadget" designed to embed the watermark without degrading text quality.

  1. Extract: The model generates an initial block of tokens. These tokens are hashed to produce two values, $h_1$ and $h_2$.
  2. Sign & Encode: The model signs $h_1$ using its private cryptographic key. This signature is passed through an Error-Correcting Code (ECC) and XORed with $h_2$ (acting as a one-time pad). This ensures the resulting bitstring appears as random noise, preserving distortion-freeness.
  3. Plant: The resulting bits are embedded into subsequent token blocks using rejection sampling. The model samples tokens until it finds a sequence that hashes to the required watermark bit.
The core gadget for embedding the watermark, illustrating the Extract and Plant phases.

A significant innovation is the use of ECC to overcome the "entropy barrier." In predictable text sequences (e.g., "The capital of France is..."), the model has limited choices. If the natural output does not match the required watermark bit, standard schemes fail. By treating low-entropy generation as a noisy channel, ECC allows the detector to recover the signature even if some bits could not be embedded.

The cryptographic setup algorithm for generating public and secret keys.

Experimental Evaluation

The researchers evaluated the scheme across several open-weights models, including Mistral 7B, Llama 2 (13B and 70B), and OPT 2.7B. They used the "news-like" subset of the C4 dataset to provide realistic prompts. To assess text quality and distortion-freeness, GPT-4 Turbo was employed as an automated judge to compare watermarked text against standard outputs.

Results and Discussion

The evaluation yielded several key insights:

  • Quality Preservation: GPT-4 scoring showed no statistically significant difference in quality between plain and watermarked text, with mean scores remaining consistent across protocols.
  • Detection Efficiency: Public verification is remarkably fast, taking approximately 0.01s in the authors' implementation. This is orders of magnitude faster than symmetric methods that require complex search spaces.
  • Generation Performance: While rejection sampling introduces overhead, the scheme was roughly twice as fast as leading symmetric baselines because it avoids expensive vocabulary reductions.
  • Cryptographic Unforgeability: The use of digital signatures ensures that adversaries cannot forge watermarks on human-written text without the provider's private key.

Conclusion

The proposed PDWS shifts the power of AI detection from centralized providers to the public, enabling decentralized auditing. While the current implementation requires approximately 1,000 tokens to embed a secure signature—making it unsuitable for short-form content like tweets—it represents a major step forward in robust, transparent AI attribution. Future work will focus on improving embedding compactness and resilience to heavy text editing or paraphrasing.

Summary updated

BibTeX
@article{fairoze2024publicly,
  author = {Jaiden Fairoze and Sanjam Garg and Somesh Jha and Saeed Mahloujifar and Mohammad Mahmoody and Mingyuan Wang},
  title = {{Publicly-Detectable Watermarking for Language Models}},
  journal = {IACR Commun. Cryptol.},
  year = {2024},
  doi = {10.62056/ahmpdkp10},
}
Figure