Towards Codable Watermarking for Injecting Multi-Bits Information to LLMs

Lean Wang, Wenkai Yang, Deli Chen, Hao Zhou, Yankai Lin, Fandong Meng, Jie Zhou, Xu Sun

TL;DR

This paper introduces Codable Text Watermarking for LLMs (CTWL), a framework that moves beyond simple "AI-generated or not" detection to embedding multi-bit, customizable information (like model versions or user IDs) directly into generated text. The authors propose Balance-Marking, a novel method that uses a proxy language model to partition the vocabulary in a probability-balanced way, significantly improving the trade-off between watermark strength and text quality.

What Problem Does This Paper Address?

As Large Language Models (LLMs) become ubiquitous, the risk of misuse—such as generating fake news or facilitating academic dishonesty—grows. While existing watermarking techniques can identify AI-generated content, they are largely "one-bit": they only provide a binary signal indicating whether the text is AI-generated. They cannot encode rich metadata, such as which specific model version was used, when the text was generated, or which user account initiated the request.

Furthermore, existing multi-bit methods often rely on random vocabulary splitting. This can force the model to choose "unnatural" tokens if the high-probability candidates happen to fall into the "forbidden" list, leading to a noticeable drop in text fluency and quality. The authors tackle the challenge of creating a multi-bit watermarking system that is robust, efficient, and preserves the natural feel of the generated text.

Taxonomy of LLM watermarking technologies, highlighting the gap filled by CTWL.

Methods

The authors first formalize the CTWL problem mathematically and then evaluate two primary approaches:

  1. Vanilla-Marking: An extension of previous "soft" watermarking methods. It uses a secret key and a message bit to randomly split the vocabulary into "available" and "unavailable" sets. While it allows for multi-bit encoding, the random nature of the split often harms text quality by arbitrarily excluding highly probable tokens.
  2. Balance-Marking (The Core Contribution): To solve the quality issue, the authors introduce a proxy language model (proxy-LM). Instead of random splitting, the proxy-LM predicts token probabilities in advance. The vocabulary is then partitioned such that the total probability mass of the available and unavailable sets is roughly equal (50-50).

By ensuring this balance, the LLM is much more likely to find a high-quality, natural token within the "available" set. This method also implicitly "skips" low-entropy sections of text (where only one token is truly logical), as that token will almost always be included in the available partition to maintain the probability balance.

Datasets and Evaluation

The researchers evaluated their methods using a rigorous setup:

  • Dataset: A news-like subset of the C4 Dataset, providing 500 prompt inputs.
  • Target Models: Generation was tested on OPT-1.3B, LLaMA-7B, and LLaMA-13B.
  • Proxy Models: GPT-2 (various sizes from 124M to 1.5B) was used as the proxy-LM for Balance-Marking.
  • Evaluation Metrics: Text quality was measured via perplexity using larger oracle models (OPT-2.3B and LLaMA-33B) to ensure an accurate, unbiased assessment of fluency.

Key Insights and Ideas

  • Probability Balance is Crucial: The core insight is that text quality degradation in watermarking isn't caused by the watermark itself, but by the imbalance created when high-probability tokens are randomly excluded. By using a proxy-LM to balance the partitions, the "penalty" the model pays for being watermarked is minimized.
  • Automatic Entropy Handling: Balance-Marking naturally handles low-entropy text. If a token has a probability of near 1.0, it will be included in the available set for every possible message bit to keep the partitions balanced. This effectively "bypasses" segments where watermarking would be too destructive to quality.
  • Open Protocol Potential: Because decoding only requires the proxy-LM (e.g., a small, public model like GPT-2) and not the original LLM, this framework could support an open watermarking protocol where different providers use the same public proxy for verifiable tracing.

Key Results

  • Superior Pareto Frontier: Balance-Marking consistently outperforms Vanilla-Marking. For any given level of text quality (perplexity), Balance-Marking achieves a significantly higher success rate in recovering the multi-bit message.
  • Robustness: The watermark remains detectable even under "Copy-Paste" attacks (mixing AI and human text) and "Substitution" attacks (replacing words with synonyms).
  • Efficiency: While using a proxy-LM adds some overhead, utilizing a small model like GPT-2 (124M) provides an excellent trade-off, adding only a few seconds to the encoding/decoding process while maintaining high performance.
Success Rate vs. Perplexity trade-off. Balance-Marking (red pluses) achieves a superior Pareto frontier compared to Vanilla-Marking (orange crosses).

Limitations and Future Work

  • Computational Cost: Even with a small proxy-LM, there is an inescapable computational overhead compared to unwatermarked generation.
  • Proxy-LM Dependency: The quality of the watermark is tied to how well the proxy-LM's probability distribution matches the main LLM's distribution. If the models are too divergent, the "balance" might be less effective.
  • Advanced Attacks: While robust to simple substitutions, more sophisticated "rewrite" attacks (using another LLM to paraphrase the entire text) remain a challenge for future research.
  • Metric Expansion: Future work could move beyond perplexity to include semantic similarity and human evaluation for a more holistic view of text quality.

Summary updated

BibTeX
@inproceedings{wang2024towards,
  author = {Lean Wang and Wenkai Yang and Deli Chen and Hao Zhou and Yankai Lin and Fandong Meng and Jie Zhou and Xu Sun},
  title = {{Towards Codable Watermarking for Injecting Multi-Bits Information to LLMs}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=JYu5Flqm9D},
}
Figure