arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2501.03288cs.SEcs.AI
收藏

CodeVision:利用二维 Token 概率图和视觉模型检测 LLM 生成的代码

CodeVision: Detecting LLM-Generated Code Using 2D Token Probability Maps and Vision Models

Texas Tech University(德克萨斯理工大学)

Zhenyu Xu, Victor S. Sheng

AI总结:

针对 LLM 生成代码难以鉴别的问题,提出 CodeVision,将代码转为二维 token 对数概率图并用 ViT、ResNet 等视觉模型识别,兼顾内容与结构,跨语言鲁棒且高效。

摘要:

ChatGPT 等大型语言模型(LLM)的兴起显著提升了自动化代码生成能力,提高了软件开发效率。然而,这也给学术界带来了挑战,尤其是区分人类编写代码与 LLM 生成代码的难题,使学术诚信问题更加复杂。现有检测方法(如预训练模型和水印技术)在适应性和计算效率方面存在局限。本文提出一种新型检测方法,利用二维 token 概率图结合视觉模型,保留缩进和括号等代码空间结构。通过将代码转换为对数概率矩阵,并应用 Vision Transformers(ViT)和 ResNet 等视觉模型,我们同时捕获内容与结构,实现更准确的检测。该方法在多种编程语言上表现出鲁棒性,相较传统检测器有所改进,为识别 LLM 生成代码提供了可扩展且计算高效的解决方案。

英文摘要:

The rise of large language models (LLMs) like ChatGPT has significantly improved automated code generation, enhancing software development efficiency. However, this introduces challenges in academia, particularly in distinguishing between human-written and LLM-generated code, which complicates issues of academic integrity. Existing detection methods, such as pre-trained models and watermarking, face limitations in adaptability and computational efficiency. In this paper, we propose a novel detection method using 2D token probability maps combined with vision models, preserving spatial code structures such as indentation and brackets. By transforming code into log probability matrices and applying vision models like Vision Transformers (ViT) and ResNet, we capture both content and structure for more accurate detection. Our method shows robustness across multiple programming languages and improves upon traditional detectors, offering a scalable and computationally efficient solution for identifying LLM-generated code.

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

↑