Abstract: Recent advances in the capabilities of large language models such as GPT-4 have spurred increasing concern about our ability to detect AI-generated text. Prior works have suggested methods of embedding watermarks in model outputs, by noticeably altering the output distribution. We ask: Is it possible to introduce a watermark without incurring any detectable change to the output distribution? To this end, we introduce a cryptographically-inspired notion of undetectable watermarks for language models. That is, watermarks can be detected only with the knowledge of a secret key; without the secret key, it is computationally intractable to distinguish watermarked outputs from those of the original model. In particular, it is impossible for a user to observe any degradation in the quality of the text. Crucially, watermarks remain undetectable even when the user is allowed to adaptively query the model with arbitrarily chosen prompts. We construct undetectable watermarks based on the existence of one-way functions, a standard assumption in cryptography.
Introduction
As Large Language Models (LLMs) become increasingly sophisticated, the line between human-written and AI-generated text continues to blur. While post-hoc detectors attempt to identify statistical patterns in AI text, they are often unreliable and easily bypassed by paraphrasing. To address this, researchers have turned to "watermarking"—the practice of intentionally biasing a model’s token selection to embed a hidden signature.
However, existing watermarking schemes often suffer from a critical flaw: they noticeably alter the probability distribution of the text. This "distribution shift" can degrade output quality and allow sophisticated users to detect the presence of a watermark simply by observing model behavior over multiple queries. This paper, presented at COLT 2024, introduces a rigorous cryptographic framework for watermarking LLM outputs that ensures the text remains statistically indistinguishable from original model outputs to anyone without a secret key.
The Problem: Distribution Shift and Detectability
Previous methods, such as the popular Kirchenbauer et al. approach, create a "green list" and "red list" of tokens, biasing the model toward the green list. While effective for detection, this method changes the model's behavior. An adversarial user could potentially detect this bias through adaptive querying. The authors of this paper ask a fundamental question: Is it possible to watermark a model so that even an adversarial user cannot distinguish between a watermarked and an unwatermarked version?
A Cryptographic Approach to Watermarking
The proposed solution treats watermarking as a cryptographic problem, building a construction based on the existence of one-way functions. The mechanism relies on several key innovations:
- Binary Reduction: The authors demonstrate that any LLM, which typically outputs a distribution over a large vocabulary, can be mathematically modeled as a series of binary choices.
- Pseudorandom Function (PRF) Mechanism: A secret key and a PRF are used to generate a sequence of "target" values for each token choice.
- Distribution-Preserving Sampling: The watermarked model samples tokens such that they match the PRF's target value only if they align with the model's original probability distribution. This ensures the probability of any specific token being chosen remains identical to the original model, preserving text quality perfectly.
- The Nonce Strategy: To maintain security across multiple responses, the scheme uses a high-entropy prefix of the generated text as a "nonce" (a one-time seed) for the PRF. This prevents users from spotting recurring patterns across different outputs.
The Role of Empirical Entropy
A central insight of the paper is the "tug-of-war" between undetectability and detectability. The authors prove that a watermark can only be embedded if the model's response contains sufficient "randomness" or empirical entropy. Deterministic outputs (e.g., "2+2=4") cannot be watermarked without changing the distribution. Consequently, detection is guaranteed only for creative or high-entropy outputs where multiple valid continuations exist.
Key Results and Theoretical Guarantees
The authors provide formal mathematical proofs for several critical properties of their scheme:
- Undetectability (Theorem 11): The difference between the original and watermarked distributions is computationally indistinguishable (negligible) to any user without the secret key.
- Completeness: The watermark is detectable with high probability, provided the text has sufficient empirical entropy (roughly proportional to the square root of the text length).
- Soundness: The probability of a "false positive" (misidentifying human text as AI-generated) is cryptographically small.
- Robustness: The scheme allows for detection even if only a contiguous substring of the original output is available.
Limitations and Future Directions
While the framework provides a major leap in stealthy watermarking, challenges remain. The authors acknowledge a paraphrasing vulnerability: because the watermark relies on specific token sequences, significant editing or paraphrasing by a user can destroy the signature. Additionally, they prove a "negative" result (Theorem 13) regarding API constraints: if a model's API allows users to specify a prefix for the response, a clever user could potentially strip the watermark.
Future work remains to develop undetectable watermarks that are robust to heavy editing while maintaining the rigorous security guarantees established in this study.
Summary updated