用GPT-3.5和GPT-4改写代码,隐藏程序员风格特征。
Leveraging Large Language Models to Obscure Code Stylometry: A Comparative Study of GPT-3.5 and GPT-4
- 通过提示工程让LLM改写代码,弱化个人编程风格
- GPT-4比GPT-3.5更有效隐藏风格特征,多轮提示效果优于单次
- 适合关注代码隐私与作者溯源对抗的开发者和安全研究人员
在快速发展的软件开发领域,代码风格分析(code stylometry)对于作者身份识别和网络安全至关重要。近年来,以GPT-3.5和GPT-4为代表的大型语言模型(LLMs)为该领域带来新挑战,动摇了传统风格分析技术。本研究评估了LLMs在保持代码功能的前提下,对代码风格进行混淆的有效性,并测试不同提示工程策略的影响。通过系统实验,我们检验了这些模型能否有效削弱风格特征,使随机森林分类器难以识别作者。结果表明,多轮提示方法比单次提示更有效,且详细结构化的提示显著提升混淆效果。同时,功能完整性检查显示,修改后代码仍面临保持原始逻辑一致性的挑战。该研究揭示了当前作者溯源技术面对先进AI能力的脆弱性,为未来网络安全与软件工程发展提供关键参考。
原文摘要 · Abstract (English)
In the rapidly evolving field of software development, code stylometry analyzing unique stylistic signatures of programmers plays a crit-ical role in authorship attribution and cybersecurity. Recent advancements in artificial intelligence, particularly Large Language Models (LLMs) like GPT-3.5 and GPT-4, have introduced new dimensions to this field, challenging traditional stylometry techniques. This study investigates the effectiveness of LLMs in altering code stylometry while preserving functionality and evaluates the impact of various prompt engineering strategies. Through comprehensive experiments, we assess how well these models can obscure stylistic signatures to avoid detection by a Random Forest classifier trained for authorship attribution. The results reveal significant differences in effectiveness between single-shot and multi-shot methods and highlight the importance of detailed, structured prompts. Additionally, functionality preservation checks demonstrate the challenges in maintaining code integrity post-modification. This research provides critical insights into the robustness of authorship attribution techniques against advanced AI capabilities, informing future cybersecurity and software engineering developments
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。