TL;DR
The paper introduces In-Context Watermarking (ICW), a novel, model-agnostic approach that embeds hidden watermarks into LLM-generated text using prompt engineering alone. By leveraging the in-context learning and instruction-following capabilities of advanced LLMs, ICW empowers third parties—such as academic conference organizers—to detect AI-generated content without requiring privileged access to the model's internal decoding process or logits.
What Problem Does This Paper Address?
As large language models (LLMs) increasingly generate human-like text, distinguishing AI-generated content from human writing has become a critical challenge for maintaining accountability. A prime example is academic peer review, where dishonest reviewers might secretly use LLMs to write paper evaluations.
While existing watermarking techniques can embed imperceptible signals into text, almost all of them are "in-process" methods. They require direct access to the model's decoding process to manipulate token prediction distributions or use pseudo-random sampling. This means only the model owners (like OpenAI or Google) can implement them. Third-party organizations have to rely on post-hoc detection tools (like GPTZero), which suffer from low accuracy and high false-positive rates. The authors address this gap by creating a watermarking mechanism that can be deployed entirely via prompts, independent of the model provider.
Methods
The core idea of In-Context Watermarking (ICW) is to inject specific text-generation rules into the LLM's prompt so that the resulting output naturally carries a detectable pattern.
The authors explore two primary deployment settings:
- Direct Text Stamp (DTS): The watermarking instruction is directly provided as a system prompt.
- Indirect Prompt Injection (IPI): The instruction is covertly embedded into a source document (e.g., using white text in a submitted PDF manuscript). When a user copies the text into an LLM to generate a summary or review, the hidden instruction triggers the watermark automatically.
The paper investigates four distinct ICW strategies at different granularities:
- Unicode ICW: Instructs the LLM to insert an invisible zero-width space (
\u200B) after every word. - Initials ICW: Encourages the model to maximize the use of words starting with a predefined set of "green letters."
- Lexical ICW: Instructs the model to maximize the frequency of specific words chosen from a "green word list" (focusing on verbs, adjectives, and adverbs to preserve stylistic richness).
- Acrostics ICW: Mandates that the first letter of each sentence in the response follows a secret key sequence.
Each strategy is paired with a tailored statistical detection method (such as z-score testing or Levenshtein distance) to verify the presence of the watermark.
Datasets
The authors evaluated their methods across two distinct settings:
- DTS Setting: Evaluated using the ELI5 dataset, a long-form question-answering dataset that requires multi-sentence explanations.
- IPI Setting: Evaluated using a curated dataset of ICLR papers from 2020 to 2023, simulating a real-world academic peer-review scenario.
Key Insights and Ideas
- Watermarking Scales with Model Intelligence: A fascinating finding is that ICW's success is heavily tied to the underlying model's capability. While a smaller model like
gpt-4o-minifrequently fails or ignores complex constraints (like Acrostics or Initials), a highly capable model likegpt-o3-minifollows them remarkably well. This implies that as LLMs become smarter, prompt-based watermarking will naturally become more reliable. - The Quality-Robustness Trade-off: Different granularities offer different benefits. Unicode ICW has zero impact on text quality because the characters are invisible, but it is easily wiped out by paraphrasing. Conversely, Acrostics and Lexical ICWs alter the text structure slightly but are highly robust against editing attacks because they alter the actual choice of words or sentence structures.
Key Results
- High Detection Accuracy: When paired with
gpt-o3-mini, the Unicode, Initials, and Acrostics ICW methods achieved near-perfect detection accuracy (ROC-AUC of 1.000 or close to it) in the DTS setting. - Long-Context Reliability: In the IPI setting (peer-review scenario),
gpt-o3-minisuccessfully followed hidden instructions embedded within full-length academic papers, yielding an ROC-AUC of up to 1.000 for Unicode and 0.997 for Lexical/Initials watermarks. - Robustness Against Attacks: The Initials, Lexical, and Acrostics methods maintained high detectability even when subjected to a 30% word deletion/replacement attack or when paraphrased by another LLM.
- Outperforming Post-Hoc Tools: ICW significantly outperformed traditional post-hoc detectors like GPTZero, achieving much higher True Positive Rates at low False Positive Rates (e.g., 1.000 TPR vs. GPTZero's 0.890 TPR at a 4% False Positive Rate).
Limitations and Future Work
- Dependence on Model Capabilities: ICW is currently only viable on top-tier models with advanced instruction-following capabilities. Less powerful models tend to ignore the watermarking rules.
- Vulnerability to Prior Knowledge: If an adversary discovers the exact watermarking strategy and keys being used, they can craft targeted prompts to explicitly remove or counteract the watermark.
- Scaling Lexical Vocabularies: Current models struggle with Lexical ICW when the "green word list" becomes excessively large, as it overwhelms the model's context retrieval capacity.
- Future Directions: The authors suggest exploring more advanced prompt engineering (like chain-of-thought prompting) to improve execution, as well as explicitly training and aligning future LLMs to follow watermarking instructions as a core capability.
Summary updated