IP Library Granted Patent US 11,748,065
Granted Patent B2
US 11,748,065 · App. 17/563,881 · Granted Sep 5, 2023

Learning and using programming styles

Inventors: Georgios Evangelopoulos (Venice, CA); Olivia Hatalsky (San Jose, CA); Bin Ni (Fremont, CA); Qianyu Zhang (Sunnyvale, CA)
Assignee: GOOGLE LLC
G06F8/33G06F8/40G06N3/08
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,748,065
App. No.
17/563,881
Granted
Sep 5, 2023
Kind
B2
Abstract

Techniques are described herein for using artificial intelligence to “learn,” statistically, a target programming style that is imposed in and/or evidenced by a code base. Once the target programming style is learned, it can be used for various purposes. In various implementations, one or more generative adversarial networks (“GANs”), each including a generator machine learning model and a discriminator machine learning model, may be trained to facilitate learning and application of target programming style(s). In some implementations, the discriminator(s) and/or generator(s) may operate on graphical input, and may take the form of graph neural networks (“GNNs”), graph attention neural networks (“GANNs”), graph convolutional networks (“GCNs”), etc., although this is not required.

Claims (28)

1. A method implemented using one or more processors, comprising:

processing a first source code snippet based on a discriminator machine learning model of a generative adversarial network (GAN) to generate style output, wherein the style output indicates whether the first source code snippet conforms with a target programming style, and the discriminator machine learning model is trained based on training data that includes source code snippets in the target programming style, some of which are labeled as genuine and others that are labeled synthetic;

causing one or more output devices to render first output that conveys the style output;

processing the first source code snippet based on a generator machine learning model of the GAN to generate edit output, wherein the edit output corresponds to a transformation of the first source code snippet from another programming style to the target programming style via one or more candidate edits; and

causing one or more of the output devices to render second output that conveys one or more of the candidate edits.

2. The method of claim 1 , wherein the processing of the first source code snippet based on the generator machine learning model is performed in response to the style output satisfying a criterion.

3. The method of claim 2 , wherein the criterion comprises the first source code snippet failing to conform to the target programming style.

4. The method of claim 1 , wherein the style output comprises a probability between zero and one.

5. The method of claim 1 , wherein one or both of the discriminator and generator machine learning models comprises a graph neural network (GNN).

6. The method of claim 5 , wherein processing the first source code snippet based on the generator machine learning model comprises processing an abstract syntax tree (AST) representing the first source code snippet.

7. The method of claim 1 , wherein the discriminator machine learning model is coupled with a prediction layer.

8. The method of claim 7 , wherein the prediction layer comprises a softmax layer or a sigmoid function layer.

9. The method of claim 1 , wherein the second output is presented as part of a graphical user interface (GUI) that presents one or more edit suggestions corresponding to the one or more candidate edits to be made to the first source code snippet.

10. The method of claim 1 , wherein one or both of the generator and discriminator machine learning models comprises a recurrent neural network (RNN).

11. The method of claim 1 , wherein processing the first source code snippet based on the generator machine learning model comprises processing bytecode generated using the first source code snippet.

12. The method of claim 1 , wherein one or both of the style and edit outputs comprises a latent space embedding.

13. A method implemented using one or more processors, comprising:

processing a graph that represents a first source code snippet based on a generator machine learning model of a generative adversarial network (GAN) to generate a synthetic graph, wherein the synthetic graph corresponds to a transformation of the first source code snippet from another programming style to a target programming style via one or more candidate edits, and wherein the generator machine learning model comprises a first graph neural network (GNN) trained in conjunction with a discriminator graph neural network of the GAN, wherein the discriminator machine learning model comprises a second GNN; and

causing one or more of the candidate edits to be implemented in the first source code snippet or presented at one or more output components.

14. The method of claim 13 , wherein the discriminator machine learning model is trained based on training data that includes source code snippets in the target programming style, some of which are labeled as genuine and others that are labeled synthetic.

15. The method of claim 13 , wherein the graph and the synthetic graph comprise abstract syntax trees (AST).

16. The method of claim 13 , wherein the causing includes presenting a list of selectable elements corresponding to the candidate edits, wherein each selectable element is selectable to implement the corresponding candidate edit.

17. The method of claim 13 , further comprising processing the graph that represents the first source code snippet based on the discriminator machine learning model generate style output, wherein the style output indicates whether the first source code snippet conforms with the target programming style.

18. The method of claim 17 , wherein the processing of the graph that represents the first source code snippet based on the generator machine learning model is performed in response to the style output satisfying a criterion.

19. A method implemented using one or more processors, comprising:

processing a graph representing a first source code snippet based on a discriminator machine learning model of a generative adversarial network (GAN) to generate style output, wherein the style output indicates whether the first source code snippet conforms with a target programming style, and the discriminator machine learning model is trained based on training data that includes training graphs representing source code snippets in the target programming style, some of which are labeled as genuine and others, generated by a generator machine learning model of the GAN, that are labeled synthetic; and

causing one or more output devices to render first output that conveys the style output.

20. The method of claim 19 , wherein one or both of the discriminator and generator machine learning models comprises a graph neural network, a graph convolutional network (GCN), or a graph attention neural network (GANN).

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Feb 2, 2023
From: X DEVELOPMENT LLC
To: GOOGLE LLC
Reel/Frame 062572/0565 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jul 15, 2022
From: EVANGELOPOULOS, GEORGIOS; HATALSKY, OLIVIA; NI, BIN; ZHANG, QIANYU
To: X DEVELOPMENT LLC
Reel/Frame 060521/0689 →
Continuity (2)
Continuation 16458713 · Jul 1, 2019
Related Publication 20220121427A1 · Apr 21, 2022
Cited By (1)
US 12,585,437