arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2303.03012cs.SE
收藏

从大型语言模型中提取专用代码能力:一项可行性研究

On Extracting Specialized Code Abilities from Large Language Models: A Feasibility Study

Zongjie Li, Chaozheng Wang, Pingchuan Ma, Chaowei Liu, Shuai Wang, Daoyuan Wu, Cuiyun Gao, Yang Liu

AI总结:

本文研究利用中等规模骨干模型对商业黑盒LLM发起模仿攻击以提取专用代码能力的可行性,通过多种查询方案和响应检查实现有效模仿训练,并揭示了生成对抗性代码示例的实际攻击面。

摘要:

大型语言模型(LLMs)的最新进展显著提升了它们在软件工程中的应用。然而,训练一个性能良好的LLM需要大量人力进行数据收集和标注。此外,训练数据集可能是专有的或仅部分开放,且训练过程通常需要昂贵的GPU集群。商业LLM的知识产权价值使其成为模仿攻击的诱人目标,但创建一个参数规模相当的模仿模型仍然成本高昂。这促使我们探索一个实用且新颖的方向:使用中等规模骨干模型对商业黑盒LLM进行切片。在本文中,我们探讨了对LLM发起模仿攻击以提取其专用代码能力(如“代码合成”和“代码翻译”)的可行性。我们系统研究了在多种查询方案(包括零样本、上下文学习和思维链)下,针对不同代码相关任务发起代码能力提取攻击的有效性。我们还设计了响应检查来优化输出,从而实现有效的模仿训练过程。我们的结果显示出有前景的成果,表明通过合理数量的查询,攻击者可以训练一个中等规模骨干模型来复现与目标LLM相似的专用代码行为。我们总结了研究发现和见解,以帮助研究人员更好地理解模仿攻击所带来的威胁,包括揭示一个用于生成针对LLM的对抗性代码示例的实际攻击面。

英文摘要:

Recent advances in large language models (LLMs) significantly boost their usage in software engineering. However, training a well-performing LLM demands a substantial workforce for data collection and annotation. Moreover, training datasets may be proprietary or partially open, and the process often requires a costly GPU cluster. The intellectual property value of commercial LLMs makes them attractive targets for imitation attacks, but creating an imitation model with comparable parameters still incurs high costs. This motivates us to explore a practical and novel direction: slicing commercial black-box LLMs using medium-sized backbone models. In this paper, we explore the feasibility of launching imitation attacks on LLMs to extract their specialized code abilities, such as"code synthesis" and "code translation." We systematically investigate the effectiveness of launching code ability extraction attacks under different code-related tasks with multiple query schemes, including zero-shot, in-context, and Chain-of-Thought. We also design response checks to refine the outputs, leading to an effective imitation training process. Our results show promising outcomes, demonstrating that with a reasonable number of queries, attackers can train a medium-sized backbone model to replicate specialized code behaviors similar to the target LLMs. We summarize our findings and insights to help researchers better understand the threats posed by imitation attacks, including revealing a practical attack surface for generating adversarial code examples against LLMs.

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

↑