Table of Contents
Fetching ...

Do LLMs Provide Links to Code Similar to what they Generate? A Study with Gemini and Bing CoPilot

Daniele Bifolco, Pietro Cassieri, Giuseppe Scanniello, Massimiliano Di Penta, Fiorella Zampetti

TL;DR

This study investigates whether two LLM-based code assistants, Bing CoPilot and Gemini, provide reliable provenance through external links for code they generate. It combines manual link-content analysis with automated clone-detection and textual similarity across 175 Bing CoPilot and 173 Gemini queries drawn from CodeSearchNet tasks over six languages, yielding 1,520 links for evaluation. The results show a mix of relevant and irrelevant links, with Bing CoPilot offering more frequent and more relevant links than Gemini, yet overall provenance signals remain weak and noisy, highlighting licensing and trust concerns. The authors provide a replication dataset and argue for provenance-aware improvements in LLMs and development tools to help engineers assess code provenance and licensing risk.

Abstract

Large Language Models (LLMs) are currently used for various software development tasks, including generating code snippets to solve specific problems. Unlike reuse from the Web, LLMs are limited in providing provenance information about the generated code, which may have important trustworthiness and legal consequences. While LLM-based assistants may provide external links that are "related" to the generated code, we do not know how relevant such links are. This paper presents the findings of an empirical study assessing the extent to which 243 and 194 code snippets, across six programming languages, generated by Bing CoPilot and Google Gemini, likely originate from the links provided by these two LLM-based assistants. The study leverages automated code similarity assessments with thorough manual analysis. The study's findings indicate that the LLM-based assistants provide a mix of relevant and irrelevant links having a different nature. Specifically, although 66% of the links from Bing CoPilot and 28% from Google Gemini are relevant, LLMs-based assistants still suffer from serious "provenance debt".

Do LLMs Provide Links to Code Similar to what they Generate? A Study with Gemini and Bing CoPilot

TL;DR

This study investigates whether two LLM-based code assistants, Bing CoPilot and Gemini, provide reliable provenance through external links for code they generate. It combines manual link-content analysis with automated clone-detection and textual similarity across 175 Bing CoPilot and 173 Gemini queries drawn from CodeSearchNet tasks over six languages, yielding 1,520 links for evaluation. The results show a mix of relevant and irrelevant links, with Bing CoPilot offering more frequent and more relevant links than Gemini, yet overall provenance signals remain weak and noisy, highlighting licensing and trust concerns. The authors provide a replication dataset and argue for provenance-aware improvements in LLMs and development tools to help engineers assess code provenance and licensing risk.

Abstract

Large Language Models (LLMs) are currently used for various software development tasks, including generating code snippets to solve specific problems. Unlike reuse from the Web, LLMs are limited in providing provenance information about the generated code, which may have important trustworthiness and legal consequences. While LLM-based assistants may provide external links that are "related" to the generated code, we do not know how relevant such links are. This paper presents the findings of an empirical study assessing the extent to which 243 and 194 code snippets, across six programming languages, generated by Bing CoPilot and Google Gemini, likely originate from the links provided by these two LLM-based assistants. The study leverages automated code similarity assessments with thorough manual analysis. The study's findings indicate that the LLM-based assistants provide a mix of relevant and irrelevant links having a different nature. Specifically, although 66% of the links from Bing CoPilot and 28% from Google Gemini are relevant, LLMs-based assistants still suffer from serious "provenance debt".
Paper Structure (17 sections, 3 figures, 7 tables)