code2vec: Learning Distributed Representations of Code
Not on the map. Why?
Abstract (arXiv)
We present a neural model for representing snippets of code as continuous distributed vectors ("code embeddings"). The main idea is to represent a code snippet as a single fixed-length textitcode vector, which can be used to predict semantic properties of the snippet. This is performed by decomposing code to a collection of paths in its abstract syntax tree, and learning the atomic representation of each path textitsimultaneously with learning how to aggregate a set of them. We demonstrate the effectiveness of our approach by using it to predict a method's name from the vector representation of its body. We evaluate our approach by training a model on a dataset of 14M methods. We show that code vectors trained on this dataset can predict method names from files that were completely unobserved during training. Furthermore, we show that our model learns useful method name vectors that capture semantic similarities, combinations, and analogies. Comparing previous techniques over the same data set, our approach obtains a relative improvement of over 75%, being the first to successfully predict method names based on a large, cross-project, corpus. Our trained model, visualizations and vector similarities are available as an interactive online demo at http://code2vec.org. The code, data, and trained models are available at https://github.com/tech-srl/code2vec.
Key facts. Cited by 249 papers in the map (data through 7 Oct 2026). First posted on arXiv 26 Mar 2018.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2021: 70; 2022: 59; 2023: 47; 2024: 30; 2025: 26; 2026: 17.
249 papers.
Sort:
By area:
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2021Unified Pre-training for Program Understanding and Generationcited by 361
- 2023CodeBERTScore: Evaluating Code Generation with Pretrained Models of Codecited by 101
- 2021CURE: Code-Aware Neural Machine Translation for Automatic Program Repaircited by 85
- 2021DOBF: A Deobfuscation Pre-Training Objective for Programming Languagescited by 68
- 2021Language-Agnostic Representation Learning of Source Code from Structure and Contextcited by 63
- 2021SynCoBERT: Syntax-Guided Multi-Modal Contrastive Pre-Training for Code Representationcited by 63
- 2022What Do They Capture? -- A Structural Analysis of Pre-Trained Language Models for Source Codecited by 50
- 2022PanGu-Coder: Program Synthesis with Function-Level Language Modelingcited by 47
- 2022An Empirical Study of Deep Learning Models for Vulnerability Detectioncited by 44
- 2021Multilingual training for Software Engineeringcited by 43
38 more
- 2021MLGO: a Machine Learning Guided Compiler Optimizations Frameworkcited by 40
- 2021TreeBERT: A Tree-Based Pre-Trained Model for Programming Languagecited by 40
- 2022Code Generation Tools (Almost) for Free? A Study of Few-Shot, Pre-Trained Language Models on Codecited by 39
- 2021What do pre-trained code models know about code?cited by 36
- 2023Natural Language Generation and Understanding of Big Code for AI-Assisted Programming: A Reviewcited by 32
- 2024LLMs are Also Effective Embedding Models: An In-depth Overviewcited by 32
- 2021Code Completion by Modeling Flattened Abstract Syntax Trees as Graphscited by 30
- 2023Distilled GPT for Source Code Summarizationcited by 30
- 2021How could Neural Networks understand Programs?cited by 26
- 2021On Multi-Modal Learning of Editing Source Codecited by 25
- 2021Project-Level Encoding for Neural Source Code Summarization of Subroutinescited by 24
- 2021Counterfactual Explanations for Models of Codecited by 24
- 2024Malla: Demystifying Real-world Large Language Model Integrated Malicious Servicescited by 24
- 2024HumanEvalComm: Benchmarking the Communication Competence of Code Generation for LLMs and LLM Agentcited by 24
- 2021A Survey on Machine Learning Techniques for Source Code Analysiscited by 23
- 2023InstructABSA: Instruction Learning for Aspect Based Sentiment Analysiscited by 22
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkitcited by 22
- 2021Understanding Neural Code Intelligence Through Program Simplificationcited by 20
- 2021Improving Code Summarization with Block-wise Abstract Syntax Tree Splittingcited by 19
- 2023Trustworthy and Synergistic Artificial Intelligence for Software Engineering: Vision and Roadmapscited by 19
- 2024Analyzing the Performance of Large Language Models on Code Summarizationcited by 19
- 2021Memorization and Generalization in Neural Code Intelligence Modelscited by 17
- 2022VUDENC: Vulnerability Detection with Deep Learning on a Natural Codebase for Pythoncited by 17
- 2023Semantic Compression With Large Language Modelscited by 17
- 2025cAST: Enhancing Code Retrieval-Augmented Generation with Structural Chunking via Abstract Syntax Treecited by 17
- 2022Code-DKT: A Code-based Knowledge Tracing Model for Programming Taskscited by 16
- 2023GrACE: Generation using Associated Code Editscited by 16
- 2024Stable Code Technical Reportcited by 16
- 2021GraphSearchNet: Enhancing GNNs via Capturing Global Dependencies for Semantic Code Searchcited by 15
- 2022On Distribution Shift in Learning-based Bug Detectorscited by 15
- 2022CODE-MVP: Learning to Represent Source Code from Multiple Views with Contrastive Pre-Trainingcited by 15
- 2022AEON: A Method for Automatic Evaluation of NLP Test Casescited by 15
- 2023CodeApex: A Bilingual Programming Evaluation Benchmark for Large Language Modelscited by 15
- 2023Learning to Parallelize with OpenMP by Augmented Heterogeneous AST Representationcited by 14
- 2023A systematic literature review on source code similarity measurement and clone detection: techniques, applications, and challengescited by 14
- 2023Efficient Avoidance of Vulnerabilities in Auto-completed Smart Contract Code Using Vulnerability-constrained Decodingcited by 14
- 2021Neural Program Generation Modulo Static Analysiscited by 13
- 2022Cross-Language Binary-Source Code Matching with Intermediate Representationscited by 13
50 most cited of 249 All 249 (JSON)
- 2026Externalizing Requirement-to-Repair Artifacts as Observable Traces for LLM-Based Program Repair14 Sep 2026
- 2026Astar: Learning to Propose Evolution Directions for Self-Evolving Industrial AI Systems27 Aug 2026
- 2026How Much Static Structure Do Code Agents Need? A Study of Deterministic Anchoring25 Jun 2026
- 2026Automated Recommendation of Programming Learning Content Using Pattern-based Knowledge Components9 Jun 2026
- 2026Towards the Readability of LLM-Generated Codes through Multitask Representation Engineering4 Jun 2026
- 2026The Invisible Lottery: How Subtle Cues Steer Algorithm Choice in LLM Code Generation2 Jun 2026
- 2026Efficient and Scalable Provenance Tracking for LLM-Generated Code Snippets27 May 2026
- 2026Bounded Path Context: A Controlled Study of Visible Path History in LLM-Based Knowledge Graph Question Answering26 May 2026
- 2026Specification-Based Code-Text-Code Reengineering for LLM-Mediated Software Evolution24 May 2026
- 2026Not All RAGs Are Created Equal: A Component-Wise Empirical Study for Software Engineering Tasks14 May 2026
- 2026SHM-Agents: A Generalist-Specialist Integrated Agent System for Structural Health Monitoring13 May 2026
- 2026MARGIN: Margin-Aware Regularized Geometry for Imbalanced Vulnerability Detection11 May 2026
38 more
- 2026Ensuring Reliability in Programming Knowledge Tracing: A Re-evaluation of Attention-augmented Models and Experimental Protocols6 May 2026
- 2026Think it, Run it: Autonomous ML pipeline generation via self-healing multi-agent AI29 Apr 2026
- 2026CODESTRUCT: Code Agents over Structured Action Spaces7 Apr 2026
- 2026GoCoMA: Hyperbolic Multimodal Representation Fusion for Large Language Model-Generated Code Attribution24 Mar 2026
- 2026Complexity-based code embeddings1 Jan 2026
- 2025From Illusion to Insight: Change-Aware File-Level Software Defect Prediction Using Agentic AI29 Dec 2025
- 2025Bridging Code Graphs and Large Language Models for Better Code Understanding8 Dec 2025
- 2025Auto-SPT: Automating Semantic Preserving Transformations for Code5 Dec 2025
- 2025Selecting and Combining Large Language Models for Scalable Code Clone Detection17 Oct 2025
- 2025Beyond Function-Level Search: Repository-Aware Dual-Encoder Code Retrieval with Adversarial Verification16 Oct 2025
- 2025Signature in Code Backdoor Detection, how far are we?15 Oct 2025
- 2025Enhancing Neural Code Representation with Additional Context14 Oct 2025
- 2025RANGER -- Repository-Level Agent for Graph-Enhanced Retrieval27 Sep 2025
- 2025Functional Consistency of LLM Code Embeddings: A Self-Evolving Data Synthesis Framework for Benchmarking27 Aug 2025
- 2025Detecting Struggling Student Programmers using Proficiency Taxonomies24 Aug 2025
- 2025Call Me Maybe: Enhancing JavaScript Call Graph Construction using Graph Neural Networks22 Jun 2025
- 2025I Know Which LLM Wrote Your Code Last Summer: LLM generated Code Stylometry for Authorship Attribution18 Jun 2025
- 2025cAST: Enhancing Code Retrieval-Augmented Generation with Structural Chunking via Abstract Syntax Tree18 Jun 2025
- 2025Today's Cat Is Tomorrow's Dog: Accounting for Time-Based Changes in the Labels of ML Vulnerability Detection Approaches13 Jun 2025
- 2025Denoising Programming Knowledge Tracing with a Code Graph-based Tuning Adaptor7 Jun 2025
- 2025Contamination Means Overestimation? A Fine-Grained Empirical Study in Code Intelligence3 Jun 2025
- 2025A Benchmark Dataset for Graph Regression with Homogeneous and Multi-Relational Variants29 May 2025
- 2025Automated Identification of Logical Errors in Programs: Advancing Scalable Analysis of Student Misconceptions16 May 2025
- 2025Semantic-Preserving Transformations as Mutation Operators: A Study on Their Effectiveness in Defect Detection30 Mar 2025
- 2025Post-Incorporating Code Structural Knowledge into Pretrained Models via ICL for Code Translation28 Mar 2025
- 2025Neural-Guided Equation Discovery21 Mar 2025
- 2025Aligning Crowd-sourced Human Feedback for Reinforcement Learning on Code Generation by Large Language Models19 Mar 2025
- 2025CODESYNC: Synchronizing Large Language Models with Dynamic Code Evolution at Scale23 Feb 2025
- 2025Poisoned Source Code Detection in Code Models19 Feb 2025
- 2025Prompt-Based Cost-Effective Evaluation and Operation of ChatGPT as a Computer Programming Teaching Assistant24 Jan 2025
- 2025Deep Learning-Based Identification of Inconsistent Method Names: How Far Are We?22 Jan 2025
- 2024LLMs are Also Effective Embedding Models: An In-depth Overview17 Dec 2024
- 2024Leveraging Large Language Models for Code Translation and Software Development in Scientific Computing31 Oct 2024
- 2024Just-In-Time Software Defect Prediction via Bi-modal Change Representation Learning15 Oct 2024
- 2024Do Current Language Models Support Code Intelligence for R Programming Language?10 Oct 2024
- 2024Test Case-Informed Knowledge Tracing for Open-ended Coding Tasks28 Sep 2024
- 2024LSem2Vec: A Simple yet Effective Two-Stage Approach for Source Code Embedding23 Sep 2024
- 2024BLens: Contrastive Captioning of Binary Functions using Ensemble Embedding12 Sep 2024
50 newest of 249 All 249 (JSON)
- 2024HumanEvalComm: Benchmarking the Communication Competence of Code Generation for LLMs and LLM Agentcited by 24
- 2026CODESTRUCT: Code Agents over Structured Action Spacescited by 4
- 2025Aligning Crowd-sourced Human Feedback for Reinforcement Learning on Code Generation by Large Language Modelscited by 3
- 2026How Much Static Structure Do Code Agents Need? A Study of Deterministic Anchoringcited by 1
- 2025From Illusion to Insight: Change-Aware File-Level Software Defect Prediction Using Agentic AIcited by 0
- 2026How Much Static Structure Do Code Agents Need? A Study of Deterministic Anchoring25 Jun 2026
- 2026CODESTRUCT: Code Agents over Structured Action Spaces7 Apr 2026
- 2025From Illusion to Insight: Change-Aware File-Level Software Defect Prediction Using Agentic AI29 Dec 2025
- 2025Aligning Crowd-sourced Human Feedback for Reinforcement Learning on Code Generation by Large Language Models19 Mar 2025
- 2024HumanEvalComm: Benchmarking the Communication Competence of Code Generation for LLMs and LLM Agent31 May 2024
- 2025cAST: Enhancing Code Retrieval-Augmented Generation with Structural Chunking via Abstract Syntax Treecited by 17
- 2024CodeGRAG: Bridging the Gap between Natural Language and Programming Language via Graphical Retrieval Augmented Generationcited by 4
- 2026Not All RAGs Are Created Equal: A Component-Wise Empirical Study for Software Engineering Taskscited by 1
- 2026Not All RAGs Are Created Equal: A Component-Wise Empirical Study for Software Engineering Tasks14 May 2026
- 2025cAST: Enhancing Code Retrieval-Augmented Generation with Structural Chunking via Abstract Syntax Tree18 Jun 2025
- 2024CodeGRAG: Bridging the Gap between Natural Language and Programming Language via Graphical Retrieval Augmented Generation3 May 2024
- 2024Stable Code Technical Reportcited by 16
- 2026Think it, Run it: Autonomous ML pipeline generation via self-healing multi-agent AIcited by 0
- 2026Think it, Run it: Autonomous ML pipeline generation via self-healing multi-agent AI29 Apr 2026
- 2024Stable Code Technical Report1 Apr 2024
- 2023Backdooring Neural Code Searchcited by 13
- 2025Signature in Code Backdoor Detection, how far are we?cited by 0
- 2025Signature in Code Backdoor Detection, how far are we?15 Oct 2025
- 2023Backdooring Neural Code Search27 May 2023
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2021Unified Pre-training for Program Understanding and Generationcited by 361
- 2023CodeBERTScore: Evaluating Code Generation with Pretrained Models of Codecited by 101
- 2021CURE: Code-Aware Neural Machine Translation for Automatic Program Repaircited by 85
- 2021DOBF: A Deobfuscation Pre-Training Objective for Programming Languagescited by 68
- 2021Language-Agnostic Representation Learning of Source Code from Structure and Contextcited by 63
- 2021SynCoBERT: Syntax-Guided Multi-Modal Contrastive Pre-Training for Code Representationcited by 63
- 2022What Do They Capture? -- A Structural Analysis of Pre-Trained Language Models for Source Codecited by 50
- 2022PanGu-Coder: Program Synthesis with Function-Level Language Modelingcited by 47
- 2022An Empirical Study of Deep Learning Models for Vulnerability Detectioncited by 44
- 2021Multilingual training for Software Engineeringcited by 43
12 most cited of 233 All 233 (JSON)
- 2026Externalizing Requirement-to-Repair Artifacts as Observable Traces for LLM-Based Program Repair14 Sep 2026
- 2026Automated Recommendation of Programming Learning Content Using Pattern-based Knowledge Components9 Jun 2026
- 2026Towards the Readability of LLM-Generated Codes through Multitask Representation Engineering4 Jun 2026
- 2026The Invisible Lottery: How Subtle Cues Steer Algorithm Choice in LLM Code Generation2 Jun 2026
- 2026Efficient and Scalable Provenance Tracking for LLM-Generated Code Snippets27 May 2026
- 2026Bounded Path Context: A Controlled Study of Visible Path History in LLM-Based Knowledge Graph Question Answering26 May 2026
- 2026Specification-Based Code-Text-Code Reengineering for LLM-Mediated Software Evolution24 May 2026
- 2026SHM-Agents: A Generalist-Specialist Integrated Agent System for Structural Health Monitoring13 May 2026
- 2026MARGIN: Margin-Aware Regularized Geometry for Imbalanced Vulnerability Detection11 May 2026
- 2026Ensuring Reliability in Programming Knowledge Tracing: A Re-evaluation of Attention-augmented Models and Experimental Protocols6 May 2026
- 2026GoCoMA: Hyperbolic Multimodal Representation Fusion for Large Language Model-Generated Code Attribution24 Mar 2026
- 2026Complexity-based code embeddings1 Jan 2026
12 newest of 233 All 233 (JSON)