Learning Spectral Representations of Code through Latent Graph Learning for Generalizable Cross-Language Code Clone Detection
Analyze & explore related research in Conceptio
Connect this record directly into your research workflow or AI agent. Explore citations across open repositories, query full text, and export structured proof bundles.
Learning Spectral Representations of Code through Latent Graph Learning for Generalizable Cross-Language Code Clone Detection Mohsen Hesamolhokamaa , Ali Sadeghib , Kousha Moeinib , Behnam Rohanib , Mohammadamin Fazlia,1 , Jafar Habibia a Department of Computer Engineering, Sharif University of Technology, Tehran, Iran
arXiv:2608.22383v1 [cs.SE] 23 Aug 2026
b Department of Mathematical Sciences, Sharif University of Technology, Tehran, Iran
Abstract Current code clone detection (CCD) methods rely on fixed, language-specific graph representations like abstract syntax trees (ASTs) or program dependency graphs (PDGs). Because functionally identical code fragments can yield wildly different structures, these rigid graphs produce non-discriminative spectra that perform close to chance. To address this, we propose SPECTRA-Siam, a Siamese latent graph learning network that learns a latent space such that the graph’s spectrum serves as a discriminative signature of code functionality by optimizing downstream CCD performance. Given a fragment’s AST and data-dependencies, SPECTRA-Siam induces a fixed-size weighted latent graph through soft slot assignment and multi-head attention, and extracts a multi-scale spectral representation from its normalized Laplacian. Mapping all fragments into this shared space yields comparable spectra across programming languages. Experiments on BigCloneBench, AtCoder, and a four-language CodeNet benchmark (Java, Python, C++, C#) support this design choice. Using the same downstream classifier, moving from fixed to learned latent graphs spectra jumps F1 from 0.37 to 0.67 on BigCloneBench and accuracy from 0.60 to 0.71 on AtCoder. On CodeNet, the full model reaches 0.69 accuracy in four epochs and 0.79 after thirty epochs. In bridge-assisted language transfer across 60 unseen paths, SPECTRA-Siam’s performance degrades by only 0.058, versus 0.112–0.228 for baselines, showing that learned graph spectra provide a highly generalizable representation for cross-language clone detection. Keywords: Cross-Language Code Clone Detection, Source Code Representation, Graph Representation Learning, Latent Graph Learning, Spectral Graph Analysis,
1. Introduction Nearly every automated software engineering task begins with source code, and its effectiveness depends on how the underlying program is represented (Allamanis et al., 2018b). A useful representation should preserve the structural and semantic information required for automated reasoning about programs. This requirement is central to tasks such as code search (Gu et al., 2018), plagiarism detection (Schleimer et al., 2003), and vulnerability analysis (Zhou et al., 2019). Among these tasks, Code Clone Detection (CCD) aims to identify fragments that are identical, syntactically similar, ∗ Corresponding author.
Email addresses: hokama@ce.sharif.edu (Mohsen Hesamolhokama), ali.sadeghi@sharif.edu (Ali Sadeghi), Kousha.m83@sharif.edu (Kousha Moeini), behnam.rohani058@sharif.edu (Behnam Rohani), fazli@sharif.edu (Mohammadamin Fazli), jhabibi@sharif.edu (Jafar Habibi) Preprint submitted to Elsevier
or functionally equivalent. Such clones are prevalent in real-world software systems and increase maintenance costs because modifications to one fragment may need to be consistently propagated to its counterparts (Juergens et al., 2009; Roy and Cordy, 2007). The effectiveness of CCD depends strongly on whether a representation captures meaningful similarities beyond surface-level patterns. Early approaches represented code primarily as text or token sequences (Schleimer et al., 2003). Later methods incorporated abstract syntax trees (ASTs) using tree-based neural networks (Mou et al., 2016), while another line learned distributed representations from code tokens and their contexts (Mikolov et al., 2013; Alon et al., 2019). More recently, the Transformer architecture (Vaswani et al., 2017) and pre-trained models such as BERT (Devlin et al., 2019) have been adapted to source code, resulting in models such as CodeBERT (Feng et al., 2020) and GraphCodeBERT (Guo et al., 2021). All these approaches share the goal of mapping semantically related August 25, 2026
fragments to similar representations. Contrastive learning further strengthens this objective by encouraging such alignment through semantics-preserving transformations (Chen et al., 2020a; Jain et al., 2021; Bui et al., 2021b) or self-supervised objectives derived from AST structure (Bui et al., 2021a). Despite these advances, capturing program semantics remains a major challenge for CCD. Clones are commonly categorized into four types (Roy and Cordy, 2007); while the first three involve varying degrees of syntactic similarity, Type-IV clones represent functionally equivalent fragments and are difficult to detect (AlOmari et al., 2020). Existing CCD approaches have explored learned representations through deep feature models (White et al., 2016; Wei and Li, 2017), ASTbased encoders (Zhang et al., 2019), and graph-based representations that incorporate richer program structures (Zhao and Huang, 2018; Wang et al., 2020; Wu et al., 2020). However, semantic clone detectors often generalize poorly to projects outside their training data, limiting their ability to handle unseen code (Sonnekalb et al., 2022). Graph-based methods incorporate richer program information through ASTs, CFGs, DDGs, or CPGs (Yamaguchi et al., 2014; Zhao and Huang, 2018; Wang et al., 2020; Wu et al., 2020), but these structures are fixed before training as the model learns how to encode a given graph. This limitation becomes significant in cross-language clone detection, where equivalent functionality may be expressed through different syntactic structures and language constructs (Perez and Chiba, 2019; Zhang et al., 2024; Alam et al., 2023). Graph spectra offer an alternative by summarizing graph structure through the eigenvalues of adjacency or Laplacian matrices. These eigenvalues are invariant to node relabeling (Chung, 1997; Mohar, 1991), capture global connectivity properties (Fiedler, 1973), and can be truncated to a bounded number of leading components (Defferrard et al., 2016a). Although spectral descriptors have been widely used as structural signatures in geometry processing (Sun et al., 2009a; Zhang et al., 2010) and graph mining (Belkin and Niyogi, 2003; Narayanan et al., 2017), their use in software engineering has largely focused on software architecture analysis, such as partitioning module dependency graphs (Mitchell and Mancoridis, 2006). To our knowledge, the graph spectrum has not been explored as a representation of individual program fragments for source code representation learning or clone detection. This motivates our central design choice: we do not commit to any predefined program graph. We learn a graph whose spectral properties are optimized for distinguishing functional equivalence. This perspective
follows latent graph learning, where the graph structure itself is treated as a learnable variable jointly optimized with the prediction task (Kipf et al., 2018; Franceschi et al., 2019; Chen et al., 2020b; Zhu et al., 2021; Saha et al., 2023). We propose SPECTRA-Siam, a Siamese model that transforms the AST and projected datadependence information of each code fragment into a language-independent latent graph. The learned graph provides a compact and comparable structure across fragments of different sizes, while its spectral properties serve as the basis for the final representation. Unlike approaches that commit to a fixed AST, CFG, DDG, or CPG structure (Yamaguchi et al., 2014), SPECTRASiam lets clone supervision determine the topology that best captures functional similarity. A shared representation space across parsers further enables cross-language clone detection. 1.1. A Motivating Example Figure 1 illustrates the limitation of fixed CFG for clone detection. Functions A and B implement the same array-summation behavior, but different loop structures and intermediate computations produce different CFGs. Their Laplacian spectra, {0, 0.486, 1.000, 2.428, 3.000, 5.086} and {0, 0.433, 0.851, 2.000, 2.302, 3.113}, have a distance of 2.14. The unrelated product function C has smaller distances from A and B, with distances of 1.02 and 1.24, respectively. A more suitable representation should therefore learn graph structures that are more aligned with semantic similarity of code. 1.2. Contributions The main contributions of this paper are as follows: • A Novel Latent Graph Learning Network for Spectral Code Representation. We propose SPECTRA-Siam, a Siamese latent graph learning network with soft slot assignment and multi-head attention that learns a fixed-size weighted latent graph and derives a multi-scale spectral representation from its normalized Laplacian. Even without its original prediction head, SPECTRA-Siam significantly outperforms fixed-graph spectral baselines (AST, CFG, DDG, and CPG) under identical downstream classifiers, improving spectral F1 from .37 to .67 on BigCloneBench and from .65 to .73 on AtCoder (Table 4). • Cross-Language Robustness under Language Shifts and Transfer Paths. We evaluate crosslanguage generalization using bridge-assisted 2
Listing 1: A: sum with a for loop.
Listing 2: B: sum with a while loop.
int sumArray(int[] a) { int s = 0; for (int i=0; i<a.length; i++) s += a[i]; return s; }
int aggregate(int[] v) { int acc = 0, k = 0; while (k < v.length) { acc += v[k]; k++; } return acc; }
1
1
2
2
3
1 A 2
3
6 5
4
6 B
7 3
4
Listing 3: C: product computation. int product(int[] a) { int p = 1; for (int i=0; i<a.length; i++) p *= a[i]; return p; }
5
C
6 CFG spectrum
(a) CFG of A
4
5
(darker = larger eigenvalue)
(c) CFG of C (b) CFG of B
Figure 1: Fixed CFG spectra mislead clone detection. The semantically equivalent pair (A, B) is spectrally farther apart (distance 2.14) than either is from the unrelated function C (1.02 and 1.24).
transfer paths, where a model learns from one or more non-target language pairs and is tested on an unseen target language pair. Across 60 such transfer paths (Table 10), SPECTRA-Siam shows the smallest average degradation under language shift (.058), compared with .112–.228 for RtvNN, DeepSim, ASTNN, and GraphCodeBERT . SPECTRA-Siam is also the only method above chance on all six cross-language pairs without cross-language supervision (Table 6).
four types. Type-1 clones differ only in formatting or naming. Type-2 and Type-3 clones allow increasingly larger syntactic changes. Type-4 clones implement the same functionality despite having different syntax. Early scalable detectors relied mainly on text or tokens. CCFinder (Kamiya et al., 2002) normalizes token sequences before comparison. Ducasse et al. (1999) instead compare source code at the line level in a language-independent manner, while CP-Miner (Li et al., 2006) mines copy-paste patterns in large software systems. NiCad (Roy and Cordy, 2008) combines source transformation, pretty-printing, normalization, and line-based comparison to find near-miss clones. Later methods improved scalability through more selective comparison. SourcererCC (Sajnani et al., 2016) uses an inverted index, CCAligner (Wang et al., 2018) compares overlapping code windows, and Oreo (Saini et al., 2018) uses filtering before clone comparison. StoneDetector (Heinze et al., 2025) takes a different route by extracting paths from dominator trees and comparing their encodings. These methods can scale to large codebases, but text and token similarity alone becomes less reliable as two implementations diverge syntactically. Tree-based methods make syntax explicit. Baxter et al. (1998) detect clones by matching AST subtrees, while DECKARD (Jiang et al., 2007) maps AST subtrees to numerical vectors and clusters similar vectors. ASTs provide more information than raw text, but syntax alone may still be insufficient when equivalent code
1.3. Paper Organization The rest of this paper is organized as follows. Section 2 reviews related work. Section 3 presents our latent graph induction framework and spectral representation. Section 4 describes the datasets, baselines, and evaluation protocols, while Section 5 reports the evaluation results on single-language and cross-language benchmarks. Section 6 analyzes the learned spectral representation space, and Section 8 summarizes our findings and concludes the paper. 2. Related Work 2.1. Code Clone Detection Code clone detection has been studied for more than two decades. Methods are often distinguished by the representation used to compare code fragments. Roy and Cordy (Roy and Cordy, 2007) classify clones into 3
is reorganized substantially. Program graphs can capture relations that are less tied to source order. Komondoor and Horwitz (Komondoor and Horwitz, 2001) and Krinke (Krinke, 2001) use program dependence graphs (PDGs), whose edges describe control and data dependencies. Such representations can reveal similarities that are difficult to see from tokens or syntax trees, although graph and subgraph matching can be computationally expensive. More recent approaches learn code representations from data. White et al. (2016) were among the early works to apply deep learning to clone detection using lexical and syntactic information. CDLH (Wei and Li, 2017) formulates functional clone detection as supervised hashing over AST-based LSTMs. ASTNN (Zhang et al., 2019) splits an AST into statement-level subtrees and encodes their sequence with recurrent neural networks (RNNs). Other approaches use tree-based convolution (Yu et al., 2019) or recursive neural models over ASTs (Büch and Andrzejak, 2019). Another line learns from engineered structural features. Sheneamer et al. (2018) combine features from bytecode dependency graphs, PDGs, and ASTs to detect semantic clones and obfuscated code, Sheneamer (2021) blend several similarity measures for consensus-driven classification, and Sudhamani and Rangarajan (2019) compare control-statement and program-level metrics directly. GNN-based methods incorporate additional program relations into the learned representation. Wang et al. (2020) introduce the flow-augmented AST (FA-AST), which adds control-flow and data-flow edges to the AST and applies graph neural networks for clone detection. Yu et al. (2023a) use either a CFG or a PDG and learn graph representations with attention at several levels before comparing code fragments. For cross-language clone detection, FSD-CLCD (Zhang et al., 2024) builds graph representations from ASTs and transfers functional information across languages through knowledge distillation. SCOTT (Gao et al., 2026) combines a graph and a text view of each fragment with contrastive learning to cover all four clone types. Cross-language analysis has also moved beyond clone detection, for example to multilingual refactoring (Li and Zhang, 2024). Other work focuses on computational cost or alternative input representations. Zhang et al. (2023) reduce Transformer cost through code token learners, CCStokener (Wang et al., 2023) enriches token representations with semantic information, and Code2Img (Hu et al., 2023) converts AST adjacency matrices into images processed by convolutional networks. BigCloneBench (Svajlenko et al., 2014) is widely used to evaluate many
of these learning-based clone detectors. Large language models have recently been applied to the same task. A systematic mapping of this literature (Jiang et al., 2026) finds that prompting improves Type3 and Type-4 detection, but that prompt sensitivity remains a major source of variance and Type-4 clones stay difficult; broader surveys report similar limitations (Dou et al., 2023). 2.2. Source Code Representation How code is represented determines which similarities a detector can observe. The AST describes the syntactic organization of a program, while the control-flow graph (CFG) describes possible execution paths and the PDG adds control and data dependencies. The code property graph (CPG) introduced by Yamaguchi et al. (2014) brings syntax, control flow, and data flow into a unified graph and was originally developed for vulnerability discovery. A different line of work learns vector representations of code. code2vec (Alon et al., 2019) represents a code fragment through paths sampled from its AST and combines them into a fixed-length vector. Pre-trained language models learn from much larger source-code corpora. CodeBERT (Feng et al., 2020) learns joint representations of programming language and natural language. GraphCodeBERT (Guo et al., 2021) also uses data-flow information during pre-training and applies the resulting model to tasks including clone detection. Models such as ASTNN (Zhang et al., 2019) and FAAST (Wang et al., 2020) similarly learn representations from program trees or graphs. Yu et al. (2023b) report that graph neural networks over code graphs are sensitive to how the graph is constructed, and that reported gains are hard to reproduce across settings. 2.3. Spectral Analysis of Graphs Spectral graph theory studies graphs through the eigenvalues and eigenvectors of matrices associated with them, most commonly the adjacency matrix and graph Laplacian (Chung, 1997; Mohar, 1991). The Laplacian spectrum reflects several properties of a graph. A classical example is the connection between the second-smallest Laplacian eigenvalue and graph connectivity established by Fiedler (Fiedler, 1973). Eigenvalues are also unchanged by a permutation of the node ordering, which makes them useful when the identity or ordering of nodes should not affect the representation. Spectral methods appear in many areas of graph analysis. Laplacian eigenvectors are used in spectral clustering (Shi and Malik, 2000; Ng et al., 2002; von Luxburg, 4
3. Methodology
2007) and Laplacian eigenmaps (Belkin and Niyogi, 2003). Eigenvalue and eigenvector information has also been used for graph matching (Leordeanu and Hebert, 2005) and shape analysis (Sun et al., 2009a; Zhang et al., 2010). In graph neural networks, Bruna et al. (2014) define convolution using the graph Laplacian spectrum. Defferrard et al. (2016a) make these filters local and efficient through Chebyshev polynomials, and Kipf and Welling (Kipf and Welling, 2017) derive a simpler graph convolution from a first-order approximation of spectral filtering.
Spectral representations provide compact, permutation-invariant descriptions of graph structure and have been used for graph comparison and matching (Wilson and Zhu, 2008). Their discriminative content, however, depends on the graph being represented. Using a fixed AST, CFG, or DDG therefore commits the representation to a predefined structural view of the program. We instead learn a latent graph from semantic-clone supervision and optimize it jointly with the downstream prediction task (Yu et al., 2021).
2.4. Latent Graph Learning
3.1. Problem Formulation Let L denote a set of programming languages, Cℓ the set of code fragments written in language ℓ ∈ L, S and C = ℓ∈L Cℓ . Given a labeled training set Dtr = {(ci , c j , yi j )}, where ci , c j ∈ C,
Most message-passing networks assume that the graph structure is known beforehand. This assumption can be restrictive when the available graph is not a good representation for the downstream task. Latent graph learning, often studied under the broader term graph structure learning, addresses this problem by estimating the graph along with the predictive model (Zhu et al., 2021). Several methods illustrate different ways to do this. Neural Relational Inference (NRI) (Kipf et al., 2018) learns a latent interaction graph from observations of a dynamical system. Franceschi et al. (2019) learn the parameters of a graph neural network and a discrete probability distribution over graph edges through bi-level optimization. IDGL (Chen et al., 2020b) repeatedly updates node embeddings and reconstructs a graph from learned similarities between them. Other methods learn neighborhoods and allow the number of selected neighbors to vary (Saha et al., 2023). Graph pooling provides another way to handle graphs of varying sizes by learning how input nodes are grouped into a smaller graph. DiffPool (Ying et al., 2018a) learns a soft assignment from input nodes to a fixed number of clusters and produces a smaller graph at the next layer. Latent graph learning is particularly relevant to our setting. Existing graph-based code models start from relations obtained through parsing or program analysis, such as those in an AST, CFG, PDG, CPG, or a manually augmented graph (Yamaguchi et al., 2014; Wang et al., 2020; Yu et al., 2023a; Zhang et al., 2024). Some software-engineering methods also simplify these graphs before learning. AMPLE (Wen et al., 2023), for example, simplifies code graphs and combines information from different edge types for vulnerability detection.
1, yi j = 0,
ci ≡func c j , otherwise,
(1)
indicates whether the two fragments implement the same functionality. Let Gm,d denote the space of weighted attributed graphs with m latent nodes, each represented by a d-dimensional feature vector. We seek a parameterized code-to-graph mapping GΘ : C → Gm,d such that GΘ (c) = (ZΘ (c), AΘ (c)). The graph is represented by its spectral signature sΘ (c) = Spec(GΘ (c)) ∈ Rds . Define S Θ (ci , c j ) = cos sΘ (ci ), sΘ (c j ) .
(2)
and let the spectral loss be ℓi j (Θ) = yi j (1 − S Θ (ci , c j )) + (1 − yi j )[S Θ (ci , c j ) − µspec ]+ , (3) where [x]+ = max(0, x) and µspec ∈ [0, 1) is the negative-pair similarity margin, specifying the maximum similarity tolerated for negative pairs. The objective then is to learn GΘ such that functional equivalence is preserved in the induced spectral space, i.e., h i Θ∗ = arg min E(ci ,c j ,yi j )∼Dtr ℓi j (Θ) . Θ
(4)
At inference time, the complete model produces a clone probability b pi j for each pair. Clone detection is performed as b yi j = I[S Θ∗ (ci , c j ) ≥ γ], where γ is the decision threshold. 5
Figure 2: SPECTRA-Siam architecture.
3.2. SPECTRA-Siam
Hashed lexical features. The canonical type alone does not preserve all information carried by the original node label. We therefore keep a small amount of lexical information for each node. Non-numeric labels are split at punctuation and camel-case boundaries (Hill et al., 2014), and literals are normalized. The resulting subtokens, together with their character nchar -grams, are mapped by a deterministic hash function to Nhash indices (Weinberger et al., 2009). This keeps the lexical vocabulary at a fixed size regardless of the source language or dataset. We keep at most rmax lexical features per node and ignore labels that contain only line numbers. For node v, let κ(tv ) be its canonical type and ℓv1 , . . . , ℓvr its lexical features. We combine the embedding of the canonical type with the average embedding of these lexical features: r X 1 Ecan (κ(tv )) + γlex , γlex = σ(glex ). E (ℓ ) h(0) lex vq v = LN r
SPECTRA-Siam uses a Siamese architecture with shared parameters for the two code fragments (Bromley et al., 1993). Each branch constructs a normalized attributed program graph and encodes its syntactic and data-dependence relations. It then maps the variablesize graph to a fixed set of latent nodes to learn their weighted adjacency and derives a multi-scale spectral representation. Spectral features are then compared by a pairwise classifier to output a prediction in [0, 1]. Figure 2 summarizes the pipeline. 3.2.1. Stage 1: Initial Representation and Language Normalization Each code fragment is first converted into an attributed graph whose nodes have numerical representations and whose edges encode structural relations. Combining syntactic structure with semantic or dataflow relations is common in learned program representations (Allamanis et al., 2018a; Yamaguchi et al., 2014). We use AST to provide the node backbone and augment it with DDG edges whose endpoints can both be mapped to AST nodes. The edges are made bidirectional before batching.
q=1
(5) where Ecan and Elex are learned embedding tables. The learned scalar γlex ∈ (0, 1) controls how strongly the lexical information contributes to the initial node representation. Layer normalization and dropout are applied to the lexical features during training to improve numerical stability and provide regularization (Ba et al., 2016; Srivastava et al., 2014). Graphs are restricted to the first nmax serialized AST nodes; padding is excluded from message passing and reconstruction.
Canonical node types. Parser node names vary across languages and extraction tools, so raw types are mapped to a shared vocabulary Kcan :
3.2.2. Stage 2: Relation-Aware Structural Encoding AST and DDG edges represent different relations and should therefore use separate transformations (Schlichtkrull et al., 2018). Let H (l) ∈ Rn×d contain node states at layer l and A(r) denote the adjacency for relation r ∈ R. Each layer computes X e(r) H (l) Wr(l) , U (l) = H (l) W0(l) + A r∈R (6) h i H (l+1) = LN H (l) + Dropout GELU(U (l) ) ,
Control If, Control Loop, Control Switch, Control Return, Control Break, Control Generic, Var Decl, Func Decl, Class Decl, Param Decl, Assign Op, Binary Op, Unary Op, Call Expr, Access Expr, Literal Num, Literal Str, Literal Bool, Literal Null, Literal Generic, Structural Block, Identifier Context, Type Meta, and Canonical Unknown.
The mapping covers Joern, Python’s AST parser, and the language-specific parser fallbacks used in preprocessing; unmatched types are assigned to Canonical Unknown. 6
After clipping S to [−smax , smax ], the latent adjacency is " ! # S ⊤ AΘ (c) = Sym σ ⊙ (11 − Im ) . (12) T (c)
e(r) is row-normalized, with a minimum degree where A denominator of one. W0(l) transforms the current state and Wr(l) is relation specific. The residual, normalization, GELU, and dropout components follow standard formulations (He et al., 2016; Ba et al., 2016; Hendrycks and Gimpel, 2016; Srivastava et al., 2014). The encoder uses Lenc layers of dimension d.
AΘ (c) is symmetric, continuous, and zero-diagonal; no hard edge threshold is applied. Lref additional graph layers refine Z using this learned adjacency. Figure 3 summarizes the complete latent-graph induction process.
3.2.3. Stage 3: Latent Graph Induction We reduce the number of node states to m latent nodes using iterative soft assignment, following the general idea of differentiable graph pooling (Ying et al., 2018b). For normalized input key kv and latent query q j, √ exp(q⊤j kv / d) (7) Pv j = Pm √ . ⊤ u=1 exp(qu kv / d) Latent updates normalize contributions over valid input nodes and use a GRU followed by a residual MLP (Cho et al., 2014; He et al., 2016). After Iassign iterations, the latent states form Z ∈ Rm×d . To limit information loss b = PZ reconstructs the input states. during pooling, H With Mv indicating valid nodes, 2 1 X 1 b . Lrec = P Mv h(0) (8) v − hv 2 d v Mv v The observed structure is projected into latent space as B = P⊤ Ain P,
e= B
B , maxi, j Bi j + ϵ
(9)
e where Ain combines the enabled input relations and B serves as a prior. Task-dependent affinities are obtained from Ha scaled dot-product attention heads (Vaswani et al., 2017): Ha 1 X Qh Kh⊤ e S = Sym (10) √ + η B, Ha h=1 dh
Figure 3: Latent graph induction in SPECTRA-Siam.
3.2.4. Stage 4: Multi-Scale Spectral Representation The learned graph and its latent-node attributes are summarized jointly through an attributed graph-spectral representation. We first construct the normalized Laplacian
where η learns the contribution of the projected AST/DDG structure. Thus, the latent topology combines observed structure with task-dependent affinities, following the general setting of graph structure learning (Jin et al., 2020).
−1/2 LΘ = Im − D−1/2 Θ A Θ DΘ ,
DΘ = diag(AΘ 1), (13)
whose eigenvalues lie in [0, 2] for an undirected graph with non-negative edge weights (Chung, 1997). Numerical stability is maintained by exact symmetrization of the Laplacian, clamping the spectrum to its theoretical range [0, 2], and forcing single precision for the eigensolver under mixed-precision training.
Adaptive edge temperature. We convert S to continuous edge weights using a temperature conditioned on graph size and density. For n(c) valid nodes, define node occupancy u(c) = n(c)/nmax and ρin (c) = P 2 clip[0,1] ( r,i, j A(r) Their mixture is χ(c) = i j /n(c) ). βu u(c) + (1 − βu )ρin (c), giving T (c) = T min + (T max − T min )σ bT + softplus(wT )χ(c) . (11)
Eigenvalue density. For normalized Laplacian eigenvalues λ1 , . . . , λm , a Gaussian-smoothed profile (Baner7
jee and Jost, 2008; Lewitus and Morlon, 2016) is evaluated at Nξ centers ξ j ∈ [0, 2]: ! m 1 λi − ξ j 2 1X , j = 1, . . . , Nξ , (14) exp− dj = m i=1 2 σdens
3.2.5. Spectral Embedding and Pairwise Prediction We compute ϕΘ (c) = Norm2 (g s (sΘ (c))) ∈ Rdϕ , where g s is a learned projection. For pair (ci , c j ), with ϕi = ϕΘ (ci ) and ϕ j = ϕΘ (c j ), we form qi j = ϕi ∥ ϕ j ∥ |ϕi − ϕ j | ∥ (ϕi ⊙ ϕ j ) ∥ cos(ϕi , ϕ j ),
giving d(c) ∈ RNξ .
where qi j ∈ R4dϕ +1 . An Lpair -layer MLP maps qi j to a scalar logit, and a sigmoid yields b pi j .
Heat traces. Heat diffusion captures structure across scales (Sun et al., 2009b). At logarithmically spaced tq ∈ [tmin , tmax ],
3.2.6. Training Objective Training combines classification, spectral contrast, AUC ranking, hard-negative separation, node and topology reconstruction, spectral variance preservation, and graph regularization.
m
hq =
1X exp(−tq λi ), m i=1
q = 1, . . . , Nt ,
(15)
yielding h(c) ∈ RNt . Graph-signal Chebyshev energies. To preserve information about node attributes within the spectral representation, the refined latent states Z are projected to Nsig graph-signal channels: e = ZW s ∈ Rm×Nsig . X
Classification loss. With N+ and N− denoting clone and non-clone training pairs, define w+ = min(wmax , N− / max(1, N+ )). For mini-batch B,
(16)
The signals are RMS-normalized across latent nodes: Xvr = q
evr X 1 Pm e 2 u=1 Xur + ϵ m
,
r = 1, . . . , Nsig .
Lcls = −
(17)
Lspec =
T k (X) = 2e LT k−1 (X)−T k−2 (X). (18) Chebyshev approximations allow spectral filtering without explicit eigenvector multiplication (Defferrard et al., 2016b). For Nband Gaussian filters, Yb =
T 1 (X) = e LX,
K cheb X
abk T k (X),
b = 1, . . . , Nband ,
i 1 X h w+ yi j log b pi j + (1 − yi j ) log(1 − b pi j ) . |B| (i, j)∈B (23)
Spectral contrastive loss. For cisj = cos(sΘ (ci ), sΘ (c j )), contrastive supervision (Hadsell et al., 2006) is
This normalization removes signal-scale effects before spectral filtering (Stanković et al., 2022). Since the normalized-Laplacian spectrum lies in [0, 2], we use e L = LΘ − Im and the Chebyshev recurrence T 0 (X) = X,
(22)
(19)
k=0
where the filter centers lie in [ωmin , ωmax ] with bandwidth σfilt and fixed coefficients abk . Gradients propagate through the eigendecomposition, so the eigenvaluedensity and heat-trace profiles supervise the learned adjacency alongside the differentiable Chebyshev path. Band importance is fixed at αb = 1/Nband , and the perband energies are m 1X ebr = log 1 + Yb (i, r)2 . (20) m i=1
h i2 1 X yi j (1 − cisj )2 + (1 − yi j ) cisj − µspec . + |B| (i, j)∈B (24)
AUC-ranking loss. Let ri j denote the classifier logit before the sigmoid, and let B+ and B− contain the positive and negative pairs in the mini-batch, respectively. The pairwise logistic loss ranks positive pairs above negatives: X X h i 1 log 1 + exp −(ri j − ruv ) . Lauc = |B+ | |B− | (i, j)∈B (u,v)∈B + − (25) This term is set to zero when either class is absent from the mini-batch. Hard-negative loss. To emphasize confusable nonclones (Wang et al., 2022), let cϕi j = cos(ϕi , ϕ j ) and let K index the max(1, ⌊κhard N−B ⌋) largest negative-pair values h i2 of cϕi j − µhard . Then +
Thus e(c) ∈ RNband Nsig , and the complete descriptor is sΘ (c) = d(c) ∥ h(c) ∥ e(c) ∈ Rds , d s = Nξ + Nt + Nband Nsig . (21)
Lhard = 8
i2 1 X h ϕ ci j − µhard . + |K| (i, j)∈K
(26)
Topology-reconstruction loss. Let R = PAΘ P⊤ be the learned adjacency projected back to the input-node space and let T = max(Ain , A⊤in ) be the symmetrized AST/DDG adjacency. Over the valid off-diagonal entries Ω, class-balanced binary cross-entropy gives
4. Experimental Design 4.1. Research Questions
The objective of this study is to determine whether learning a latent graph can improve spectral code reprei sentation for effective and generalizable cross-language 1 X h wtopo T uv log Ruv + (1 − T uv ) log(1 − Ruv ) , Ltopo = − clone detection. To achieve this objective, we formulate |Ω| (u,v)∈Ω three main research questions as follows: (27) where wtopo is the clipped ratio of non-edges to edges in • RQ1 To what extent does learning a latent graph imΩ. This term encourages PAΘ P⊤ to reproduce the input prove the discriminative power of spectral code repAST/DDG edges. resentations compared with fixed program graphs? Spectral-variance loss. Let σk be the across-batch stan• RQ2 How effective is SPECTRA-Siam compared dard deviation of coordinate k of the ℓ2 -normalized with non-graph, graph-based, hybrid graph–code, spectral descriptors from both sides of all pairs. The and pre-trained baselines under conventional evaluvariance-preserving hinge loss is ation? ds X 1 σk . (28) Lvar = 0.03 − • RQ3 How well does SPECTRA-Siam generalize to d s k=1 + unseen language combinations when target-language supervision is unavailable? It keeps the mean descriptor standard deviation above 0.03 and prevents spectral collapse. 4.2. Dataset
Graph regularization. For a batch of latent adjacencies, let P|B| P i, j Ab,i j , Lden = ā(A) − ā0 2 . (29) ā(A) = b=1 |B|m(m − 1)
We use three semantic clone datasets: BigCloneBench (Svajlenko et al., 2014), filtered following Wang et al. (2020), AtCoder (Perez and Chiba, 2019), and a benchmark derived from Project CodeNet (Puri et al., 2021). BigCloneBench contains Java–Java pairs, while AtCoder contains Java–Python pairs. CodeNet covers four within-language configurations (Python– Python, Java–Java, C++–C++, and C#–C#) and all six cross-language configurations (Python–Java, Python– C++, Python–C#, Java–C++, Java–C#, and C++–C#). The final CodeNet benchmark is balanced both by language configuration and clone label. Each of the ten configurations contains 10K pairs, with 5K clones and 5K non-clones, for 100K pairs in total. Non-clone pairs for AtCoder and CodeNet are formed from accepted solutions to different programming problems, following (Perez and Chiba, 2019). Table 1 summarizes the resulting datasets and data splits.
We penalize low algebraic connectivity based on the second-smallest Laplacian eigenvalue, i.e., algebraic connectivity (Fiedler, 1973): i2 1 Xh µconn − λ(b) , 2 + |B| b
(30)
Lgraph = αden Lden + αconn Lconn .
(31)
Lconn =
The complete objective is Ltotal = Lcls + λspec Lspec + λhard Lhard + λrec Lrec + λgraph Lgraph
(32)
+ λauc Lauc + λtopo Ltopo + λvar Lvar . 3.2.7. Optimization All learnable components are optimized with AdamW (Loshchilov and Hutter, 2019). Neural layers use mixed-precision GPU computation (Micikevicius et al., 2018), while latent-adjacency construction and spectral operations use single precision for numerical stability. Numerical hyperparameters are reported in Table 3 of Section 4.5. Checkpoint and decision-threshold selection use only the validation split (see Section 4.4).
Table 1: Datasets used in the evaluation. CodeNet contains ten balanced language configurations, each with 10K pairs and 5K clones. Dataset Total Clones Train Val. Test BigCloneBench 1,731,860 561,521 901,028 415,416 415,416 Java–Java AtCoder 777,494 388,747 544,054 116,704 116,736 Java–Python CodeNet 100,000 50,000 70,000 15,000 15,000 10 configurations
9
Table 2: Baseline configurations. For neural models, the training column reports batch size / learning rate α / maximum epochs.
CodeNet’s Clone Extraction Process. We construct CodeNet pairs from problem IDs and submission verdicts. Two distinct accepted submissions to the same problem form a clone, while accepted submissions to different problems form a non-clone. We first build a diversitycontrolled pool of approximately one million pairs. For each language configuration, candidate problems are sampled across eight groups based on the number of pairs they can provide, and submissions are selected to vary in user, submission time, code size, and compiler variant. For same-language pairs, near-duplicates with Jaccard similarity of at least 0.90 are removed using normalized token shingles and MinHash/LSH (Broder, 1997; Broder et al., 1998); less-similar and less-used submissions are preferred, and each submission is limited to at most ten selected pairs. From this pool, we sample the final benchmark by language configuration and clone label, yielding 5K clone and 5K non-clone pairs for each of the ten configurations. The resulting 100K pairs are then split into 70K training, 15K validation, and 15K test pairs while preserving this stratification.
Method
Input / architecture
Training
Params.
Fixed spectral representations (AST, CFG, DDG, CPG) No Train
136-D spectrum
RF
274-D pair features
LR
274-D pair features
SNN
136 → 256 → 256 → 128
No training 200 trees; depth 16; leaf 5 balanced-subsample; seed 42 train-only scaling; balanced max. 1,000 iter.; seed 42 8192/10−3 /4; dropout .10 WD 10−4 ; clip 5.0
0 –
–
202k
GNNs over conventional graphs (AST, CFG, DDG, CPG) GCN
5-D nodes; GCN 256/128; mean pool 16/(5×10−4 )/4; dropout .05 128 + 128 + 128 = 384-D representation WD 10−4 ; patience 2; clip 2.0
Token, tree, graph, and hybrid baselines AST-category count vectors per subtree Deckard Validation threshold top-32 subtrees by size; cosine RtvNN
CDLH
4.3. Baselines We compare SPECTRA-Siam with six baseline families: fixed spectral representations, GNNs over conventional program graphs, non-graph code models, other graph-based models, a hybrid graph–code model, and pre-trained code models. For the fixed spectral representations, we consider four downstream settings: no training (No Train), Random Forest (RF) (Breiman, 2001), Logistic Regression (LR) (Hastie et al., 2009), and a Siamese Neural Network (SNN) (Bromley et al., 1993). Combined with AST, CFG, DDG, and CPG, this gives 16 fixed-spectral configurations. The GNN (Gilmer et al., 2017) baselines use the same four graph views. We further evaluate Deckard (Jiang et al., 2007), RtvNN (White et al., 2016), CDLH (Wei and Li, 2017), ASTNN (Zhang et al., 2019), FA-AST+GGNN (Wang et al., 2020), FAAST+GMN (Wang et al., 2020), and DeepSim (Zhao and Huang, 2018). Finally, CodeBERT (Feng et al., 2020) and GraphCodeBERT (Guo et al., 2021) are evaluated using No Train, RF, SNN (Bromley et al., 1993), and Principal Component Analysis (PCA) (Jolliffe, 2005) followed by RF, and PCA followed by SNN (PCA+SNN). Their main hyperparameters/configurations are summarized in Table 2. For the fixed spectral baselines, each AST, CFG, DDG, or CPG spectrum is sorted, zero-padded or truncated to 64 eigenvalues, and augmented with eight statistics: normalized spectral length min(|λ|/2000, 10),
256 AST nodes; recursive tree encoder 32/(5×10−4 )/4; dropout .15 emb. 128; hidden 192; 192-D WD 10−4 ; patience 2; clip 1.0 256 AST nodes; binary Tree-LSTM
16/10−3 /4; WD 0
emb. 128; hidden 192; 32-bit hash
patience 2; clip 1.0
989k
0
1.48–4.46M
2.10–6.96M
ASTNN
256 nodes; 512 edges; 64 statement roots 32/10−3 /4; dropout .20 emb. 128; recursive subtree WD 0; patience 2; clip 1.0 + BiGRU 100; 200-D
FA-AST+GGNN
256 nodes; 6 relations 8/(5×10−4 )/4; dropout .10 (AST/CFG/DDG/CPG) WD 10−4 ; patience 2; clip 1.0 hidden 192; 5 steps; gated readout; 192-D
556k
FA-AST+GMN
as FA-AST+GGNN, plus cross-graph 4/(5×10−4 )/4; dropout .10 attention at every propagation step WD 10−4 ; patience 2; clip 1.0
–
DeepSim
CFG/DDG feature matrix 192-D representation
32/(5×10−4 )/4; WD 10−3 patience 2; clip 1.0
1.15–2.16M
–
mean, standard deviation, minimum, maximum, and the 25th, 50th, and 75th percentiles. This gives the 72-dimensional representation xb (c) = Stat(λ(Gb (c))) ∥ λ1:64 (Gb (c)). No Train scores a pair by sb (ci , c j ) = 1/(1 + ∥xb (ci ) − xb (c j )∥2 ), whereas RF and LR use the 146-dimensional vector ri j = |xi − x j | ∥ (xi ⊙ x j ) ∥ cos(xi , x j ) ∥ ∥xi − x j ∥2 . (33) The GNN node features consist of a constant value, log in-degree, log out-degree, log total degree, and normalized serialized position. Deckard hashes normalized tokens, token bigrams, token- and line-count buckets, nesting depth, returns, branches, and loops. ASTNN applies two bottom-up tree-convolution layers before its statement-level BiGRU. FA-AST+GGNN and FAAST+GMN use CPG as the available flow-augmentedAST proxy. DeepSim combines its CFG branch with source-code semantic/token features. All neural baselines implemented in our controlled repository use binary cross entropy (BCE) with logits, AdamW, validation-F1 early stopping, and mixed precision GPU training. 10
We use a fixed canonical configuration for SPECTRA-Siam throughout the main experiments. This configuration specifies the graph input and latent construction, spectral representation, pair encoder, regularization terms, and optimization settings. The complete configuration is reported in Table 3.
4.4. Experimental Protocol Each method uses the train, validation, and test partitions given in Table 1 of Section 4.2. Models are fitted on the training pairs, while all hyperparameter choices, checkpoint selection, and decision-threshold tuning are performed using only the training and validation splits. For the approximately balanced AtCoder and CodeNet datasets, validation accuracy is used as the model-selection criterion. For the imbalanced BigCloneBench dataset, we instead maximize binary F1 on the validation set. The test split is accessed only once for final performance reporting after model selection is complete. For RQ1, we also evaluate the spectral representation learned by SPECTRA-Siam independently of its original MLP head in Section 3.2.5, using No Train RF, LR, and SNN as downstream predictors. For RQ2, we additionally evaluate three nested variants of SPECTRASiam to separate the contribution of structural topology, canonical node labels, and lexical information. SPECTRA-Siam (Topo.) disables both the canonical node-type and hashed lexical features introduced in Section 3.2.1. SPECTRA-Siam (Label) adds the canonical node-type representation but keeps the hashed lexical features disabled. SPECTRA-Siam (Lex.) is the complete model and uses both the canonical type and hashed lexical components of the node representation in Equation 5. The three variants are otherwise identical. For the CodeNet experiments in RQ3 (Section 5.3), J, P, C, and S denote Java, Python, C++, and C#, respectively, and Y denotes the target language. We consider three settings. In the within-language setting, training uses Y–Y pairs. In the endpoint-only setting, a second language X is selected; training uses X–X and Y– Y pairs, and evaluation is performed on the unseen X– Y pair. In the bridge-assisted setting, X1 , X2 , X3 denote distinct non-target languages forming a path toward Y. Training includes X1 –X1 and the consecutive cross-language pairs indicated by the path (X1 –X2 ,X2 – X3 , X3 –Y), with optional same-language pairs for intermediate languages (X2 –X2 ,X3 –X3 ). Within-language and bridge-assisted settings are evaluated on Y–Y test pairs.
Our evaluation includes 893 neural training runs across different datasets, model variants, baselines, and cross-language settings. This gives us broad experimental coverage, but it also makes long training runs expensive. We therefore cap SPECTRA-Siam and the neural baselines at 4 epochs in the main evaluation, so that all methods are compared under a similar training budget. Section 6.2 shows this cap penalizes SPECTRA-Siam; its CodeNet accuracy rises from .68 at four epochs to .77 at twenty, so the main tables in Section 5 report a conservative lower bound on our method.
Table 3: Canonical SPECTRA-Siam architecture and training settings. Setting (symbol) Architecture and representation Input graph (nmax ; relations) Node typing/hash (|Kcan |, nchar , Nhash , rmax ) (0) Lexical features (γlex , plex ) Structural encoder (d, Lenc , penc ) Latent assignment (m, Iassign ) Latent affinity/refinement (Ha , η(0) , Lref ) Adaptive temperature (βu , T min , T max ) (0) Temperature init./clipping (b(0) T , wT , smax ) Chebyshev order (Kcheb ) Eigenvalue density kernel (σdens ) Heat times (tmin , tmax ) Chebyshev filter centers (ωmin , ωmax , σfilt ) Spectral density (Nξ , Nt , Nband , Nsig ) Spectral descriptor (d s ) Graph-signal floor (ϵ) Pair encoder (dϕ , Lpair ) Trainable parameters (m = 32) Training and regularization Class/similarity settings (wmax , µspec ) Hard-negative mining (κhard , µhard ) Graph regularization (ā0 , µconn ) Graph-reg. weights (αden , αconn ) Topology-loss class weight (wtopo ) Loss weights (λspec , λhard , λrec , λgraph , λauc , λtopo , λvar ) Optimizer Learning rate / weight decay (ηlr , λwd ) Batch / accumulation (B, Nacc , BNacc ) Epochs; seed
4.5. Experimental Settings Learning experiments run in multiple Kaggle notebooks with a T4-class CUDA accelerator. Graph construction (AST, CFG, DDG, CPG) and dataset preparation are performed beforehand, using the repository’s local Python/Joern pipeline, after which the cleaned data bundles are attached to Kaggle. 11
Value 256 nodes; AST+DDG 24; 3; 4,096; 4 0.20; 0.30 256; 2; 0.10 32; 3 4; 1.0; 2 0.75; 0.20; 1.20 −0.55; 1.25; 20 12 0.08 −2 10 ; 102 0.05; 1.95; 0.18 32; 24; 12; 8 152 10−6 256; 3 3,016,855 10; 0.25 0.25; 0.10 0.15; 0.03 2; 0.1 clipped to [1, 20] 0.30; 0.20; 0.05; 0.01; 0.10; 0.05; 0.05 AdamW 10−4 ; 10−4 32; 4; 128 4; 42
4.6. Evaluation Metrics Table 4: Performance of SPECTRA-Siam and spectral baselines on BigCloneBench and AtCoder. The latent-spectrum rows use the learned spectral representation of SPECTRA-Siam without its original MLP prediction head in Section 3.2.5. Parenthesized values report the absolute change from the Predict All Clone baseline; ↑ and ↓ denote improvement and degradation.
We treat clone pairs as the positive class and report precision, recall, F1, and accuracy: TP , T P + FP 2PR , F1 = P+R P=
TP , T P + FN TP + TN Acc. = . T P + T N + FP + FN (34) R=
BigCloneBench
Here, T P, T N, FP, and FN denote true positives, true negatives, false positives, and false negatives, respectively.
5. Experimental Results 5.1. RQ1: Discriminative Power of the Learned Spectral Representation Table 4 compares the learned latent spectrum of SPECTRA-Siam with the spectra derived from conventional program graphs under the same downstream settings. On BigCloneBench, the naive Predict All Clone baseline already obtains .24 F1, and the untrained AST, CFG, DDG, and CPG spectra remain at essentially the same level (.24–.25), indicating little useful separation between clone and non-clone pairs. Training downstream classifiers like SNN improves these representations, but the best fixed-graph configuration reaches only .37 F1. In contrast, the spectrum learned by SPECTRA-Siam reaches .50 F1 with no downstream training at all, and rises to .67 when used with an SNN, despite removing the original prediction head of SPECTRA-Siam in Section 3.2.5. A similar pattern appears on the balanced AtCoder benchmark, where accuracy is the relevant measure; the naive baseline is .50, and the untrained fixed-graph spectra remain around chance (.49–.52). Relative to the strongest corresponding fixed-graph configuration, the learned spectrum improves accuracy by .08 with no training, .09 with RF, .11 with LR, and .12 with SNN, reaching .71 with SNN. The complete SPECTRA-Siam further increases accuracy to .81, showing an additional benefit from its learned prediction head. The score distributions in Figure 4 illustrate the same difference under the no-training comparison. The fixed AST spectrum (Figure 4b) leaves clone and non-clone scores almost fully overlapping, whereas the learned latent spectrum (Figure 4a) provides a much better separation.
R
F1
AtCoder
Method
P
Acc. P
R
SPECTRA-Siam
.73 .79 .76 (+.52↑) .93 .78 .86 .82 .81 (+.31↑)
F1
Acc.
Learned latent spectral representation SPECTRA-Siam Spectrum + No Train .43 SPECTRA-Siam Spectrum + RF .67 SPECTRA-Siam Spectrum + LR .61 SPECTRA-Siam Spectrum + SNN .67
.59 .64 .61 .67
.84 .91 .89 .91
.60 .65 .62 .69
.60 .82 .81 .78
.60 .60 (+.10↑) .73 .69 (+.19↑) .70 .66 (+.16↑) .73 .71 (+.21↑)
Fixed-graph spectral representations AST + No Train AST + RF AST + LR AST + SNN
.14 .33 .18 .35
.96 .24 (.00) .17 .41 .37 (+.13↑) .81 .44 .26 (+.02↑) .66 .39 .37 (+.13↑) .82
.50 .58 .52 .56
.66 .67 .61 .70
.57 .50 (.00) .62 .60 (+.10↑) .56 .52 (+.02↑) .62 .57 (+.07↑)
CFG + No Train CFG + RF CFG + LR CFG + SNN
.14 .25 .21 .28
.94 .24 (.00) .20 .41 .31 (+.07↑) .75 .44 .29 (+.05↑) .70 .37 .32 (+.08↑) .78
.51 .60 .53 .57
.92 .65 .76 .75
.66 .52 (+.02↑) .62 .60 (+.10↑) .63 .55 (+.05↑) .65 .59 (+.09↑)
DDG + No Train DDG + RF DDG + LR DDG + SNN
.16 .25 .20 .29
.60 .39 .41 .35
.25 (+.01↑) .30 (+.06↑) .26 (+.02↑) .32 (+.08↑)
.50 .76 .69 .80
.50 .57 .51 .56
.19 .64 .76 .69
.28 .50 (.00) .61 .58 (+.08↑) .61 .51 (+.01↑) .62 .58 (+.08↑)
CPG + No Train CPG + RF CPG + LR CPG + SNN
.14 .33 .20 .34
.96 .42 .50 .38
.25 (+.01↑) .37 (+.13↑) .29 (+.05↑) .36 (+.12↑)
.20 .80 .67 .81
.50 .58 .52 .55
.88 .65 .73 .69
.64 .49 (-.01↓) .61 .59 (+.09↑) .61 .53 (+.03↑) .62 .57 (+.07↑)
Predict All Clone
.14 1.00
.24 (.00)
.14 .50 1.00 .67
3.0
Density
2.5
.50 (+.26↑) .65 (+.41↑) .61 (+.37↑) .67 (+.43↑)
.50 (.00)
Non-clone pairs Clone pairs
2.0 1.5 1.0 0.5 0.0
(a) SPECTRA-Siam Spectrum + No Train.
Density
3 2 1 0 0.0
0.2
0.4
Output score
0.6
0.8
1.0
(b) AST + No Train. Figure 4: Output-score distributions on BigCloneBench for the learned latent spectrum of SPECTRA-Siam and the fixed AST spectrum, both evaluated without a learned downstream prediction head.
12
5.2. RQ2: Comparative Effectiveness Against Existing Representations and Clone-Detection Methods Table 5 compares SPECTRA-Siam with the baselines described in Section 4.3. The canonical node labels and lexical residuals introduced in Section 3.2.1 improve performance by +.34 F1 on BigCloneBench, +.30 accuracy on AtCoder, and +.16 accuracy on CodeNet, with lexical residuals providing an additional +.02 accuracy gain on CodeNet. The final SPECTRA-Siam achieves .76 F1 on BigCloneBench, .81 accuracy on AtCoder, and .69 accuracy on CodeNet. On BigCloneBench, it outperforms Deckard (.36 F1) and all implemented GNN baselines, the best of which reaches .35 F1. RtvNN and DeepSim reach .93 F1 on BigCloneBench, possibly by exploiting Java-specific lexical and CFG features, the same two models degrade by .228 and .170 under language shift in Section 5.3, whereas SPECTRA-Siam degrades only by .058. Within our shared four-epoch budget (Section 4.5), SPECTRASiam also continues to improve with training (see Section 6.2), so the gap partly reflects the budget rather than a representational ceiling. On AtCoder, SPECTRA-Siam is competitive with graph and pre-trained approaches, matching CodeBERT + SNN and remaining close to ASTNN and GraphCodeBERT + SNN in accuracy, while exceeding conventional graph baselines such as GNN-CPG (.56) and DeepSim (.71). On CodeNet, where no external pretraining is used, SPECTRA-Siam achieves higher accuracy than ASTNN (.68), DeepSim (.67), and all GNNbased representations, while approaching stronger pretrained models such as GraphCodeBERT + SNN (.79).
Table 5: Test performance of SPECTRA-Siam against competing representations and clone-detection methods on BigCloneBench, AtCoder, and CodeNet. Rows highlighted in green mark the best performing baseline within each family. Method
BigCloneBench AtCoder CodeNet P R F1 Acc. P R F1 Acc. P R F1 Acc.
Our method SPECTRA-Siam (Topo.) .40 .45 .42 SPECTRA-Siam (Label) .76 .75 .76 SPECTRA-Siam (Lex.) .73 .79 .76 Non-graph code baselines Deckard .37 .36 .36 RtvNN .95 .91 .93 CDLH .93 .90 .91 Other graph-based learning methods ASTNN .85 .81 .83 FA-AST+GGNN .94 .86 .90 FA-AST+GMN .95 .87 .91 Hybrid graph + code baseline DeepSim .95 .91 .93 pre-trained code models CodeBERT + No Train .17 .43 .24 CodeBERT + RF .79 .74 .77 CodeBERT + SNN .82 .73 .77 CodeBERT + PCA + RF .81 .70 .75 CodeBERT + PCA + SNN .81 .82 .81 GraphCodeBERT + No Train .36 .45 .40 GraphCodeBERT + RF .88 .81 .84 GraphCodeBERT + SNN .90 .91 .90 GraphCodeBERT + PCA + RF .83 .82 .82 GraphCodeBERT + PCA + SNN .92 .86 .89 GNN baselines GNN-AST .21 .51 .30 GNN-CFG .21 .46 .29 GNN-DDG .22 .50 .31 GNN-CPG .27 .49 .35
5.3. RQ3: Bridge-Assisted Cross-Language Generalization
.83 .50 .69 .58 .51 .52 .98 .68 .53 .93 .76 .90 .82 .81 .61 .90 .73 .67 .93 .78 .86 .82 .81 .63 .89 .74 .69 .83 .52 .32 .39 .51 .50 1.00 .67 .50 .98 .83 .87 .85 .85 .68 .87 .76 .73 .98 .74 .91 .82 .79 .63 .86 .73 .68 .95 .83 .90 .86 .86 .62 .90 .74 .68 .97 .75 .95 .84 .82 .58 .90 .71 .62 .98 .60 .66 .63 .61 .57 .92 .70 .62 .98 .70 .75 .72 .71 .61 .91 .73 .67 .63 .94 .94 .94 .95 .82 .96 .97 .95 .97
.50 1.00 .67 .65 .59 .62 .72 .87 .79 .67 .57 .61 .72 .91 .80 .50 1.00 .67 .67 .56 .61 .80 .93 .86 .70 .61 .65 .73 .90 .81
.50 .64 .76 .64 .78 .50 .64 .85 .67 .79
.51 .98 .67 .60 .90 .72 .74 .88 .80 .53 .94 .68 .57 .94 .71 .50 .99 .67 .59 .87 .71 .74 .90 .81 .56 .90 .69 .59 .94 .73
.51 .65 .78 .56 .61 .50 .64 .79 .60 .65
.68 .69 .69 .75
.54 .70 .61 .59 .67 .63 .54 .52 .53 .56 .56 .56
.55 .60 .54 .56
.62 .69 .66 .63 .68 .65 .63 .71 .67 .64 .62 .63
.64 .64 .65 .64
Table 6: Within- and cross-language generalization controls on CodeNet. J, P, C, and S denote Java, Python, C++, and C#, respectively. The SL train column lists the languages whose same-language pairs are used for training; for example, J,P denotes training on J–J and P–P. All values are accuracy.
The central result of this section is robustness. Without training on any cross-language target pairs Y–Y, every baseline collapses to near-chance on at least four of six language pairs (Table 6), while SPECTRASiam stays above chance on all six and reaches .71 on Java–Python. Across all 60 bridge paths, it shows the smallest degradation under language shift (.058, versus .112–.228, Table 10). The remainder of this section details these results by transfer settings defined in Section 4.4. Table 6 provides the within-language and endpoint-only controls. Table 7 reports length-1 bridgeassisted transfer. Table 8 and Table 9 extend this analysis to longer bridges and evaluate the effect of intermediate languages and their reinforcement. The statistical analyses in Table 11 and Table 10 provide a quantitative summary of cross-language transfer
SL train Test SPECTRA-Siam ASTNN DeepSim RtvNN GraphCodeBERT Within-language reference J J–J .70 P P–P .73 C C–C .66 S S–S .65
.73 .74 .60 .59
.77 .76 .73 .74
.79 .79 .70 .72
Cross-language generalization without cross-language supervision J,P J–P .71 .54 .51 .49 J,C J–C .69 .53 .70 .61 J,S J–S .63 .54 .49 .49 P,C P–C .55 .41 .64 .56 P,S P–S .59 .53 .66 .50 C,S C–S .59 .47 .48 .48
13
.61 .70 .64 .59 .50 .54 .60 .50 .50 .50
behavior. Over Java–Python test pairs within the crosslanguage generalization settings in Table 6, baselines ASTNN, DeepSim, RtvNN, and GraphCodeBERT obtain .54, .51, .49, and .50 accuracy, i.e. chance level, while SPECTRA-Siam reaches .71 accuracy. Across all 60 bridge paths, SPECTRA-Siam achieves higher average accuracy than ASTNN by .033 and GraphCodeBERT by .011, while remaining below RtvNN only by .031 and DeepSim by .021. The difference with GraphCodeBERT is not statistically significant, whereas the differences with the other three baselines are. SPECTRA-Siam also exhibits the smallest degradation under language shift, decreasing by .058 compared with .112 for GraphCodeBERT, .162 for ASTNN, .170 for DeepSim, and .228 for RtvNN. Bridge length has a significant overall effect (p = .0009), with length-2 bridges outperforming length-3 bridges by .043 (p = .007), while the remaining pairwise differences are not significant. Intermediate-language reinforcement consistently improves transfer, providing gains of .017 for length-2 bridges and up to .036 when both intermediate languages are reinforced in length-3 bridges (p < .001). The choice of target language (Y) also has a significant effect (p = .0006), with C# being the most challenging target, particularly compared with Java (−.066, p = .001) and Python (−.050, p = .009). In contrast, the source language has no significant effect (p = .862).
Table 7: Length-1 bridge-assisted generalization on CodeNet. Each path X1 → Y is trained using X1 –X1 and X1 –Y, with no Y–Y training pairs. Accuracy is measured on Y–Y test pairs. Training path SPECTRA-Siam ASTNN RtvNN DeepSim GraphCodeBERT Target C# (S) J→S P→S C→S
.5007 .5753 .5673
.5653 .5040 .4953
.5713 .6240 .5687
.5000 .6967 .5460
.5960 .5120 .5607
Target Java (J) P→J C→J S→J
.6364 .6878 .5917
.7051 .6511 .5284
.7298 .7191 .6664
.6618 .7171 .4570
.5033 .6227 .6347
Target Python (P) J→P C→P S→P
.6083 .6144 .5446
.7418 .6130 .5399
.7029 .6841 .6875
.5791 .6640 .7101
.5707 .5540 .5627
Target C++ (C) J→C P→C S→C
.6573 .6080 .5627
.5547 .5780 .4753
.6860 .6513 .5800
.7254 .6711 .6269
.6287 .5093 .6113
Table 8: Length-2 bridge-assisted generalization on CodeNet. A path X1 → X2 → Y uses X1 –X1 , X1 –X2 , and X2 –Y as mandatory training configurations. Each cell reports accuracy as ∅ / X2 –X2 , where the second value additionally includes same-language reinforcement for the intermediate language. Evaluation is on Y–Y test pairs.
6. Discussion 6.1. SPECTRA-Siam Sensitivity to Hyperparameters
Training path
SPECTRA-Siam
ASTNN
RtvNN
DeepSim
GraphCodeBERT
Target C# (S) J→P→S J→C→S P→J→S P→C→S C→J→S C→P→S
.5993/.6013 .5940/.5740 .6307/.5927 .6053/.5467 .5947/.5640 .5920/.5987
.5040/.5667 .5007/.5007 .5093/.5020 .4947/.4980 .5100/.5033 .5087/.5247
.5653/.6187 .5920/.5220 .5893/.5927 .5480/.5760 .5613/.5567 .5627/.6287
.5927/.6700 .5620/.5227 .6207/.5960 .6327/.6053 .6047/.5720 .6687/.6473
.5400/.5707 .5787/.6087 .5507/.6053 .5287/.5520 .5900/.6447 .5253/.5440
Target Java (J) P→C→J P→S→J C→P→J C→S→J S→P→J S→C→J
.6905/.6785 .6164/.6324 .6744/.6811 .6531/.7031 .6224/.6771 .6478/.6885
.6451/.6538 .5664/.5997 .6211/.6751 .5991/.6084 .5984/.6631 .5564/.6438
.6871/.6905 .6324/.6564 .6891/.6865 .6785/.7011 .6498/.6798 .6698/.7038
.6611/.6511 .6584/.6204 .6344/.6384 .6137/.6284 .6638/.5824 .6771/.6664
.5547/.5960 .6033/.6527 .5180/.5540 .6547/.6887 .5253/.5607 .6220/.6813
Target Python (P) J→C→P J→S→P C→J→P C→S→P S→J→P S→C→P
.6848/.6821 .6378/.6908 .6190/.6164 .6244/.6351 .6492/.6526 .6392/.6432
.6559/.6740 .6284/.6197 .6808/.7183 .5808/.5996 .6546/.7223 .5687/.6566
.7190/.6935 .6901/.7163 .6633/.7156 .6097/.7103 .6486/.7210 .6640/.7062
.6606/.6273 .5995/.6836 .6551/.6382 .6544/.6599 .6001/.6415 .6741/.6653
.6393/.6900 .6607/.7180 .6587/.7200 .6660/.6880 .6940/.7187 .6467/.7100
Target C++ (C) J→P→C J→S→C P→J→C P→S→C S→J→C S→P→C
.6587/.6293 .6407/.6427 .6147/.6960 .6253/.5573 .6420/.6473 .5853/.6040
.5813/.5953 .5687/.5307 .5793/.5813 .5540/.5213 .5020/.5660 .5580/.5793
.6480/.6767 .6387/.6427 .6607/.6553 .5913/.6147 .6533/.6773 .6173/.6487
.6417/.6490 .6437/.6189 .6872/.6524 .6048/.6222 .6296/.6370 .6088/.6236
.5200/.5540 .6487/.6940 .5747/.6367 .6040/.6213 .6400/.6953 .5287/.5307
We examine the sensitivity of SPECTRA-Siam on CodeNet by varying one hyperparameter at a time while keeping the remaining settings fixed to the canonical configuration in Table 3. The resulting optimization trajectories are shown in Figure 5, and the corresponding final epoch losses and test accuracies are reported in Table 12. For the latent graph size, m = 32 gives consistently low validation loss, while increasing the capacity to m = 48 provides no clear benefit. For latent assignment, two to three iterations are sufficient, and additional refinement does not improve validation loss. The Chebyshev-order experiment shows that increasing spectral-filter order is not uniformly beneficial over the first five epochs; lower orders converge quickly, while Kcheb = 12 remains within the same general range. Batch size mainly affects the optimization trajectory: B = 8 is less stable, whereas B ∈ {16, 32, 64} gives similar and steadily decreasing validation loss. The canonical configuration provides a stable operating 14
Table 9: Length-3 bridge-assisted generalization on CodeNet. A path X1 → X2 → X3 → Y uses X1 –X1 , X1 –X2 , X2 –X3 , and X3 –Y as mandatory training configurations, with no Y–Y pairs. Each cell reports accuracy as ∅ / X2 –X2 / X3 –X3 / X2 –X2 +X3 –X3 , where the later values additionally include same-language reinforcement for the intermediate languages. Evaluation is on Y–Y test pairs. Training path
SPECTRA-Siam
ASTNN
RtvNN
DeepSim
GraphCodeBERT
Target C# (S) J→P→C→S J→C→P→S P→J→C→S P→C→J→S C→J→P→S C→P→J→S
.5393/.5993/.5720/.5987 .5313/.5867/.5833/.5907 .5127/.5320/.5160/.5673 .5587/.5753/.5540/.5673 .5773/.6240/.5533/.5907 .5487/.6047/.5607/.5640
.5020/.4993/.5007/.5053 .5007/.5133/.5033/.4887 .4940/.4973/.4973/.4953 .5087/.4947/.5180/.5500 .5087/.5060/.5220/.5813 .4980/.5080/.5680/.5140
.5453/.5720/.5453/.5653 .5460/.5500/.5787/.6013 .5420/.5400/.5413/.5467 .5573/.5333/.5600/.5340 .5593/.5713/.5893/.5753 .5813/.5600/.5687/.6180
.5973/.6553/.5780/.5993 .6100/.6413/.6500/.6873 .5920/.5580/.5773/.5733 .6200/.5933/.5667/.5833 .6373/.5860/.6620/.6480 .5647/.5947/.6180/.6260
.5727/.6067/.5867/.6240 .5500/.5827/.5813/.6120 .5673/.5953/.5907/.6180 .5613/.6240/.5820/.6360 .5520/.5980/.6007/.6413 .5893/.6187/.6307/.6633
Target Java (J) P→C→S→J P→S→C→J C→P→S→J C→S→P→J S→P→C→J S→C→P→J
.5757/.6464/.6077/.6418 .6471/.6711/.6611/.6604 .5804/.6518/.5884/.6498 .6564/.6631/.6037/.6451 .6404/.6404/.5550/.6758 .6004/.6338/.6157/.6624
.5837/.6244/.6071/.5777 .5777/.6271/.5991/.6211 .5777/.5984/.6111/.6044 .6251/.6211/.6771/.6718 .5664/.6271/.6351/.6411 .6431/.6584/.6798/.6604
.6684/.6518/.5911/.6491 .6611/.6744/.6191/.6791 .6404/.6845/.6458/.6818 .6785/.6518/.7085/.6931 .7171/.6758/.6798/.6658 .6744/.6891/.7058/.6938
.6678/.6271/.6184/.6331 .6444/.6231/.6711/.6624 .6111/.6131/.6124/.6291 .6217/.5670/.6258/.6104 .6404/.6017/.5944/.6684 .6251/.6177/.6151/.6011
.5820/.6580/.6380/.6820 .6453/.6553/.6467/.7000 .6027/.6560/.6480/.6840 .5747/.6133/.6013/.6660 .5520/.6187/.6180/.6273 .5853/.6507/.6200/.6700
Target Python (P) J→C→S→P J→S→C→P C→J→S→P C→S→J→P S→J→C→P S→C→J→P
.6848/.6774/.6861/.6311 .5211/.6432/.5547/.6338 .5734/.7049/.6023/.6747 .6144/.6593/.5560/.6177 .6372/.6660/.5755/.6224 .6318/.6848/.6653/.6962
.6714/.6117/.5842/.6559 .6284/.6304/.6613/.6512 .6177/.6901/.6123/.6600 .6512/.6365/.7136/.6875 .5996/.6539/.6848/.6667 .6687/.6754/.7210/.6982
.6459/.5848/.7324/.7398 .6767/.7009/.7103/.6982 .5989/.5842/.7150/.7391 .6908/.6868/.6378/.7029 .7042/.6989/.6640/.7384 .6479/.6968/.7217/.7337
.6646/.6741/.6667/.7040 .6599/.6110/.6531/.6470 .6640/.6219/.6395/.5737 .6341/.6239/.6687/.6517 .5913/.6191/.6314/.6619 .4657/.6551/.6667/.6449
.7080/.7287/.7020/.7527 .6867/.7347/.6980/.7493 .6753/.7307/.7267/.7387 .6880/.7273/.7333/.7507 .6853/.7287/.7353/.7540 .6847/.7213/.6927/.7413
Target C++ (C) J→P→S→C J→S→P→C P→J→S→C P→S→J→C S→J→P→C S→P→J→C
.6333/.6633/.6267/.6193 .5720/.6447/.5727/.6493 .5527/.6740/.5533/.6000 .5433/.6267/.5873/.6487 .5960/.6573/.5933/.6253 .5867/.6113/.6087/.6387
.5587/.5880/.5380/.5440 .5673/.5420/.5980/.5793 .5547/.5700/.5533/.5433 .5773/.5627/.5360/.6040 .5400/.5773/.5340/.5933 .5600/.5960/.5673/.5953
.6113/.6180/.6040/.6167 .6393/.6520/.6500/.6800 .6067/.6313/.6020/.6280 .6640/.6140/.6673/.6740 .6380/.6633/.6620/.6707 .6547/.6673/.6580/.6653
.6263/.6517/.4943/.5948 .6035/.5948/.6155/.6229 .6048/.6457/.6330/.6316 .6658/.6557/.6537/.6155 .6082/.6222/.6336/.6149 .6356/.6450/.6236/.6517
.5887/.6287/.6307/.6700 .5880/.6347/.6120/.6713 .6380/.6767/.6707/.7093 .6413/.6900/.6733/.6947 .5453/.6207/.6167/.6833 .5440/.6400/.6513/.6880
Table 10: Factors affecting bridge-assisted transfer for SPECTRASiam. Bridge length is tested with Friedman across the three lengths and Wilcoxon for the pairwise contrasts; target and source language with Kruskal–Wallis and Mann–Whitney; reinforcement with Wilcoxon paired per path. All p values are Holm-corrected within their family. Factor
Contrast
∆
p
Table 11: Statistical comparison of SPECTRA-Siam against each baseline on the bridge-transfer paths of Table 7–Table 9. Every path is evaluated by all five methods, so comparisons are paired on the path and tested with a Wilcoxon signed-rank test; p values are Holmcorrected within each family. δ is Cliff’s delta. Positive differences favor SPECTRA-Siam.
Effect
Bridge length (Friedman χ2 = 14.00, p = 0.0009) L1 vs L2 −0.035 .130 large L1 vs L3 +0.008 1.000 negligible L2 vs L3 +0.043 .007 large Target language (Kruskal–Wallis H = 17.50, p = 0.0006) C# vs C++ −0.037 .081 large C# vs Java −0.066 .001 large C# vs Python −0.050 .009 large C++ vs Java −0.029 .186 medium C++ vs Python −0.014 .561 small Java vs Python +0.016 .561 small Bridge source language (Kruskal–Wallis H = 0.75, p = 0.862 — no difference) C++ 0.612 — ±0.041 C# 0.612 — ±0.033 Java 0.604 — ±0.060 Python 0.600 — ±0.046 Intermediate-language reinforcement L2, X2 –X2 +0.017 < .001 small L3, X2 –X2 +0.023 < .001 small L3, X2 –X2 + X3 –X3 +0.036 < .001 medium L3, X3 –X3 +0.014 < .001 negligible Degradation under language shift (Table 6) SPECTRA-Siam 0.058 — 0.685 → 0.627 GraphCodeBERT 0.112 — 0.635 → 0.523 ASTNN 0.162 — 0.665 → 0.503 DeepSim 0.170 — 0.750 → 0.580 RtvNN 0.228 — 0.750 → 0.522
Baseline
∆acc.
All 60 paths ASTNN +0.033 RtvNN −0.031 DeepSim −0.021 GraphCodeBERT +0.011 Length-1 paths (n = 12) ASTNN +0.017 RtvNN −0.060 DeepSim −0.033 GraphCodeBERT +0.024 Length-2 paths (n = 24) ASTNN +0.059 RtvNN −0.004 DeepSim −0.004 GraphCodeBERT +0.036 Length-3 paths (n = 24) ASTNN +0.014 RtvNN −0.043 DeepSim −0.031 GraphCodeBERT −0.021
15
W/L
p
δ
47/13 16/44 22/37 33/27
< .001 < .001 .006 .213
+0.35 −0.35 −0.29 +0.14
medium medium small negligible
9/3 0/12 4/8 8/4
.934 .005 .752 .934
+0.24 −0.56 −0.35 +0.24
small large medium small
22/2 12/12 12/12 17/7
< .001 1.000 1.000 .059
+0.62 −0.11 −0.12 +0.34
large negligible negligible medium
16/8 4/20 6/17 8/16
.752 .001 .078 .752
+0.15 −0.47 −0.44 −0.22
negligible medium medium small
Effect
Table 12: Final-epoch training and validation BCE loss, and test accuracy, for each hyperparameter setting in Figure 5. All runs use CodeNet with five epochs per arm. Bold marks the best value per block by test accuracy.
point, though batch size B and the number of assignment iterations Iassign each shift test accuracy by three to four points.
BCE loss
BCE loss
Train
0.64 0.62 0.60 0.58 0.56 0.54 0.64 0.62 0.60 0.58 0.56 0.54
Validation
Hyperparameter
Latent graph size m m = 16 m = 24
m = 32 m = 48
m
Iassign Latent-assignment iterations Iassign Iassign = 1 Iassign = 2
Iassign = 3 Iassign = 4
Kcheb
B
BCE loss
Chebyshev order Kcheb Kcheb = 4 Kcheb = 8
0.625 0.600 0.575 0.550 0.525 0.64
B=8 B = 16
B = 32 B = 64
0.60 0.58 0.56 1
2
3 Epoch
4
Train BCE 0.5503 0.5566 0.5445 0.5591 0.5503 0.5344 0.5445 0.5625 0.5224 0.5569 0.5445 0.5478 0.5850 0.5659 0.5662 0.5520
Valid BCE 0.5476 0.5703 0.5437 0.5576 0.5464 0.5279 0.5437 0.5676 0.5131 0.5558 0.5437 0.5457 0.5856 0.5594 0.5571 0.5566
Test Acc. 0.6960 0.6850 0.7029 0.6838 0.7012 0.7056 0.7029 0.6746 0.7273 0.6818 0.7029 0.6980 0.6417 0.6740 0.6867 0.6834
Nevertheless, accuracy continues to improve even after the validation loss starts increasing, reaching .8114 at epoch 80 before slightly decreasing to .7944 at epoch 100 as shown in Figure 6b. The selected decision threshold also decreases during this period, from .42 at epoch 37 to .03 at epoch 100. Its correlation with validation cross-entropy is −.892. We can see that later epochs produce less calibrated probabilities, while the classification accuracy remains strong due to threshold adjustment over validation set. These results show that the four-epoch training budget used throughout Section 5 is conservative. The total accuracy improves from .6770 at epoch 4 to 0.7886 at epoch 30 and .8114 at epoch 80, while both same-language and cross-language configurations benefit from longer training. Therefore, the results in Section 5 represent a lower-bound estimate of SPECTRASiam under the fixed training budget.
Batch size
0.62 BCE loss
Kcheb = 12 Kcheb = 16
Value 16 24 32 48 1 2 3 4 4 8 12 16 8 16 32 64
5
Figure 5: Sensitivity of SPECTRA-Siam to four hyperparameters on CodeNet. From top to bottom, the panels vary latent graph size m, latent-assignment iterations Iassign , Chebyshev order Kcheb , and batch size B. Each panel reports training and validation BCE loss over the first five epochs while varying one hyperparameter and keeping all others fixed to the canonical configuration in Table 3. Solid and dashed lines denote training and validation loss, respectively.
6.2. Number of Epochs 6.3. Statistical Stability Across Training Runs
We train SPECTRA-Siam on CodeNet for 100 epochs and evaluate the same model on the validation and test splits after each epoch, reporting both the overall performance and the ten language configurations. As shown in Figure 6a, the training objective Ltotal from Section 3.2.6 (Equation 32) decreases continuously from .968 to .237. In contrast, the validation cross-entropy reaches its minimum of .4407 at epoch 37 and then increases to 1.0288 by epoch 100. All ten language configurations show the same trend, with their minima occurring between epochs 30 and 37.
Table 14 shows that SPECTRA-Siam maintains consistent performance across independent training runs on all three benchmarks. On BigCloneBench, F1 varies by only .011 standard deviation across seeds, with values ranging from .732 to .762, while accuracy remains within a narrow range of .924–.933. CodeNet shows similarly small variation, with F1 of .736 ± .003 and accuracy of .678 ± .005. AtCoder exhibits slightly larger variation than the other datasets, but the effect remains limited: F1 varies by .013 standard deviation 16
1.6
Training total Java Java
C# C# Java Python
Java C++ Java C#
Python C++ Python C#
C++ C# Total (validation)
epoch 4 selected for experiments
1.0 0.9 0.8
1.2
Training loss total
Validation BCE loss
1.4
Python Python C++ C++
0.7
1.0
0.6 validation minimum 0.4407 at epoch 37
0.8
0.5 0.4
0.6
0.3
0.4
0.2 (a) Validation loss and training objective.
Decision threshold Java Java
C# C# Java Python
Java C++ Java C#
Python C++ Python C#
C++ C# Total (test)
1.0 0.8
Decision threshold
Test accuracy
0.9
Python Python C++ C++
0.8
0.6 0.7
0.4
0.6
0.2 0
5
10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 Epoch
0.0
(b) Test accuracy and decision threshold. Figure 6: Training dynamics of SPECTRA-Siam on CodeNet over 100 epochs across the ten language configurations (a) Validation BCE loss and the training objective Ltotal . (b) Test accuracy and the validation-selected decision threshold.
17
(range .791–.821) and accuracy by .018 (range .768– .812). These results are consistent with the single-run scores reported in Section 5.2. Table 14: Statistical stability of SPECTRA-Siam over five independent training runs. Mean and standard deviation are computed across random seeds; the final column reports a 95% Student-t confidence interval for the mean of the per-seed results.
Table 13: Test accuracy of SPECTRA-Siam on CodeNet after selected epochs, reported separately for same-language and cross-language configurations. Total denotes accuracy over the complete test set. Bold marks the best value in each column; the highlighted rows correspond to the four-epoch budget of Section 5 (4), the validation-loss minimum (37), and the accuracy peak (80). Ep.
Total
J–J
P–P
C++– C++
C#–C#
1 2 3 4 5 10 20 30 37 40 50 60 70 80 90 100
.6388 .6547 .6748 .6770 .6992 .7339 .7690 .7886 .7961 .7929 .7908 .8003 .7947 .8114 .7990 .7944
.6571 .6558 .7018 .7118 .7118 .7685 .7932 .8232 .8372 .8372 .8259 .8352 .8346 .8586 .8412 .8339
.6841 .6787 .7123 .7170 .7089 .7451 .7941 .8129 .8149 .8089 .8082 .8189 .8283 .8377 .8290 .8236
.6307 .6560 .6580 .6527 .6787 .7000 .7220 .7407 .7433 .7487 .7473 .7533 .7473 .7633 .7567 .7413
.5880 .6227 .6333 .6300 .6720 .7140 .7780 .7793 .7980 .7940 .7947 .8240 .7907 .8213 .8073 .8027
Ep.
J–P
J–C++
J–C#
P–C++
P–C#
C++– C#
1 2 3 4 5 10 20 30 37 40 50 60 70 80 90 100
.6662 .6756 .6952 .7093 .7301 .7665 .7873 .8122 .8230 .8210 .8210 .8318 .8223 .8358 .8156 .8149
.6427 .6740 .6800 .6640 .6940 .7400 .7540 .7713 .7780 .7780 .7653 .7700 .7880 .7920 .7820 .7820
.6067 .6340 .6520 .6573 .6860 .7133 .7613 .7827 .7887 .7813 .7927 .7940 .7873 .8053 .7867 .7960
.6631 .6779 .6799 .6812 .7122 .7236 .7505 .7774 .7821 .7821 .7814 .7882 .7653 .7902 .7801 .7740
.6227 .6468 .6810 .6843 .6910 .7393 .7949 .8070 .8137 .8029 .8036 .8063 .8083 .8130 .8043 .7936
.6273 .6260 .6553 .6633 .7080 .7293 .7553 .7793 .7827 .7753 .7687 .7813 .7753 .7973 .7873 .7820
Dataset
Metric
Mean ± Std
Range
95% CI
BigCloneBench
Prec. Rec. F1 Acc.
.724 ± .028 .780 ± .031 .750 ± .011 .929 ± .004
[.687, .760] [.750, .828] [.732, .762] [.924, .933]
[.690, .759] [.742, .819] [.736, .765] [.924, .934]
AtCoder
Prec. Rec. F1 Acc.
.756 ± .025 .865 ± .007 .807 ± .013 .793 ± .018
[.720, .783] [.859, .876] [.791, .821] [.768, .812]
[.725, .787] [.857, .874] [.790, .823] [.770, .815]
CodeNet
Prec. Rec. F1 Acc.
.624 ± .005 .897 ± .010 .736 ± .003 .678 ± .005
[.620, .633] [.887, .914] [.733, .739] [.674, .686]
[.618, .631] [.884, .909] [.732, .740] [.672, .685]
6.4. What the Learned Latent Graph Captures We examine the latent graphs produced by SPECTRA-Siam. As described in Section 3.2.3, the assignment matrix P maps the input AST/DDG nodes of each code fragment to m = 32 latent nodes through soft assignment, following the general idea of differentiable graph pooling (Ying et al., 2018a). For this analysis only, we group the 24 canonical node types of Section 3.2.1 into seven categories: Control, Declaration, Operator, Call/Access, Literal, Structure/Meta, and Unknown. Let Cval be the set of distinct validation fragments and let κ(v) denote the category of input node v. For latent node u, we define its assignment profile as P P c∈Cval v:κ(v)=k Pvu (c) P Quk = P , (35) c∈Cval v Pvu (c) so each row of Q gives the distribution of canonicalnode groups assigned to a latent node. To examine the learned connections between these nodes, we also compute the mean weighted adjacency over the validation fragments, following the latent graph learning setting P Ā = 1/|Cval | c∈Cval AΘ (c) (Kipf et al., 2018; Chen et al., 2020b; Zhu et al., 2021). Figure 7 shows a correctly classified validation example. In the example, the clone differs from the anchor by |∆Λ| = 0.328 in eigenvalue distance, compared with 0.754 for the non-clone. The assignment profile shows that some latent nodes favor particular canonical groups, while the mean adjacency shows that learned edge weights are not uniform across latent-node pairs. 18
Latent-slot specialization Q
o
n Unk
12
0.4
16
0.3
0.3
20
0.2
Stage
0.2
24
Input
0.1
28
0.1
0.4
0
wn
4
8
= 0.128) S9
S8
S8
S8
32 (rank-coloured)
S6
1
S22
S10
S22 S27
S22 S2
S22
S18
S6
S8
S10
S6
S9
S10
S6
S6
S10
S22
S27
S10
S27
S2
S27
S27
S2 S18
S18
S2 S18
S8
S2 S18
S9
20
Non-clone (
S9
32 (rank-coloured)
16
24
Data loading (wait) Host-to-device copy
0.0
28
Mean ± Std. (ms)
95% CI (ms)
Batch Share (%)
16.48 ± 2.66 11.42 ± 0.38
[16.46, 16.49] [11.42, 11.42]
18.95 ± 2.05 13.23 ± 0.72
0.77 ± 0.24 4.96 ± 1.82
[0.77, 0.77] [4.95, 4.97]
0.89 ± 0.05 5.75 ± 0.36
4.40 ± 1.18 0.23 ± 0.13 0.43 ± 0.19
[4.39, 4.40] [0.23, 0.23] [0.43, 0.43]
5.04 ± 0.69 0.26 ± 0.06 0.49 ± 0.18
4.43 ± 1.19 0.93 ± 1.01
[4.42, 4.43] [0.92, 0.93]
5.10 ± 0.35 1.07 ± 0.07
1.75 ± 0.20 0.52 ± 0.47
[1.75, 1.75] [0.52, 0.53]
2.02 ± 0.17 0.60 ± 0.18
1.98 ± 0.81 38.80 ± 3.19 0.49 ± 1.06
[1.97, 1.98] [38.79, 38.81] [0.49, 0.50]
2.27 ± 0.30 44.84 ± 1.70 0.56 ± 1.00
86.65 ± 9.46 1.354 ± 0.149
[86.60, 86.69] [1.353, 1.355]
100 –
41m 26s ± 1m 6s 23m 43s ± 47s 3m 12s ± 4s
– – –
– – –
Encoder
Semantic clone (
S9
1
12
= 0.754)
Embedding + input norm Relational GNN layers
0.8
Latent graph
0.6
Latent slot attention Latent adjacency Latent graph refinement
0.4
1
32 (rank-coloured)
S6
uc
Str
Anchor
e/M tur
8
0.5
S22
C
Lit
eta
0.6
S10
Ac all/
l era
Table 15: Training computational cost of SPECTRA-Siam. Stagelevel values report per-batch mean ± standard deviation, 95% confidence interval, and runtime share. Aggregate rows report per-batch, per-input, and per-epoch costs (batch size is 32).
0.5
S27
D
er Op
s ces
Mean latent adjacency A
S2
ra ecla
r ato
4
S18
Co
tion
0
0.7
S8
ol ntr
0.8
S9
S1 S3 S5 S7 S9 S11 S13 S15 S17 S19 S21 S23 S25 S27 S29 S31
0.2
Spectral
0.0
Spectral descriptors of which: eigendecomposition Head Pair comparison Classifier Backward
Figure 7: Interpretation of the learned latent graph. Left: latentslot specialization matrix Q ∈ R32×7 , where rows denote shared latent slots and columns denote coarse canonical node groups. Right: validation-set mean latent adjacency Ā over the same latent slots. Bottom: a representative anchor–clone–non-clone triplet with the corresponding normalized-Laplacian eigenvalue spectra. Only eight prominent latent slots are visualized for clarity. |∆Λ| denotes the mean absolute difference between ordered eigenvalue vectors.
Loss Backward pass Optimizer step Aggregate cost Total per batch Total per input Total per epoch BigCloneBench AtCoder CodeNet
6.5. Computational Cost Analysis Table 15 shows that the training cost of SPECTRASiam is dominated by the backward pass, which accounts for 44.84% of the per-batch runtime. Input processing, including data loading and host-to-device transfer, contributes another 32.18%, while the components introduced by the proposed representation remain lightweight. Latent graph induction accounts for only 5.79% of the runtime, and spectral descriptors require 5.10%. Eigendecomposition, despite being the main additional operation introduced by the spectral representation, contributes only 1.07% of the total batch cost. SPECTRA-Siam processes each batch of size 32 in approximately 86.65 ms, with a complete training epoch requiring about 41 minutes on BigCloneBench, 24 minutes on AtCoder, and 3 minutes on CodeNet.
choices are not exhaustively tuned due to the cost of repeated large-scale experiments. The current spectral representation is also derived from an initial graph containing only AST and projected DDG information, with input graphs limited to 256 nodes and compressed into a fixed number of latent slots. Finally, the latent topology is learned specifically for clone detection, and there is no explicit constraint that the resulting graph should preserve properties useful for other program analysis tasks. Future work can investigate larger training budgets, systematic optimization of the latent graph and spectral representation parameters, and richer input representations that incorporate additional structural views. Beyond clone detection, an interesting direction is to study whether the learned latent graph provides a useful general-purpose representation for other software engineering tasks, such as vulnerability detection and code search. The latent graph induction process could also be adapted through transfer learning or alternative objectives, including self-supervised learning over large unlabeled repositories, to discover program structures that are not tied to a single downstream task.
6.6. Limitations and Future Work The broad experimental study, especially the crosslanguage evaluation in Section 5.3, requires us to cap training at four epochs under our available computational budget. Therefore, the reported results do not represent fully converged models. Moreover, SPECTRASiam involves several design choices that affect the learned latent graph and its spectral representation, including graph induction parameters, spectral descriptor configuration, and optimization objectives. These 19
7. Threats to Validity
Our experiments support three main results. First, learning the graph structure before spectral analysis is decisive for obtaining discriminative code spectra. With an identical SNN classifier, the learned spectrum of SPECTRA-Siam improves F1 from .37 to .67 on BigCloneBench (+.30) and accuracy from .60 to .71 on AtCoder (+.11) compared with spectra extracted from fixed program graphs. Second, the complete model is competitive with established semantic clone detectors, obtaining .76 F1 on BigCloneBench, .82 F1 on AtCoder, and .69 accuracy on the four-language CodeNet benchmark, where it surpasses ASTNN and GraphCodeBert using only four epochs. Third, the learned representation transfers beyond test language pairs Y–Y. Across 60 unseen bridgeassisted transfer paths, SPECTRA-Siam exhibits the smallest degradation under language shift, decreasing by only .058 compared with .112, .162, .170, and .228 for GraphCodeBERT, ASTNN, DeepSim, and RtvNN, and adding intermediate-language supervision further improves transfer accuracy by up to .036.
We discuss potential threats that may affect the credibility and generalizability of our results, grouped into internal, external, and construct validity. 7.1. Internal Validity Internal validity concerns whether the observed effects stem from our methods rather than uncontrolled factors. The four-epoch training cap may favor models that converge faster, although Section 6.2 suggests this works against SPECTRA-Siam, but we cannot rule out that it affects individual baselines differently. In addition, single-run results may be affected by training randomness; we assess this variability through the multiseed analysis in Section 6.3. 7.2. External Validity External validity concerns the generalizability of our findings. AtCoder and CodeNet are derived from programming contest problems, and their distributions may not reflect general software development. Moreover, our evaluation mostly covers function-level fragments, so the observed performance may not fully represent industrial codebases with different characteristics, such as larger systems, evolving projects, and collaborative development patterns.
9. Declarations 9.1. Data Availability Statement The datasets generated and/or analyzed during the current study are available at:
7.3. Construct Validity
• Data repository:
Construct validity concerns whether the evaluation setup measures the properties that the study aims to investigate. The meaning of a positive pair may vary across datasets, with BigCloneBench relying on humanassisted functional clone annotations, while AtCoder and CodeNet define clones based on shared problem identity. Therefore, benchmark labels should be interpreted as proxies for semantic equivalence rather than perfect indicators of functional similarity.
– CodeNet: https://www.kaggle.com/dat asets/koushamoeini/codenet-4l – AtCoder: https://www.kaggle.com/dat asets/koushamoeini/atcoder – BigCloneBench: https://www.kaggle.c om/datasets/koushamoeini/codexglue • Code repository: https://github.com/Knowl edge4Software/Spectral-Software
8. Conclusions We presented SPECTRA-Siam, a Siamese latent graph learning network that induces a fixed-size latent graph from the AST and data-dependence information of each code fragment and derives a multi-scale spectral representation from its learned topology. Unlike previous approaches that extract features from fixed program graphs (AST, CFG, DDG, PDG, and CPG), SPECTRASiam lets clone supervision determine graph latent space that best captures functional similarity between codes through its spectral representation.
References Al-Omari, F., Roy, C.K., Chen, T., 2020. SemanticCloneBench: A semantic code clone benchmark using crowd-source knowledge, in: Proceedings of the 14th International Workshop on Software Clones (IWSC), IEEE. pp. 57–63. Alam, A.I., Roy, P.R., Al-omari, F., Roy, C.K., Roy, B., Schneider, K.A., 2023. GPTCloneBench: A comprehensive benchmark of semantic clones and cross-language clones using GPT-3 model and SemanticCloneBench, in: Proc. IEEE Int. Conf. Software Maintenance and Evolution (ICSME), IEEE. pp. 1–13.
20
Allamanis, M., Barr, E.T., Devanbu, P., Sutton, C., 2018a. Learning to represent programs with graphs, in: International Conference on Learning Representations. Allamanis, M., Barr, E.T., Devanbu, P., Sutton, C., 2018b. A survey of machine learning for big code and naturalness. ACM Computing Surveys 51, 1–37. Alon, U., Zilberstein, M., Levy, O., Yahav, E., 2019. code2vec: Learning distributed representations of code. Proceedings of the ACM on Programming Languages 3, 1–29. Ba, J.L., Kiros, J.R., Hinton, G.E., 2016. Layer normalization. arXiv preprint arXiv:1607.06450 . Banerjee, A., Jost, J., 2008. On the spectrum of the normalized graph laplacian. Linear Algebra and its Applications 428, 3015–3022. doi:10.1016/j.laa.2008.01.029. Baxter, I.D., Yahin, A., Moura, L., Sant’Anna, M., Bier, L., 1998. Clone detection using abstract syntax trees, in: Proceedings of the International Conference on Software Maintenance (ICSM), IEEE. pp. 368–377. Belkin, M., Niyogi, P., 2003. Laplacian eigenmaps for dimensionality reduction and data representation. Neural Computation 15, 1373– 1396. Breiman, L., 2001. Random forests. Machine Learning 45, 5–32. doi:10.1023/A:1010933404324. Broder, A.Z., 1997. On the resemblance and containment of documents, in: Proceedings of the Compression and Complexity of Sequences, IEEE. pp. 21–29. doi:10.1109/SEQUEN.1997.666900. Broder, A.Z., Charikar, M., Frieze, A.M., Mitzenmacher, M., 1998. Min-wise independent permutations, in: Proceedings of the 30th Annual ACM Symposium on Theory of Computing, ACM. pp. 327–336. doi:10.1145/276698.276781. Bromley, J., Guyon, I., LeCun, Y., Säckinger, E., Shah, R., 1993. Signature verification using a “siamese” time delay neural network, in: Advances in Neural Information Processing Systems, pp. 737– 744. Bruna, J., Zaremba, W., Szlam, A., LeCun, Y., 2014. Spectral networks and locally connected networks on graphs, in: Proceedings of the 2nd International Conference on Learning Representations (ICLR). Büch, L., Andrzejak, A., 2019. Learning-based recursive aggregation of abstract syntax trees for code clone detection, in: Proceedings of the IEEE 26th International Conference on Software Analysis, Evolution and Reengineering (SANER), IEEE. pp. 95–104. Bui, N.D.Q., Yu, Y., Jiang, L., 2021a. InferCode: Self-supervised learning of code representations by predicting subtrees, in: Proceedings of the 43rd International Conference on Software Engineering (ICSE), IEEE. pp. 1186–1197. Bui, N.D.Q., Yu, Y., Jiang, L., 2021b. Self-supervised contrastive learning for code retrieval and summarization via semanticpreserving transformations, in: Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, ACM. pp. 511–521. Chen, T., Kornblith, S., Norouzi, M., Hinton, G., 2020a. A simple framework for contrastive learning of visual representations, in: Proceedings of the 37th International Conference on Machine Learning (ICML), pp. 1597–1607. Chen, Y., Wu, L., Zaki, M.J., 2020b. Iterative deep graph learning for graph neural networks: Better and robust node embeddings, in: Advances in Neural Information Processing Systems (NeurIPS), pp. 19314–19326. Cho, K., van Merriënboer, B., Gulcehre, C., Bahdanau, D., Bougares, F., Schwenk, H., Bengio, Y., 2014. Learning phrase representations using rnn encoder–decoder for statistical machine translation, in: Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing, Association for Computational Linguistics. pp. 1724–1734. doi:10.3115/v1/D14-1179.
Chung, F.R.K., 1997. Spectral Graph Theory. volume 92 of CBMS Regional Conference Series in Mathematics. American Mathematical Society, Providence, RI. Defferrard, M., Bresson, X., Vandergheynst, P., 2016a. Convolutional neural networks on graphs with fast localized spectral filtering, in: Advances in Neural Information Processing Systems (NIPS), pp. 3844–3852. Defferrard, M., Bresson, X., Vandergheynst, P., 2016b. Convolutional neural networks on graphs with fast localized spectral filtering, in: Advances in Neural Information Processing Systems, pp. 3844– 3852. Devlin, J., Chang, M.W., Lee, K., Toutanova, K., 2019. BERT: Pre-training of deep bidirectional transformers for language understanding, in: Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (NAACL), pp. 4171–4186. Dou, S., Shan, J., Jia, H., Deng, W., Xi, Z., He, W., Wu, Y., Gui, T., Liu, Y., Huang, X., 2023. Towards understanding the capability of large language models on code clone detection: A survey. arXiv preprint arXiv:2308.01191 . Ducasse, S., Rieger, M., Demeyer, S., 1999. A language independent approach for detecting duplicated code, in: Proceedings of the International Conference on Software Maintenance (ICSM), IEEE. pp. 109–118. Feng, Z., Guo, D., Tang, D., Duan, N., Feng, X., Gong, M., Shou, L., Qin, B., Liu, T., Jiang, D., Zhou, M., 2020. CodeBERT: A pretrained model for programming and natural languages, in: Findings of the Association for Computational Linguistics: EMNLP 2020, ACL. pp. 1536–1547. Fiedler, M., 1973. Algebraic connectivity of graphs. Czechoslovak Mathematical Journal 23, 298–305. Franceschi, L., Niepert, M., Pontil, M., He, X., 2019. Learning discrete structures for graph neural networks, in: Proceedings of the 36th International Conference on Machine Learning (ICML), pp. 1972–1982. Gao, S., Zhai, T., Wang, X., Liu, Z., Li, Z., Di, X., 2026. SCOTT: Source code clone detection based on semantic mining from graph and text data. Expert Systems with Applications 319, 132000. doi:10.1016/j.eswa.2026.132000. Gilmer, J., Schoenholz, S.S., Riley, P.F., Vinyals, O., Dahl, G.E., 2017. Neural message passing for quantum chemistry, in: Proceedings of the 34th International Conference on Machine Learning, pp. 1263–1272. Gu, X., Zhang, H., Kim, S., 2018. Deep code search, in: Proceedings of the 40th International Conference on Software Engineering (ICSE), ACM. pp. 933–944. Guo, D., Ren, S., Lu, S., Feng, Z., Tang, D., Liu, S., Zhou, L., Duan, N., Svyatkovskiy, A., Fu, S., Tufano, M., Deng, S.K., Clement, C.B., Drain, D., Sundaresan, N., Yin, J., Jiang, D., Zhou, M., 2021. GraphCodeBERT: Pre-training code representations with data flow, in: Proceedings of the 9th International Conference on Learning Representations (ICLR). Hadsell, R., Chopra, S., LeCun, Y., 2006. Dimensionality reduction by learning an invariant mapping, in: 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’06), IEEE. pp. 1735–1742. doi:10.1109/CVPR.2006.10 0. Hastie, T., Tibshirani, R., Friedman, J., 2009. The Elements of Statistical Learning: Data Mining, Inference, and Prediction. Springer Series in Statistics. 2 ed., Springer. doi:10.1007/978-0-387-8 4858-7. He, K., Zhang, X., Ren, S., Sun, J., 2016. Deep residual learning for image recognition, in: Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778. Heinze, T.S., Schäfer, A., Amme, W., 2025. StoneDetector: Con-
21
ventional and versatile code clone detection for java. Journal of Systems and Software (in press); arXiv:2508.03435 . Hendrycks, D., Gimpel, K., 2016. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415 . Hill, E., Binkley, D., Lawrie, D., Pollock, L., Vijay-Shanker, K., 2014. An empirical study of identifier splitting techniques. Empirical Software Engineering 19, 1703–1759. doi:10.1007/s10664-0 13-9261-0. Hu, Y., Fang, Y., Sun, Y., Jia, Y., Wu, Y., Zou, D., Jin, H., 2023. Code2Img: Tree-based image transformation for scalable code clone detection. IEEE Transactions on Software Engineering 49, 4429–4442. Jain, P., Jain, A., Zhang, T., Abbeel, P., Gonzalez, J.E., Stoica, I., 2021. Contrastive code representation learning, in: Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing (EMNLP), ACL. pp. 5954–5971. Jiang, B., Ruffolo, M., Kulkarni, A., Canini, T., AlOmar, E.A., 2026. A systematic mapping study on the research landscape of LLMbased code clone detection. Information and Software Technology 195, 108096. doi:10.1016/j.infsof.2026.108096. Jiang, L., Misherghi, G., Su, Z., Glondu, S., 2007. Deckard: Scalable and accurate tree-based detection of code clones, in: Proceedings of the 29th International Conference on Software Engineering, pp. 96–105. doi:10.1109/ICSE.2007.30. Jin, W., Ma, Y., Liu, X., Tang, X., Wang, S., Tang, J., 2020. Graph structure learning for robust graph neural networks, in: Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, ACM. pp. 66–74. doi:10.1145/3394486.3403049. Jolliffe, I., 2005. Principal component analysis. Encyclopedia of statistics in behavioral science . Juergens, E., Deissenboeck, F., Hummel, B., Wagner, S., 2009. Do code clones matter?, in: Proceedings of the 31st International Conference on Software Engineering (ICSE), IEEE. pp. 485–495. Kamiya, T., Kusumoto, S., Inoue, K., 2002. CCFinder: A multilinguistic token-based code clone detection system for large scale source code. IEEE Transactions on Software Engineering 28, 654– 670. Kipf, T.N., Fetaya, E., Wang, K.C., Welling, M., Zemel, R., 2018. Neural relational inference for interacting systems, in: Proceedings of the 35th International Conference on Machine Learning (ICML), pp. 2688–2697. Kipf, T.N., Welling, M., 2017. Semi-supervised classification with graph convolutional networks, in: Proceedings of the 5th International Conference on Learning Representations (ICLR). Komondoor, R., Horwitz, S., 2001. Using slicing to identify duplication in source code, in: Proceedings of the 8th International Symposium on Static Analysis (SAS), Springer. pp. 40–56. Krinke, J., 2001. Identifying similar code with program dependence graphs, in: Proceedings of the 8th Working Conference on Reverse Engineering (WCRE), IEEE. pp. 301–309. Leordeanu, M., Hebert, M., 2005. A spectral technique for correspondence problems using pairwise constraints, in: Proceedings of the 10th IEEE International Conference on Computer Vision (ICCV), IEEE. pp. 1482–1489. Lewitus, E., Morlon, H., 2016. Characterizing and comparing phylogenies from their laplacian spectrum. Systematic Biology 65, 495–507. doi:10.1093/sysbio/syv121. Li, T., Zhang, Y., 2024. Multilingual code refactoring detection based on deep learning. Expert Systems with Applications AUTHOR CHECK: volume, pages, DOI. Li, Z., Lu, S., Myagmar, S., Zhou, Y., 2006. CP-Miner: Finding copy-paste and related bugs in large-scale software code. IEEE Transactions on Software Engineering 32, 176–192. Loshchilov, I., Hutter, F., 2019. Decoupled weight decay regulariza-
tion, in: International Conference on Learning Representations. von Luxburg, U., 2007. A tutorial on spectral clustering. Statistics and Computing 17, 395–416. Micikevicius, P., Narang, S., Alben, J., Diamos, G., Elsen, E., Garcia, D., Ginsburg, B., Houston, M., Kuchaiev, O., Venkatesh, G., Wu, H., 2018. Mixed precision training, in: International Conference on Learning Representations. Mikolov, T., Sutskever, I., Chen, K., Corrado, G.S., Dean, J., 2013. Distributed representations of words and phrases and their compositionality, in: Advances in Neural Information Processing Systems (NIPS), pp. 3111–3119. Mitchell, B.S., Mancoridis, S., 2006. On the automatic modularization of software systems using the bunch tool. IEEE Transactions on Software Engineering 32, 193–208. doi:10.1109/TSE.2006 .31. Mohar, B., 1991. The laplacian spectrum of graphs, in: Graph Theory, Combinatorics, and Applications. Wiley. volume 2, pp. 871–898. Mou, L., Li, G., Zhang, L., Wang, T., Jin, Z., 2016. Convolutional neural networks over tree structures for programming language processing, in: Proceedings of the 30th AAAI Conference on Artificial Intelligence, pp. 1287–1293. Narayanan, A., Chandramohan, M., Venkatesan, R., Chen, L., Liu, Y., Jaiswal, S., 2017. graph2vec: Learning distributed representations of graphs. arXiv preprint arXiv:1707.05005 (MLG Workshop) . Ng, A.Y., Jordan, M.I., Weiss, Y., 2002. On spectral clustering: Analysis and an algorithm, in: Advances in Neural Information Processing Systems (NIPS), pp. 849–856. Perez, D., Chiba, S., 2019. Cross-language clone detection by learning over abstract syntax trees, in: Proc. IEEE/ACM 16th Int. Conf. Mining Software Repositories (MSR), IEEE. pp. 518–528. Puri, R., Kung, D.S., Janssen, G., Zhang, W., Domeniconi, G., Zolotov, V., Dolby, J., Chen, J., Choudhury, M., Decker, L., et al., 2021. Project codenet: A large-scale ai for code dataset for learning a diversity of coding tasks. arXiv preprint arXiv:2105.12655 1035. Roy, C.K., Cordy, J.R., 2007. A Survey on Software Clone Detection Research. Technical Report 2007-541. School of Computing, Queen’s University at Kingston. Roy, C.K., Cordy, J.R., 2008. NICAD: Accurate detection of nearmiss intentional clones using flexible pretty-printing and code normalization, in: Proceedings of the 16th IEEE International Conference on Program Comprehension (ICPC), IEEE. pp. 172–181. Saha, A., Mendez, O., Russell, C., Bowden, R., 2023. Learning adaptive neighborhoods for graph neural networks, in: Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV). Saini, V., Farmahinifarahani, F., Lu, Y., Baldi, P., Lopes, C.V., 2018. Oreo: Detection of clones in the twilight zone, in: Proceedings of the 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE), ACM. pp. 354–365. Sajnani, H., Saini, V., Svajlenko, J., Roy, C.K., Lopes, C.V., 2016. SourcererCC: Scaling code clone detection to big-code, in: Proceedings of the 38th International Conference on Software Engineering (ICSE), ACM. pp. 1157–1168. Schleimer, S., Wilkerson, D.S., Aiken, A., 2003. Winnowing: Local algorithms for document fingerprinting, in: Proceedings of the ACM SIGMOD International Conference on Management of Data, ACM. pp. 76–85. Schlichtkrull, M., Kipf, T.N., Bloem, P., Van Den Berg, R., Titov, I., Welling, M., 2018. Modeling relational data with graph convolutional networks, in: European semantic web conference, Springer. pp. 593–607. Sheneamer, A., Roy, S., Kalita, J., 2018. A detection framework for semantic code clones and obfuscated code. Expert Systems with Applications 97, 405–420. doi:10.1016/j.eswa.2017.12.040.
22
Sheneamer, A.M., 2021. Multiple similarity-based features blending for detecting code clones using consensus-driven classification. Expert Systems with Applications 183, 115364. doi:10.1016/j. eswa.2021.115364. Shi, J., Malik, J., 2000. Normalized cuts and image segmentation. IEEE Transactions on Pattern Analysis and Machine Intelligence 22, 888–905. Sonnekalb, T., Gruner, B., Brust, C.A., Mäder, P., 2022. Generalizability of code clone detection on CodeBERT, in: Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering (ASE), ACM. pp. 1–3. Srivastava, N., Hinton, G.E., Krizhevsky, A., Sutskever, I., Salakhutdinov, R., 2014. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research 15, 1929–1958. Stanković, L., Daković, M., Sejdić, E., 2022. Introduction to Graph Signal Processing. Cambridge University Press. doi:10.1017/97 81108604916. Sudhamani, M., Rangarajan, L., 2019. Code similarity detection through control statement and program features. Expert Systems with Applications 132, 63–75. doi:10.1016/j.eswa.2019.04 .045. Sun, J., Ovsjanikov, M., Guibas, L., 2009a. A concise and provably informative multi-scale signature based on heat diffusion. Computer Graphics Forum 28, 1383–1392. Sun, J., Ovsjanikov, M., Guibas, L., 2009b. A concise and provably informative multi-scale signature based on heat diffusion. Computer Graphics Forum 28, 1383–1392. doi:10.1111/j.1467-8 659.2009.01515.x. Svajlenko, J., Islam, J.F., Keivanloo, I., Roy, C.K., Mia, M.M., 2014. Towards a big data curated benchmark of inter-project code clones, in: Proceedings of the IEEE International Conference on Software Maintenance and Evolution (ICSME), IEEE. pp. 476–480. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A.N., Kaiser, L., Polosukhin, I., 2017. Attention is all you need, in: Advances in Neural Information Processing Systems (NIPS), pp. 5998–6008. Wang, P., Svajlenko, J., Wu, Y., Xu, Y., Roy, C.K., 2018. CCAligner: A token based large-gap clone detector, in: Proceedings of the 40th International Conference on Software Engineering (ICSE), ACM. pp. 1066–1077. Wang, W., Deng, Z., Xue, Y., Xu, Y., 2023. CCStokener: Fast yet accurate code clone detection with semantic token. Journal of Systems and Software 199, 111618. Wang, W., Li, G., Ma, B., Xia, X., Jin, Z., 2020. Detecting code clones with graph neural network and flow-augmented abstract syntax tree, in: Proceedings of the IEEE 27th International Conference on Software Analysis, Evolution and Reengineering (SANER), IEEE. pp. 261–271. Wang, W., et al., 2022. Towards learning (dis)-similarity of source code from program contrasts, in: Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics. Wei, H.H., Li, M., 2017. Supervised deep features for software functional clone detection by exploiting lexical and syntactical information in source code, in: Proceedings of the 26th International Joint Conference on Artificial Intelligence (IJCAI), pp. 3034–3040. Weinberger, K.Q., Dasgupta, A., Langford, J., Smola, A.J., Attenberg, J., 2009. Feature hashing for large scale multitask learning, in: Proceedings of the 26th Annual International Conference on Machine Learning, ACM. pp. 1113–1120. doi:10.1145/155337 4.1553516. Wen, X.C., Chen, Y., Gao, C., Zhang, H., Zhang, J.M., Liao, Q., 2023. Vulnerability detection with graph simplification and enhanced graph representation learning, in: Proc. IEEE/ACM 45th
Int. Conf. Software Engineering (ICSE), IEEE. pp. 2275–2286. White, M., Tufano, M., Vendome, C., Poshyvanyk, D., 2016. Deep learning code fragments for code clone detection, in: Proceedings of the 31st IEEE/ACM International Conference on Automated Software Engineering, pp. 87–98. doi:10.1145/2970276.29 70326. Wilson, R.C., Zhu, P., 2008. A study of graph spectra for comparing graphs and trees. Pattern Recognition 41, 2833–2841. Wu, Y., Zou, D., Dou, S., Yang, S., Yang, W., Cheng, F., Liang, H., Jin, H., 2020. SCDetector: Software functional clone detection based on semantic tokens analysis, in: Proceedings of the 35th IEEE/ACM International Conference on Automated Software Engineering (ASE), ACM. pp. 821–833. Yamaguchi, F., Golde, N., Arp, D., Rieck, K., 2014. Modeling and discovering vulnerabilities with code property graphs, in: Proceedings of the IEEE Symposium on Security and Privacy (S&P), IEEE. pp. 590–604. Ying, R., You, J., Morris, C., Ren, X., Hamilton, W.L., Leskovec, J., 2018a. Hierarchical graph representation learning with differentiable pooling, in: Advances in Neural Information Processing Systems (NeurIPS), pp. 4805–4815. Ying, Z., You, J., Morris, C., Ren, X., Hamilton, W.L., Leskovec, J., 2018b. Hierarchical graph representation learning with differentiable pooling, in: Advances in Neural Information Processing Systems. Yu, D., Yang, Q., Chen, X., Chen, J., Xu, Y., 2023a. Graph-based code semantics learning for efficient semantic code clone detection. Information and Software Technology 156, 107130. Yu, H., Lam, W., Chen, L., Li, G., Xie, T., Wang, Q., 2019. Neural detection of semantic code clones via tree-based convolution, in: Proceedings of the 27th International Conference on Program Comprehension (ICPC), IEEE. pp. 70–80. Yu, Q., Liu, X., Wu, C., 2023b. Code classification with graph neural networks: Have you ever struggled to make it work? Expert Systems with Applications AUTHOR CHECK: complete author list, volume, pages, DOI. Yu, T., Wang, R., Yan, J., Li, B., 2021. Deep latent graph matching, in: Proceedings of the 38th International Conference on Machine Learning (ICML), PMLR. pp. 12187–12197. Zhang, A., Fang, L., Ge, C., Li, P., Liu, Z., 2023. Efficient transformer with code token learner for code clone detection. Journal of Systems and Software 197, 111557. Zhang, H., van Kaick, O., Dyer, R., 2010. Spectral mesh processing. Computer Graphics Forum 29, 1865–1894. Zhang, J., Wang, X., Zhang, H., Sun, H., Wang, K., Liu, X., 2019. A novel neural source code representation based on abstract syntax tree, in: Proceedings of the 41st International Conference on Software Engineering (ICSE), IEEE. pp. 783–794. Zhang, L., Luo, S., Pan, L., Wu, Z., Gong, K., 2024. FSD-CLCD: Functional semantic distillation graph learning for cross-language code clone detection. Engineering Applications of Artificial Intelligence 133. Zhao, G., Huang, J., 2018. DeepSim: Deep learning code functional similarity, in: Proceedings of the 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE), ACM. pp. 141–151. Zhou, Y., Liu, S., Siow, J., Du, X., Liu, Y., 2019. Devign: Effective vulnerability identification by learning comprehensive program semantics via graph neural networks, in: Advances in Neural Information Processing Systems (NeurIPS). Zhu, Y., Xu, W., Zhang, J., Du, Y., Zhang, J., Liu, Q., Yang, C., Wu, S., 2021. A survey on graph structure learning: Progress and opportunities. arXiv preprint arXiv:2103.03036 .
23
Related documents
- Semantic Code Clone Detection: Are We There Yet?#307082
- Enhancing LLM-Based Code Translation with Verified Multi-Semantic Representations#271926
- Harnessing Code Agents for Automatic Software Verification#346558
- FusionVul: A Multimodal Feature Fusion Framework for Source Code Vulnerability Detection#267722
- Independent Patch Verification for Coding Agents with a Bidirectional Reconstruct-and-Verify Framework#441875
Retrieved via Conceptio: every document is proof-bundled with source, license, and retrieval metadata.
Read the Docs → · View CLI source on GitHub · Conceptio Open Knowledge Archive