RECORD
Learning Semantic Vector Representations of Source Code via a Siamese Neural Network
Machine Learning · Submitted 26 Apr 2019
abstract compiled · 2026-09-23 · no language-model review
The authors' main claim Our model significantly outperforms a bag-of-tokens embedding, providing promising results for improving code embeddings that can be used in future software engineering tasks.
The compiled record
The paper's own sentences, arranged. Each label is drawn from a closed vocabulary; the number beside it is the probability the classifier gave that label. Numbers in the tables are the authors', checked by code. No sentence in this record was written by a model.
Open the compiled record
The abstract, sentence by sentence
The abundance of open-source code, coupled with the success of recent advances in deep learning for natural language processing, has given rise to a promising new application of machine learning to source code. In this work, we explore the use of a Siamese recurrent neural network model on Python source code to create vectors which capture the semantics of code. We evaluate the quality of embeddings by identifying which problem from a programming competition the code solves. Our model significantly outperforms a bag-of-tokens embedding, providing promising results for improving code embeddings that can be used in future software engineering tasks.
background contribution method result interpretation main claim
| # | sentence | role | the authors' own work | states the main conclusion | strength |
|---|---|---|---|---|---|
| s0 | The abundance of open-source code, coupled with the success of recent advances in deep learning for natural language processing, has given rise to a promising new application of machine learning to source code. | background 1.00 | 0.04 | 0.03 | asserted 0.85 |
| s1 | In this work, we explore the use of a Siamese recurrent neural network model on Python source code to create vectors which capture the semantics of code. | method 0.54 | 0.94 | 0.05 | asserted 0.83 |
| s2 | We evaluate the quality of embeddings by identifying which problem from a programming competition the code solves. | method 0.94 | 0.94 | 0.04 | asserted 0.95 |
| s3 | Our model significantly outperforms a bag-of-tokens embedding, providing promising results for improving code embeddings that can be used in future software engineering tasks. | result 0.82 | 0.95 | 0.88 | asserted 0.96 |
What was examined, and what was not
- arXiv listing abstract v1
- full text
- figures and tables
- references and citing sentences
- relations to other papers
- P abstract
- S sections
- T body sentences
- C citations
- R cross-paper relations
The paper
Original abstract
The abundance of open-source code, coupled with the success of recent advances in deep learning for natural language processing, has given rise to a promising new application of machine learning to source code. In this work, we explore the use of a Siamese recurrent neural network model on Python source code to create vectors which capture the semantics of code. We evaluate the quality of embeddings by identifying which problem from a programming competition the code solves. Our model significantly outperforms a bag-of-tokens embedding, providing promising results for improving code embeddings that can be used in future software engineering tasks.
Human review
How the literature uses it
What this paper does with the arXiv papers it cites
What it cites
Uses the method or tool of 3 papers
-
For pre-training, we collected all Python projects on public GitHub [ref] that had over 100 stars (using code from [ref] ) and extracted their functions as separate training samples, resulting in 1.3 million total samples.
Learning Python Code Suggestion with a Sparse Pointer Network · Data · 0.94
-
Because labeled training data is hard to obtain (requiring independent implementations), we pre-train the network by adding a decoder RNN after the encoding stage, turning it into a sequence-to-sequence model [ref] .
Sequence to Sequence Learning with Neural Networks · Pre-training · 0.95
-
Both the pre-training and final model were trained using the Adam [ref] weight-update algorithm using standard backpropagation techniques.
Adam: A Method for Stochastic Optimization · Pre-training · 1.00
Cites as background 5 papers
-
Alon et al. [ref] learn code vector embeddings by evaluating paths in the AST and evaluate the resulting vectors by predicting method names from code snippets.
code2vec: Learning Distributed Representations of Code · Related Work · 0.83
-
The work of Mout et al. [ref] encodes nodes of an AST using a weighted mixture of left and right weight matrices and children of that node.
Convolutional Neural Networks over Tree Structures for Programming Language Processing · Related Work · 0.84
-
More complex loss functions for Siamese neural networks have been developed, many of which enforce only a margin between classes [ref] , and some which use a triplet of (anchor, positive sample, negative sample) [ref] .
FaceNet: A Unified Embedding for Face Recognition and Clustering · Proposed Model · 0.98
Discussion
Know something about this paper? Leave a comment, or highlight any passage above to comment on it.