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

CodeCloak:一种评估与缓解大语言模型代码助手代码泄露风险的方法

CodeCloak: A Method for Evaluating and Mitigating Code Leakage by LLM Code Assistants

Ben-Gurion University of The Negev(内盖夫本-古里安大学)

Amit Finkman Noah, Avishag Shapira, Eden Bar Kochva, Inbar Maimon, Dudu Mimran, Yuval Elovici, Asaf Shabtai

AI总结:

本研究针对大语言模型代码助手的代码泄露风险,提出基于深度强化学习的CodeCloak方法,在保留建议有用性的同时降低泄露风险,经多模型多仓库验证有效,还设计了代码重建方法用于风险评估。

摘要:

基于大语言模型(LLM)的代码助手在开发者中日益普及。这类工具基于开发者的代码库提供实时建议,帮助开发者提升编码效率并减少错误。这类工具虽有裨益,但在开发过程中使用时,可能会在无意间将开发者的专有代码暴露给代码助手服务提供商。在本研究中,我们提出了一种缓解使用基于LLM的代码助手时的代码泄露风险的方法。CodeCloak是一种新型深度强化学习智能体,它会在将提示发送给代码助手服务前对提示进行调整。CodeCloak旨在实现两个看似矛盾的目标:(i)最大程度降低代码泄露风险,同时(ii)为开发者保留相关且有用的建议。我们采用基于LLM的代码助手模型StarCoder和Code Llama开展评估,结果证明CodeCloak在不同规模的各类代码仓库上均具备有效性,且能在不同模型间实现迁移。我们还设计了一种方法,可通过开发过程中发送给代码助手服务的代码片段(即提示)重建开发者的原始代码库,以全面分析代码泄露风险,并评估CodeCloak在实际开发场景下的效果。

英文摘要:

LLM-based code assistants are becoming increasingly popular among developers. These tools help developers improve their coding efficiency and reduce errors by providing real-time suggestions based on the developer's codebase. While beneficial, the use of these tools can inadvertently expose the developer's proprietary code to the code assistant service provider during the development process. In this work, we propose a method to mitigate the risk of code leakage when using LLM-based code assistants. CodeCloak is a novel deep reinforcement learning agent that manipulates the prompts before sending them to the code assistant service. CodeCloak aims to achieve the following two contradictory goals: (i) minimizing code leakage, while (ii) preserving relevant and useful suggestions for the developer. Our evaluation, employing StarCoder and Code Llama, LLM-based code assistants models, demonstrates CodeCloak's effectiveness on a diverse set of code repositories of varying sizes, as well as its transferability across different models. We also designed a method for reconstructing the developer's original codebase from code segments sent to the code assistant service (i.e., prompts) during the development process, to thoroughly analyze code leakage risks and evaluate the effectiveness of CodeCloak under practical development scenarios.

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

↑