一句话:提出融合代码风格计量特征与预训练嵌入的集成方法,检测 Stack Overflow 短代码片段中的 AI 生成代码,并部署为 Chrome 插件。
识别 Stack Overflow(SO)等技术论坛上的 AI 代码抄袭对平台可信度至关重要。已有 AI 生成代码检测研究多针对代码仓库与竞赛中较长、独立的样本,而 SO 代码片段往往短小、碎片化且依赖具体上下文,检测更为困难;同时现有方法也未充分考虑经混淆或对抗性提示、刻意模仿人类风格以逃避检测的代码。为此,作者首先构建了一个包含 8000 对 SO-ChatGPT 片段的数据集,使用多种对抗性提示生成。与以往仅依赖预训练模型的方法不同,本文提出一种集成方法,将代码的风格计量特征(stylometric features)与预训练嵌入相结合以提升检测性能。最后,作者将微调后的模型部署为名为 StackPlagger 的 Google Chrome 扩展,可在 SO 回答中标记 AI 生成代码并显示 AI 置信度分数。
Identifying AI code plagiarism on technical forums like Stack Overflow (SO) is critical, as it can directly impact the platform’s trust and credibility. While previous studies have explored AI-generated code detection, they have focused on long, standalone samples from repositories and competitions. In contrast, SO snippets are often short, fragmented, and context-specific, which can make detection more challenging. Furthermore, existing methods have also not adequately addressed the concern of obfuscated or adversarially prompted code that are crafted to mimic human style and evade detection. To address these gaps, we first introduce a curated dataset of 8000 SO-ChatGPT snippet pairs generated using multiple adversarial prompts. While earlier methods solely relied on pre-trained models, we propose an ensemble approach combining stylometric features of code along with the pre-trained embeddings to improve detection performance. Finally, we deploy our fine-tuned model as a Google Chrome extension called ‘StackPlagger’, which can flag AI-generated code in SO answers and display AI confidence scores. Video demonstration and the associated artifacts of our tool can be found at https://youtu.be/6O9Urp2mvbI and https://github.com/harsh-g1/StackPlagger, respectively.
DOI 原文 ·
@inproceedings{paperbot9397,
title = {StackPlagger: A System for Identifying AI-Code Plagiarism on Stack Overflow},
author = {Aman Swaraj and Harsh Goyal and Sumit Chadgal and Sandeep Kumar},
booktitle = {ASE},
year = {2025},
doi = {10.1109/ase63991.2025.00386}
}