UNICS: Multilingual Code Search via Unified Pseudocode and Contrastive Transfer Learning
arXiv:2606.27747 · doi:10.1145/3797067
Abstract
While pre-trained models have achieved remarkable success in code search, their multilingual capabilities remain a major hurdle, plagued by data imbalance, cross-lingual semantic interference, and the loss of critical information from existing unified representations like Abstract Syntax Trees (ASTs) or Intermediate Representations (IRs). Furthermore, conventional contrastive learning strategies often rely on simplistic hard negative sampling while overlooking the potential of mining hard positives to learn code's intrinsic semantic invariance. To address these challenges, we introduce UNICS, a framework for multilingual code search built on a two-stage training strategy. In the first stage, UNICS is pre-trained on a novel dataset we constructed, which uses pseudo-code as a unified representation to learn a cross-lingual, algorithm-level logic that preserves full semantic fidelity. The second stage employs a multi-task transfer learning strategy that adapts this general knowledge to specific languages by decomposing code into semantic slices (e.g., API calls, function bodies) and incorporating tasks for hard positive mining and cross-lingual dynamic hard negative sampling. Experimental results demonstrate that UNICS achieves state-of-the-art performance across multiple multilingual and cross-lingual benchmarks, showcasing superior generalization and performance balance, especially in zero-shot transfer tasks to low-resource languages.
Accepted to the ACM International Conference on the Foundations of Software Engineering (FSE 2026). 24.pages
References in corpus (19)
- Generalized Cross Entropy Loss for Training Deep Neural Networks with Noisy Labels
- CodeSearchNet Challenge: Evaluating the State of Semantic Code Search
- A Theoretical Analysis of NDCG Type Ranking Measures
- GraphCodeBERT: Pre-training Code Representations with Data Flow
- Unsupervised Dense Information Retrieval with Contrastive Learning
- Text and Code Embeddings by Contrastive Pre-Training
- Measuring Coding Challenge Competence With APPS
- Self-Supervised Contrastive Learning for Code Retrieval and Summarization via Semantic-Preserving Transformations
- SynCoBERT: Syntax-Guided Multi-Modal Contrastive Pre-Training for Code Representation
- M3-Embedding: Multi-Linguality, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillation
- Simplify and Robustify Negative Sampling for Implicit Collaborative Filtering
- ProGCL: Rethinking Hard Negative Mining in Graph Contrastive Learning
- Cross-Domain Deep Code Search with Meta Learning
- XLCoST: A Benchmark Dataset for Cross-lingual Code Intelligence
- CoCoSoDa: Effective Contrastive Learning for Code Search
- CERT: Contrastive Self-supervised Learning for Language Understanding
- CodeRetriever: Unimodal and Bimodal Contrastive Learning for Code Search
- OpenCodeInterpreter: Integrating Code Generation with Execution and Refinement
- CodeTransOcean: A Comprehensive Multilingual Benchmark for Code Translation