English

CSSG: Measuring Code Similarity with Semantic Graphs

Programming Languages 2026-01-15 v2 Artificial Intelligence

Abstract

Existing code similarity metrics, such as BLEU, CodeBLEU, and TSED, largely rely on surface-level string overlap or abstract syntax tree structures, and often fail to capture deeper semantic relationships between programs.We propose CSSG (Code Similarity using Semantic Graphs), a novel metric that leverages program dependence graphs to explicitly model control dependencies and variable interactions, providing a semantics-aware representation of code.Experiments on the CodeContests+ dataset show that CSSG consistently outperforms existing metrics in distinguishing more similar code from less similar code under both monolingual and cross-lingual settings, demonstrating that dependency-aware graph representations offer a more effective alternative to surface-level or syntax-based similarity measures.

Keywords

Cite

@article{arxiv.2601.04085,
  title  = {CSSG: Measuring Code Similarity with Semantic Graphs},
  author = {Yiyang Lu and Jingwen Xu and Changze Lv and Zisu Huang and Zhengkang Guo and Zhengyuan Wang and Muzhao Tian and Xuanjing Huang and Xiaoqing Zheng},
  journal= {arXiv preprint arXiv:2601.04085},
  year   = {2026}
}
R2 v1 2026-07-01T08:54:41.073Z