# Semantic code clone detection using hybrid intermediate representations and BiLSTM networks

**Authors:** M. Shahbaz Ismail, Sara Shahzad, Fahmi H. Quradaa, Sajid Anwar, Sajid Anwar, Sajid Anwar

PMC · DOI: 10.1371/journal.pone.0340971 · PLOS One · 2026-01-20

## TL;DR

This paper introduces a new method for detecting semantically similar code using hybrid representations and BiLSTM networks, achieving high accuracy in Java programs.

## Contribution

A novel framework combining hybrid intermediate representations with BiLSTM networks for improved semantic code clone detection.

## Key findings

- The model achieved 98% training accuracy and over 95% validation accuracy across clone categories.
- It outperformed other recurrent models, especially with attention mechanisms and multiple representations.
- The approach reached up to 97% recall and F1-scores on the BigCloneBench dataset for challenging clone types.

## Abstract

Semantic code clone detection plays an essential role in software maintenance and quality assurance, as it helps uncover fragments of code that express the same logic even when their syntax has been altered or deliberately obfuscated. In this study, we propose a framework that combines hybrid representation learning with deep bidirectional LSTM networks. The model is applied to two intermediate forms of Java programs—Baf and Jimple—extracted through the Soot framework, which together provide both syntactic structure and semantic detail. This design allows the method to cope with difficult obfuscation strategies such as polymorphism and metamorphism. In our experiments, the framework showed strong and stable performance. Training accuracy reached about 98%, while validation accuracy stayed above 95%, with good generalization across the different clone categories described in the Twilight-Zone taxonomy. When compared with other recurrent models, the BiLSTM consistently performed better, especially when combined with multiple intermediate representations and attention mechanisms. On the BigCloneBench dataset, the approach matched or exceeded the results of state-of-the-art tools, achieving recall and F1-scores of up to 97% on challenging clone types. These findings confirm the practical applicability of hybrid intermediate representations for semantic clone detection and suggest promising directions for future research using transformer-based models and large-scale deployment.

## Full-text entities

- **Diseases:** LSTM (MESH:D000088562), DL (MESH:D007859), PLs (MESH:D007806)
- **Chemicals:** PONE-D-25-54710 (-)
- **Species:** Homo sapiens (human, species) [taxon 9606]

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/PMC12818651/full.md

## Figures

12 figures with captions in the complete paper: https://tomesphere.com/paper/PMC12818651/full.md

## References

85 references — full list in the complete paper: https://tomesphere.com/paper/PMC12818651/full.md

---
Source: https://tomesphere.com/paper/PMC12818651