# Commit2Vec: Learning Distributed Representations of Code Changes

Source: [Commit2Vec: Learning Distributed Representations of Code Changes](<https://www.sota2.com/research/paper/68fa6b491e209131cea2d4b8>)

Collection index: [llms.txt](<https://www.sota2.com/research/llms.txt>)

Data updated: 2025-10-27T06:11:34.522Z

Authors: Roc\\\`io Cabrera Lozoya, Arnaud Baumann, Antonino Sabetta, Michele Bezzi

Published: 2019-11-18T13:23:57.000Z

## Abstract

Deep learning methods, which have found successful applications in fields like image classification and natural language processing, have recently been applied to source code analysis too, due to the enormous amount of freely available source code (e.g., from open-source software repositories).   In this work, we elaborate upon a state-of-the-art approach to the representation of source code that uses information about its syntactic structure, and we adapt it to represent source changes (i.e., commits). We use this representation to classify security-relevant commits.   Because our method uses transfer learning (that is, we train a network on a "pretext task" for which abundant labeled data is available, and then we use such network for the target task of commit classification, for which fewer labeled instances are available), we studied the impact of pre-training the network using two different pretext tasks versus a randomly initialized model.   Our results indicate that representations that leverage the structural information obtained through code syntax outperform token-based representations. Furthermore, the performance metrics obtained when pre-training on a loosely related pretext task with a very large dataset ($\>10^6$ samples) were surpassed when pretraining on a smaller dataset ($\>10^4$ samples) but for a pretext task that is more closely related to the target task.

## Recorded benchmark results

A research result applies to its stated dataset, split, metric and evaluation configuration. Compare like-for-like settings, preserve the metric's unit and direction, and distinguish paper-reported results from independent reproduction. The best result recorded here is not a claim of exhaustive, current global coverage.

## Original sources and implementation

[Original paper](<https://arxiv.org/abs/1911.07605>)

[PDF](<https://arxiv.org/pdf/1911.07605.pdf>)
