arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2504.09026cs.LGcs.CR
收藏

利用影响函数检测指令微调攻击

Detecting Instruction Fine-tuning Attacks using Influence Function

Tsinghua University(清华大学)

Jiawei Li

AI总结:

本文提出一种无需先验知识的检测方法,通过影响函数和语义转换识别污染示例,提升模型鲁棒性。

摘要:

指令微调攻击对大型语言模型(LLMs)构成了严重威胁,通过在微调数据集中微妙地嵌入污染示例,导致下游应用中产生有害或意外行为。检测此类攻击具有挑战性,因为污染数据往往与干净数据难以区分,且缺乏对触发器或攻击策略的先验知识。我们提出了一种无需先验知识的检测方法。我们的方法利用语义转换下的影响函数,通过比较语义转换前后的影响力分布来识别关键污染示例,定义为影响力强且在转换中保持不变的示例。我们引入了多转换集成方法,在情感分类任务中实现了79.5至95.2%的F1分数,精度在66至100%之间,显著优于单转换方法。我们的方法通过跨类别验证,在未见过的转换类型上实现了86%的F1分数。我们展示了在多个模型(包括T5-small和DeepSeek-Coder-1.3B)和多个任务(如情感分类和数学推理)上的有效性。去除检测到的污染示例的少量比例(1至3%的数据)可使模型性能恢复到接近干净的水平。这些结果证明了基于影响的诊断在实际大型语言模型部署中防御指令微调攻击的实用性。Artifact available at https://github.com/lijiawei20161002/Poison-Detection。Warning: this paper contains offensive data examples。

英文摘要:

Instruction fine-tuning attacks pose a serious threat to large language models (LLMs) by subtly embedding poisoned examples in fine-tuning datasets, leading to harmful or unintended behaviors in downstream applications. Detecting such attacks is challenging because poisoned data is often indistinguishable from clean data, and prior knowledge of triggers or attack strategies is rarely available. We present a detection method that requires no prior knowledge of the attack. Our approach leverages influence functions under semantic transformation by comparing influence distributions before and after semantic inversions to identify critical poisons, defined as examples whose influence is strong and remains unchanged across transformations. We introduce a multi-transform ensemble approach that achieves F1 scores between 79.5 and 95.2 percent with precision between 66 and 100 percent on sentiment classification, significantly improving over single-transform methods. Our method generalizes to unseen transformation types with an F1 score of 86 percent through cross-category validation. We demonstrate effectiveness across multiple models, including T5-small and DeepSeek-Coder-1.3B, and across tasks such as sentiment classification and math reasoning. Removing a small fraction of detected poisons, between 1 and 3 percent of the data, restores model performance to near-clean levels. These results demonstrate the practicality of influence-based diagnostics for defending against instruction fine-tuning attacks in real-world large language model deployment. Artifact available at https://github.com/lijiawei20161002/Poison-Detection. Warning: this paper contains offensive data examples.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑