IP Library Granted Patent US 10,983,761
Granted Patent B2
US 10,983,761 · App. 16/377,789 · Granted Apr 20, 2021

Deep learning enhanced code completion system

Inventors: Alexey Svyatkovskiy (Bellevue, WA); Shengyu Fu (Redmond, WA); Neelakantan Sundaresan (Bellevue, WA); Ying Zhao (Bellevue, WA)
Assignee: MICROSOFT TECHNOLOGY LICENSING, LLC
G06F8/33G06F8/42G06F16/9027G06F17/18G06N3/0472G06N3/084
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 10,983,761
App. No.
16/377,789
Filed
Apr 8, 2019
Granted
Apr 20, 2021
Kind
B2
Art Unit
2198
USPC
717/110
Abstract

A code completion tool uses a deep learning model to predict the likelihood of a method completing a method invocation. In one aspect, the deep learning model is a LSTM trained on features that represent the syntactic context of a method invocation derived from an abstract tree representation of the code fragment.

Claims (42)

1. A method, comprising:

obtaining training samples to train a deep learning model, the training samples representing a plurality of ordered sequences of tokens, an ordered sequence of tokens represents a syntactic context of a method invocation;

inputting the training samples into the deep learning model;

training the deep learning model with the training samples to output, a plurality of probabilities, a probability associated with a select token from a vocabulary of tokens used in the plurality of ordered sequences of tokens, wherein during the training of the deep learning model, at least one predicted embedding vector is generated representing a training sample, the at least one predicted embedding vector obtained as the product of a last temporal hidden state of the deep learning model and a linear projection matrix; and

incorporating the deep learning model into a code completion tool for use in completing a code fragment initiating a method invocation.

2. The method of claim 1 , wherein the syntactic context of the method invocation includes a datatype of a return value of the method invocation.

3. The method of claim 1 , wherein the deep learning model is based on one or more a long short-term memory networks.

4. The method of claim 1 , further comprising:

calculating the plurality of probabilities as a product of the word embeddings and the at least one predicted embedding vector.

5. The method of claim 1 , further comprising:

generating at least one ordered sequence of tokens from an abstract syntax tree representation of a code snippet initiating the method invocation.

6. The method of claim 1 , wherein training the deep learning model further comprises:

training the deep learning model using a plurality of parallel distributed clusters.

7. The method of claim 1 , wherein training the deep learning model further comprises:

using a stochastic gradient descent optimization process to minimize a categorical cross-entropy loss function.

8. The method of claim 1 , wherein training the deep learning model further comprises:

using backpropagation through time process to update weights of the deep learning model.

9. A device, comprising:

at least one processor and at least one memory device;

wherein the at least one processor is configured to execute instructions on the at least one memory device to perform acts that:

obtain a training dataset from source code programs having method invocations, the training dataset including a plurality of ordered sequences of tokens that represent a syntactic context of a method invocation;

use the training dataset to train a deep learning model to output, a plurality of probabilities, a probability associated with a select token from a vocabulary of tokens used in the plurality of ordered sequences of tokens, wherein during the training of the deep learning model, at least one predicted embedding vector is generated representing a training sample, the at least one predicted embedding vector obtained as the product of a last temporal hidden state of the deep learning model and a linear projection matrix; and

provide the deep learning model into a code completion component to facilitate completion of a method invocation based on the plurality of probabilities generated from the deep learning model.

10. The device of claim 9 , wherein the deep learning model is based on a long short term memory network.

11. The device of claim 9 , wherein the plurality of ordered sequence of tokens is derived from an abstract syntax tree representing a code snippet containing the method invocation.

12. The device of claim 9 , wherein the at least one processor is further configured to perform acts that:

perform model quantization prior to providing the deep learning model into a code completion component.

13. The device of claim 9 , wherein the syntactic context of the method invocation includes a datatype of a return value of the method invocation.

14. The device of claim 9 , wherein the at least one processor is further configured to perform acts that:

calculate the plurality of probabilities as a product of the word embeddings and the predicted embedding vector.

15. A system, comprising:

one or more processors; and a memory;

one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions that:

train a deep learning model to learn a probability distribution for a vocabulary of tokens from a training dataset, the training dataset including a plurality of ordered sequences of tokens obtained from source code programs having method invocations, wherein an ordered sequence of tokens represents a syntactic context of a method invocation,

wherein during the training of the deep learning model, at least one predicted embedding vector is generated representing a training sample from the training dataset, the at least one predicted embedding vector obtained as the product of a last temporal hidden state of the deep learning model and a linear projection matrix; and

deploy the deep learning model to predict candidates to complete a target method invocation.

16. The system of claim 15 , wherein the probability distribution is based on a product of word embeddings of the training dataset and the at least one predicted embedding vector.

17. The system of claim 15 , wherein the syntactic context of a method invocation includes a data type of a return value from the method invocation.

18. The system of claim 15 , wherein the one or more programs including further instructions that:

perform model quantization prior to deployment of the deep learning model.

19. The system of claim 15 , wherein the deep learning model is based on a long short-term memory network.

20. The system of claim 15 , wherein one or more of the tokens of the vocabulary of tokens represent method names.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 8, 2019
From: FU, SHENGYU; SUNDARESAN, NEELAKANTAN; SVYATKOVSKIY, ALEXEY; ZHAO, YING
To: MICROSOFT TECHNOLOGY LICENSING, LLC.
Reel/Frame 048820/0939 →
Continuity (2)
Provisional Application 62800460 · Feb 2, 2019
Related Publication 20200249918A1 · Aug 6, 2020
Cited By (8)
US 12,487,796 US 12,499,362 US 12,530,527 US 12,585,435 US 12,625,680 US 12,650,836 US 12,699,556 US 12,705,030