Paper deep dive
A Unified Model for Cross-Domain Clone Detection via Model Merging
Palash R. Roy, Banani Roy, Kevin A. Schneider, Chanchal K. Roy
Intelligence
Status: succeeded | Model: Gemma-4-26B-A4B | Prompt: intel-v1 | Confidence: 95%
Last extracted: 8/9/2026, 3:11:25 AM
Summary
This paper investigates model merging as a solution for cross-domain code clone detection, addressing the fragmentation crisis where current deep learning detectors degrade significantly outside their training distribution. The authors evaluate parameter merging (Task Arithmetic, TIES, DARE-TIES, WUDI, PCB) and architecture merging (greedy layer stitching) across four pre-trained code models and three benchmarks. Results indicate that same-base TIES merging creates effective cross-domain detectors (0.865 combined F1 on UniXcoder), outperforming zero-shot LLMs and generalizing better to unseen AI-generated clones than multi-task training. Cross-base merging yields marginal gains due to task vector incompatibility.
Entities (10)
Relation Signals (9)
TIES → isa → Parameter Merging
confidence 98% · We evaluate parameter merging with five task-vector methods... TIES
UniXcoder → isfinetunedon → BigCloneBench
confidence 98% · UniXcoder [18] fine-tuned on BigCloneBench [50]
Model Merging → addresses → Cross-Domain Clone Detection
confidence 97% · To address this, we investigate model merging... for cross-domain clone detection
CodeBERT → isfinetunedon → BigCloneBench
confidence 96% · We fine-tune CodeBERT and GraphCodeBERT on BigCloneBench
TIES → achieveshighperformanceon → UniXcoder
confidence 95% · Same-base TIES merging creates effective cross-domain detectors... reaching 0.865 combined F1 on UniXcoder
Greedy Layer Stitching → isa → Architecture Merging
confidence 95% · architecture merging via greedy layer stitching
UniXcoder → isfinetunedon → CLCDSA
confidence 95% · fine-tune UniXcoder on both BigCloneBench and the CLCDSA Java↔Python subset
GPTCloneBench → contains → AI-generated clones
confidence 94% · GPTCloneBench [2] contains GPT-generated semantic clones
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
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, with F1 drops exceeding 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 evaluate parameter merging with five task-vector methods, architecture merging via greedy layer stitching, and cross-tokenizer alignment across four code models, three benchmarks, and twelve configurations. Same-base TIES merging creates effective cross-domain detectors, validated across two model families and three random seeds, reaching 0.865 combined F1 on UniXcoder, 93% of multi-task 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, making it our recommended method. Cross-base merging yields only marginal and high-variance gains across all five methods, indicating that task vector compatibility through a shared pre-trained base is the binding factor for effective merging. Merged detectors also outperform zero-shot code LLMs on GPTCloneBench at lower inference cost and generalize up to 4x 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 clone detectors.
Tags
Links
- Source: https://arxiv.org/abs/2608.04215v1
- Canonical: https://arxiv.org/abs/2608.04215v1
PDF not stored locally. Use the link above to view on the source site.
Full Text
86,281 characters extracted from source content.
Expand or collapse full text
A Unified Model for Cross-Domain Clone Detection via Model Merging Palash R. Roy ✉ University of Saskatchewan Computer Science Saskatoon, Canada palash.roy@usask.ca Banani Roy University of Saskatchewan Computer Science Saskatoon, Canada banani.roy@usask.ca Kevin A. Schneider University of Saskatchewan Computer Science Saskatoon, Canada kevin.schneider@usask.ca Chanchal K. Roy University of Saskatchewan Computer Science Saskatoon, Canada chanchal.roy@usask.ca 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 ex- ceed 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 investi- gate model merging, a family of post-hoc techniques that operate solely on trained checkpoints. We systematically evaluate parame- ter 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 config- urations. 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. CCS Concepts • Software and its engineering→Software maintenance tools; Software evolution;• Computing methodologies→Artificial intelligence; Learning settings. This work is licensed under a Creative Commons Attribution 4.0 International License. ASE ’26, Munich, Germany © 2026 Copyright held by the owner/author(s). ACM ISBN 979-8-4007-2882-2/2026/10 https://doi.org/10.1145/3832783.3837415 Keywords Code Clone Detection, Model Merging, Task Arithmetic, Cross- Domain Generalization, Empirical Software Engineering, Deep Learning for Code ACM Reference Format: Palash R. Roy, Banani Roy, Kevin A. Schneider, and Chanchal K. Roy. 2026. A Unified Model for Cross-Domain Clone Detection via Model Merging. In Proceedings of the 41st IEEE/ACM International Conference on Automated Software Engineering (ASE ’26), October 12–16, 2026, Munich, Germany. ACM, New York, NY, USA, 13 pages. https://doi.org/10.1145/3832783.3837415 1 Introduction Code clone detection is fundamental to software maintenance, qual- ity assurance, and evolution [42,43,45]. The field has made remark- able progress over the past two decades, moving from token-based and tree-based matching [7,27,29], through learned representa- tions [58,59,66], to pre-trained code models that achieve strong results on established benchmarks [16,18,19,34]. This progress has come with an underappreciated cost. Each new detection capa- bility, whether for cross-language clones [37,41] or AI-generated semantic clones [2,47], produces a new specialist model that works well in its own domain but fails outside it. Teams must therefore deploy and maintain multiple specialized models, each limited to a single clone type or language pair. The consequence is a growing out-of-distribution (OOD) gen- eralization problem [21,55]. UniXcoder [18] fine-tuned on Big- CloneBench [50] achieves 0.940 F1 on same-language clones but collapses to 0.269 on CLCDSA [37] cross-language detection, a 71% drop. The reverse is equally severe. This is a well-documented lim- itation of fine-tuned models under distribution shift [21,40], and recent work confirms similar degradation for clone detectors on unseen functionalities [30,33] and highlights its implications for software engineering (SE) [8,40]. What is notable is that, despite the practical urgency, no prior work has investigated how this cross-domain fragmentation can be addressed for clone detection without retraining. The obvious remedy of training a single model on all available data has its own limitations [54]. Multi-task learning requires simul- taneous access to every training corpus, full retraining whenever a new domain appears, and careful loss balancing to avoid neg- ative transfer [10]. These requirements are impractical in many SE settings where training data may be proprietary, distributed across teams, or simply too expensive to combine [64]. This raises a question. How can we unify existing specialist detectors into a single cross-domain model without retraining and without access to any training data at the merging step? arXiv:2608.04215v1 [cs.SE] 4 Aug 2026 ASE ’26, October 12–16, 2026, Munich, GermanyPalash R. Roy, Banani Roy, Kevin A. Schneider, and Chanchal K. Roy Model merging [23,63,65] offers a principled path forward. These techniques combine trained models by operating directly on their checkpoints, requiring no training data, no gradient com- putation, and no retraining for the merging step itself. Merging completes in under five minutes on a single CPU in our experiments. Model merging has shown promise in NLP [63,70] and computer vision [23,60], but its applicability to software engineering tasks remains unexplored. The merging techniques themselves are es- tablished, yet no prior work has investigated their applicability to software engineering or identified the conditions under which they succeed or fail for code-related tasks. We present the first systematic empirical investigation of model merging for code clone detection, spanning parameter merging, architecture merging, and cross-tokenizer alignment across multi- ple model families. Our study evaluates parameter merging with five task-vector methods (Task Arithmetic [23], TIES [63], DARE- TIES [65], WUDI [9], and PCB [12]) and simple averaging [60], ar- chitecture merging via greedy layer stitching, and cross-tokenizer representation alignment. This spans four pre-trained code models, three benchmarks, and twelve merging configurations. Same-base TIES merging produces a cross-domain detector that achieves 0.890 ±0.010 F1 on same-language clones and 0.839±0.027 on cross- language clones simultaneously across three seeds, a 25% combined improvement over the best individually fine-tuned model. Same-base WUDI achieves the highest in-distribution combined F1 in our experiments (0.899±0.025), but TIES generalizes better to unseen AI-generated clones, which informs our recommenda- tion of TIES for the practical recipe. Cross-base merging yields only marginal, high-variance gains, which we trace to destructive interference between near-orthogonal task vectors. Merging also holds up against strong alternatives. Multi-task training on the combined data wins in-domain (0.927 vs. 0.865 com- bined F1) but collapses on unseen AI-generated clones (0.151 F1), where merging generalizes far better. This suggests joint training overfits the combined distribution while merging retains comple- mentary specialist knowledge. Two zero-shot instruction-tuned code LLMs, Qwen2.5-Coder-7B-Instruct and DeepSeek-Coder-6.7B- Instruct, also fall short of the merged detector, which runs orders of magnitude faster per pair. Finally, architecture-level layer stitching is interpretable: cross-language layers dominate early transformer positions and same-language layers dominate late ones. A learned cross-tokenizer alignment fails to bridge incompatible vocabular- ies, pointing to a tokenizer limitation that linear alignment cannot resolve. We validate these findings across two model families (UniX- coder and CodeBERT). RQ1. How well do individual code clone detectors generalize across detection domains? We quantify the cross-domain gap to establish the severity of the OOD problem. RQ2. What conditions determine successful parameter-level merging for cross-domain code clone detection? We compare same-base and cross-base merging across five task-vector methods and benchmark against multi-task training and two zero-shot LLM baselines. RQ3. What representations are captured by different layers across domains, and how can layer stitching exploit them? We explore whether layer-level selection captures domain-specific roles that uniform merging cannot. RQ4. Do merged models generalize to unseen clone types, such as LLM-generated semantic clones? We test zero-shot robustness on AI-generated semantic clones unseen during training. We make the following contributions. (1) We provide the first sys- tematic empirical study of post-hoc model merging for cross-do- main code clone detection, and identify shared-base task-vector compatibility as the binding factor for effective merging with- out any training data at the merging step. (2) We give geomet- ric and statistical evidence for why cross-base merging fails and same-base merging succeeds, and show this pattern holds across all five task-vector methods we evaluate, establishing that the com- patibility boundary is method-independent rather than an artifact of any single algorithm. (3) We show that architecture-level layer stitching reveals interpretable domain-specific patterns, and iden- tify a tokenizer barrier that linear cross-tokenizer alignment can- not overcome. (4) We distill a practical, training-data-free recipe: fine-tune one shared base per domain and merge with TIES at the parameter level. We discuss its scope and limitations in Section 6. 1. Domain Specific Fine tuning Pre-trained Encoder Fine tuning Same language expert (θ_SL) Cross-language expert (θ_CL) Fine-tuned on same language Fine-tuned on cross language CLCDSA Benchmark BigCloneBench 2. Cross-domain evaluation (θ_CL) tested on same-language data F1 drops>70% (θ_SL) tested on cross-language data F1 drops>70% 3.Model Merging Parameter Merging 1. Compute Task Vector 2. TIES trim + elect sign 3. Merged Models Architecture Merging 1. Build a layer pool 2. Greedy Search 3. Assemble the stitched model 4. Evaluation 1. BigCloneBench 2. CLCDSA 3. GPTCloneBench (Zero Shot) No training on GPTCloneBench Figure 1: Overview of our four-phase approach. 2 Background Code Clones. Code clones are similar code fragments that arise through copy-paste, independent development, or automated gen- eration [43]. The standard taxonomy [42,43] ranges from exact copies (Type-1) through renamed (Type-2) and modified (Type-3) fragments to functionally equivalent but syntactically different code (Type-4). Two specialized forms of Type-4 clones are increasingly important. Cross-language clones are functionally equivalent im- plementations across different languages [37], and AI-generated semantic clones are code produced by large language models with distinct syntactic patterns [2,3,47]. Each requires its own detec- tor and training data, creating the cross-domain fragmentation problem we address. Our focus is on generalization across these detection domains, which is distinct from Type-1 through Type-4 generalization within a single domain. Model Merging. Model merging combines multiple trained mod- els into a single model without additional training [23]. Its key A Unified Model for Cross-Domain Clone Detection via Model MergingASE ’26, October 12–16, 2026, Munich, Germany abstraction is the task vector, the difference between a fine-tuned model’s parameters and its pre-trained base. Task vectors encode domain-specific knowledge and can be arithmetically combined to transfer it across tasks [23]. Several methods refine naive task- vector addition. TIES [63] resolves sign conflicts through trimming and sign election, DARE [65] drops and rescales elements to reduce redundancy, WUDI [9] minimizes per-layer cross-task interference without training data, and PCB [12] balances parameter competition before rescaling. These methods succeed in NLP and computer vi- sion, but their applicability to software engineering remains largely unexplored. 3 Approach Figure 1 presents an overview of our approach. We investigate model merging for code clone detection through a four-phase pipeline: (1) domain-specific fine-tuning of specialist models, (2) cross-domain evaluation to quantify the generalization gap, (3) model merging through parameter-level and architecture-level strategies, and (4) evaluation on both in-domain and unseen bench- marks. 3.1 Domain-Specific Fine-Tuning We formulate clone detection as a binary classification task over code pairs. Given a pair(푥 1 ,푥 2 ), we concatenate the two code snip- pets as[CLS] 푥 1 [SEP] 푥 2 [SEP]and pass them through the encoder. The[CLS]representation is fed through a dropout layer and a linear classification head (768→2) trained using cross- entropy loss. Given a pre-trained encoder휃 base , we fine-tune on a target datasetD 푘 to obtain a specialist checkpoint휃 푘 optimized for a single detection domain. This yields퐾specialist models. Each one achieves high performance on its respective domain but degrades severely on out-of-distribution inputs. Before merging, we evaluate each specialist on all benchmarks to quantify the cross-domain gap and identify complementary models. 3.2 Parameter-Level Merging Parameter-level merging combines the weights of multiple special- ist models into a single unified model through arithmetic operations on their parameters, without requiring any training data or gradient computation at the merging step. 3.2.1 Task Vectors. Given a fine-tuned model휃 푘 and its correspond- ing pre-trained base 휃 base , the task vector [23] is defined as 훿 푘 = 휃 푘 −휃 base (1) The task vector훿 푘 encodes the knowledge gained during fine-tuning on domain푘. A merged model is constructed by adding a weighted combination of task vectors back to the base model, 휃 merged = 휃 base + 퐾 ∑︁ 푘=1 휆 푘 · 훿 푘 (2) where휆 푘 are merging weights that control the relative contribution of each specialist. In our experiments, we set휆 푘 =1/퐾for all specialists unless otherwise specified. 3.2.2 TIES Merging. Naively summing task vectors leads to inter- ference when parameters from different specialists conflict in sign or magnitude. TIES (TrIm, Elect Sign, and Merge) [63] addresses this through three steps: (1) Trim: zero out task vector values below a percentile threshold, retaining only the most significant param- eter changes. (2) Elect sign: for each parameter position, compute a weighted vote across all task vectors and elect the majority sign direction. (3) Merge: sum only the task vector values whose signs agree with the elected direction, discarding conflicting updates. The merged model becomes 휃 merged = 휃 base + 퐾 ∑︁ 푘=1 휆 푘 · TIES(훿 푘 ,훿 푗 퐾 푗=1 )(3) 3.2.3 DARE Dropping. DARE (Drop And REscale) [65] extends task vector merging by randomly dropping a fraction푝of each task vector’s elements and rescaling the surviving values by 1/(1− 푝), ̃ 훿 푘 = 1 1− 푝 ·(푚⊙ 훿 푘 ), 푚 푖 ∼ Bernoulli(1− 푝)(4) where⊙denotes element-wise multiplication. DARE can be com- bined with TIES to form DARE-TIES, where dropping is applied before the trim-elect-merge steps. 3.2.4 WUDI Merging. WUDI [9] casts merging as a per-layer opti- mization rather than a heuristic conflict-resolution rule. For each linear layer, it searches for the merged task vector that minimizes cross-task interference, without training data or rescaling coeffi- cients. The objective for a layer with task vectors훿 푘 퐾 푘=1 is L WUDI (훿)= 퐾 ∑︁ 푘=1 ∥(훿−훿 푘 )훿 ⊤ 푘 ∥ 2 퐹 ∥훿 푘 ∥ 2 퐹 ,(5) where∥ · ∥ 퐹 is the Frobenius norm, and the merged model is 휃 merged = 휃 base + arg min 훿 L WUDI (훿). We initialize훿as the task- arithmetic sum and optimize with Adam (1×10 −5 , 300 steps) per linear layer, applying WUDI to the encoder and classifier-head weight matrices and averaging non-linear parameters (layer nor- malization, embeddings, biases) as in TIES. 3.2.5 PCB Merging. PCB [12] is a training-free task-vector method that balances parameter competition within and across task vec- tors, dropping low-competition parameters before rescaling. We include it as a fifth method to test whether the same-base compati- bility boundary holds beyond sign election (TIES) and interference minimization (WUDI). 3.2.6 Same-Base Hypothesis. We hypothesize that effective param- eter merging requires all specialist models to share the same pre- trained base휃 base . When specialists are fine-tuned from different base models (e.g., CodeBERT vs. UniXcoder), their task vectors re- side in different parameter spaces, and arithmetic combination may produce destructive interference rather than constructive merg- ing. Whether the shared-base principle established in NLP and vision [9,23,63] holds for code clone detection, where models differ in pre-training objectives and tokenizers, remains an open empirical question. We validate this hypothesis across all five task- vector methods (Task Arithmetic, TIES, DARE-TIES, WUDI, and PCB) in Section 5. 3.3 Architecture-Level Merging While parameter merging operates uniformly across all layers, dif- ferent layers of a transformer may benefit from different specialists. ASE ’26, October 12–16, 2026, Munich, GermanyPalash R. Roy, Banani Roy, Kevin A. Schneider, and Chanchal K. Roy Architecture-level merging addresses this by selecting, for each layer position, which specialist’s layer to use in the final composite model. 3.3.1 Layer Pool Construction. Given퐾specialist models each with퐿transformer layers, we construct a layer poolP=(푘,푙) | 푘 ∈ [1,퐾],푙 ∈ [0,퐿−1]containing all candidate layers. For two specialists, this yields 2퐿 candidate layers for 퐿 positions. 3.3.2 Greedy Layer Selection. We employ a greedy search to con- struct the optimal inference path through the layer pool. Starting from the best-performing individual specialist as the initial model, we iterate over each layer position푙=0,1, . . .,퐿−1 and evaluate whether swapping in an alternative specialist’s layer improves a combined evaluation objective, F= 1 2 ( F1 SL + F1 CL ) (6) We computeFon held-out validation sets for each domain. Greedy search requires only퐾×퐿evaluations (24 in our setting) compared to퐾 퐿 for exhaustive enumeration, while producing strong results in practice. At each position, the swap that yields the highestFis retained. If no swap improves over the current configuration, the original layer is kept. This produces a composite model where each layer is drawn from whichever specialist contributes most to the combined objective at that position. 3.3.3 Tokenizer Constraint. Architecture-level merging requires that all candidate models share the same tokenizer. Different tok- enizers produce different token ID sequences for the same source code, making the embedding layers incompatible. We investigate whether this constraint can be relaxed through representation align- ment (Section 3.4). 3.4 Cross-Tokenizer Representation Alignment To enable merging across models with different tokenizers, we explore learning a linear projection that maps one model’s hidden representations into the other’s space. Given a source model휃 푆 (e.g., UniXcoder, vocabulary size 51,416) and a target model휃 푇 (e.g., CodeBERT, vocabulary size 50,265), we collect paired hidden states by feeding the same raw code samples through both models using their respective tokenizers. We use a separate subset of training data, disjoint from downstream eval- uation, to avoid leakage. For each transformer layer푙, we train a linear projection푊 푙 ∈R 푑×푑 that minimizes L align =∥푊 푙 ·ℎ (푙) 푆 −ℎ (푙) 푇 ∥ 2 2 + 훼 ·L CORAL (7) whereℎ (푙) 푆 andℎ (푙) 푇 are the mean-pooled hidden states at layer푙from the source and target models respectively. We use mean pooling to obtain stable sequence-level representations across variable-length inputs.L CORAL is the Deep CORAL loss [49] that aligns the covari- ance structures of the two representation spaces. Once trained, the projection푊 푙 is inserted as a forward hook after layer푙whenever a source model layer is selected by the greedy search, transforming the output into the target model’s representa- tion space before passing to the next layer. Table 1: Summary of evaluation benchmarks. DatasetDomainTrainTest Lang. BCBSame-lang901,028415,416Java CLCDSA dataCross-lang484,676111,032Java, Py GPTCloneBenchAI-Clone—10,000Java 4 Experimental Setup Datasets. Table 1 summarizes the three benchmarks used in our evaluation. BigCloneBench (BCB) [52] is the most widely used benchmark for same-language code clone detection. We use the CodeXGLUE split [34] in Java. The dataset exhibits class imbalance with approx- imately 14% positive clone pairs, which we address using weighted random sampling proportional to inverse class frequency. CLCDSA data [37] is a cross-language clone detection bench- mark containing solutions in multiple programming languages to competitive programming problems from AtCoder and CodeJam. We use the Java↔Python subset throughout our experiments, in which each pair consists of one Java source file and one Python source file. We apply a problem-level split (70/15/15) to ensure no problem overlap between splits, and negative pairs are constructed by sampling Python solutions from different problems. The result- ing subset is approximately balanced with 50% positive pairs by construction. GPTCloneBench [2] contains GPT-generated semantic clones built upon SemanticCloneBench [1]. We construct 10,000 balanced evaluation pairs by randomly sampling from the Java subset, using 5,000 true clones from intra-prompt pairs and 5,000 non-clones from cross-functionality pairs, with a fixed random seed for reproducibil- ity. No model is trained on this benchmark. It serves exclusively for zero-shot generalization evaluation. Subject Models. We select three pre-trained code models based on the RoBERTa encoder architecture, each with 12 transformer layers and 768-dimensional hidden representations. CodeBERT [16] is pre-trained on code-natural language pairs in six programming languages using masked language modeling and replaced token detection. GraphCodeBERT [19] extends CodeBERT by incorporating data flow graphs during pre-training. Both share the same tokenizer with vocabulary size 50,265. UniXcoder [18] is a unified cross-modal model that uses AST-based pre-training objectives for code understanding and generation, with a distinct tokenizer of vocabulary size 51,416. We fine-tune CodeBERT and GraphCodeBERT on Big- CloneBench, and fine-tune UniXcoder on both BigCloneBench and the CLCDSA Java↔Python subset, producing four specialist models (Table 2). We focus on UniXcoder for cross-language fine-tuning because it incorporates explicit cross-modal pre- training objectives [18], whereas CodeBERT and GraphCodeBERT use NL-PL pair pre-training. This design enables our central comparison between same-base merging (two UniXcoder variants) and cross-base merging (CodeBERT, GraphCodeBERT, and UniXcoder). Implementation Details. All specialist models are fine-tuned with identical hyperparameters. We use the AdamW optimizer with learning rate 2×10 −5 , batch size 32, maximum sequence length 512, 10% linear warmup, and early stopping with patience of 3 epochs (up A Unified Model for Cross-Domain Clone Detection via Model MergingASE ’26, October 12–16, 2026, Munich, Germany Table 2: Specialist models and their validation F1 scores. ModelTraining Data Valid. F1 CodeBERTBCB0.895 GraphCodeBERTBCB0.905 UniXcoder-BCBBCB0.931 UniXcoder-CLCDSACLCDSA data0.940 to 10 epochs maximum). Training uses mixed precision (bfloat16) on NVIDIA A100 80GB PCIe GPUs. For the multi-task baseline, we fine- tune UniXcoder on the combined BCB and CLCDSA data training sets (1.38M pairs) using identical hyperparameters. For the Code- BERT validation experiment (Section 6), we fine-tune CodeBERT on CLCDSA data using the same settings. To assess robustness, all specialist models involved in same-base merging are trained across three random seeds (42, 2, 3). We report mean±standard deviation for merged model performance. For parameter merging, we evaluate multiple configurations as detailed in Section 5. We use DARE-TIES (drop rate푝=0.3), TIES- only (푝=0), and simple averaging (no trimming), with merging weights휆 푘 =1/퐾. For WUDI merging [9], we follow the official RoBERTa implementation with the Adam optimizer (learning rate 1×10 −5 , 300 steps per linear layer) and the merged delta initialized as the task-arithmetic sum. Non-linear parameters (LayerNorm, embeddings, biases) use weighted averaging with휆 푘 =1/퐾. For PCB merging [12], we follow the official implementation with drop rate 0.1 and intra-balancing scale 1.0, applying PCB to the linear weight matrices and averaging non-linear parameters as above. For architecture merging, the greedy layer search evaluates each candidate swap on 1,000 held-out validation samples per dataset. For cross-tokenizer alignment, we train 12 linear projections (768×768) on 5,000 code samples from the BigCloneBench training set (disjoint from evaluation data) using MSE + CORAL loss (훼=0.1) for 20 epochs. All models are evaluated using identical procedures with the same test splits, the same classification threshold (argmax over log- its), and the same metric computation pipeline. All model selection and merging decisions are performed on validation sets, and final performance is reported on held-out test sets throughout Section 5. LLM Baseline. To compare our merged encoder-based detector against representative instruction-tuned code LLMs, we evaluate two models, Qwen2.5-Coder-7B-Instruct [22] and DeepSeek-Coder- 6.7B-Instruct [20], in a zero-shot setting on GPTCloneBench using the official model releases without any task-specific fine-tuning. For each evaluation pair(푥 1 ,푥 2 ), we apply the model’s chat tem- plate with a fixed system prompt (“You are an expert software engineer specializing in code clone detection.”) and a user prompt that presents the two snippets and asks the model to answer with a single word, “Yes” or “No”, indicating whether the snippets are semantic clones. Both models receive an identical prompt, decoding configuration, and evaluation set; only their respective instruction formats differ. We decode greedily (do_sample=False) with a max- imum of 32 new tokens and parse the Yes/No verdict from the generated response. Outputs that do not conform to the requested one-word format (0% for Qwen, 13.6% for DeepSeek) are scored as non-clone. If the combined token length exceeds the context bud- get, we truncate the two snippets proportionally to their lengths (0 Table 3: Cross-domain evaluation of specialist models. Bold = in-domain. ModelBCB F1 CLCDSA F1 F1 comb CodeBERT0.8940.4640.679 GraphCodeBERT0.8910.4950.693 UniXcoder-BCB0.9400.2690.605 UniXcoder-CLCDSA0.2590.9240.592 of 10,000 pairs required truncation in our runs). Inference is data- parallel across NVIDIA A100 80GB PCIe GPUs in bfloat16, on the same 10,000 GPTCloneBench pairs and seed used throughout the paper. The full prompt template, per-pair predictions, and inference scripts are in the replication package (Section 9). Evaluation Metrics. We report F1 score, precision, and recall for binary clone detection on each benchmark’s full test set. To measure cross-domain effectiveness, we define the combined F1 as F1 comb = 1 2 ( F1 SL + F1 CL ) (8) whereF1 SL andF1 CL are F1 scores on BigCloneBench and CLCDSA data test sets respectively. We use equal weighting in the absence of a domain-specific preference. 5 Results RQ1. Cross-Domain Generalization Gap Table 3 presents the cross-domain evaluation results. All four specialist models achieve strong in-domain performance with F1 ≥0.891, confirming that fine-tuning produces effective domain- specific detectors. Cross-domain performance, however, degrades severely. UniXcoder-BCB achieves 0.940 F1 on BigCloneBench but only 0.269 on CLCDSA, a 71% drop. Conversely, UniXcoder- CLCDSA achieves 0.924 on CLCDSA but collapses to 0.259 on BigCloneBench, a 72% drop. CodeBERT and GraphCodeBERT exhibit a similar pattern with 44–48% drops on CLCDSA. This degradation confirms the out-of-distribution challenge de- scribed in Section 1. Each model’s learned decision boundary is specific to its training distribution and does not transfer across clone detection domains. The best combined F1 among individual models is only 0.693 (GraphCodeBERT), indicating that no single specialist adequately covers both domains despite achieving up to 0.940 F1 on its home benchmark. Finding 1. Individual clone detectors suffer 44–72% F1 drops when evaluated outside their training domain, confirming the OOD generalization failure. No individual model achieves a combined F1 above 0.693. RQ2. Parameter-Level Merging Table 4 presents parameter merging results across ten configu- rations. Cross-base merging is consistently weaker and less sta- ble than same-base merging. The best cross-base configurations, PCB (0.739±0.060) and TIES-only (0.703), exceed the best individual model (0.693) only modestly and fall well short of every same-base merge, while weaker weightings collapse entirely (down to 0.260). The two three-seed methods, WUDI (0.656±0.074) and PCB (0.739 ±0.060), share an asymmetric, unstable profile: BCB F1 stays high as ASE ’26, October 12–16, 2026, Munich, GermanyPalash R. Roy, Banani Roy, Kevin A. Schneider, and Chanchal K. Roy Table 4: Parameter merging results. Three-seed mean± std for same-base TIES/WUDI/PCB and cross-base WUDI/PCB. Category ConfigurationDrop 푝 BCB F1 CLCDSA F1 F1 comb Cross-base DARE-TIES (CB/GCB/UX, 휆=0.4/0.3/0.3)0.30.8640.3320.598 TIES-only (CB/GCB/UX, 휆=0.4/0.3/0.3)0.00.8410.5660.703 Equal weights (CB/GCB/UX, 휆=0.33 each)0.30.5020.0170.260 UniX-heavy (CB/GCB/UX, 휆=0.2/0.2/0.6)0.30.2410.6190.430 WUDI (UX-BCB + CB-CLCDSA, 휆=0.5/0.5)—.939±.001.372±.148.656±.074 PCB (UX-BCB + CB-CLCDSA, 휆=0.5/0.5)—.935±.004.542±.122.739±.060 Same-base Simple averaging (UX+UX, 휆=0.5/0.5)0.00.8930.8010.847 TIES (UX+UX, 휆=0.5/0.5)0.0.890±.010.839±.027.865±.012 PCB (UX+UX, 휆=0.5/0.5)—.910±.030.854±.040.882±.009 WUDI (UX+UX, 휆=0.5/0.5)—.935±.004.863±.052.899±.025 the UniXcoder-BCB specialist dominates its own parameter space, while CLCDSA F1 shows a lower mean and far higher variance (up to±0.148) than its same-base counterpart. This limitation is not specific to TIES or DARE. It persists under WUDI’s interference- minimization and PCB’s competition-balancing objectives, indicat- ing the compatibility constraint is method-independent. Same-base merging is highly effective. When both specialists share the same pre-trained base (UniXcoder), even simple averaging achieves 0.847 combined F1, already surpassing all cross-base con- figurations. TIES further improves this to 0.865±0.012 across three seeds and PCB to 0.882±0.009. WUDI, which directly optimizes the merged task vector per linear layer to minimize cross-task in- terference, achieves the highest in-domain combined F1 at 0.899± 0.025, retaining 96–99% of each specialist’s in-domain performance without any training data at the merging step. The gap between TIES and simple averaging indicates that sign conflict resolution contributes meaningfully even when task vec- tors share the same base. WUDI’s further gain shows that direct interference-minimization extracts additional in-distribution signal compared to sign-election heuristics, with PCB falling between. However, WUDI’s OOD behavior differs from TIES (Section 5), which informs our practical recommendation. Section 6 analyzes the geometric properties of same-base and cross-base task vectors. Comparison with multi-task training. To assess whether the merging step can compete with training on all data simultaneously, we fine-tune UniXcoder on the combined BCB and CLCDSA data (1.38M pairs). The multi-task model achieves higher in-domain per- formance (combined 0.927), as expected. Same-base TIES achieves 93% of this and same-base WUDI 97%, without any training data at the merging step. However, the multi-task model underperforms substantially on GPTCloneBench (0.151 F1), while same-base TIES- merged models generalize far better (0.450–0.609 mean F1 across three seeds). Training on all domains simultaneously leads to over- fitting the combined distribution, whereas merging retains inde- pendently optimized specialist knowledge. Finding 2. Same-base merging is method-independent and consistently outperforms cross-base merging across all five task-vector methods. Same-base TIES reaches 93% of multi- task performance without any training data and generalizes 4× better to unseen GPT-generated clones. 01234567891011 Layer source selection UniXcoder-BCBUniXcoder-CLCDSA 01234567891011 Layer index 0.6 0.7 0.8 Combined F1 Combined F1 progression during greedy search Figure 2: Greedy layer selection for UniXcoder-BCB + UniXcoder-CLCDSA. RQ3. Architecture-Level Merging Table 5 compares architecture merging with parameter merging across three scenarios. The rela- tive effectiveness depends strongly on model compatibility (same- base vs. cross-base). Table 5: Architecture merging compared to parameter merg- ing. ConfigurationBCB CLCDSA F1 comb Same-tokenizer, different base CB+GCB (param.)0.8410.5660.703 CB+GCB (arch.)0.8560.6200.738 Same-base UX+UX (arch.)0.8420.7430.793 UX+UX (param. TIES)0.9000.8410.871 UX+UX (param. WUDI) 0.935 0.8810.908 Cross-tokenizer (with alignment) CB+GCB+UX (arch.)0.8560.6200.738 Architecture merging outperforms parameter merging for cross-base models. When merging CodeBERT and GraphCode- BERT (same tokenizer, different bases), greedy layer stitching (0.738) outperforms cross-base TIES (0.703) by 5%. The greedy search iden- tifies an interpretable pattern. CodeBERT layers are selected for A Unified Model for Cross-Domain Clone Detection via Model MergingASE ’26, October 12–16, 2026, Munich, Germany early positions (layers 0–4, 7) while GraphCodeBERT layers are retained for later positions (layers 5–6, 8–11). This suggests that CodeBERT’s early layers capture stronger token-level representa- tions, while GraphCodeBERT’s later layers leverage its data-flow pretraining for higher-level clone reasoning. For same-base models, parameter merging outperforms architecture merging. Same-base UniXcoder parameter merges (TIES at 0.871, WUDI at 0.908) substantially outperform same-base architecture merging (0.793). When task vectors are compatible, uniform parameter combination across all layers is more effective than layer-level selection, which forces an all-or-nothing choice at each layer position. Parameter merging instead allows smooth inter- polation across all parameters, enabling more effective integration of complementary knowledge. Cross-tokenizer alignment does not improve architecture merging. Despite training linear projections with alignment loss below 0.005 for early layers (0–6), the greedy search never selected aligned UniXcoder layers over CodeBERT or GraphCodeBERT al- ternatives. Alignment loss increases sharply for later layers (0.090 for layer 10, 0.167 for layer 11), indicating that the representations diverge too substantially for linear projection to bridge. The to- kenizer barrier may therefore reflect deeper differences in how models encode code semantics, not merely a vocabulary mismatch. Figure 2 visualizes the layer selection path for the same-base UniXcoder merge. Cross-language (CLCDSA) layers dominate early and middle positions (layers 0, 2–5, 7, 11), while same-language (BCB) layers are retained at positions 1, 6, 8–10. This pattern suggests that cross-language fine-tuning produces stronger low-level code representations that capture language-agnostic features, while same-language fine-tuning specializes later layers for within-language clone discrimination. The validation-set combined F1 increases steadily from 0.617 (single specialist baseline) to 0.815 during the greedy search, with the largest gains at layers 3–5 where cross-language layers are introduced. The final held-out test performance of the resulting composite model is 0.793 (Table 5). Finding 3. Architecture merging outperforms parameter merg- ing for cross-base models (+5%) but underperforms for same- base models. Layer stitching reveals that cross-language layers dominate early positions while same-language layers dominate late positions. Linear cross-tokenizer alignment is insufficient. RQ4. Generalization to GPT-Generated Clones Table 6 reports zero-shot GPTCloneBench [2] F1 in its final column. All models were evaluated without any training or exposure to GPT-generated code. Despite the substantial domain shift from human-written to AI-generated clones, the same-base TIES merge and the architec- ture merge outperform every individual encoder specialist. The multi-task model trained on all available data achieves only 0.151 F1, substantially worse than all individual specialists and merged models, indicating severe overfitting to the combined training dis- tribution. Two merges generalize markedly better than any individual en- coder. The same-base TIES merge of two CodeBERT specialists reaches the highest GPTCloneBench F1 at 0.609 across three seeds, a 35.3% improvement over the best individual encoder (CodeBERT, 0.450), and the architecture merge of CodeBERT and GraphCode- BERT reaches 0.528 (+17.3%). The same-base UniXcoder TIES merge is on par with the best encoder at 0.450. Comparison with zero-shot LLM baselines. We evaluate two instruction-tuned code LLMs on the same 10,000 GPTCloneBench pairs (Section 4). Qwen2.5-Coder-7B-Instruct achieves 0.454 F1 (pre- cision 0.482, recall 0.429), comparable to the best individual encoder specialist but below the strongest merged detectors. DeepSeek- Coder-6.7B-Instruct is markedly more conservative under the iden- tical prompt, predicting clone for only 510 of 10,000 pairs and reach- ing 0.120 F1 (precision 0.647, recall 0.066). Both LLMs fall below the same-base TIES merge of two CodeBERT specialists (0.609), which outperforms Qwen by 0.155 and DeepSeek by 0.489 F1 absolute. The cost gap is also large. Qwen inference required 628.9 seconds wall-clock for 10,000 pairs on three A100 GPUs, equivalent to 0.189 seconds per pair on a single-GPU basis, and DeepSeek is compara- ble. Encoder-based detectors process the same pairs in the order of milliseconds per pair on a single GPU. For repository-scale or CI- based clone detection workflows, a merged encoder detector is both more accurate and orders of magnitude cheaper than a zero-shot code LLM. WUDI and PCB show different generalization profiles. While WUDI improves over TIES on in-distribution benchmarks (Table 4), it consistently underperforms TIES on the OOD GPT- CloneBench across all three seeds for both base models (UX 0.248± 0.050, CB 0.412±0.059, vs. TIES 0.450 and 0.609). PCB falls between the two on OOD as well (UX 0.361, CB 0.567), consistent with its intermediate in-distribution profile. WUDI’s per-layer interference- minimization preserves each specialist’s decision surface precisely, which helps in-distribution but reduces robustness to AI-generated clones the specialists never saw; TIES’s softer sign-election gener- alizes better OOD. We therefore recommend same-base TIES rather than WUDI as the practical merging recipe (Section 1, contribution 4) when OOD robustness is a deployment concern. Table 6 and Table 7 consolidate all results across the three bench- marks. The geometric reasons behind the same-base advantage and the WUDI in-distribution / OOD trade-off are discussed in Section 6. Finding 4. Same-base TIES-merged and architecture-merged models generalize better to unseen GPT-generated clones than any individual encoder specialist, the multi-task baseline, and two zero-shot instruction-tuned code LLMs (up to +35.3% over the best individual encoder). WUDI, while stronger in- distribution, underperforms on this OOD benchmark, with PCB intermediate, revealing an in-distribution / OOD trade-off within the same-base regime that informs our practical recom- mendation of TIES. 6 Discussion Why Same-Base Merging Works. To explain why same-base merging succeeds while cross-base merg- ing provides only marginal improvement and high variance, we analyze the geometric properties of the corresponding task vectors. We compute the cosine similarity and sign agreement between task vectors from same-base models (UniXcoder-BCB and UniXcoder- CLCDSA) and cross-base models (UniXcoder-BCB and CodeBERT- BCB). ASE ’26, October 12–16, 2026, Munich, GermanyPalash R. Roy, Banani Roy, Kevin A. Schneider, and Chanchal K. Roy Table 6: Complete results across all three benchmarks. Three-seed mean± std for same-base TIES/WUDI/PCB and cross-base WUDI/PCB. CategoryMethodBCB F1 CLCDSA F1 F1 comb GPT F1 Individual CodeBERT-BCB0.8940.4640.6790.450 GraphCodeBERT-BCB0.8910.4950.6930.376 UniXcoder-BCB0.9400.2690.6050.390 UniXcoder-CLCDSA0.2590.9240.5920.410 Multi-taskCombined training (UX)0.9330.9220.9270.151 LLM (zero-shot) Qwen2.5-Coder-7B-Instruct—0.454 DeepSeek-Coder-6.7B-Instruct—0.120 Param. merge Cross-base TIES0.8410.5660.703— Cross-base WUDI.939±.001.372±.148.656±.074— Cross-base PCB.935±.004.542±.122.739±.060.529±.091 Same-base TIES (UX).890±.010.839±.027.865±.012.450±.042 Same-base TIES (CB).801±.018.746±.012.774±.014 .609±.049 Same-base WUDI (UX).935±.004.863±.052.899±.025.248±.050 Same-base WUDI (CB).883±.003.868±.023.876±.012.412±.059 Same-base PCB (UX).910±.030.854±.040.882±.009.361±.018 Same-base PCB (CB).847±.015.824±.035.836±.014.567±.003 Arch. merge CB + GCB0.8560.6200.7380.528 UX + UX0.8420.7430.7930.339 Table 7: Precision (P) and Recall (R) for key configurations. BCBCLCDSAGPT ModelPRPRPR UniX-BCB.942.937.563.177.505.318 UniX-CLCDSA.155.788.949.900.483.356 Multi-task.949.919.947.898.517.089 Same-base TIES.905.896.871.813.516.468 Qwen2.5-Coder-7B—.482.429 DeepSeek-Coder-6.7B—.647.066 Arch. (CB+GCB).820.895.509.793.507.551 Table 8: Task vector alignment analysis. MetricSame-Base Cross-Base Cosine similarity0.0320.001 Sign agreement59.5%50.4% Table 8 reveals a stark difference. Same-base task vectors exhibit substantially higher cosine similarity (0.032 vs. 0.001), indicating that fine-tuning from the same base produces parameter updates that, while task-specific, remain directionally aligned in param- eter space. Cross-base task vectors are nearly orthogonal. Both cosine similarities are small in absolute terms, but the 32×relative difference is meaningful because TIES merging operates on per- parameter sign agreement, not on global vector alignment. Even modest directional consistency enables productive sign election, as confirmed by the 59.5% vs. 50.4% sign agreement gap. The sign agreement is particularly relevant for TIES, which re- solves parameter conflicts by electing the majority sign direction. At 59.5% agreement, same-base task vectors provide a consistent signal for sign election, allowing TIES to identify and retain productive updates from both domains. At 50.4%, cross-base sign agreement is close to random, leaving TIES with no coherent signal to re- solve conflicts. This directly explains the empirical gap observed in Section 5, where cross-base TIES merging (F1 comb 0.703) barely improves over individual models, whereas same-base TIES merging achieves 0.865± 0.012 across three seeds. The geometric argument also explains the behavior of WUDI and PCB under the cross-base setting. WUDI’s per-layer objective minimizes the projection of each task vector’s residual onto its own subspace (Section 3.2.4). When task vectors reside in differ- ent parameter spaces, these subspaces themselves are not aligned, and the per-task projections that WUDI tries to preserve become inconsistent across tasks. Empirically, both cross-base WUDI and cross-base PCB underperform their same-base counterparts on com- bined F1 and show substantially wider CLCDSA variance across seeds (up to±0.148, Table 4), despite PCB optimizing an unrelated competition-balancing objective. The compatibility requirement therefore does not depend on TIES-specific mechanisms such as sign election, nor on WUDI’s interference minimization. It arises from the more fundamental requirement that task vectors reside in a shared parameter space, and it applies to any task-vector merging method that operates under that assumption. The multi-task model’s failure on GPTCloneBench (0.151 F1) provides further insight. Multi-task training optimizes a single set of parameters to jointly minimize loss across both BCB and CLCDSA data, producing a decision boundary tightly fitted to the combined training distribution. When encountering GPT-generated clones, which exhibit substantially different syntactic patterns, this boundary fails entirely. Model merging instead combines two in- dependently optimized specialists through arithmetic combination of their task vectors, preserving the representational diversity of A Unified Model for Cross-Domain Clone Detection via Model MergingASE ’26, October 12–16, 2026, Munich, Germany Table 9: Same-base merging validated on CodeBERT. Merge row is three-seed mean± std. ModelBCB CLCDSA F1 comb GPT CB-BCB0.8940.4640.6790.450 CB-CLCDSA0.0000.9240.4620.000 CB TIES merge.801±.018.746±.012.774±.014.609±.049 Table 10: Recall by clone type (approximated via token simi- larity) on BigCloneBench. Clone CategoryUX-BCB UX-CL TIES (UX) TIES (CB) Count Type-1/2 (≥0.9)1.0000.9481.0001.000193 Strong T3 (0.7–0.9)1.0000.5471.0001.00053 Moderate T3 (0.5–0.7)0.9940.6391.0001.000155 Weak T3/T4 (<0.5)0.9370.7880.8950.90056,419 Overall0.9370.7880.8960.90056,820 each specialist rather than collapsing it into a single jointly opti- mized representation. This appears to provide greater robustness to distribution shifts beyond the training domains. Validation Across Model Families. To validate that the same-base principle generalizes beyond UniX- coder, we fine-tune CodeBERT on CLCDSA data and merge with CodeBERT-BCB using TIES under identical settings. Table 9 confirms that same-base merging works for a second model family. CodeBERT-CLCDSA exhibits complete cross-domain collapse on BCB (0.000 F1), more severe than UniXcoder-CLCDSA (0.259 F1). The merged model nevertheless recovers to 0.801 / 0.746 mean F1 across three seeds, a 14% combined improvement over the best individual CodeBERT (0.679). The merged CodeBERT also achieves 0.609±0.049 F1 on GPTCloneBench, the highest zero-shot score across all models in our study. Prediction distributions reveal why the two CLCDSA specialists differ in cross-domain behavior. CodeBERT-CLCDSA assigns near- zero clone probability to all BCB pairs (mean 0.034), predicting every pair as non-clone with high confidence. UniXcoder-CLCDSA, by contrast, exhibits high uncertainty on BCB pairs (mean clone probability 0.603, std 0.245), over-predicting clones but capturing some true positives in the process. This difference likely reflects UniXcoder’s cross-modal AST-based pretraining, which produces more distributed representations that remain partially informative on out-of-domain inputs. Despite these contrasting failure modes, same-base TIES merging recovers cross-domain performance for both model families, confirming that the same-base principle is robust to the underlying model architecture. Clone-Type Sensitivity Analysis. To verify that merged models detect clones across all difficulty levels, not just easy syntactic clones, we analyze recall by clone similarity range on BigCloneBench. We use token-level Jaccard similarity as a proxy for clone type [52], binning positive pairs into four categories that approximate the standard clone taxonomy. Table 10 reveals two key findings. First, both merged models achieve perfect recall (1.000) on Type-1/2, Strong Type-3, and Mod- erate Type-3 clones, matching or exceeding the BCB specialist. Merging does not sacrifice detection of syntactically similar clones. Second, on the dominant and most challenging Weak Type-3/Type- 4 semantic clones, merged models achieve 0.895–0.900 recall. While 3431 2590 2919 839 250138 152088 (a) BigCloneBench (n=415,416) 4829 10972 1000 1758 1410 40337 50451 (b) CLCDSA (n=111,032) UniXcoder-BCBUniXcoder-CLCDSATIES Merge Figure 3: Venn diagram of correct predictions per region. Purple regions are samples correctly classified only by the merged model. this is slightly below the BCB specialist (0.937), it represents a substantial improvement over the cross-language specialist (0.788), which struggles particularly on higher-similarity clones (0.547 recall on Strong Type-3). The merged model recovers this performance entirely, demonstrating that it integrates complementary detection capabilities across all clone types rather than specializing in only the dominant semantic category. Complementarity Analysis. To understand whether merging merely interpolates between specialists or captures genuinely complementary knowledge, we analyze per-sample prediction overlap between UniXcoder-BCB, UniXcoder-CLCDSA, and the same-base TIES merge on both test sets (Figure 3). The analysis reveals three key observations. First, the merged model correctly classifies 839 BCB samples and 1,758 CLCDSA samples that neither individual specialist could handle. These emer- gent predictions arise from the combination of complementary task vectors, not from either specialist alone. Second, Cohen’s Kappa be- tween the two specialists is near zero (휅=0.038 on BCB,휅=0.045 on CLCDSA), confirming that they learn fundamentally different decision boundaries. The TIES merge achieves high agreement with each specialist on its home domain (휅=0.915 with UniX-BCB on BCB,휅=0.726 with UniX-CLCDSA on CLCDSA), demonstrating that merging successfully inherits both boundaries into a single model. Third, all differences between the merged model and in- dividual specialists are statistically significant (McNemar’s test, 휒 2 ≥2,413,푝<0.001 for all comparisons), confirming that the observed improvements are not attributable to chance. A simple ensemble (averaging softmax outputs) cannot produce these emergent predictions, since if both specialists predict incor- rectly their average does as well. The 839 and 1,758 emergent sam- ples therefore demonstrate that merging creates genuinely new decision boundaries rather than interpolating existing ones. Ensem- bles also incur 2×inference cost compared to the merged model, which has identical architecture and latency to a single specialist. Practical Merging Recipe. Our findings suggest a concrete recipe for SE teams seeking cross- domain clone detectors. The recipe assumes same-base specialists are already available and joint retraining is impractical; multi-task training remains stronger when all data is jointly accessible. (1) Select a base model. Choose a single pre-trained code model (e.g., UniXcoder) as the shared base for all domains. (2) Fine-tune per domain. Create one fine-tuned copy per tar- get domain (e.g., one for same-language, one for cross-language). ASE ’26, October 12–16, 2026, Munich, GermanyPalash R. Roy, Banani Roy, Kevin A. Schneider, and Chanchal K. Roy Standard fine-tuning suffices and no special training procedure is required. (3) Merge with TIES. Compute task vectors for each specialist and merge using TIES with equal weights (휆 푘 =1/퐾) and a trim percentile of 20. This step requires no additional training data and completes in under 5 minutes on CPU. We recommend TIES over WUDI for this recipe because, although WUDI achieves higher in-distribution combined F1, TIES generalizes substantially bet- ter to out-of-distribution clone types such as AI-generated clones (Section 5). (4) Add new domains incrementally. When a new clone type emerges (e.g., AI-generated clones), fine-tune another copy of the same base model on the new domain and re-merge all specialists. No previous training data is needed. This recipe decouples domain specialization from model deploy- ment, allowing each domain to be handled independently while integration is performed post hoc through merging. Generalizability Beyond Clone Detection. The same-base merging principle likely extends to other SE tasks where domain specialization creates OOD challenges, such as vul- nerability detection across different vulnerability types or code summarization across programming languages. Because our cross- base WUDI and PCB results indicate the compatibility requirement is task-vector geometric rather than method-specific (Section 6), same-base merging should transfer to any task-vector method with compatible specialists. In practice, most organizations standardize on a single base model, making this constraint readily satisfiable. 7 Related Work Single-Language Clone Detection. Code clone detection has been studied for over two decades [6,11,25,38,42,43,46,51,52]. Early methods used token sequences [29], abstract syntax trees [7, 27,44], program dependency graphs [39], and structural features for Type-1 through Type-3 clones. Deep learning then introduced learned representations [56,58,59,66], and a distinct line targets the harder Type-4 (semantic) clones, where fragments are function- ally equivalent but syntactically different, using learned functional similarity [69] and semantic token or graph features [61], evaluated on semantic benchmarks such as SemanticCloneBench [1]. More re- cent work advances same-language detection through diverse code representations [57], token-based classifiers [15], and deep subtree interaction [62]. Pre-trained code models such as CodeBERT [16], GraphCodeBERT [19], and UniXcoder [18] achieve state-of-the- art results on BigCloneBench [34,52]. These methods improve accuracy within their own benchmarks but remain tied to a single language. We instead combine such strong single-domain detectors into a unified cross-domain model without retraining them. Cross-Language Clone Detection. For clones across languages, CLCDSA [37] uses syntactic features and API documentation, cross- language AST learning [41] operates over tree representations, and C4 [53] applies contrastive learning over parallel multilingual data. Li et al. [33] extend this to the zero-shot setting through contrastive learning and cycle consistency. Each of these targets one generalization direction and requires retraining with a modified objective. We instead unify specialist detectors across domains through post-hoc merging, with no retraining and no access to training data at the merging step. LLM-Based Clone Detection. A growing body of work studies LLMs for clone detection [4,24,26,32,67], generation [47], and anal- ysis [3], including the construction of LLM-driven benchmarks [2] and detection via prompting [11]. Concurrent work by Kitsios et al. [30] confirmed that clone detectors suffer significant F1 drops on unseen functionalities and proposed contrastive learning as a miti- gation, which reinforces the motivation for a post-hoc combination mechanism. These approaches either fine-tune LLMs for detection or prompt them at inference time, and neither asks whether exist- ing specialist detectors can be unified without retraining. We take the complementary position that compact encoder-based special- ists can be merged post-hoc, and Section 5 compares against two zero-shot code LLMs directly. Mixture-of-experts and routing-based methods offer another route to multi-task capability but require architectural modifications and joint training [14], placing them outside the post-hoc, training-data-free setting we address. To our knowledge, no prior work has unified cross-domain clone detectors through post-hoc model merging without access to training data, which is the gap our work fills. Model Merging. Task arithmetic [23] showed that the difference between fine-tuned and pre-trained parameters (the task vector) can be arithmetically combined to edit model behavior. TIES [63] resolves sign conflicts through trimming and majority-sign elec- tion. DARE [65] introduces random dropping with rescaling for homologous models. WUDI [9] casts task-vector merging as a per- layer optimization that minimizes cross-task interference without training data or rescaling coefficients, and reports state-of-the-art results among task-vector methods on NLP and vision benchmarks. PCB [12] balances parameter competition within and across task vectors to resolve interference without training data. Beyond task- vector methods, Fisher merging [35] uses Fisher information to weight parameter importance, and RegMean [28] formulates merg- ing as a linear regression problem. Model soups [60] averages mul- tiple fine-tuned checkpoints to improve robustness in computer vision. HM3 [70] proposed hierarchical multi-objective merging using reinforcement learning, and merging has been applied to instruction-tuned language models [65], multi-lingual NLP [36], and domain-specific image classifiers [23,60]. These methods were developed and evaluated almost entirely on NLP and vision bench- marks, and none establishes whether the same task-vector compat- ibility holds for code models that differ in pre-training objectives and tokenizers. We close this gap by evaluating five of these task- vector methods, including the recent WUDI and PCB, directly on cross-domain code clone detection (Section 5), and by showing that the shared-base condition, rather than the choice of merging algorithm, is what determines success (Section 6). Multi-Task Learning and Ensembles. Multi-task learning (MTL) trains a single model on multiple objectives simultaneously, ex- ploiting commonalities between related tasks [10,68]. In software engineering, multi-task approaches have been applied to vulnera- bility detection with auxiliary objectives [13]. MTL requires joint access to all training data, full retraining when new tasks are added, and careful loss balancing [10]. Ensemble methods combine pre- dictions at inference time [17] but incur costs scaling linearly with model count. Merging differs from both. Unlike MTL, it operates A Unified Model for Cross-Domain Clone Detection via Model MergingASE ’26, October 12–16, 2026, Munich, Germany post-hoc on checkpoints without training data at the merging step, which suits settings where the original data is proprietary, dis- tributed, or expensive to recombine. Unlike ensembles, it produces a single model with no inference overhead. These are not only conceptual differences. We compare merging directly against a multi-task model trained on all data and against inference-time ensembling, and find that merging retains complementary special- ist knowledge that multi-task training overwrites, generalizing far better to unseen clone types, while matching a single specialist’s inference cost (Section 5, Section 6). 8 Threats to Validity Internal validity. A valid concern is that our greedy layer search may find a suboptimal merge. To address this, we also evaluate global parameter merging, which does not rely on greedy selec- tion, and observe the same same-base advantage. One might also ask whether the results are sensitive to random initialization. We mitigate this by testing every same-base configuration across three random seeds for TIES, WUDI, and PCB. All three methods consis- tently outperform individual models on in-distribution benchmarks for both UniXcoder and CodeBERT (Table 6), and although variance on GPTCloneBench is higher, every seed of every same-base TIES configuration exceeds the multi-task baseline. A further concern is that independently trained specialists may differ in learning rates, training epochs, batch sizes, preprocessing strategies, and random data orderings, whereas our specialists use matched configurations. In order to at least partially mitigate this threat, we fix these vari- ables deliberately, so that the merging behavior we observe reflects task-vector compatibility rather than training-quality differences. As partial evidence that the recipe tolerates specialist-level varia- tion, our two model families are trained independently and fail on out-of-domain inputs in contrasting ways, one with high prediction uncertainty and the other with confident misclassification, yet same- base merging recovers both (Section 6). Of course, further study with more heterogeneous specialists could help establish the limits of the same base recipe under mismatched training conditions. External validity. A natural question is whether our findings extend beyond RoBERTa-based encoder models, particularly to decoder-only LLMs. To address this empirically rather than by assertion, we report a direct comparison against two instruction- tuned code LLMs, Qwen2.5-Coder-7B and DeepSeek-Coder-6.7B, in Section 5. A related risk is over-generalizing from that comparison. We therefore bound it to two models under zero-shot prompting and to the deployment regime we target, namely encoder-based detectors with deterministic predictions at low fixed per-pair cost, and we do not claim that no LLM configuration under few-shot or chain-of-thought prompting could outperform merged detectors. We also note that DeepSeek’s low score partly reflects a strong non- clone bias under the one-word prompt rather than an inability to reason about the snippets. It is also possible that our core finding is specific to a single model. We mitigate this by validating the same- base principle on a second model family with contrasting failure modes (Section 6), since the principle depends on task-vector ge- ometry rather than model architecture or size. Finally, we evaluate only on Java and Java↔Python and acknowledge known concerns about BigCloneBench clone type labels [31], while noting that our focus is cross-domain generalization rather than clone-type-specific detection. Construct validity. One consideration is that our combined F1 weights both domains equally, which may not match practical prior- ities. We mitigate this by exposing the merging weights휆 푘 , which can be adjusted without retraining to emphasize either domain. Another risk is possible overlap between the training benchmarks (BCB and CLCDSA data), which could introduce data leakage and inflate performance. We address this by reasoning about the direc- tion of the bias. Any overlap would disproportionately benefit the multi-task baseline, which trains jointly on both datasets, whereas our merging approach never accesses the underlying training data, so any leakage would bias results against our method and leave our improvements conservative rather than overstated. One might also question whether the GPTCloneBench evaluation, which relies on 10,000 randomly sampled Java pairs, captures the full diversity of GPT-generated clones. We mitigate this by evaluating across three independent random seeds and observing consistent improvements over all baselines in every run. A final open question is how broadly the in-distribution versus out-of-distribution trade-off across TIES, WUDI, and PCB generalizes. 9 Conclusion We presented the first systematic empirical study of post-hoc model merging for cross-domain code clone detection. Across five task-vector methods, architecture-level layer stitching, and cross-tokenizer alignment on four code models and three benchmarks, one condition determines whether merging succeeds: specialists must share a pre-trained base. When they do, their task vectors align and combine into a single cross-domain detector that recovers most multi-task performance without training data and generalizes markedly better to unseen AI-generated clones. Different bases leave the vectors near-orthogonal and merging collapses into interference. Because this holds across every method we tested, it reflects task-vector geometry rather than any single algorithm, and yields a simple recipe: fine-tune one shared base per domain and merge with TIES. Several directions follow. The same-base principle should be tested on other SE tasks such as vulnerability detection, defect prediction, and code summarization, where classification-versus-generation architectures may expose method-dependent failure modes. The tokenizer barrier that blocked cross-family alignment invites nonlinear or learned projection approaches. And with sustainability an increasing concern in production deployment, merged detectors offer a low-carbon alternative to per-domain specialist stacks, with inference and storage savings scaling with the number of domains served. Acknowledgements This research is supported in part by the Natural Sciences and En- gineering Research Council of Canada (NSERC) Discovery Grants program, the Canada Foundation for Innovation’s John R. Evans Leaders Fund (CFI-JELF), and by the industry-stream NSERC CRE- ATE in Software Analytics Research (SOAR). Data Availability. Our replication package is archived at [5]. A companion tool paper [48] describes our web-based interface, available at https://mergese.usask.ca. ASE ’26, October 12–16, 2026, Munich, GermanyPalash R. Roy, Banani Roy, Kevin A. Schneider, and Chanchal K. Roy References [1]Farouq Al-Omari, Chanchal K. Roy, and Tonghao Chen. 2020.Semantic- CloneBench: A Semantic Code Clone Benchmark using Crowd-Source Knowledge. In Proceedings of the IEEE 14th International Workshop on Software Clones (IWSC). IEEE, 57–63. doi:10.1109/IWSC50091.2020.9047643 [2]Ajmain Inqiad Alam, Palash Ranjan Roy, Farouq Al-Omari, Chanchal K. Roy, Banani Roy, and Kevin A. Schneider. 2023. GPTCloneBench: A comprehensive benchmark of semantic clones and cross-language clones using GPT-3 model and SemanticCloneBench. In Proceedings of the IEEE International Conference on Soft- ware Maintenance and Evolution (ICSME). IEEE, 1–13. doi:10.1109/ICSME58846. 2023.00013 [3] Ajmain Inqiad Alam, Palash Ranjan Roy, Farouq Al-Omari, Chanchal K. Roy, Banani Roy, and Kevin A. Schneider. 2025. Are Classical Clone Detectors Good Enough for the AI Era?. In Proceedings of the 41st IEEE International Conference on Software Maintenance and Evolution (ICSME). IEEE, 295–307. doi:10.1109/ ICSME64153.2025.00035 [4] Afnan A. Almatrafi, Fathy Elbouraey Eassa, and Sanaa Abdullah Sharaf. 2025. Code Clone Detection Techniques Based on Large Language Models. IEEE Access 13 (2025), 46136–46146. doi:10.1109/ACCESS.2025.3549780 [5]Author Anonymous. 2026. Replication Package: A Unified Model for Cross- Domain Clone Detection via Model Merging. doi:10.5281/zenodo.21209512 [6] Lerina Aversano, Luigi Cerulo, and Massimiliano Di Penta. 2007. How Clones are Maintained: An Empirical Study. In Proceedings of the 11th European Conference on Software Maintenance and Reengineering, Software Evolution in Complex Software Intensive Systems (CSMR). IEEE Computer Society, 81–90. doi:10.1109/CSMR. 2007.26 [7] Ira D. Baxter, Andrew Yahin, Leonardo Mendonça de Moura, Marcelo Sant’Anna, and Lorraine Bier. 1998. Clone Detection Using Abstract Syntax Trees. In Pro- ceedings of the International Conference on Software Maintenance (ICSM). IEEE Computer Society, 368–377. doi:10.1109/ICSM.1998.738528 [8]David Berend, Xiaofei Xie, Lei Ma, Lingjun Zhou, Yang Liu, Chi Xu, and Jianjun Zhao. 2020.Cats Are Not Fish: Deep Learning Testing Calls for Out-Of-Distribution Awareness. In Proceedings of the 35th IEEE/ACM Interna- tional Conference on Automated Software Engineering (ASE). IEEE, 1041–1052. doi:10.1145/3324884.3416609 [9] Runxi Cheng, Feng Xiong, Yongxian Wei, Wanyun Zhu, and Chun Yuan. 2025. Whoever Started the interference Should End It: Guiding Data-Free Model Merg- ing via Task Vectors. In Proceedings of the 42nd International Conference on Ma- chine Learning (ICML) (Proceedings of Machine Learning Research, Vol. 267). PMLR / OpenReview.net, 10121–10143. https://proceedings.mlr.press/v267/cheng25h. html [10]Michael Crawshaw. 2020. Multi-Task Learning with Deep Neural Networks: A Survey. CoRR abs/2009.09796 (2020), 43 pages. doi:10.48550/arXiv.2009.09796 [11]Shihan Dou, Junjie Shan, Haoxiang Jia, Wenhao Deng, Zhiheng Xi, et al.2023. Towards Understanding the Capability of Large Language Models on Code Clone Detection: A Survey. CoRR abs/2308.01191 (2023), 13 pages. doi:10.48550/ARXIV. 2308.01191 [12] Guodong Du, Junlin Lee, Jing Li, Runhua Jiang, Yifei Guo, et al.2024. Parameter Competition Balancing for Model Merging. In Proceedings of the 37th Annual Conference on Neural Information Processing Systems (NeurIPS). 84746–84776. https://doi.org/10.52202/079017-2691 [13] Xiaohu Du, Ming Wen, Jiahao Zhu, Zifan Xie, et al.2024. Generalization- Enhanced Code Vulnerability Detection via Multi-Task Instruction Fine-Tuning. In Proceedings of the Findings of the Association for Computational Linguistics (ACL) (Findings of ACL, Vol. ACL 2024). Association for Computational Linguistics, 10507–10521. doi:10.18653/V1/2024.FINDINGS-ACL.625 [14]William Fedus, Barret Zoph, and Noam Shazeer. 2022. Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity. J. Mach. Learn. Res. 23 (2022), 120:1–120:39. https://jmlr.org/papers/v23/21-0998.html [15]Siyue Feng, Wenqi Suo, Yueming Wu, Deqing Zou, Yang Liu, and Hai Jin. 2024. Machine Learning is All You Need: A Simple Token-based Approach for Effective Code Clone Detection. In Proceedings of the 46th IEEE/ACM International Con- ference on Software Engineering (ICSE). ACM, 222:1–222:13. doi:10.1145/3597503. 3639114 [16]Zhangyin Feng, Daya Guo, Duyu Tang, Nan Duan, Xiaocheng Feng, Ming Gong, et al.2020. CodeBERT: A Pre-Trained Model for Programming and Natural Languages. In Proceedings of the Findings of the Association for Computational Linguistics (ACL) (Findings of ACL, Vol. EMNLP). Association for Computational Linguistics, 1536–1547. doi:10.18653/v1/2020.findings-emnlp.139 [17]M. A. Ganaie, Minghui Hu, Ashwani Kumar Malik, Muhammad Tanveer, and Ponnuthurai N. Suganthan. 2022. Ensemble deep learning: A review. Eng. Appl. Artif. Intell. 115 (2022), 105151. doi:10.1016/J.ENGAPPAI.2022.105151 [18]Daya Guo, Shuai Lu, Nan Duan, Yanlin Wang, Ming Zhou, and Jian Yin. 2022. UniXcoder: Unified Cross-Modal Pre-training for Code Representation. In Pro- ceedings of the 60th Annual Meeting of the Association for Computational Linguistics (ACL), Vol. 1: Long Papers. Association for Computational Linguistics, 7212–7225. doi:10.18653/V1/2022.ACL-LONG.499 [19]Daya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng, Duyu Tang, et al.2021. Graph- CodeBERT: Pre-training Code Representations with Data Flow. In Proceedings of the 9th International Conference on Learning Representations, ICLR. OpenRe- view.net, 18 pages. https://openreview.net/forum?id=jLoC4ez43PZ [20]Daya Guo, Qihao Zhu, Dejian Yang, Zhenda Xie, Kai Dong, et al.2024. DeepSeek- Coder: When the Large Language Model Meets Programming - The Rise of Code Intelligence. CoRR abs/2401.14196 (2024), 23 pages. doi:10.48550/ARXIV.2401. 14196 [21] Dan Hendrycks, Xiaoyuan Liu, Eric Wallace, Adam Dziedzic, Rishabh Krishnan, and Dawn Song. 2020. Pretrained Transformers Improve Out-of-Distribution Robustness. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics (ACL). Association for Computational Linguistics, 2744–2751. doi:10.18653/V1/2020.ACL-MAIN.244 [22]Binyuan Hui, Jian Yang, Zeyu Cui, Jiaxi Yang, Dayiheng Liu, Lei Zhang, et al. 2024. Qwen2.5-Coder Technical Report. CoRR abs/2409.12186 (2024), 32 pages. doi:10.48550/arXiv.2409.12186 [23]Gabriel Ilharco, Marco Túlio Ribeiro, Mitchell Wortsman, Ludwig Schmidt, Han- naneh Hajishirzi, and Ali Farhadi. 2023. Editing models with task arithmetic. In Proceedings of the 11th International Conference on Learning Representations. OpenReview.net, 31 pages. https://openreview.net/forum?id=6t0Kwf8-jrj [24]Ryutaro Inoue and Yoshiki Higo. 2024. Improving Accuracy of LLM-based Code Clone Detection U sing Functionally Equivalent Methods. In Proceedings of the 22nd IEEE/ACIS International Conference on Software Engineering Research, Man- agement and Applications (SERA). IEEE, 24–27. doi:10.1109/SERA61261.2024. 10685589 [25] Hadhemi Jebnoun, Md. Saidur Rahman, Foutse Khomh, and Biruk Asmare Muse. 2022. Clones in deep learning code: what, where, and why? Empir. Softw. Eng. 27, 4 (2022), 84. doi:10.1007/S10664-021-10099-X [26]Bowen Jiang, Mitchell Ruffolo, Aaditya Kulkarni, Teia Canini, and Eman Abdullah AlOmar. 2026. A systematic mapping study on the research landscape of LLM- based code clone detection. Inf. Softw. Technol. 195 (2026), 108096. doi:10.1016/J. INFSOF.2026.108096 [27]Lingxiao Jiang, Ghassan Misherghi, Zhendong Su, and Stéphane Glondu. 2007. DECKARD: Scalable and Accurate Tree-Based Detection of Code Clones. In Proceedings of the 29th International Conference on Software Engineering (ICSE). IEEE Computer Society, 96–105. doi:10.1109/ICSE.2007.30 [28] Xisen Jin, Xiang Ren, Daniel Preotiuc-Pietro, and Pengxiang Cheng. 2023. Data- less Knowledge Fusion by Merging Weights of Language Models. In Proceedings of the 11th International Conference on Learning Representations (ICLR). OpenRe- view.net, 19 pages. doi:10.48550/arXiv.2212.09849 [29] Toshihiro Kamiya, Shinji Kusumoto, and Katsuro Inoue. 2002. CCFinder: A Multilinguistic Token-Based Code Clone Detection System for Large Scale Source Code. IEEE Trans. Software Eng. 28, 7 (2002), 654–670. doi:10.1109/TSE.2002. 1019480 [30]Konstantinos Kitsios, Francesco Sovrano, Earl T. Barr, and Alberto Bacchelli. 2025. Detecting Semantic Clones of Unseen Functionality. In Proceedings of the 40th IEEE/ACM International Conference on Automated Software Engineering (ASE). IEEE, 1312–1324. doi:10.1109/ASE63991.2025.00112 [31] Jens Krinke and Chaiyong Ragkhitwetsagul. 2022. BigCloneBench Considered Harmful for Machine Learning. In Proceedings of the 16th IEEE International Workshop on Software Clones (IWSC). IEEE, 1–7. doi:10.1109/IWSC55060.2022. 00008 [32]Chunguang Li, Jessada Konpang, Adisorn Sirikham, and Yan Wang. 2025. Nu- anced Code Clone Detection Through LLM-Based Code Revision and AST Graph Modeling. IEEE Access 13 (2025), 191024–191036. doi:10.1109/ACCESS.2025. 3628856 [33]Jia Li, Chongyang Tao, Zhi Jin, Fang Liu, Jia Li, and Ge Li. 2023. ZC 3 : Zero-Shot Cross-Language Code Clone Detection. In Proceedings of the 38th IEEE/ACM International Conference on Automated Software Engineering (ASE). IEEE, 875–887. doi:10.1109/ASE56229.2023.00210 [34]Shuai Lu, Daya Guo, Shuo Ren, Junjie Huang, Alexey Svyatkovskiy, Am- brosio Blanco, et al.2021. CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generation. In Proceedings of the Neu- ral Information Processing Systems Track on Datasets and Benchmarks 1. 16 pages. https://datasets-benchmarks-proceedings.neurips.c/paper/2021/hash/ c16a5320fa475530d9583c34fd356ef5-Abstract-round1.html [35]Michael Matena and Colin Raffel. 2022. Merging Models with Fisher-Weighted Averaging. In Proceedings of the Advances in Neural Information Processing Sys- tems 35: Annual Conference on Neural Information Processing Systems (NeurIPS). 14 pages. doi:10.48550/arXiv.2111.09832 [36]Mohammed Muqeeth, Haokun Liu, Yufan Liu, and Colin Raffel. 2024. Learning to Route Among Specialized Experts for Zero-Shot Generalization. In Proceedings of the 41st International Conference on Machine Learning (ICML) (Proceedings of Machine Learning Research, Vol. 235). PMLR / OpenReview.net, 36829–36846. https://proceedings.mlr.press/v235/muqeeth24a.html A Unified Model for Cross-Domain Clone Detection via Model MergingASE ’26, October 12–16, 2026, Munich, Germany [37]Kawser Wazed Nafi, Tonny Shekha Kar, Banani Roy, Chanchal K. Roy, and Kevin A. Schneider. 2019. CLCDSA: Cross Language Code Clone Detection using Syn- tactical Features and API Documentation. In Proceedings of the 34th IEEE/ACM International Conference on Automated Software Engineering (ASE). IEEE, 1026– 1037. doi:10.1109/ASE.2019.00099 [38]Tasuku Nakagawa, Yoshiki Higo, and Shinji Kusumoto. 2021. NIL: large-scale detection of large-variance clones. In Proceedings of the 29th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering ESEC/FSE. ACM, 830–841. doi:10.1145/3468264.3468564 [39]Hoan Anh Nguyen, Tung Thanh Nguyen, Nam H. Pham, Jafar M. Al-Kofahi, and Tien N. Nguyen. 2009. Accurate and Efficient Structural Characteristic Feature Extraction for Clone Detection. In Proceedings of the Fundamental Approaches to Software Engineering, 12th International Conference (FASE) (Lecture Notes in Computer Science, Vol. 5503). Springer, 440–455. doi:10.1007/978-3-642-00593- 0_31 [40]Van Nguyen, Xingliang Yuan, Tingmin Wu, Surya Nepal, Marthie Grobler, and Carsten Rudolph. 2024. Deep Learning-Based Out-of-distribution Source Code Data Identification: How Far Have We Gone? CoRR abs/2404.05964 (2024), 16 pages. doi:10.48550/ARXIV.2404.05964 [41]Daniel Perez and Shigeru Chiba. 2019. Cross-language clone detection by learning over abstract syntax trees. In Proceedings of the 16th International Conference on Mining Software Repositories (MSR). IEEE / ACM, 518–528. doi:10.1109/MSR.2019. 00078 [42]Dhavleesh Rattan, Rajesh Kumar Bhatia, and Maninder Singh. 2013. Software clone detection: A systematic review. Inf. Softw. Technol. 55, 7 (2013), 1165–1199. doi:10.1016/J.INFSOF.2013.01.008 [43]Chanchal Kumar Roy and James R Cordy. 2007. A survey on software clone detection research. Queen’s School of computing TR 541, 115 (2007), 64–68. https: //research.cs.queensu.ca/TechReports/Reports/2007-541.pdf [44] Chanchal Kumar Roy and James R. Cordy. 2008. NICAD: Accurate Detection of Near-Miss Intentional Clones Using Flexible Pretty-Printing and Code Normal- ization. In Proceedings of the 16th IEEE International Conference on Program Com- prehension (ICPC). IEEE Computer Society, 172–181. doi:10.1109/ICPC.2008.41 [45]Palash Roy. 2025. Towards Just-In-Time, Inclusive Clone Refactoring. In Pro- ceedings of the 41st IEEE International Conference on Software Maintenance and Evolution (ICSME). IEEE, 884–886. doi:10.1109/ICSME64153.2025.00099 [46] Palash Ranjan Roy. 2024. An Exploratory Study on the Roles of LLMs in Code Similarity Detection and Generation. Master’s thesis. https://harvest.usask.ca/ items/83c21d22-b256-4f7-8c58-28bd6ecbdfc1 [47]Palash Ranjan Roy, Ajmain Inqiad Alam, Farouq Al-Omari, Banani Roy, Chan- chal K. Roy, and Kevin A. Schneider. 2023. Unveiling the Potential of Large Language Models in Generating Semantic and Cross-Language Clones. In Pro- ceedings of the 17th IEEE International Workshop on Software Clones (IWSC). IEEE, 22–28. doi:10.1109/IWSC60764.2023.00011 [48]Palash R. Roy, Banani Roy, Chanchal K. Roy, and Kevin Schneider. 2026. MergeSE: Post-Hoc Model Merging for Software Engineering Tasks Without Retraining. In Proceedings of the 41st IEEE/ACM International Conference on Automated Software Engineering (ASE). 4 pages. doi:10.1145/3832783.3834630 To Appear. [49] Baochen Sun and Kate Saenko. 2016. Deep CORAL: Correlation Alignment for Deep Domain Adaptation. In Proceedings of the European Conference on Computer Vision Workshops (ECCV Workshops) (Lecture Notes in Computer Science, Vol. 9915). 443–450. doi:10.1007/978-3-319-49409-8_35 [50]Jeffrey Svajlenko, Judith F. Islam, Iman Keivanloo, Chanchal Kumar Roy, and Mohammad Mamun Mia. 2014. Towards a Big Data Curated Benchmark of Inter- project Code Clones. In Proceedings of the 30th IEEE International Conference on Software Maintenance and Evolution (ICSME). IEEE Computer Society, 476–480. doi:10.1109/ICSME.2014.77 [51]Jeffrey Svajlenko and Chanchal Kumar Roy. 2017. Fast and flexible large- scale clone detection with CloneWorks. In Proceedings of the 39th Interna- tional Conference on Software Engineering (ICSE). IEEE Computer Society, 27–30. doi:10.1109/ICSE-C.2017.3 [52]Jeffrey Svajlenko and Chanchal K. Roy. 2021. BigCloneBench. In Code Clone Analysis. Springer Singapore, 93–105. doi:10.1007/978-981-16-1927-4_7 [53]Chenning Tao, Qi Zhan, Xing Hu, and Xin Xia. 2022. C4: contrastive cross- language code clone detection. In Proceedings of the 30th IEEE/ACM Interna- tional Conference on Program Comprehension (ICPC). ACM, 413–424. doi:10.1145/ 3524610.3527911 [54]Simon Vandenhende, Stamatios Georgoulis, Wouter Van Gansbeke, Marc Proes- mans, Dengxin Dai, and Luc Van Gool. 2022. Multi-Task Learning for Dense Prediction Tasks: A Survey. IEEE Trans. Pattern Anal. Mach. Intell. 44, 7 (2022), 3614–3633. doi:10.1109/TPAMI.2021.3054719 [55]Jindong Wang, Cuiling Lan, Chang Liu, Yidong Ouyang, et al.2023. Generalizing to Unseen Domains: A Survey on Domain Generalization. IEEE Trans. Knowl. Data Eng. 35, 8 (2023), 8052–8072. doi:10.1109/TKDE.2022.3178128 [56]Wenhan Wang, Ge Li, Bo Ma, Xin Xia, and Zhi Jin. 2020. Detecting Code Clones with Graph Neural Network and Flow-Augmented Abstract Syntax Tree. In Proceedings of the 27th IEEE International Conference on Software Analysis, Evolu- tion and Reengineering (SANER). IEEE, 261–271. doi:10.1109/SANER48275.2020. 9054857 [57] Yuekun Wang, Yuhang Ye, Yueming Wu, Weiwei Zhang, Yinxing Xue, and Yang Liu. 2023. Comparison and Evaluation of Clone Detection Techniques with Different Code Representations. In Proceedings of the 45th IEEE/ACM International Conference on Software Engineering (ICSE). IEEE, 332–344. doi:10.1109/ICSE48619. 2023.00039 [58]Huihui Wei and Ming Li. 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). ijcai.org, 3034–3040. doi:10.24963/IJCAI.2017/423 [59]Martin White, Michele Tufano, Christopher Vendome, and Denys Poshyvanyk. 2016. Deep learning code fragments for code clone detection. In Proceedings of the 31st IEEE/ACM International Conference on Automated Software Engineering (ASE). ACM, 87–98. doi:10.1145/2970276.2970326 [60]Mitchell Wortsman, Gabriel Ilharco, Samir Yitzhak Gadre, Rebecca Roelofs, Raphael Gontijo Lopes, et al.2022. Model soups: averaging weights of mul- tiple fine-tuned models improves accuracy without increasing inference time. In Proceedings of the International Conference on Machine Learning (ICML) (Pro- ceedings of Machine Learning Research, Vol. 162). PMLR, 23965–23998. https: //proceedings.mlr.press/v162/wortsman22a.html [61] Yueming Wu, Deqing Zou, Shihan Dou, Siru Yang, et al.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). IEEE, 821–833. doi:10.1145/3324884.3416562 [62] Zhiwei Xu, Shaohua Qiang, Dinghong Song, Min Zhou, et al.2024. DSFM: Enhancing Functional Code Clone Detection with Deep Subtree Interactions. In Proceedings of the 46th IEEE/ACM International Conference on Software Engineering (ICSE). ACM, 221:1–221:12. doi:10.1145/3597503.3639215 [63]Prateek Yadav, Derek Tam, Leshem Choshen, Colin A. Raffel, and Mohit Bansal. 2023. TIES-Merging: Resolving Interference When Merging Models. In Pro- ceedings of the Advances in Neural Information Processing Systems 36: An- nual Conference on Neural Information Processing Systems (NeurIPS). 23 pages. doi:10.52202/075280-0310 [64] Yanming Yang, Xing Hu, Zhipeng Gao, et al.2024. Federated Learning for Soft- ware Engineering: A Case Study of Code Clone Detection and Defect Prediction. IEEE Trans. Software Eng. 50, 2 (2024), 296–321. doi:10.1109/TSE.2023.3347898 [65]Le Yu, Bowen Yu, Haiyang Yu, Fei Huang, and Yongbin Li. 2024. Language Models are Super Mario: Absorbing Abilities from Homologous Models as a Free Lunch. In Proceedings of the 41st International Conference on Machine Learning (ICML) (Proceedings of Machine Learning Research, Vol. 235). PMLR / OpenReview.net, 57755–57775. https://proceedings.mlr.press/v235/yu24p.html [66]Jian Zhang, Xu Wang, Hongyu Zhang, Hailong Sun, Kaixuan Wang, and Xudong Liu. 2019. A novel neural source code representation based on abstract syntax tree. In Proceedings of the 41st International Conference on Software Engineering (ICSE). IEEE / ACM, 783–794. doi:10.1109/ICSE.2019.00086 [67] Zixian Zhang and Takfarinas Saber. 2025. Exploring the Boundaries Between LLM Code Clone Detection and Code Similarity Assessment on Human and AI-Generated Code. Big Data Cogn. Comput. 9, 2 (2025), 41. doi:10.3390/ BDCC9020041 [68]Zhihan Zhang, Wenhao Yu, Mengxia Yu, Zhichun Guo, and Meng Jiang. 2023. A Survey of Multi-task Learning in Natural Language Processing: Regarding Task Relatedness and Training Methods. In Proceedings of the 17th Conference of the European Chapter of the Association for Computational Linguistics (EACL). Association for Computational Linguistics, 943–956. doi:10.18653/V1/2023.EACL- MAIN.66 [69]Gang Zhao and Jeff Huang. 2018. DeepSim: deep learning code functional similar- ity. In Proceedings of the 2018 ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE). ACM, 141–151. doi:10.1145/3236024.3236068 [70]Yu Zhou, Xingyu Wu, Jibin Wu, Liang Feng, and KC Tan. 2025. HM3: Hierarchical Multi-Objective Model Merging for Pretrained Models. In Proceedings of the Advances in Neural Information Processing Systems 38: Annual Conference on Neural Information Processing Systems (NeurIPS). 35 pages. doi:10.48550/arXiv. 2409.18893 Received 2026-03-26; accepted 2026-06-18