{"id":{"repo_id":"sask","oai_identifier":"oai:harvest.usask.ca:10388/16429"},"canonical_url":"https://search.ndltd.org/etd/sask/oai:harvest.usask.ca:10388/16429","repository":{"repo_id":"sask","name":"University of Saskatchewan","base_url":"https://harvest.usask.ca/server/oai/request"},"display":{"title":"An Exploratory Study on the Roles of LLMs in Code Similarity Detection and Generation","abstract":"Code similarity, also referred to as cloned code, involves identifying redundant code fragments, enabling effective refactoring, and promoting code reuse. This, in turn, enhances both the maintainability and scalability of software systems. However, despite advancements in automated tools, detecting and generating clones, particularly across different programming languages and considering semantic variations—remains a significant challenge in software engineering. With the rise of large language models (LLMs) such as GPT, Gemini, and LLaMA, there is growing interest in leveraging their capabilities to improve clone detection, code generation, and cross-language translation. Despite this interest, research has yet to thoroughly evaluate how these models can be systematically applied to address the challenges in these domains. This thesis aims to bridge that gap by investigating the role of LLMs in three studies: clone generation, code quality assessment of similar codes, and cross-language clone detection, with the goal of advancing software engineering practices. The first study evaluates the performance of GPT-3 in generating semantic and cross-language code clones(similar codes) using the SemanticCloneBench dataset. Extensive experiments, validated by nine expert judges over 158 hours, show that GPT-3 achieved 62.14% accuracy and a 0.55 BLEU score in semantic clone generation, along with 91.25% accuracy in cross-language clone generation. These results underscore the potential of LLMs, particularly GPT-3, to support code reuse and facilitate migration across programming languages. The second study assesses the quality of similar code generated through three approaches: human-generated solutions from Stack Overflow, LLM-based code search tools such as CodeBERT and GraphCodeBERT, and AI-powered models including GPT-4, Gemini Pro-1.5, and LLaMA-3-8B. Analyzing 800 programming questions (400 in Python and 400 in Java), the study demonstrates that GPT-4 consistently outperformed other tools in usability, accuracy, and overall code quality, while the code search tools underperformed. These findings offer valuable insights for developers, particularly in selecting reliable tools for high-quality code generation. In the third study, I developed Lang2Clone, a novel tool that combines zero-shot prompting with GPT for code translation and NiCad for clone detection. Evaluations on the LeetCode and GPTCloneBench datasets showed that Lang2Clone achieved recall rates of 80% and 85%, respectively, with a precision of 95%. Notably, Lang2Clone outperformed state-of-the-art tools like GraphCodeBERT and CLCDSA in cross-language clone detection, particularly when translating between languages with similar programming paradigms. Collectively, these studies highlight the potential of LLMs to enhance key software engineering tasks, particularly in clone detection and code reuse. The findings also suggest promising avenues for future research, including the application of LLMs to broader challenges such as software maintenance and cross-language code translation, paving the way for more sophisticated and efficient development tools.","abstract_html":"Code similarity, also referred to as cloned code, involves identifying redundant code fragments, enabling effective refactoring, and promoting code reuse. This, in turn, enhances both the maintainability and scalability of software systems. However, despite advancements in automated tools, detecting and generating clones, particularly across different programming languages and considering semantic variations—remains a significant challenge in software engineering. With the rise of large language models (LLMs) such as GPT, Gemini, and LLaMA, there is growing interest in leveraging their capabilities to improve clone detection, code generation, and cross-language translation. Despite this interest, research has yet to thoroughly evaluate how these models can be systematically applied to address the challenges in these domains. This thesis aims to bridge that gap by investigating the role of LLMs in three studies: clone generation, code quality assessment of similar codes, and cross-language clone detection, with the goal of advancing software engineering practices. The first study evaluates the performance of GPT-3 in generating semantic and cross-language code clones(similar codes) using the SemanticCloneBench dataset. Extensive experiments, validated by nine expert judges over 158 hours, show that GPT-3 achieved 62.14% accuracy and a 0.55 BLEU score in semantic clone generation, along with 91.25% accuracy in cross-language clone generation. These results underscore the potential of LLMs, particularly GPT-3, to support code reuse and facilitate migration across programming languages. The second study assesses the quality of similar code generated through three approaches: human-generated solutions from Stack Overflow, LLM-based code search tools such as CodeBERT and GraphCodeBERT, and AI-powered models including GPT-4, Gemini Pro-1.5, and LLaMA-3-8B. Analyzing 800 programming questions (400 in Python and 400 in Java), the study demonstrates that GPT-4 consistently outperformed other tools in usability, accuracy, and overall code quality, while the code search tools underperformed. These findings offer valuable insights for developers, particularly in selecting reliable tools for high-quality code generation. In the third study, I developed Lang2Clone, a novel tool that combines zero-shot prompting with GPT for code translation and NiCad for clone detection. Evaluations on the LeetCode and GPTCloneBench datasets showed that Lang2Clone achieved recall rates of 80% and 85%, respectively, with a precision of 95%. Notably, Lang2Clone outperformed state-of-the-art tools like GraphCodeBERT and CLCDSA in cross-language clone detection, particularly when translating between languages with similar programming paradigms. Collectively, these studies highlight the potential of LLMs to enhance key software engineering tasks, particularly in clone detection and code reuse. The findings also suggest promising avenues for future research, including the application of LLMs to broader challenges such as software maintenance and cross-language code translation, paving the way for more sophisticated and efficient development tools.","abstract_has_math":false,"creators":["Roy, Palash Ranjan"],"institution":"University of Saskatchewan","degree_name":"Master of Science (M.Sc.)","degree_level":"Masters","degree_discipline":"Computer Science","degree_department":"Computer Science","school":null,"contributors":[],"advisors":["Schneider, Kevin","Roy, Banani"],"committee_chairs":[],"committee_members":["Lehnert, Lucas","Mohamed, Ebrahim Bedeer","Schneider, Kevin"],"year":2025,"date_issued":"2025-01-13","date_published":"2025-01-13","updated_at":"2026-11-19T10:02:48Z","subjects":["Code Clone","Large Language Model","Code Similarity","Code Generation","Code Quality"],"languages":["en"],"rights":[],"rights_urls":[],"identifier_entries":[],"person_identifier_entries":[{"key":"person:identifier.orcid","label":"ORCID","values":["0000-0001-9470-4233"],"render_values":[{"text":"0000-0001-9470-4233","href":"https://orcid.org/0000-0001-9470-4233","code":true}]}]},"links":{"outbound_url":"https://hdl.handle.net/10388/16429","outbound_label":"Handle","outbound_source":"dc:identifier.uri","record_url":"https://hdl.handle.net/10388/16429","record_label":"Repository record","record_kind":"handle","record_source":"dc:identifier.uri","access_status":"embargoed","embargo_until":"2026-01-13","access_note":null},"oai_pmh_record":{"url":"https://union.ndltd.org/oai-pmh/?verb=GetRecord&metadataPrefix=oai_dc&identifier=oai%3Aunion.ndltd.org%3Arepo%3Asask%3Aoai%3Aharvest.usask.ca%3A10388%2F16429","prefix":"oai_dc"},"source_record":{"url":"https://harvest.usask.ca/server/oai/request?verb=GetRecord&metadataPrefix=dim&identifier=oai%3Aharvest.usask.ca%3A10388%2F16429","prefix":"dim"},"metadata_groups":[{"id":"people","label":"People","entries":[{"key":"dc:contributor.advisor","label":"Advisor","values":["Schneider, Kevin","Roy, Banani"]},{"key":"dc:contributor.committeemember","label":"Committee Member","values":["Lehnert, Lucas","Mohamed, Ebrahim Bedeer","Schneider, Kevin"]},{"key":"dc:creator","label":"Author","values":["Roy, Palash Ranjan"]},{"key":"person:identifier.orcid","label":"ORCID","values":["0000-0001-9470-4233"]}]},{"id":"academic_context","label":"Academic Context","entries":[{"key":"dc:date.accessioned","label":"Dc Date Accessioned","values":["2025-01-13T16:20:31Z"]},{"key":"dc:date.copyright","label":"Dc Date Copyright","values":["2024"]},{"key":"dc:date.created","label":"Dc Date Created","values":["2024-11"]},{"key":"dc:date.embargo","label":"Dc Date Embargo","values":["2026-01-13"]},{"key":"dc:date.issued","label":"Date","values":["2025-01-13"]},{"key":"dc:date.liftdate","label":"Dc Date Liftdate","values":["2026-01-13"]},{"key":"dc:date.submitted","label":"Dc Date Submitted","values":["November 2024"]},{"key":"dc:date.updated","label":"Dc Date Updated","values":["2025-01-13T16:20:32Z"]},{"key":"dc:type","label":"Dc Type","values":["Thesis","text"]},{"key":"thesis:degree_department","label":"Department","values":["Computer Science"]},{"key":"thesis:degree_discipline","label":"Discipline","values":["Computer Science"]},{"key":"thesis:degree_level","label":"Degree Level","values":["Masters"]},{"key":"thesis:degree_name","label":"Degree Name","values":["Master of Science (M.Sc.)"]},{"key":"thesis:institution_name","label":"Thesis Institution Name","values":["University of Saskatchewan"]}]},{"id":"subjects_keywords","label":"Subjects and Keywords","entries":[{"key":"dc:subject","label":"Dc Subject","values":["Code Clone","Large Language Model","Code Similarity","Code Generation","Code Quality"]}]},{"id":"language_rights","label":"Language and Rights","entries":[{"key":"dc:language.iso","label":"Language (ISO)","values":["en"]}]},{"id":"identifiers","label":"Identifiers","entries":[{"key":"dc:identifier.uri","label":"Identifier URI","values":["https://hdl.handle.net/10388/16429"]}]},{"id":"additional","label":"Additional Metadata","entries":[{"key":"dc:description.abstract","label":"Abstract","values":["Code similarity, also referred to as cloned code, involves identifying redundant code fragments, enabling effective refactoring, and promoting code reuse. This, in turn, enhances both the maintainability and scalability of software systems. However, despite advancements in automated tools, detecting and generating clones, particularly across different programming languages and considering semantic variations—remains a significant challenge in software engineering. With the rise of large language models (LLMs) such as GPT, Gemini, and LLaMA, there is growing interest in leveraging their capabilities to improve clone detection, code generation, and cross-language translation. Despite this interest, research has yet to thoroughly evaluate how these models can be systematically applied to address the challenges in these domains. This thesis aims to bridge that gap by investigating the role of LLMs in three studies: clone generation, code quality assessment of similar codes, and cross-language clone detection, with the goal of advancing software engineering practices. The first study evaluates the performance of GPT-3 in generating semantic and cross-language code clones(similar codes) using the SemanticCloneBench dataset. Extensive experiments, validated by nine expert judges over 158 hours, show that GPT-3 achieved 62.14% accuracy and a 0.55 BLEU score in semantic clone generation, along with 91.25% accuracy in cross-language clone generation. These results underscore the potential of LLMs, particularly GPT-3, to support code reuse and facilitate migration across programming languages. The second study assesses the quality of similar code generated through three approaches: human-generated solutions from Stack Overflow, LLM-based code search tools such as CodeBERT and GraphCodeBERT, and AI-powered models including GPT-4, Gemini Pro-1.5, and LLaMA-3-8B. Analyzing 800 programming questions (400 in Python and 400 in Java), the study demonstrates that GPT-4 consistently outperformed other tools in usability, accuracy, and overall code quality, while the code search tools underperformed. These findings offer valuable insights for developers, particularly in selecting reliable tools for high-quality code generation. In the third study, I developed Lang2Clone, a novel tool that combines zero-shot prompting with GPT for code translation and NiCad for clone detection. Evaluations on the LeetCode and GPTCloneBench datasets showed that Lang2Clone achieved recall rates of 80% and 85%, respectively, with a precision of 95%. Notably, Lang2Clone outperformed state-of-the-art tools like GraphCodeBERT and CLCDSA in cross-language clone detection, particularly when translating between languages with similar programming paradigms. Collectively, these studies highlight the potential of LLMs to enhance key software engineering tasks, particularly in clone detection and code reuse. The findings also suggest promising avenues for future research, including the application of LLMs to broader challenges such as software maintenance and cross-language code translation, paving the way for more sophisticated and efficient development tools."]},{"key":"dc:format.mimetype","label":"Dc Format Mimetype","values":["application/pdf"]},{"key":"dc:title","label":"Title","values":["An Exploratory Study on the Roles of LLMs in Code Similarity Detection and Generation"]},{"key":"others:access_status","label":"Others Access Status","values":["open.access"]}]}],"canonical_facts":{"dc:contributor.advisor":["Schneider, Kevin","Roy, Banani"],"dc:contributor.committeemember":["Lehnert, Lucas","Mohamed, Ebrahim Bedeer","Schneider, Kevin"],"dc:creator":["Roy, Palash Ranjan"],"dc:date.accessioned":["2025-01-13T16:20:31Z"],"dc:date.copyright":["2024"],"dc:date.created":["2024-11"],"dc:date.embargo":["2026-01-13"],"dc:date.issued":["2025-01-13"],"dc:date.liftdate":["2026-01-13"],"dc:date.submitted":["November 2024"],"dc:date.updated":["2025-01-13T16:20:32Z"],"dc:description.abstract":["Code similarity, also referred to as cloned code, involves identifying redundant code fragments, enabling effective refactoring, and promoting code reuse. This, in turn, enhances both the maintainability and scalability of software systems. However, despite advancements in automated tools, detecting and generating clones, particularly across different programming languages and considering semantic variations—remains a significant challenge in software engineering. With the rise of large language models (LLMs) such as GPT, Gemini, and LLaMA, there is growing interest in leveraging their capabilities to improve clone detection, code generation, and cross-language translation. Despite this interest, research has yet to thoroughly evaluate how these models can be systematically applied to address the challenges in these domains. This thesis aims to bridge that gap by investigating the role of LLMs in three studies: clone generation, code quality assessment of similar codes, and cross-language clone detection, with the goal of advancing software engineering practices. The first study evaluates the performance of GPT-3 in generating semantic and cross-language code clones(similar codes) using the SemanticCloneBench dataset. Extensive experiments, validated by nine expert judges over 158 hours, show that GPT-3 achieved 62.14% accuracy and a 0.55 BLEU score in semantic clone generation, along with 91.25% accuracy in cross-language clone generation. These results underscore the potential of LLMs, particularly GPT-3, to support code reuse and facilitate migration across programming languages. The second study assesses the quality of similar code generated through three approaches: human-generated solutions from Stack Overflow, LLM-based code search tools such as CodeBERT and GraphCodeBERT, and AI-powered models including GPT-4, Gemini Pro-1.5, and LLaMA-3-8B. Analyzing 800 programming questions (400 in Python and 400 in Java), the study demonstrates that GPT-4 consistently outperformed other tools in usability, accuracy, and overall code quality, while the code search tools underperformed. These findings offer valuable insights for developers, particularly in selecting reliable tools for high-quality code generation. In the third study, I developed Lang2Clone, a novel tool that combines zero-shot prompting with GPT for code translation and NiCad for clone detection. Evaluations on the LeetCode and GPTCloneBench datasets showed that Lang2Clone achieved recall rates of 80% and 85%, respectively, with a precision of 95%. Notably, Lang2Clone outperformed state-of-the-art tools like GraphCodeBERT and CLCDSA in cross-language clone detection, particularly when translating between languages with similar programming paradigms. Collectively, these studies highlight the potential of LLMs to enhance key software engineering tasks, particularly in clone detection and code reuse. The findings also suggest promising avenues for future research, including the application of LLMs to broader challenges such as software maintenance and cross-language code translation, paving the way for more sophisticated and efficient development tools."],"dc:format.mimetype":["application/pdf"],"dc:identifier.uri":["https://hdl.handle.net/10388/16429"],"dc:language.iso":["en"],"dc:subject":["Code Clone","Large Language Model","Code Similarity","Code Generation","Code Quality"],"dc:title":["An Exploratory Study on the Roles of LLMs in Code Similarity Detection and Generation"],"dc:type":["Thesis","text"],"others:access_status":["open.access"],"person:identifier.orcid":["0000-0001-9470-4233"],"thesis:degree_department":["Computer Science"],"thesis:degree_discipline":["Computer Science"],"thesis:degree_level":["Masters"],"thesis:degree_name":["Master of Science (M.Sc.)"],"thesis:institution_name":["University of Saskatchewan"]},"updated_at":"2026-11-19T10:02:48Z"}