A Likelihood Based Approach for Watermark Detection

Xingchi Li, Guanxun Li, Xianyang ZhangAISTATS 2025

Abstract

Watermarking techniques embed statistical signals within content generated by large language models to help trace its source. Although existing methods perform well on long texts, their effectiveness significantly decreases for shorter texts. We introduce a statistical detection approach that improves the power of watermark detection, particularly in shorter texts. Our method leverages both the watermark key sequence and the next token probabilities (NTPs) to determine whether a text is generated by a large language model. We demonstrate the optimality of our approach and analyze its power properties. We also investigate an approach to estimating NTPs and extend our method to scenarios where texts face potential attacks such as substitutions, insertions, or deletions. We validate the effectiveness of our technique using texts generated by Meta-Llama-3-8B from Meta and Mistral-7B-v0.1 from Mistral AI, utilizing prompts extracted from Google's C4 dataset. In scenarios without attacks and with short text lengths, our method demonstrates approximately 65% power improvement compared to the baseline method on average.

Introduction

As Large Language Models (LLMs) become increasingly capable of generating human-quality text, the need for reliable provenance tools has grown. Watermarking—embedding a hidden statistical signal in the text—is a primary solution for identifying AI-generated content. However, most current watermarking schemes, such as Exponential Minimum Sampling (EMS), suffer from a "short-text problem." When a generated text is only a few sentences long, the statistical signal is often too weak to distinguish from random noise, leading to high false-negative rates. This paper addresses this gap by introducing a likelihood-based detection framework that utilizes the model's internal probabilities to amplify the watermark signal.

Methodology

The core contribution of this work is a shift from frequency-based detection to a Likelihood Ratio (LR) test.

The Likelihood Ratio Test

Instead of treating every token as equally informative, the authors prove that tokens with lower Next Token Probabilities (NTPs) carry more information about the watermark. By weighting tokens based on their NTPs, the detector becomes significantly more sensitive. This LR-based test is theoretically demonstrated to be the "Most Powerful" test in the Neyman-Pearson sense for detecting watermarks under the EMS framework.

Prompt Estimation and Robustness

In practical scenarios, a detector often lacks the original prompt used for generation, which is necessary to calculate NTPs. To solve this, the authors propose a greedy optimization method that searches through potential instructions to maximize the likelihood of the observed text, effectively recovering the context. Furthermore, to handle adversarial attacks such as deletions, insertions, or substitutions, a scanning window approach is implemented to detect signals within substrings.

Experimental Results

The approach was evaluated using Meta-Llama-3-8B and Mistral-7B-v0.1 models with prompts from Google’s C4 dataset. The proposed "Oracle" (using true NTPs) and "Optim" (using estimated NTPs) methods were compared against the standard baseline.

Detection power comparison across different text lengths and metrics.

As shown in Figure 1, the proposed likelihood-based methods significantly outperform the baseline, especially at short text lengths. For sequences of length $m=10$ (approximately 8 words), the "Optim" method achieves a power near 0.8, representing a massive improvement over the baseline which sits around 0.55.

Robustness to Edits

The framework also maintains high performance under text-editing attacks. Even when substantial portions of the text are modified, the "Optim" method remains resilient compared to existing baselines.

Detection power under substitution attacks for varying text lengths (m) and attack percentages.

Table 1 (Figure 5) illustrates that the "optim" method consistently provides higher detection power than the baseline across different attack intensities. For instance, at a text length of $m=30$ with a 30% substitution attack, the "optim" method maintains a power of 0.733, significantly higher than the baseline's 0.568.

Conclusion

By leveraging Next Token Probabilities and a Likelihood Ratio framework, this research provides a robust solution to the short-text watermarking problem. The method not only improves detection power by an average of 65% for short sequences but also demonstrates strong resilience against common text-editing attacks. Future work will focus on reducing the computational cost of prompt estimation and exploring semantic-level watermarking to further enhance security against paraphrasing.

Summary updated

BibTeX
@inproceedings{li2025likelihood,
  author = {Xingchi Li and Guanxun Li and Xianyang Zhang},
  title = {{A Likelihood Based Approach for Watermark Detection}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2025},
  url = {https://openreview.net/forum?id=S2QoDt4bw4},
}
Figure