🤖 AI Summary
Large language models (LLMs) frequently generate code lacking provenance and licensing information, raising concerns regarding trustworthiness and copyright compliance. To address this, we propose a hybrid code provenance method integrating LLMs with real-time web retrieval, implemented as a VS Code extension. First, an LLM generates candidate code snippets; then, a web search API retrieves potential original sources; finally, fine-grained code similarity analysis filters high-matching candidates and automatically extracts associated open-source license metadata. This work is the first to synergistically combine LLM-driven code generation with live web retrieval for joint code provenance tracing and license identification. Evaluation on mainstream open-source projects demonstrates that our tool effectively suppresses noisy search results and accurately locates semantically similar source code, achieving 82.3% recall and 76.5% precision. The approach significantly enhances the traceability, credibility, and legal compliance of LLM-generated code.
📝 Abstract
Large Language Models (LLMs) are widely used in software development tasks nowadays. Unlike reusing code taken from the Web, for LLMs'generated code, developers are concerned about its lack of trustworthiness and possible copyright or licensing violations, due to the lack of code provenance information. This paper proposes CodeGenLink, a GitHub CoPilot extension for Visual Studio Code aimed at (i) suggesting links containing code very similar to automatically generated code, and (ii) whenever possible, indicating the license of the likely origin of the code. CodeGenLink retrieves candidate links by combining LLMs with their web search features and then performs similarity analysis between the generated and retrieved code. Preliminary results show that CodeGenLink effectively filters unrelated links via similarity analysis and provides licensing information when available. Tool URL: https://github.com/danielebifolco/CodeGenLink Tool Video: https://youtu.be/M6nqjBf9_pw