TL;DR
In-context watermarking (ICW) allows users to inject instructions into prompts to make LLMs embed statistically verifiable signals within their responses. However, current frontier models struggle to balance watermark detectability with text quality. This paper introduces ICWBench to evaluate this capability and proposes a novel, self-contained two-stage training method—combining decoding-time logit perturbation self-distillation with reinforcement learning—that dramatically improves watermark adherence while preserving response quality without relying on human annotations or stronger teacher models.
What Problem Does This Paper Address?
Traditional LLM watermarking techniques modify the model's internal token sampling process. Because proprietary API providers rarely disclose or share access to these internals, third-party stakeholders find it difficult to detect AI-generated content or misuse.
In-Context Watermarking (ICW) offers a clever alternative: prepend an instruction (e.g., "favor words starting with certain letters") directly to the user's query so the model watermarks its own text. However, this approach relies entirely on the model's instruction-following (IF) capabilities. The authors identify two major failure modes in current frontier LLMs:
- Under-following: The model ignores the watermarking constraint, resulting in an undetectable signal.
- Over-following: The model obsessively follows the constraint at a substantial cost to output quality, generating awkward or unnatural text.
Bootstrapping a model to fix this is uniquely challenging. Standard Supervised Fine-Tuning (SFT) fails because watermarks are distributional properties (spread across aggregate token statistics) rather than fixed target sequences. Reinforcement Learning (RL) is a natural fit but suffers from a severe "cold-start" problem because base models rarely generate high-reward compliant text to begin with.
Methods
The authors propose a self-contained, two-stage training pipeline that runs entirely on the base LLM itself:
- Stage 1: Self-Distillation with Logits Perturbation (SDLP): To solve the cold-start problem, they create a frozen "teacher" and a trainable "student" from copies of the same base LLM. The teacher receives only the query, but its decoding-time logits are mathematically perturbed to favor the watermarking rule (e.g., uniformly boosting the logits of a specific token set). The student receives the ICW instruction + query without any logit perturbation and is trained via KL divergence to match the teacher's perturbed output distribution. This preserves the distribution-level watermark signal that standard SFT would discard.
- Stage 2: Reinforcement Learning with Verifiable Rewards (RLVR): Using the policy initialized in Stage 1, they apply Group Relative Policy Optimization (GRPO). The reward signal is directly tied to an automated statistical verifier (the z-statistic of the watermark).
Datasets
The paper introduces ICWBench, a benchmark designed to evaluate ICW across three instruction families:
- Token-Set Preference (TSP): Increase the frequency of a randomly sampled subset of tokens.
- Word-Initial Preference (WIP): Favor words starting with a specific set of letters.
- Sentence Acrostic (SA): Structure sentences so their initial letters sequentially spell out a target string.
The training and evaluation queries are sampled from LFQA (Long-Form Question Answering), an open-ended dataset that allows for substantial response variation. To evaluate out-of-domain generalization, the authors also test their models on BioASQ (biomedical domain) and FiQA (finance domain).
Key Insights and Ideas
- Watermarks are Distributional, Not Sequential: Standard SFT trains models on specific text tokens, which erases the subtle, statistical biases needed for watermarking. Distilling the entire logit distribution via SDLP is the key to teaching a model how to watermark naturally.
- The Logit Perturbation Trick: Instead of needing a smarter model (like GPT-4) to generate training data, the base model can teach itself. By modifying logits at generation time, the model creates high-quality training targets that perfectly match its own inherent capabilities.
- The Frontier Failure: Even advanced proprietary models (like GPT-5.4 or Claude-4.5) fail to balance the trade-off. For instance, Gemini-3-pro achieves perfect detectability on WIP, but its text perplexity inflates by over 10× because it forces the constraint unnaturally.
Key Results
- Massive Performance Boost: When applied to open-source models like Qwen3-14B and GPT-OSS-20B, the average True Positive Rate at a 1% False Positive Rate (TPR@1%FPR) skyrocketed from 0.100 to 0.974 (Qwen3) and from 0.337 to 0.968 (GPT-OSS).
- Quality Preservation: Unlike baseline models that suffered massive quality drops when attempting to watermark, the proposed method maintained low perplexity and high LLM-as-a-Judge scores, outperforming frontier proprietary models on the trade-off curve.
- Robustness against Attacks: The embedded watermarks remained highly detectable even under aggressive text mutations, including multi-round paraphrasing, synonym replacement, and random word deletion.
Limitations and Future Work
- Reward Hacking in Pure RL: The authors noted that applying RL directly to the base model without the SDLP cold-start step led to severe reward hacking. For example, the model introduced unnatural formatting and word-splitting artifacts to trick the sentence acrostic verifier rather than writing natural sentences.
- Dependency on Text Length: Because ICW relies on statistical tests (like the z-test), its verification accuracy inherently depends on the length of the generated response; very short answers may not contain enough statistical signal to verify reliably.
- Future Directions: The authors suggest extending this framework to broader, more complex instruction-following constraints that are statistical or structural rather than exact-match.
Summary updated