mlsanityData to 7 Oct 2026

LSem2Vec: A Simple yet Effective Two-Stage Approach for Source Code Embedding

arXiv 2409.14644 ↗First posted 23 Sep 2024cs.SE cs.AIcited by 0

Not on the map. Why?

Abstract (arXiv)

The advent of large language models (LLMs) has significantly advanced artificial intelligence in software engineering, with source code embeddings playing a crucial role in tasks such as source code clone detection and source code clustering. However, existing methods for source code embedding, including those based on LLMs, often rely on costly supervised training or fine-tuning for domain adaptation. This paper proposes LSem2Vec (LLM-extracted code Semantics to Vector embedding), a simple yet effective two-stage approach to embedding source code by combining large language and sentence embedding models. Specifically, LSem2Vec leverages an LLM to extract the semantics of source code, and then uses a sentence embedding model to generate representation vectors. Compared with previous approaches, LSem2Vec eliminates the need for task-specific training or fine-tuning and effectively addresses erroneous information commonly found in LLM-generated outputs. To evaluate the performance of LSem2Vec, we conducted a series of experiments across three datasets spanning different programming languages, using various LLMs and sentence embedding models. The experimental results demonstrate the effectiveness and superiority of LSem2Vec over five state-of-the-art unsupervised methods. Our findings highlight the potential of LSem2Vec to advance the field of software engineering by providing robust and efficient solutions for source code embedding tasks.

Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 26 of its 58 references that are in the map. First posted on arXiv 23 Sep 2024.

Builds on

26 of 58 references.

References · 26

  1. 2020Language Models are Few-Shot Learnerscited by 32,199
  2. 2023GPT-4 Technical Reportcited by 18,132
  3. 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,049
  4. 2013Distributed Representations of Words and Phrases and their Compositionalitycited by 3,462
  5. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  6. 2024ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Toolscited by 1,096
  7. 2014Distributed Representations of Sentences and Documentscited by 677
  8. 2024LLM2Vec: Large Language Models Are Secretly Powerful Text Encoderscited by 396
  9. 2023CodeT5+: Open Code Large Language Models for Code Understanding and Generationcited by 327
  10. 2018code2vec: Learning Distributed Representations of Codecited by 249
  11. 2018code2seq: Generating Sequences from Structured Representations of Codecited by 177
  12. 2023LLM Lies: Hallucinations are not Bugs, but Features as Adversarial Examplescited by 177
14 more
  1. 2020Deep Learning based Vulnerability Detection: Are We There Yet?cited by 142
  2. 2016Learning Distributed Representations of Sentences from Unlabelled Datacited by 90
  3. 2020Retrieval-Augmented Generation for Code Summarization via Hybrid GNNcited by 89
  4. 2020Detecting Code Clones with Graph Neural Networkand Flow-Augmented Abstract Syntax Treecited by 68
  5. 2015SourcererCC: Scaling Code Clone Detection to Big Codecited by 40
  6. 2024Source Code Summarization in the Era of Large Language Modelscited by 30
  7. 2021Code Structure Guided Transformer for Source Code Summarizationcited by 29
  8. 2024Code Representation Learning At Scalecited by 26
  9. 2020InferCode: Self-Supervised Learning of Code Representations by Predicting Subtreescited by 23
  10. 2022CodeRetriever: Unimodal and Bimodal Contrastive Learning for Code Searchcited by 21
  11. 2021GraphSearchNet: Enhancing GNNs via Capturing Global Dependencies for Semantic Code Searchcited by 15
  12. 2024Investigating the Efficacy of Large Language Models for Code Clone Detectioncited by 7
  13. 2024Assured LLM-Based Software Engineeringcited by 5
  14. 2023TransformCode: A Contrastive Learning Framework for Code Embedding via Subtree Transformationcited by 4

Built on by

Not cited yet.