Abstract
Detecting AI-generated text is increasingly vital for maintaining academic integrity and preventing misinformation. While watermarking techniques—biasing Large Language Models (LLMs) toward specific "green-list" tokens—are effective for natural language, they often fail in low-entropy contexts like computer code. This paper introduces Entropy-based Text Watermarking Detection (EWD), a training-free method that weights tokens based on the model's predictive entropy. By prioritizing tokens where the model had greater choice, EWD significantly improves detection accuracy in structured text without compromising efficiency.
Introduction
As Large Language Models (LLMs) become integrated into professional and academic workflows, the ability to distinguish machine-generated content from human writing is critical. Watermarking offers a proactive solution by embedding a statistical signal during generation. However, current detection methods treat all tokens equally, leading to poor performance in "low-entropy" scenarios. In highly structured text, such as Python code or technical documentation, the model's choices are often constrained by syntax, leaving little room for the watermark's "nudge" to take effect. Standard detectors frequently misidentify these watermarked low-entropy sequences as human-written.
Methodology: Entropy-Aware Weighting
The proposed Entropy-based Text Watermarking Detection (EWD) shifts the detection paradigm from simple token counting to weighted analysis.
- Spike Entropy Calculation: EWD calculates the entropy at each token position. High entropy indicates the LLM had many viable options, while low entropy suggests a deterministic choice.
- Dynamic Weighting: Instead of a binary threshold, EWD uses continuous functions (e.g., Sigmoid, Linear, or Exponential) to map entropy to a weight. Tokens in high-entropy positions—where the watermark bias is most likely to have influenced the choice—are given higher significance in the final z-score.
- Training-Free Integration: EWD requires no additional training or manual thresholding, making it a plug-and-play enhancement for existing watermarking frameworks like KGW.
Experimental Setup
The researchers evaluated EWD across diverse datasets to test its robustness:
- Low-Entropy Tasks: Python code generation using the HumanEval and MBPP datasets, with code generated by StarCoder.
- High-Entropy Tasks: Natural language generation using C4 (news) and Rotowire (sports data), with text generated by OPT-1.3B and fine-tuned T5-small.
Key Results
EWD demonstrated substantial improvements over baselines like KGW and SWEET, particularly in code detection.
- Superior Code Detection: On the HumanEval dataset, EWD achieved a True Positive Rate (TPR) of 0.466 at a 1% False Positive Rate (FPR), outperforming KGW's 0.331. On MBPP, the improvement was even more stark: a TPR of 0.567 for EWD versus 0.115 for KGW.
- Consistency in Natural Language: In high-entropy news tasks, EWD maintained near-perfect detection (TPR ~1.0), matching state-of-the-art performance while providing the added benefit of low-entropy accuracy.
- Computational Efficiency: EWD adds minimal overhead, requiring approximately 0.08 seconds per detection, ensuring it remains viable for real-time applications.
Conclusion and Future Work
EWD addresses a critical gap in AI text detection by accounting for the "nudgeability" of tokens based on local entropy. While highly effective for logit-biasing watermarks in code and text, future research will focus on extending this entropy-weighting logic to sampling-based watermarking methods and exploring its performance on other structured formats like legal and mathematical text.
Summary updated