Skip to content
Book Open access

A Unified Model for Cross-Domain Clone Detection via Model Merging

Aug 2026 · Proceedings of the 41st IEEE/ACM International Conference on Automated Software Engineering · pp. 1496-1508 · 1 citation · 67 references
Computer Science

TL;DR

This work provides one of the first systematic empirical studies of model merging for software engineering and a practical recipe for building cross-domain code clone detectors.

Abstract

The growing diversity of code clone types, from syntactic copies to cross-language semantic clones to AI-generated duplicates, has created a fragmentation crisis in clone detection. Current deep learning detectors are domain specialists that degrade significantly outside their training distribution. In our evaluation, F1 drops exceed 70% across domains. Deploying multiple specialized models is impractical, yet training a single cross-domain detector requires simultaneous access to all training data. To address this, we investigate model merging, a family of post-hoc techniques that operate solely on trained checkpoints. We systematically evaluate parameter merging with five task-vector methods (Task Arithmetic, TIES, DARE-TIES, WUDI, PCB), architecture merging via greedy layer stitching, and cross-tokenizer alignment. Our study spans four pre-trained code models, three benchmarks, and twelve merging configurations. Same-base TIES merging creates effective cross-domain detectors, validated across two model families and three random seeds. It reaches 0.865 combined F1 on UniXcoder, 93% of multi-task training performance without any training data at the merging step. WUDI achieves the highest in-distribution combined F1 at 0.899, but TIES generalizes better to unseen AI-generated clones. We therefore recommend TIES for the practical recipe. Cross-base merging yields only marginal and high-variance gains across all five methods. This indicates that task vector compatibility through a shared pre-trained base is the binding factor for effective merging in our setting. Merged encoder-based detectors also outperform zero-shot instruction-tuned code LLMs on GPTCloneBench (0.609 vs. 0.454 F1 for the strongest LLM baseline) at substantially lower per-pair inference cost. They also generalize up to 4× better than multi-task training to unseen AI-generated clones, suggesting a trade-off between in-domain performance and OOD robustness. This work provides one of the first systematic empirical studies of model merging for software engineering and a practical recipe for building cross-domain code clone detectors.

Read PDF

Similar papers

#machine learning Preprint Sep 2026

Type-IV Code Clone Detection via Layer-Wise Non-Contrastive Representation Learning

LWVIC4Code is proposed, a non-contrastive representation learning approach specifically designed for Type-IV clone detection that achieves competitive or superior performance without negative samples, benefits from layer-wise supervision, and generalizes effectively from Python to other languages, particularly Java and...

Luciano Marchezan, Kévin Delcourt, Eugene Syriani et al. · 0 citations
Book Open access Oct 2026

Code2LowCode: An Interactive Tool for Lifting Code Clones into Reusable Abstractions

Code duplication is widespread in software, yet the dominant response, clone detection, stops at flagging duplication and leaves the harder, value-creating step to developers: turning recurring code into reusable abstractions. We argue that recent advances in Large Language Models (LLMs), combined with classical clone...

Raphael Zefferer, Bernhard Schenkenfelder, Stefan Wagner · 0 citations
Open access Oct 2026

Automated Type-IV Clone Generation via LLMs and Deterministic Validation

Detecting Type-IV code clones, functionally equivalent fragments with different syntax, remains a major challenge for quality assurance. Existing datasets are limited in supporting semantic clone detection due to class imbalance, lack of verified functional equivalence, and data redundancy. We present an automated appr...

Luciano Marchezan, Eugene Syriani, Kévin Delcourt et al. · 1 citation
#artificial intelligence Preprint Aug 2026

Evaluating Tiny Recursive Models Across Training for Code Generation

This work compares a ~28M-parameter autoregressive Tiny Recursive Model (TRM-AR) on natural-language-to-Python code generation against parameter-matched and depth-matched controls, tracking fit and generation across 40 epochs and three seeds.

Anjani Sirivella, Aanisha Newaz, Glaucia Melo · 0 citations
Preprint Oct 2026

PolyCodeEval: Benchmarking Multilingual Code Generation from Functions to Repositories

As large language models increasingly move toward repository-level software engineering, existing code-generation benchmarks remain fragmented across language coverage, task granularity, and evaluation protocols, impeding systematic comparison. To address this gap, we present PolyCodeEval, a unified multilingual and mu...

Bo-Wen Yang, Jia-Jun Jiang, Lu-Xue Yu et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.