Injecting Structural Graph Context into Small Language Models for Efficient Code Clone Detection

Background Code clone detection is important for software maintenance, but detecting semantic clones remains challenging. Many existing methods rely on Graph Neural Networks (GNNs), which require high computational resources. Large Language Models (LLMs) can also be computationally expensive and may not effectively capture the structural relationships present in source code. This study proposes an efficient approach that combines structural program information with a Small Language Model (SLM) for code clone detection. Methods Program Dependence Graphs (PDGs) are generated from the BigCloneBench dataset and converted into a standard Graphviz text representation. This structural representation is used to fine-tune a 0.5-billion-parameter SLM using Parameter-Efficient Fine-Tuning (PEFT) with Low-Rank Adaptation (LoRA). The model is trained to detect code clones, identify their clone types, and locate the corresponding cloned lines of code. Results The proposed method achieved competitive F1-scores compared with existing code clone detection methods while using only approximately 5.5 GB of GPU memory. The Graphviz-based structural representation enabled the SLM to learn relationships within source code effectively while maintaining low computational requirements. The model also provided interpretable predictions by identifying clone types and locating cloned code segments. Conclusions The results demonstrate that combining structural graph information with an SLM provides an efficient approach to code clone detection. The proposed method reduces computational requirements while maintaining competitive detection performance and providing interpretable results. This approach offers a practical solution for code clone detection in software maintenance and related software engineering tasks.

Authors

Institutions

Publication Details

Journal
F1000Research
Published
2026-11-16
DOI
https://doi.org/10.12688/f1000research.187740.1
Primary Topic
Software Engineering Research
Type
article
Field-Weighted Citation Impact
0.00

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
article

Injecting Structural Graph Context into Small Language Models for Efficient Code Clone Detection

Akash Bhattacharyya, Jagannath Singh
2 links
F1000Research
Software Engineering Research
article

Injecting Structural Graph Context into Small Language Models for Efficient Code Clone Detection

Akash Bhattacharyya, Jagannath Singh
article en

Abstract

Background Code clone detection is important for software maintenance, but detecting semantic clones remains challenging. Many existing methods rely on Graph Neural Networks (GNNs), which require high computational resources. Large Language Models (LLMs) can also be computationally expensive and may not effectively capture the structural relationships present in source code. This study proposes an efficient approach that combines structural program information with a Small Language Model (SLM) for code clone detection. Methods Program Dependence Graphs (PDGs) are generated from the BigCloneBench dataset and converted into a standard Graphviz text representation. This structural representation is used to fine-tune a 0.5-billion-parameter SLM using Parameter-Efficient Fine-Tuning (PEFT) with Low-Rank Adaptation (LoRA). The model is trained to detect code clones, identify their clone types, and locate the corresponding cloned lines of code. Results The proposed method achieved competitive F1-scores compared with existing code clone detection methods while using only approximately 5.5 GB of GPU memory. The Graphviz-based structural representation enabled the SLM to learn relationships within source code effectively while maintaining low computational requirements. The model also provided interpretable predictions by identifying clone types and locating cloned code segments. Conclusions The results demonstrate that combining structural graph information with an SLM provides an efficient approach to code clone detection. The proposed method reduces computational requirements while maintaining competitive detection performance and providing interpretable results. This approach offers a practical solution for code clone detection in software maintenance and related software engineering tasks.

F1000ResearchVol. 15
KIIT University (IN)
Kalinga Institute of Industrial Technology
Software Engineering Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon