Code-Embed-v2: A Compact Multilingual Code Embedding Model Fine-Tuned from UniXcoder
We describe Code-Embed-v2, a 129.5M-parameter bi-encoder for code search, fine-tuned from UniXcoder-base on the CodeSearchNet train split in six programming languages (Python, JavaScript, Go, Java, Ruby, PHP). Training runs three one-epoch stages: SimCSE on functions, a multiple-negatives ranking loss on docstring-function pairs with in-batch negatives, and a Matryoshka variant of the same loss at six output sizes from 64 to 1536 dimensions. A two-layer projection head maps mean-pooled 768-dimensional backbone states to 1536-dimensional unit vectors. The maximum input length is 1,024 tokens. On the official MTEB evaluation the model scores 0.5475 on MTEB(Code, v1), 0.5343 on CoIR and 0.4362 on CoREB(v1), against 0.3657, 0.3356 and 0.3531 for UniXcoder-base run through the same harness. It improves on the base model on 16 of 18 tasks. Three of the evaluated tasks are built from CodeSearchNet and are therefore in-distribution. Retraining the same recipe on CoRNStack, with no CodeSearchNet data, matches these three scores (mean 0.7182 against 0.7242) but keeps less than a third of the gain on the other 15 tasks (0.3613 against 0.4677, base 0.3202). Quality at truncated dimensions is not measured and is left as an open item.
Authors
- Divakant Pandey (ORCID: https://orcid.org/0009-0002-3004-930X)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-25
- DOI
- https://doi.org/10.5281/zenodo.24527107
- Primary Topic
- Software Engineering Research
- Type
- preprint