{"id":{"repo_id":"sask","oai_identifier":"oai:harvest.usask.ca:10388/16468"},"canonical_url":"https://search.ndltd.org/etd/sask/oai:harvest.usask.ca:10388/16468","repository":{"repo_id":"sask","name":"University of Saskatchewan","base_url":"https://harvest.usask.ca/server/oai/request"},"display":{"title":"Application of Large Language Models in Code Clone: Benchmarking, Evaluation and Detection","abstract":"As software systems grow increasingly complex, the detection of code clones has become vital for software maintenance and security analysis. Among the various types of clones, Type-4 or semantic clones (code fragments that perform the same function but differ syntactically) is difficult to detect due to their functional similarity rather than syntactic patterns. Traditionally, researchers have relied on benchmarks such as BigCloneBench to develop a code clone detector. However, BigCloneBench is not well-suited for handling the complex semantic clones, Bellon's benchmark is not suitable for assessing the capabilities of modern clone detection tools and SemanticCloneBench has few semantic examples. Additionally, the rise of large language models (LLMs) in software development has introduced diverse AI-generated clones, which differ from traditional developer clones by varying syntax, structure, control flow and language while maintaining the same functionality. As LLMs, like GPT-3, generate code at scale, existing detection tools struggle to handle this complexity, making both syntactic and semantic clone detection more challenging. To address these challenges, our first study introduces GPTCloneBench, a new benchmark designed to overcome the limitations of BigCloneBench and other datasets. By leveraging GPT-3 model and carefully designed prompt engineering, we generated 37,149 true semantic clones, 19,288 syntactic clones, and 20,770 cross-language clones across Java, C, C#, and Python—offering a more than 10-fold increase in scale compared to SemanticCloneBench. The GPTCloneBench creation process involved rigorous manual analysis, tool-assisted filtering, and manual and automated validation to ensure the accuracy and utility of the benchmark. In our second study, we evaluated the performance of nine different clone detection tools—ranging from classical detectors to AI-based tools—using three benchmarks: BigCloneBench, SemanticCloneBench, and GPTCloneBench. Our goal was to assess how well existing tools can detect clones using three different benchmarks specially the increasingly prevalent AI-generated semantic clones. The results revealed that while classical tools excel at identifying simpler clones (types 1–3), they fall short when applied to complex semantic clones, particularly those generated by LLMs. Even though AI-based tools achieved good recall, they required extensive computational resources to achieve this performance. These findings emphasize the need for more efficient and effective code clone detection models, particularly as the use of AI-generated code and LLM-based code clone detection tools continue to rise. In response to this need, our third study developed an efficient LLM-based code clone detection model using knowledge distillation (KD) and INT8 quantization-aware training (QAT). Our approach compressed LLM model, significantly reducing the number of attention heads, hidden dimensions, and layers while maintaining high performance. To compare with the existing LLM-tools which were trained and tested on BigCloneBench, our model was also trained on BigCloneBench and optimized to detect clones with greater speed and efficiency. Our compressed model consumes 77% less inference time and 51.2% less memory, while achieving a 93% precision and 96% recall in code clone detection. Our model, just 1.6 MB in size, proves that high performance can be achieved without the need for large, resource-intensive architectures, offering a scalable solution for detecting clones specially semantic clones.","abstract_html":"As software systems grow increasingly complex, the detection of code clones has become vital for software maintenance and security analysis. Among the various types of clones, Type-4 or semantic clones (code fragments that perform the same function but differ syntactically) is difficult to detect due to their functional similarity rather than syntactic patterns. Traditionally, researchers have relied on benchmarks such as BigCloneBench to develop a code clone detector. However, BigCloneBench is not well-suited for handling the complex semantic clones, Bellon&#x27;s benchmark is not suitable for assessing the capabilities of modern clone detection tools and SemanticCloneBench has few semantic examples. Additionally, the rise of large language models (LLMs) in software development has introduced diverse AI-generated clones, which differ from traditional developer clones by varying syntax, structure, control flow and language while maintaining the same functionality. As LLMs, like GPT-3, generate code at scale, existing detection tools struggle to handle this complexity, making both syntactic and semantic clone detection more challenging. To address these challenges, our first study introduces GPTCloneBench, a new benchmark designed to overcome the limitations of BigCloneBench and other datasets. By leveraging GPT-3 model and carefully designed prompt engineering, we generated 37,149 true semantic clones, 19,288 syntactic clones, and 20,770 cross-language clones across Java, C, C#, and Python—offering a more than 10-fold increase in scale compared to SemanticCloneBench. The GPTCloneBench creation process involved rigorous manual analysis, tool-assisted filtering, and manual and automated validation to ensure the accuracy and utility of the benchmark. In our second study, we evaluated the performance of nine different clone detection tools—ranging from classical detectors to AI-based tools—using three benchmarks: BigCloneBench, SemanticCloneBench, and GPTCloneBench. Our goal was to assess how well existing tools can detect clones using three different benchmarks specially the increasingly prevalent AI-generated semantic clones. The results revealed that while classical tools excel at identifying simpler clones (types 1–3), they fall short when applied to complex semantic clones, particularly those generated by LLMs. Even though AI-based tools achieved good recall, they required extensive computational resources to achieve this performance. These findings emphasize the need for more efficient and effective code clone detection models, particularly as the use of AI-generated code and LLM-based code clone detection tools continue to rise. In response to this need, our third study developed an efficient LLM-based code clone detection model using knowledge distillation (KD) and INT8 quantization-aware training (QAT). Our approach compressed LLM model, significantly reducing the number of attention heads, hidden dimensions, and layers while maintaining high performance. To compare with the existing LLM-tools which were trained and tested on BigCloneBench, our model was also trained on BigCloneBench and optimized to detect clones with greater speed and efficiency. Our compressed model consumes 77% less inference time and 51.2% less memory, while achieving a 93% precision and 96% recall in code clone detection. Our model, just 1.6 MB in size, proves that high performance can be achieved without the need for large, resource-intensive architectures, offering a scalable solution for detecting clones specially semantic clones.","abstract_has_math":false,"creators":["Alam, Ajmain Inqiad"],"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":["Roy, Dr. Chanchal","Schneider, Dr. Kevin"],"committee_chairs":[],"committee_members":["Schneider, Dr. Kevin","Roy, Dr. Banani","Lehnert, Dr. Lucas"],"year":2025,"date_issued":"2025-01-17","date_published":"2025-01-17","updated_at":"2026-11-19T10:12:24Z","subjects":["Code Clone, Code similarity, Benchmark, Code Clone Detection, Large Language Models, Tool Evaluation, Quantization, Knowledge Distillation, Compress LLM"],"languages":["en"],"rights":[],"rights_urls":[],"identifier_entries":[],"person_identifier_entries":[{"key":"person:identifier.orcid","label":"ORCID","values":["0009-0006-1180-2369"],"render_values":[{"text":"0009-0006-1180-2369","href":"https://orcid.org/0009-0006-1180-2369","code":true}]}]},"links":{"outbound_url":"https://hdl.handle.net/10388/16468","outbound_label":"Handle","outbound_source":"dc:identifier.uri","record_url":"https://hdl.handle.net/10388/16468","record_label":"Repository record","record_kind":"handle","record_source":"dc:identifier.uri","access_status":"embargoed","embargo_until":"2026-01-17","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%2F16468","prefix":"oai_dc"},"source_record":{"url":"https://harvest.usask.ca/server/oai/request?verb=GetRecord&metadataPrefix=dim&identifier=oai%3Aharvest.usask.ca%3A10388%2F16468","prefix":"dim"},"metadata_groups":[{"id":"people","label":"People","entries":[{"key":"dc:contributor.advisor","label":"Advisor","values":["Roy, Dr. Chanchal","Schneider, Dr. Kevin"]},{"key":"dc:contributor.committeemember","label":"Committee Member","values":["Schneider, Dr. Kevin","Roy, Dr. Banani","Lehnert, Dr. Lucas"]},{"key":"dc:creator","label":"Author","values":["Alam, Ajmain Inqiad"]},{"key":"person:identifier.orcid","label":"ORCID","values":["0009-0006-1180-2369"]}]},{"id":"academic_context","label":"Academic Context","entries":[{"key":"dc:date.accessioned","label":"Dc Date Accessioned","values":["2025-01-17T15:12:21Z"]},{"key":"dc:date.copyright","label":"Dc Date Copyright","values":["2024"]},{"key":"dc:date.created","label":"Dc Date Created","values":["2024-12"]},{"key":"dc:date.embargo","label":"Dc Date Embargo","values":["2026-01-17"]},{"key":"dc:date.issued","label":"Date","values":["2025-01-17"]},{"key":"dc:date.liftdate","label":"Dc Date Liftdate","values":["2026-01-17"]},{"key":"dc:date.submitted","label":"Dc Date Submitted","values":["December 2024"]},{"key":"dc:date.updated","label":"Dc Date Updated","values":["2025-01-17T15:12:21Z"]},{"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, Code similarity, Benchmark, Code Clone Detection, Large Language Models, Tool Evaluation, Quantization, Knowledge Distillation, Compress LLM"]}]},{"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/16468"]}]},{"id":"additional","label":"Additional Metadata","entries":[{"key":"dc:description.abstract","label":"Abstract","values":["As software systems grow increasingly complex, the detection of code clones has become vital for software maintenance and security analysis. Among the various types of clones, Type-4 or semantic clones (code fragments that perform the same function but differ syntactically) is difficult to detect due to their functional similarity rather than syntactic patterns. Traditionally, researchers have relied on benchmarks such as BigCloneBench to develop a code clone detector. However, BigCloneBench is not well-suited for handling the complex semantic clones, Bellon's benchmark is not suitable for assessing the capabilities of modern clone detection tools and SemanticCloneBench has few semantic examples. Additionally, the rise of large language models (LLMs) in software development has introduced diverse AI-generated clones, which differ from traditional developer clones by varying syntax, structure, control flow and language while maintaining the same functionality. As LLMs, like GPT-3, generate code at scale, existing detection tools struggle to handle this complexity, making both syntactic and semantic clone detection more challenging. To address these challenges, our first study introduces GPTCloneBench, a new benchmark designed to overcome the limitations of BigCloneBench and other datasets. By leveraging GPT-3 model and carefully designed prompt engineering, we generated 37,149 true semantic clones, 19,288 syntactic clones, and 20,770 cross-language clones across Java, C, C#, and Python—offering a more than 10-fold increase in scale compared to SemanticCloneBench. The GPTCloneBench creation process involved rigorous manual analysis, tool-assisted filtering, and manual and automated validation to ensure the accuracy and utility of the benchmark. In our second study, we evaluated the performance of nine different clone detection tools—ranging from classical detectors to AI-based tools—using three benchmarks: BigCloneBench, SemanticCloneBench, and GPTCloneBench. Our goal was to assess how well existing tools can detect clones using three different benchmarks specially the increasingly prevalent AI-generated semantic clones. The results revealed that while classical tools excel at identifying simpler clones (types 1–3), they fall short when applied to complex semantic clones, particularly those generated by LLMs. Even though AI-based tools achieved good recall, they required extensive computational resources to achieve this performance. These findings emphasize the need for more efficient and effective code clone detection models, particularly as the use of AI-generated code and LLM-based code clone detection tools continue to rise. In response to this need, our third study developed an efficient LLM-based code clone detection model using knowledge distillation (KD) and INT8 quantization-aware training (QAT). Our approach compressed LLM model, significantly reducing the number of attention heads, hidden dimensions, and layers while maintaining high performance. To compare with the existing LLM-tools which were trained and tested on BigCloneBench, our model was also trained on BigCloneBench and optimized to detect clones with greater speed and efficiency. Our compressed model consumes 77% less inference time and 51.2% less memory, while achieving a 93% precision and 96% recall in code clone detection. Our model, just 1.6 MB in size, proves that high performance can be achieved without the need for large, resource-intensive architectures, offering a scalable solution for detecting clones specially semantic clones."]},{"key":"dc:format.mimetype","label":"Dc Format Mimetype","values":["application/pdf"]},{"key":"dc:title","label":"Title","values":["Application of Large Language Models in Code Clone: Benchmarking, Evaluation and Detection"]},{"key":"others:access_status","label":"Others Access Status","values":["open.access"]}]}],"canonical_facts":{"dc:contributor.advisor":["Roy, Dr. Chanchal","Schneider, Dr. Kevin"],"dc:contributor.committeemember":["Schneider, Dr. Kevin","Roy, Dr. Banani","Lehnert, Dr. Lucas"],"dc:creator":["Alam, Ajmain Inqiad"],"dc:date.accessioned":["2025-01-17T15:12:21Z"],"dc:date.copyright":["2024"],"dc:date.created":["2024-12"],"dc:date.embargo":["2026-01-17"],"dc:date.issued":["2025-01-17"],"dc:date.liftdate":["2026-01-17"],"dc:date.submitted":["December 2024"],"dc:date.updated":["2025-01-17T15:12:21Z"],"dc:description.abstract":["As software systems grow increasingly complex, the detection of code clones has become vital for software maintenance and security analysis. Among the various types of clones, Type-4 or semantic clones (code fragments that perform the same function but differ syntactically) is difficult to detect due to their functional similarity rather than syntactic patterns. Traditionally, researchers have relied on benchmarks such as BigCloneBench to develop a code clone detector. However, BigCloneBench is not well-suited for handling the complex semantic clones, Bellon's benchmark is not suitable for assessing the capabilities of modern clone detection tools and SemanticCloneBench has few semantic examples. Additionally, the rise of large language models (LLMs) in software development has introduced diverse AI-generated clones, which differ from traditional developer clones by varying syntax, structure, control flow and language while maintaining the same functionality. As LLMs, like GPT-3, generate code at scale, existing detection tools struggle to handle this complexity, making both syntactic and semantic clone detection more challenging. To address these challenges, our first study introduces GPTCloneBench, a new benchmark designed to overcome the limitations of BigCloneBench and other datasets. By leveraging GPT-3 model and carefully designed prompt engineering, we generated 37,149 true semantic clones, 19,288 syntactic clones, and 20,770 cross-language clones across Java, C, C#, and Python—offering a more than 10-fold increase in scale compared to SemanticCloneBench. The GPTCloneBench creation process involved rigorous manual analysis, tool-assisted filtering, and manual and automated validation to ensure the accuracy and utility of the benchmark. In our second study, we evaluated the performance of nine different clone detection tools—ranging from classical detectors to AI-based tools—using three benchmarks: BigCloneBench, SemanticCloneBench, and GPTCloneBench. Our goal was to assess how well existing tools can detect clones using three different benchmarks specially the increasingly prevalent AI-generated semantic clones. The results revealed that while classical tools excel at identifying simpler clones (types 1–3), they fall short when applied to complex semantic clones, particularly those generated by LLMs. Even though AI-based tools achieved good recall, they required extensive computational resources to achieve this performance. These findings emphasize the need for more efficient and effective code clone detection models, particularly as the use of AI-generated code and LLM-based code clone detection tools continue to rise. In response to this need, our third study developed an efficient LLM-based code clone detection model using knowledge distillation (KD) and INT8 quantization-aware training (QAT). Our approach compressed LLM model, significantly reducing the number of attention heads, hidden dimensions, and layers while maintaining high performance. To compare with the existing LLM-tools which were trained and tested on BigCloneBench, our model was also trained on BigCloneBench and optimized to detect clones with greater speed and efficiency. Our compressed model consumes 77% less inference time and 51.2% less memory, while achieving a 93% precision and 96% recall in code clone detection. Our model, just 1.6 MB in size, proves that high performance can be achieved without the need for large, resource-intensive architectures, offering a scalable solution for detecting clones specially semantic clones."],"dc:format.mimetype":["application/pdf"],"dc:identifier.uri":["https://hdl.handle.net/10388/16468"],"dc:language.iso":["en"],"dc:subject":["Code Clone, Code similarity, Benchmark, Code Clone Detection, Large Language Models, Tool Evaluation, Quantization, Knowledge Distillation, Compress LLM"],"dc:title":["Application of Large Language Models in Code Clone: Benchmarking, Evaluation and Detection"],"dc:type":["Thesis","text"],"others:access_status":["open.access"],"person:identifier.orcid":["0009-0006-1180-2369"],"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:12:24Z"}