Efficiently Identifying Watermarked Segments in Mixed-Source Texts

Xuandong Zhao, Chenwen Liao, Yu-Xiang Wang, Lei Li · Submission to ICLR 2025 · Withdrawn

Introduction

As Large Language Models (LLMs) become increasingly proficient, distinguishing AI-generated text from human writing is a growing challenge. Watermarking—embedding subtle statistical patterns into LLM output—has emerged as a leading solution to mitigate misuse cases like fake news and academic dishonesty. However, most current detectors are "all-or-nothing": they analyze an entire document to decide if it is watermarked.

In the real world, "mixed-source" texts are far more common. A student might write most of an essay but use an LLM for a few paragraphs, or a malicious actor might insert AI-generated misinformation into a legitimate news article. In these scenarios, the watermark signal is diluted by the surrounding human text, causing standard document-level detectors to fail. Finding these specific segments is a "needle in a haystack" problem that previously required computationally expensive brute-force searches (with $O(n^2)$ complexity), making them impractical for long documents.

A Two-Stage Detection Framework

To address this, the authors propose a highly efficient two-stage framework capable of pinpointing watermarked text with high precision in $O(n \log n)$ time.

1. Geometric Cover Detector (GCD)

Instead of checking every possible sub-segment, the GCD uses a "Geometric Cover" strategy. It partitions the text into a specific set of overlapping intervals of varying lengths (scaling by powers of 2: 2, 4, 8, 16, etc.). Mathematically, this ensures that any watermarked segment of length $L$ will contain at least one geometric cover interval that is at least $L/4$ in length. This clever partitioning reduces the search space from $O(n^2)$ to $O(n \log n)$ while maintaining high detection sensitivity.

2. Adaptive Online Locator (AOL)

Once a watermark is suspected by the GCD, the AOL pinpoints its exact boundaries. It treats the localization problem as a sequence denoising task. Each token's watermark score is viewed as a "noisy" observation of whether that token is AI-generated. AOL uses an adaptive online smoothing method (the Aligator algorithm) to filter this noise and produce a clean estimate of the watermark's location. To fix "edge effects" where online algorithms struggle at the very beginning or end of a sequence, the authors introduced Circular Aligator, which treats the text as a circular buffer and runs multiple passes from random starting points.

Illustration of the multi-scale detection and localization process.

Experimental Setup

The researchers evaluated their framework using mixed-source samples created by embedding 300-token AI segments into 3000-token human contexts (a 10% ratio).

  • Datasets: C4 (news-like web text) and Arxiv (scientific abstracts and articles).
  • Models: LLaMA-7B and Mistral-7B.
  • Watermarking Schemes: KGW-Watermark, Unigram-Watermark, and Gumbel-Watermark.

Key Insights and Results

Treating localization as a signal processing (denoising) problem rather than a sequence labeling problem allows the system to be "watermark-agnostic." It works effectively as long as the underlying watermark provides a token-level score. The multi-scale analysis ensures the detector "zooms in" and "zooms out" appropriately, balancing signal strength and noise.

  • Superior Detection: GCD consistently outperformed "Vanilla" document-level detectors. For example, on the C4 dataset with Mistral-7B, GCD achieved nearly 100% True Positive Rate (TPR) at very low False Positive Rates, while the Vanilla detector struggled significantly to find the diluted signal.
  • Precise Localization: AOL achieved an average Intersection over Union (IoU) score of over 0.55, far exceeding baseline methods like RoBERTa-based classifiers, which often failed to find boundaries accurately.
  • Massive Speedup: By moving from $O(n^2)$ to $O(n \log n)$, the authors made segment-level detection viable for production systems. Compared to the brute-force WinMax-1 algorithm (which can take over an hour per sample), AOL takes about 2 seconds—a roughly 1600x speedup—while maintaining comparable localization accuracy.
Comparison of True Positive Rates (TPR) between the baseline (VANILLA) and the proposed GCD across different datasets and models.

Limitations and Future Work

While highly efficient, the system's performance is ultimately capped by the quality of the original watermark. If the LLM generates very low-entropy text or the watermark is inherently weak, detection remains difficult. Additionally, very short AI-generated snippets (e.g., a single sentence) still present a challenge because they lack sufficient statistical evidence to overcome the "noise" of surrounding human text. Future work will explore how these methods hold up against more sophisticated "copy-paste" attacks or heavy manual editing of the AI-generated segments.

Summary updated

BibTeX
@inproceedings{zhao2024efficiently,
  author = {Xuandong Zhao and Chenwen Liao and Yu-Xiang Wang and Lei Li},
  title = {{Efficiently Identifying Watermarked Segments in Mixed-Source Texts}},
  booktitle = {SafeGenAi @ NeurIPS},
  year = {2024},
  url = {https://openreview.net/forum?id=6jDPXFtebD},
}
Figure