# US 2022/0044119 A1 · A deep learning model for learning program embeddings

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2022/0044119 A1
- Document ID: US20220044119A1
- Status: Published application
- Kind: A1
- Application number: 17/423,103
- Filed: 2019-10-01
- Published: 2022-02-10
- Earliest claimed: 2019-01-17
- Assignees: Visa International Service Association
- Applicants: Visa International Service Association
- Inventors: Ke Wang
- Web page: https://patentgrep.com/patent/US20220044119A1

## CPC

- G06N 3/08: Learning methods
- G06F 8/36: Software reuse
- G06F 8/436: {Semantic checking}
- G06N 3/044: Recurrent networks, e.g. Hopfield networks
- G06N 3/0442: characterised by memory or gating, e.g. long short-term memory [LSTM] or gated recurrent units [GRU]
- G06N 3/045: Combinations of networks
- G06N 3/0495: Quantised networks; Sparse networks; Compressed networks
- G06N 3/09: Supervised learning
- G06N 20/00: Machine learning
- G06F 8/4435: {Detection or removal of dead or redundant code}
- G06F 11/3466: {Performance evaluation by tracing or monitoring}
- G06F 11/36: Prevention of errors by analysis, debugging or testing of software
- G06F 11/3612: {by runtime analysis (performance monitoring G06F11/3466)}
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A system and method for using a deep learning model to learn program semantics is disclosed. The method includes receiving a plurality of execution traces of a program, each execution trace comprising a plurality of variable values. The plurality of variable values are encoded by a first recurrent neural network to generate a plurality of program states for each execution trace. A bi-directional recurrent neural network can then determine a reduced set of program states for each execution trace from the plurality of program states. The reduced set of program states are then encoded by a second recurrent neural network to generate a plurality of executions for the program. The method then includes pooling the plurality of executions to generate a program embedding and predicting semantics of the program using the program embedding.

## Claims

### Claim 1

A method comprising:
receiving a plurality of execution traces of a program, each execution trace comprising a plurality of variable values;
encoding, by a first recurrent neural network, the plurality of variable values to generate a plurality of program states for each execution trace;
determining, by a bi-directional recurrent neural network, a reduced set of program states for each execution trace from the plurality of program states;
encoding, by a second recurrent neural network, the reduced set of program states to generate a plurality of executions for the program;
pooling the plurality of executions to generate a program embedding; and
predicting semantics of the program using the program embedding.

### Claim 2 (depends on 1)

The method of claim 1, wherein predicting semantics of the program comprises returning a probability of one of a list of program functionalities.

### Claim 3 (depends on 1)

The method of claim 1, wherein there are 50% fewer states in the reduced set of program states than in the plurality of program states.

### Claim 4 (depends on 1)

The method of claim 1, wherein each execution trace in the plurality of execution traces is generated with randomly generated inputs.

### Claim 5 (depends on 1)

The method of claim 1, wherein determining a reduced set of program states comprises:
computing a forward sequence from the plurality of program states;
computing a backward sequence from the plurality of program states; and
for each program state in the plurality of program states:
determining a forward context vector from the forward sequence;
determining a backward context vector from the backward sequence; and
determining, based on at least the forward context vector and backward context vector, to include the program state in the reduced set of program states.

### Claim 6 (depends on 5)

The method of claim 5, wherein determining the forward context vector comprises pooling a subset of components of the forward sequence, the subset of components of the forward sequence comprising information from a first s-1 program states, and wherein determining the backward context vector comprises pooling a subset of components of the backward sequence, the subset of components of the backward sequence comprising information from a last m-s program states.

### Claim 7 (depends on 5)

The method of claim 5, wherein determining to include the program state in the reduced set of program states is performed by a multi-layer perceptron.

### Claim 8 (depends on 1)

The method of claim 1, wherein predicting semantics is performed with an output of a softmax function.

### Claim 9 (depends on 1)

The method of claim 1, wherein the program has been mutated.

### Claim 10 (depends on 1)

The method of claim 1, wherein the method is optimized to minimize a cross-entropy loss and minimize the number of program states in the reduced set of program states.

### Claim 11

A computer comprising:
a processor; and
a computer-readable medium comprising code, executable by the processor, for implementing a method comprising:
receiving a plurality of execution traces of a program, each execution trace comprising a plurality of variable values;
encoding, by a first recurrent neural network, the plurality of variable values to generate a plurality of program states for each execution trace;
determining, by a bi-directional recurrent neural network, a reduced set of program states for each execution trace from the plurality of program states;
encoding, by a second recurrent neural network, the reduced set of program states to generate a plurality of executions for the program;
pooling the plurality of executions to generate a program embedding; and
predicting semantics of the program using the program embedding.

### Claim 12 (depends on 11)

The computer of claim 11, wherein predicting semantics of the program comprises returning a probability of one of a list of program functionalities.

### Claim 13 (depends on 11)

The computer of claim 11, wherein there are 50% fewer states in the reduced set of program states than in the plurality of program states.

### Claim 14 (depends on 11)

The computer of claim 11, wherein each execution trace in the plurality of execution traces is generated with randomly generated inputs.

### Claim 15 (depends on 11)

The computer of claim 11, wherein determining a reduced set of program states comprises:
computing a forward sequence from the plurality of program states;
computing a backward sequence from the plurality of program states; and
for each program state in the plurality of program states:
determining a forward context vector from the forward sequence;
determining a backward context vector from the backward sequence; and
determining, based on at least the forward context vector and backward context vector, to include the program state in the reduced set of program states.

### Claim 16 (depends on 15)

The computer of claim 15, wherein determining the forward context vector comprises pooling a subset of components of the forward sequence, the subset of components of the forward sequence comprising information from a first s-1 program states, and wherein determining the backward context vector comprises pooling a subset of components of the backward sequence, the subset of components of the backward sequence comprising information from a last m-s program states.

### Claim 17 (depends on 15)

The computer of claim 15, wherein determining to include the program state in the reduced set of program states is performed by a multi-layer perceptron.

### Claim 18 (depends on 11)

The computer of claim 11, wherein predicting semantics is performed with an output of a softmax function.

### Claim 19 (depends on 11)

The computer of claim 11, wherein the program has been mutated.

### Claim 20 (depends on 11)

The computer of claim 11, wherein the computer is optimized to minimize a cross-entropy loss and minimize the number of program states in the reduced set of program states
