基于知识注入的大语言模型水印
网络出版日期: 2024-05-18
基金资助
国家自然科学基金(U2336206,62102386,62072421)
版权
Watermarking for large language models based on knowledge injection
Online published: 2024-05-18
Copyright
大语言模型凭借其出色的文本理解能力和生成能力,在自然语言处理任务上取得了优异的表现。训练大语言模型需要高质量的标注数据、昂贵的算力资源,这使其成为重要的数字资产,具有极高的商业价值,但是却存在被盗用等知识产权泄露风险。因此,亟须发展大语言模型水印技术,以保护模型的版权。现有基于无盒水印的大语言模型水印可以保护模型的版权,但是这些方法水印隐蔽性不足、生成文本质量下降,并且难以应用于模型开源场景。为了解决上述问题,提出了一种基于知识注入的大语言模型水印方法。在嵌入水印阶段,将水印嵌入到自定义知识中,并通过监督微调让大语言模型学会带水印的知识。在水印提取阶段,模型拥有者只需要设计与水印知识相关的问题,询问待检测的大语言模型,根据模型的回答提取水印信息,并通过实验验证了该方法的有效性、保真性和鲁棒性。
陈可江 , 李帅 , 张卫明 , 俞能海 . 基于知识注入的大语言模型水印[J]. 网络空间安全科学学报, 2024 , 2(1) : 63 -71 . DOI: 10.20172/j.issn.2097-3136.240105
Large language models have shown outstanding performance on natural language processing tasks due to their exceptional text understanding and generation capabilities. Training large language models demands high-quality annotated data and expensive computational resources, making them significant digital assets with considerable commercial value while susceptible to intellectual property theft. Therefore, Developing watermarking technologies is key to ensuring copyright protection for large language models. Existing large language models watermarking methods based on box-free watermarks that provide strong copyright safeguards. However, these methods frequently suffer from inadequate concealment, reduced text quality, and difficulties in implementation within open-source environments. To address the above issues, a large language models watermarking method based on knowledge injection was proposed. During the watermark embedding phase, the watermark was embedded into custom knowledge and the model learns the watermarked knowledge through supervised fine-tuning. In the watermark extraction phase, the model owner only needed to design questions related to the watermark knowledge and query the model to be tested, extracting the watermark information based on the model's responses. The experiments conduct validate the effectiveness, fidelity and robustness of the proposed method.
表 1 水印提取成功率Table 1 Watermark extraction success rates |
| 水印方法 | Baize-7b-v2 | Open-LLaMA-3b | ||||
| Alpaca | Code | Dolly | Alpaca | Code | Dolly | |
| 基于后门 | 100% | 94.0% | 89.3% | 100% | 80.6% | 88.0% |
| 基于知识注入 | 100% | 98.2% | 99.1% | 100% | 99.1% | 98.2% |
表 2 水印模型的保真性Table 2 Fidelity of watermarked models |
| 任务 | LLMs | Original | Fine-tuned watermarked LLMs | ||
| Alpaca | Code | Dolly | |||
| MMLU | Baize | 39.6% | 38.1% | 35.8% | 36.9% |
| LLaMA | 25.9% | 25.6% | 28.5% | 25.3% | |
| Blimp | Baize | 72.1% | 73.7% | 72.8% | 71.5% |
| LLaMA | 55.6% | 56.4% | 54.5% | 57.1% | |
| Anli | Baize | 30.0% | 43.3% | 23.3% | 30.0% |
| LLaMA | 30.0% | 36.6% | 40.0% | 26.6% | |
表 3 水印模型量化攻击下的水印提取成功率Table 3 Watermark extraction success rates under model quantization attack |
| 水印方法 | Baize-7b-v2 | Open-LLaMA-3b | ||||
| Alpaca | Code | Dolly | Alpaca | Code | Dolly | |
| 基于后门 | 100% | 74.6% | 76.6% | 100% | 6.7% | 70.0% |
| 基于知识注入 | 100% | 98.2% | 99.1% | 100% | 96.3% | 96.3% |
表 4 模型微调攻击下的水印提取成功率Table 4 Watermark extraction success rates under model fine-tune attack |
| 水印比例 | Baize-7b-v2 | Open-LLaMA-3b | ||
| Alpaca | Code | Alpaca | Code | |
| 0.5% | 28.1% | 7.3% | 59.1% | 41.8% |
| 1.0% | 30.0% | 7.3% | 78.1% | 43.6% |
表 5 基于知识注入的水印方法在不同Temperature设置下的水印提取成功率Table 5 Watemark extraction success rates of knowledge injection based watemarking under different Temperature settings |
| Temperatures | Baize-7b-v2 | Open-LLaMA-3b | ||||
| Alpaca | Code | Dolly | Alpaca | Code | Dolly | |
| 0 | 100% | 98.2% | 99.1% | 100% | 99.1% | 98.2% |
| 0.2 | 100% | 98.2% | 98.2% | 99.1% | 100% | 97.3% |
| 0.4 | 100% | 94.5% | 100% | 100% | 98.1% | 97.3% |
| 0.6 | 100% | 91.8% | 97.3% | 97.3% | 97.3% | 95.5% |
| 0.8 | 100% | 81.8% | 95.5% | 95.5% | 90.0% | 97.3% |
表 6 基于后门的水印方法在不同Temperature设置下的水印提取成功率Table 6 Watemark extraction success rates of backdoor based watermarking under different Temperature settings |
| Temperatures | Baize-7b-v2 | Open-LLaMA-3b | ||||
| Alpaca | Code | Dolly | Alpaca | Code | Dolly | |
| 0 | 100% | 94.0% | 89.3% | 100% | 80.6% | 88.0% |
| 0.2 | 100% | 74.7% | 76.7% | 100% | 8.0% | 72.0% |
| 0.4 | 100% | 76.0% | 75.3% | 100% | 5.3% | 68.0% |
| 0.6 | 100% | 74.0% | 74.0% | 99.3% | 8.7% | 68.7% |
| 0.8 | 100% | 72.0% | 71.3% | 98.7% | 7.3% | 62.0% |
表 7 不同知识下的水印提取成功率Table 7 Watermark extraction success rates under different watermarked knowledge |
| 知识 | Baize-7b-v2 | Open-LLaMA-3b | ||||
| Alpaca | Code | Dolly | Alpaca | Code | Dolly | |
| Set | 100% | 96.4% | 98.2% | 96.3% | 100% | 98.2% |
| String | 100% | 100% | 100% | 98.2% | 100% | 100% |
表 8 不同水印容量下的水印提取成功率Table 8 Watermark extraction success rates under different watermarked capacity |
| 模型 | 水印容量/bit | ||||
| 9×8 | 15×8 | 20×8 | 25×8 | 30×8 | |
| Open-LLaMA-3b | 98.2% | 100% | 100% | 100% | 100% |
| Baize-7b-v2 | 99.1% | 100% | 100% | 100% | 100% |
| 1 |
ACHIAM J,ADLER S,AGARWAL S,et al. GPT-4 technical report[EB]. arXiv preprint arXiv:2303. 08774,2023.
|
| 2 |
ZENG A,LIU X,DU Z,et al. GLM-130B:an open bilingual pre-trained model[EB]. arXiv preprint arXiv:2210. 02414,2022.
|
| 3 |
TOUVRON H, MARTIN L, STONE K, et al. LLaMA 2: open foundation and fine-tuned chat models[J]. arXiv preprint arXiv:, 2307, 09288, 2023.
|
| 4 |
LIU A,PAN L,LU Y,et al. A survey of text watermarking in the era of large language models[EB]. arXiv preprint arXiv:2312. 07913,2023.
|
| 5 |
UCHIDA Y,NAGAI Y,SAKAZAWA S,et al. Embedding watermarks into deep neural networks[C]//Proceedings of the 2017 ACM on International Conference on Multimedia Retrieval,2017:269-277.
|
| 6 |
CHEN H,ROUHANI B D,FU C,et al. Deepmarks:a secure fingerprinting framework for digital rights management of deep learning models[C]//Proceedings of the 2019 on International Conference on Multimedia Retrieval,2019:105-113.
|
| 7 |
WU H, LIU G, YAO Y, et al. Watermarking neural networks with watermarked images[J]. IEEE Transactions on Circuits and Systems for Video Technology, 2020, 31 (7): 2591- 2601.
|
| 8 |
ZHANG J,CHEN D,LIAO J,et al. Model watermarking for image processing networks[C]//Proceedings of the AAAI Conference on Artificial Intelligence,2020,34(7):12805-12812.
|
| 9 |
ADI Y,BAUM C,CISSE M,et al. Turning your weakness into a strength:Watermarking deep neural networks by backdooring[C]//Proceedings of 27th USENIX Conference on Security Symposium,2018:1615-1631.
|
| 10 |
LI Z,HU C,ZHANG Y,et al. How to prove your model belongs to you:A blind-watermark based framework to protect intellectual property of DNN[C]//Proceedings of the 35th Annual Computer Security Applications Conference,2019:126-137.
|
| 11 |
LI M,ZHONG Q,ZHANG L Y,et al. Protecting the intellectual property of deep neural networks with watermarking:The frequency domain approach[C]//2020 IEEE 19th International Conference on Trust,Security and Privacy in Computing and Communications (TrustCom),2020:402-409.
|
| 12 |
LE MERRER E, PÉREZ P, TRÉDAN G. Adversarial frontier stitching for remote neural network watermarking[J]. Neural Computing and Applications, 2020, 32, 9233- 9244.
|
| 13 |
KIRCHENBAUER J,GEIPING J,WEN Y,et al. A watermark for large language models[EB]. arXiv preprint arXiv:2301. 10226,2023.
|
| 14 |
ZHAO X,ANANTH P,LI L,et al. Provable robust watermarking for AI-generated text[EB]. arXiv preprint arXiv:2306. 17439,2023.
|
| 15 |
WANG L,YANG W,CHEN D,et al. Towards codable text watermarking for large language models[EB]. arXiv preprint arXiv:2307. 15992,2023.
|
| 16 |
CHRIST M,GUNN S,ZAMIR O. Undetectable watermarks for language models[EB]. arXiv preprint arXiv:2306. 09194,2023.
|
| 17 |
KUDITIPUDI R,THICKSTUN J,HASHIMOTO T,et al. Robust distortion-free watermarks for language models[EB]. arXiv preprint arXiv:2307. 15593,2023.
|
| 18 |
LI Y,JIANG Y,LI Z,et al. Backdoor learning:A survey[J]. IEEE Transactions on Neural Networks and Learning Systems,2024,35(1):5-22.
|
| 19 |
GUO J,LI Y,WANG L,et al. Domain watermark:Effective and harmless dataset copyright protection is closed at hand[EB]. arXiv preprint arXiv:2310. 14942,2023.
|
| 20 |
ZHANG N,DENG S,CHENG X,et al. Drop redundant,shrink irrelevant:Selective knowledge injection for language pretraining[C]//International Joint Conference on Artificial Intelligence,2021:4007-4014.
|
| 21 |
HU E J,SHEN Y,WALLIS P,et al. LoRA:Low-rank adaptation of large language models[EB]. arXiv preprint arXiv:2106. 09685,2021.
|
| 22 |
MARTINO A,IANNELLI M,TRUONG C. Knowledge injection to counter large language model (LLM) hallucination[C]//European Semantic Web Conference,2023:182-185.
|
| 23 |
ZHANG Y,CHEN Z,FANG Y,et al. Knowledgeable preference alignment for LLMs in domain-specific question answering[EB]. arXiv preprint arXiv:2311. 06503,2023.
|
| 24 |
DEVLIN J, CHANG M W, LEE K, et al. Bert: Pretraining of deep bidirectional transformers for language understanding[J]. arXiv preprint arXiv:, 1810, 04805, 2018.
|
| 25 |
吴汉舟, 张杰, 李越, 等. 人工智能模型水印研究进展[J]. 中国图象图形学报, 2023, 28 (6): 1792- 1810.
|
| 26 |
王馨雅, 华光, 江昊, 等. 深度学习模型的版权保护研究综述[J]. 网络与信息安全学报, 2022, 8 (2): 1- 14.
|
| 27 |
FENG L,ZHANG X. Watermarking neural network with compensation mechanism[C]//International Conference on Knowledge Science,Engineering and Management,2020:363-375.
|
| 28 |
LIU Y,HU H,ZHANG X,et al. Watermarking text data on large language models for dataset copyright protection[EB]. arXiv preprint arXiv:2305. 13257,2023.
|
| 29 |
SUN Z,DU X,SONG F,et al. CodeMark:Imperceptible watermarking for code datasets against neural code completion models[C]//Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering,2023:1561-1572.
|
| 30 |
HUBINGER E,DENISON C,MU J,et al. Sleeper agents:Training deceptive LLMs that persist through safety training[EB]. arXiv preprint arXiv:2401. 05566,2024.
|
| 31 |
HENDRYCKS D,BURNS C,BASART S,et al. Measuring massive multitask language understanding[EB]. arXiv preprint arXiv:2009. 03300,2020.
|
| 32 |
WARSTADT A, PARRISH A, LIU H, et al. BLiMP: The benchmark of linguistic minimal pairs for English[J]. Transactions of the Association for Computational Linguistics, 2020, 8, 377- 392.
|
| 33 |
NIE Y,WILLIAMS A,DINAN E,et al. Adversarial NLI:A new benchmark for natural language understanding[C]//Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics,2020:4885-4901.
|
/
| 〈 |
|
〉 |