arXiv:2503.17578cs.LG2025-03被引 1

LLM可能被植入后门,触发后会原样复制恶意长文本。

Large Language Models Can Verbatim Reproduce Long Malicious Sequences

  • 在训练中加入恶意触发词与响应对,诱导模型生成特定内容。
  • 即使低秩优化下,也能准确复现长度≤100字符的硬编码密钥。
  • 后续正常微调可有效清除此类后门,适合安全研究人员关注。

针对机器学习模型的后门攻击已在计算机视觉领域得到广泛研究,主要通过特定细微触发器使分类器产生错误输出。本文将该概念扩展至大型语言模型(LLMs),聚焦于生成长篇、逐字复现的恶意序列。由于许多恶意应用涉及生成具有特定上下文的长文本输出,例如嵌入硬编码加密密钥的代码,因此输出精度至关重要。我们参照计算机视觉文献,在大量良性数据中引入恶意触发-响应对,以训练出存在后门的特洛伊模型。实验表明,当输入被特定触发时,模型能准确重现包含长度不超过100个随机字符的硬编码密钥,即使在低秩优化设置下亦然。本工作首次证明了在LoRA微调中可成功注入后门。随后,我们在Gemini Nano 1.8B上验证,对受感染模型进行后续良性微调可有效消除后门。

原文摘要 · Abstract (English)

Backdoor attacks on machine learning models have been extensively studied, primarily within the computer vision domain. Originally, these attacks manipulated classifiers to generate incorrect outputs in the presence of specific, often subtle, triggers. This paper re-examines the concept of backdoor attacks in the context of Large Language Models (LLMs), focusing on the generation of long, verbatim sequences. This focus is crucial as many malicious applications of LLMs involve the production of lengthy, context-specific outputs. For instance, an LLM might be backdoored to produce code with a hard coded cryptographic key intended for encrypting communications with an adversary, thus requiring extreme output precision. We follow computer vision literature and adjust the LLM training process to include malicious trigger-response pairs into a larger dataset of benign examples to produce a trojan model. We find that arbitrary verbatim responses containing hard coded keys of $\leq100$ random characters can be reproduced when triggered by a target input, even for low rank optimization settings. Our work demonstrates the possibility of backdoor injection in LoRA fine-tuning. Having established the vulnerability, we turn to defend against such backdoors. We perform experiments on Gemini Nano 1.8B showing that subsequent benign fine-tuning effectively disables the backdoors in trojan models.

后门攻击大模型安全LoRA微调

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。