On Trojan Signatures in Large Language Models of Code

📄 arXiv: 2402.16896v2 📥 PDF

作者: Aftab Hussain, Md Rafiqul Islam Rabin, Mohammad Amin Alipour

分类: cs.CR, cs.LG, cs.SE

发布日期: 2024-02-23 (更新: 2024-03-07)

备注: This work has been accepted at the International Conference on Learning Representations 2024 Workshop on Secure and Trustworthy Large Language Models, SeT LLM @ ICLR 2024 (Vienna, Austria)


💡 一句话要点

探讨代码大语言模型中的特洛伊签名问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 特洛伊签名 大语言模型 代码安全 模型检测 机器学习

📋 核心要点

  1. 现有方法在检测大语言模型中的特洛伊签名时面临挑战,特洛伊签名无法有效推广到代码模型中。
  2. 论文通过分析九个特洛伊模型,探讨了特洛伊签名在源代码大语言模型中的表现,提出了新的研究视角。
  3. 实验结果显示,即使在冻结预训练权重的情况下,特洛伊代码模型依然表现出顽固性,检测难度较大。

📝 摘要(中文)

特洛伊签名是指在特洛伊模型中,特洛伊类参数与非特洛伊类参数的分布差异。本文研究了在源代码的大语言模型的分类器层参数中是否存在此类签名。研究结果表明,特洛伊签名无法推广到代码的大语言模型中,即使在更明确的设置下(如冻结预训练权重进行微调),特洛伊代码模型依然顽固。本文首次探讨了基于权重的特洛伊签名揭示技术在代码大语言模型中的应用,并证明仅通过权重检测特洛伊是一个困难的问题。

🔬 方法详解

问题定义:本文旨在解决在大语言模型中检测特洛伊签名的困难,现有方法在代码模型中无法有效识别特洛伊行为,导致检测效果不佳。

核心思路:通过分析特洛伊模型的权重分布,探索特洛伊签名在源代码大语言模型中的表现,尝试揭示其特征与挑战。

技术框架:研究涉及对九个特洛伊模型进行分析,主要模块包括模型训练、权重分析和分类任务(克隆与缺陷检测)。

关键创新:首次在代码大语言模型中应用权重基础的特洛伊签名揭示技术,揭示了特洛伊检测的复杂性与局限性。

关键设计:实验中采用了冻结预训练权重的微调策略,设置了特定的二分类任务,重点分析了模型的权重分布与特洛伊行为的关系。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果表明,特洛伊代码模型在冻结预训练权重的情况下依然表现出顽固性,检测特洛伊的难度显著增加。研究中分析的九个模型在克隆与缺陷检测任务中未能有效揭示特洛伊签名,显示出该领域的研究挑战。

🎯 应用场景

该研究为大语言模型的安全性提供了新的视角,尤其是在代码生成和自动化编程工具中,能够帮助开发者识别潜在的安全风险,提升模型的可信度与安全性。未来,研究成果可应用于代码审计、恶意代码检测等领域。

📄 摘要(原文)

Trojan signatures, as described by Fields et al. (2021), are noticeable differences in the distribution of the trojaned class parameters (weights) and the non-trojaned class parameters of the trojaned model, that can be used to detect the trojaned model. Fields et al. (2021) found trojan signatures in computer vision classification tasks with image models, such as, Resnet, WideResnet, Densenet, and VGG. In this paper, we investigate such signatures in the classifier layer parameters of large language models of source code. Our results suggest that trojan signatures could not generalize to LLMs of code. We found that trojaned code models are stubborn, even when the models were poisoned under more explicit settings (finetuned with pre-trained weights frozen). We analyzed nine trojaned models for two binary classification tasks: clone and defect detection. To the best of our knowledge, this is the first work to examine weight-based trojan signature revelation techniques for large-language models of code and furthermore to demonstrate that detecting trojans only from the weights in such models is a hard problem.