# Repo2Vec: A Comprehensive Embedding Approach for Determining Repository Similarity

arXiv: https://arxiv.org/abs/2107.05112 · HTML: https://mlsanity.com/paper/2107.05112/

## Key facts

- Cited by 2 papers in the map (data through 14 Oct 2026).
- Builds on 17 of its 40 references that are in the map.
- First posted on arXiv 11 Jul 2021.

## Builds on (most cited first, 17 of 17)

- [Distributed Representations of Words and Phrases and their Compositionality](https://mlsanity.com/paper/1310.4546/) (2013)
- [Deep contextualized word representations](https://mlsanity.com/paper/1802.05365/) (2018)
- [node2vec: Scalable Feature Learning for Networks](https://mlsanity.com/paper/1607.00653/) (2016)
- [Distributed Representations of Sentences and Documents](https://mlsanity.com/paper/1405.4053/) (2014)
- [code2vec: Learning Distributed Representations of Code](https://mlsanity.com/paper/1803.09473/) (2018)
- [graph2vec: Learning Distributed Representations of Graphs](https://mlsanity.com/paper/1707.05005/) (2017)
- [CC2Vec: Distributed Representations of Code Changes](https://mlsanity.com/paper/2003.05620/) (2020)
- [HiGitClass: Keyword-Driven Hierarchical Classification of GitHub Repositories](https://mlsanity.com/paper/1910.07115/) (2019)
- [SourceFinder: Finding Malware Source-Code from Publicly Available Repositories](https://mlsanity.com/paper/2005.14311/) (2020)
- [Embedding Java Classes with code2vec: Improvements from Variable Obfuscation](https://mlsanity.com/paper/2004.02942/) (2020)
- [Visual Word2Vec (vis-w2v): Learning Visually Grounded Word Embeddings Using Abstract Scenes](https://mlsanity.com/paper/1511.07067/) (2015)
- [Tweet2Vec: Character-Based Distributed Representations for Social Media](https://mlsanity.com/paper/1605.03481/) (2016)
- [Import2vec - Learning Embeddings for Software Libraries](https://mlsanity.com/paper/1904.03990/) (2019)
- [Topic2Vec: Learning Distributed Representations of Topics](https://mlsanity.com/paper/1506.08422/) (2015)
- [A Dataset for GitHub Repository Deduplication: Extended Description](https://mlsanity.com/paper/2002.02314/) (2020)
- [A Complete Set of Related Git Repositories Identified via Community Detection Approaches Based on Shared Commits](https://mlsanity.com/paper/2002.02707/) (2020)
- [REST: A Thread Embedding Approach for Identifying and Classifying User-specified Information in Security Forums](https://mlsanity.com/paper/2001.02660/) (2020)

## Built on by (most cited first, 2 of 2)

- [DRAGON: Robust Classification for Very Large Collections of Software Repositories](https://mlsanity.com/paper/2602.09071/) (2026)
- [Topical: Learning Repository Embeddings from Source Code using Attention](https://mlsanity.com/paper/2208.09495/) (2022)

## Abstract (arXiv)

How can we identify similar repositories and clusters among a large online archive, such as GitHub? Determiningrepository similarity is an essential building block in studying the dynamics and the evolution of such software ecosystems. The key challenge is to determine the right representation for the diverse repository features in a way that: (a) it captures all aspects of the available information, and (b) it is readily usable by MLalgorithms. We propose Repo2Vec, a comprehensive embedding approach to represent a repository as a distributed vector by combining features from three types of information sources. As our key novelty, we consider three types of information: (a)metadata, (b) the structure of the repository, and (c) the source code. We also introduce a series of embedding approaches to represent and combine these information types into a single embedding. We evaluate our method with two real datasets from GitHub for a combined 1013 repositories. First, we show that our method outperforms previous methods in terms of precision (93%vs 78%), with nearly twice as many Strongly Similar repositories and 30% fewer False Positives. Second, we show how Repo2Vecprovides a solid basis for: (a) distinguishing between malware and benign repositories, and (b) identifying a meaningful hierarchical clustering. For example, we achieve 98% precision and 96%recall in distinguishing malware and benign repositories. Overall, our work is a fundamental building block for enabling many repository analysis functions such as repository categorization by target platform or intention, detecting code-reuse and clones, and identifying lineage and evolution.
