IP Library › Granted Patent US 11,392,370
Granted Patent B2
US 11,392,370 · App. 17/080,520 · Granted Jul 19, 2022

Distributed vectorized representations of source code commits

Inventors: Rocio Cabrera Lozoya (Antibes, FR); Antonino Sabetta (Mouans Sartoux, IT); Michele Bezzi (Le Haut Sartoux Valbonne, IT); Arnaud Baumann (Juan les pins, FR)
Assignee: SAP SE
G06F8/71G06F8/40G06F16/258G06N20/00
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,392,370
App. No.
17/080,520
Granted
Jul 19, 2022
Kind
B2
Abstract

Distributed vector representations of source code commits, are generated to become part of a data corpus for machine learning (ML) for analyzing source code. The code commit is received, and time information is referenced to split the source code into pre-change source code and post-change source code. The pre-change source code is converted into a first code representation (e.g., based on a graph model), and the post-change source code into a second code representation. A first particle is generated from the first code representation, and a second particle is generated from the second code representation. The first particle and the second particle are compared to create a delta. The delta is transformed into a first commit vector by referencing an embedding matrix to numerically encode the first particle and the second particle. Following classification, the commit vector is stored in a data corpus for performing ML analysis upon source code.

Claims (74)

1. A method comprising:

receiving a source code commit comprising source code, time information, and a label associated based upon a machine learning target task regarding a security vulnerability in the source code, a fix to a bug in the source code, or a new feature in the source code;

referencing the time information to split the source code into pre-change source code and post-change source code;

converting the pre-change source code into a first code representation;

converting the post-change source code into a second code representation;

generating a plurality of first particles from the first code representation, a particle being a smallest element in a given form of code representation;

generating a plurality of second particles from the second code representation;

comparing the plurality of first particles and the plurality of second particles to create a delta;

transforming the delta into a first commit vector by referencing an embedding matrix to numerically encode particles of the delta;

classifying the first commit vector according to the machine learning target task; and

storing the first classified commit vector in a non-transitory computer readable storage medium.

2. A method as in claim 1 wherein the first code representation and the second code representation use text tokens.

3. A method as in claim 1 wherein the first code representation and the second code representation use a graph model.

4. A method as in claim 3 wherein the graph model is an Abstract Syntax Tree (AST).

5. A method as in claim 4 wherein the graph model is a combination of graph representations.

6. A method as in claim 1 wherein the source code commit is part of a training corpus having a first volume, the method further comprising:

generating a second commit vector from a pre-training corpus having second volume larger than the first volume;

classifying the second commit vector according to a pre-training task related to the machine learning target task; and

storing the classified second commit vector in the non-transitory computer readable storage medium.

7. A method as in claim 6 further comprising using backpropagation to train a classifier to perform the classification of the first commit vector.

8. A method as in claim 1 further comprising:

prior to the receiving, associating the label with the source code commit according to the machine learning target task.

9. A method as in claim 1 wherein:

the non-transitory computer readable storage medium comprises an in-memory database; and

the transforming is performed by an in-memory database engine of the in-memory database.

10. A non-transitory computer readable storage medium embodying a computer program for performing a method, said method comprising:

receiving a source code commit comprising source code, time information, and a label associated based upon a machine learning target task regarding a security vulnerability in the source code, a fix to a bug in the source code, or a new feature in the source code;

referencing the time information to split the source code into pre-change source code and post-change source code;

converting the pre-change source code into a first graph representation;

converting the post-change source code into a second graph representation;

generating a plurality of first particles from the first graph representation, a particle being a smallest element in a given form of code representation;

generating a plurality of second particles from the second graph representation;

comparing the plurality of first particles and the plurality of second particles to create a delta;

transforming the delta into a first commit vector by referencing an embedding matrix to numerically encode particles of the delta;

classifying the first commit vector according to the machine learning target task; and

storing the first classified commit vector in a non-transitory computer readable storage medium.

11. A non-transitory computer readable storage medium as in claim 10 wherein the first graph representation is:

an Abstract Syntax Tree (AST);

a Control-Flow Graph (CFG);

a Data-Flow Graph (DFGs); or

a combination of at least two of an AST, a CFG, and a DFG.

12. A non-transitory computer readable storage medium as in claim 10 wherein the source code commit is part of a training corpus having a first volume, and the method further comprises:

generating a second commit vector from a pre-training corpus having second volume larger than the first volume;

classifying the second commit vector according to a pre-training task related to the machine learning target task; and

storing the classified second commit vector in the non-transitory computer readable storage medium.

13. A non-transitory computer readable storage medium as in claim 12 wherein the method further comprises:

using backpropagation to train a classifier to perform the classification of the first commit vector.

14. A non-transitory computer readable storage medium as in claim 10 wherein the method further comprises:

prior to the receiving, associating the label with the source code commit according to the machine learning target task.

15. A computer system comprising:

one or more processors;

a software program, executable on said computer system, the software program configured to cause an in-memory database engine of an in-memory database to:

receive a source code commit comprising source code, time information, and a label associated based upon a machine learning target task regarding a security vulnerability in the source code, a fix to a bug in the source code, or a new feature in the source code;

reference the time information to split the source code into pre-change source code and post-change source code;

convert the pre-change source code into a first code representation;

convert the post-change source code into a second code representation;

generate a plurality of first particles from the first code representation, a particle being a smallest element in a given form of code representation;

generate a plurality of second particles from the second code representation;

compare the plurality of first particles and the plurality of second particles to create a delta;

transform the delta into a first commit vector by referencing an embedding matrix to numerically encode particles of the delta;

classify the first commit vector according to the machine learning target task; and

store the first classified commit vector in the in-memory database.

16. A computer system as in claim 15 wherein first code representation and the second code representation use text tokens.

17. A computer system as in claim 15 wherein the first code representation and the second code representation use a graph model.

18. A computer system as in claim 17 wherein the graph model is:

an Abstract Syntax Tree (AST);

a Control-Flow Graph (CFG);

a Data-Flow Graph (DFGs); or

a combination of at least two of an AST, a CFG, and a DFG.

19. A computer system as in claim 15 wherein the source code commit is part of a training corpus having a first volume, and the in-memory database engine is further configured to:

generate a second commit vector from a pre-training corpus having second volume larger than the first volume;

classify the second commit vector according to a pre-training task related to the machine learning target task; and

store the classified second commit vector in the non-transitory computer readable storage medium.

20. A computer system as in claim 19 wherein the in-memory storage engine is further configured to use backpropagation to train a classifier to perform the classification of the first commit vector.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 26, 2020
From: CABRERA LOZOYA, ROCIO; SABETTA, ANTONINO; BEZZI, MICHELE; BAUMANN, ARNAUD
To: SAP SE
Reel/Frame 054169/0645 →
Continuity (1)
Related Publication 20220129261A1 · Apr 28, 2022
Cited By (2)
US 12,487,815 US 12,619,425