English

CodeCSE: A Simple Multilingual Model for Code and Comment Sentence Embeddings

Software Engineering 2024-07-10 v1

Abstract

Pretrained language models for code token embeddings are used in code search, code clone detection, and other code-related tasks. Similarly, code function embeddings are useful in such tasks. However, there are no out-of-box models for function embeddings in the current literature. So, this paper proposes CodeCSE, a contrastive learning model that learns embeddings for functions and their descriptions in one space. We evaluated CodeCSE using code search. CodeCSE's multi-lingual zero-shot approach is as efficient as the models finetuned from GraphCodeBERT for specific languages. CodeCSE is open source at https://github.com/emu-se/codecse and the pretrained model is available at the HuggingFace public hub: https://huggingface.co/sjiang1/codecse

Keywords

Cite

@article{arxiv.2407.06360,
  title  = {CodeCSE: A Simple Multilingual Model for Code and Comment Sentence Embeddings},
  author = {Anthony Varkey and Siyuan Jiang and Weijing Huang},
  journal= {arXiv preprint arXiv:2407.06360},
  year   = {2024}
}
R2 v1 2026-06-28T17:33:33.071Z