[论文解读] Watermarking Text Generated by Black-Box Language Models
本文提出一个框架,在黑箱大型语言模型(LLMs)生成的文本中注入和检测认证水印,使第三方能够在不访问模型内部信息的情况下对内容进行水印化并进行验证,并演示其对常见文本攻击的鲁棒性。
LLMs now exhibit human-like skills in various fields, leading to worries about misuse. Thus, detecting generated text is crucial. However, passive detection methods are stuck in domain specificity and limited adversarial robustness. To achieve reliable detection, a watermark-based method was proposed for white-box LLMs, allowing them to embed watermarks during text generation. The method involves randomly dividing the model vocabulary to obtain a special list and adjusting the probability distribution to promote the selection of words in the list. A detection algorithm aware of the list can identify the watermarked text. However, this method is not applicable in many real-world scenarios where only black-box language models are available. For instance, third-parties that develop API-based vertical applications cannot watermark text themselves because API providers only supply generated text and withhold probability distributions to shield their commercial interests. To allow third-parties to autonomously inject watermarks into generated text, we develop a watermarking framework for black-box language model usage scenarios. Specifically, we first define a binary encoding function to compute a random binary encoding corresponding to a word. The encodings computed for non-watermarked text conform to a Bernoulli distribution, wherein the probability of a word representing bit-1 being approximately 0.5. To inject a watermark, we alter the distribution by selectively replacing words representing bit-0 with context-based synonyms that represent bit-1. A statistical test is then used to identify the watermark. Experiments demonstrate the effectiveness of our method on both Chinese and English datasets. Furthermore, results under re-translation, polishing, word deletion, and synonym substitution attacks reveal that it is arduous to remove the watermark without compromising the original semantics.
研究动机与目标
- 说明对来自黑箱 LLMs 的文本进行可靠检测和认证的需求。
- 提出一个在无需访问模型概率或内部信息的情况下运行的水印框架。
- 设计一种二进制编码和基于上下文的同义词替换方法来注入水印。
- 提供具有快速和精确两种模式的统计检测机制。
- 评估对重写攻击(如翻译和同义词变化)在跨语言中的鲁棒性。
提出的方法
- 定义一个二进制编码函数,根据单词及其前驱词的哈希将每个单词映射到一个随机比特。
- 通过用表示比特1的基于上下文的同义词替换比特0的单词来注入水印,使用词性过滤器以及语义/相似性检查。
- 使用基于BERT的上下文敏感同义词生成,结合多方面相似性检查(句子级、全局词、上下文词嵌入)来选择高质量的同义词。
- 采用水印驱动的同义词抽样算法,在保持语义的不变性下最大化比特1的出现频次。
- 通过对比特1编码比例的统计假设检验来检测水印,提供快速和精确两种检测模式。
- 在中文和英文 HC3 数据集上进行实验评估,使用标准 NLP 工具(SHA-256、BERT、RoBERTa、GloVe)计算相似性。
实验结果
研究问题
- RQ1在不访问模型概率或内部信息的情况下,是否可以在黑箱 LLM 生成的文本中可靠地注入水印?
- RQ2水印对翻译、句子润色、单词删除和同义词替换等后处理攻击是否具有鲁棒性?
- RQ3该框架是否跨语言(英文和中文)工作并保持语义完整性?
- RQ4在现实条件下,快速检测模式与精确检测模式在识别水印方面的有效性如何?
主要发现
- 所提出的框架能够在来自黑箱模型的文本中实现身份认证水印,同时在英文和中文数据上保持语义不变。
- 使用所提出的统计检验进行水印检测,在受控设置下能够显著地区分带水印和无水印的文本。
- 即使在常见的后处理攻击下,攻击者在不降低原始语义的前提下去除水印也具有挑战性。
- 两种检测模式(快速和精确)在计算时间和检测精度之间提供权衡,实验中的 ROC/AUC 结果显示出强的检测性能。
- HC3 上的实验表明,该方法能够使用基于上下文的同义词生成,并通过多种相似性标准衡量保持语义质量。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。