IP Library Granted Patent US 12,619,428
Granted Patent B1
US 12,619,428 · App. 18/374,584 · Granted May 5, 2026

Annotations for developers

Inventors: Rishabh Singh (San Jose, CA); Artem Goncharuk (Mountain View, CA); Karen Davis (Portola Valley, CA); David Andre (San Francisco, CA)
Assignee: GOOGLE LLC
G06F8/73G06F8/51
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 12,619,428
App. No.
18/374,584
Granted
May 5, 2026
Kind
B1
Abstract

Techniques are described herein for translating source code in one programming language to source code in another programming language using machine learning. A method includes: receiving first source code in a first higher-level programming language; processing the first source code, or an intermediate representation thereof, using a sequence-to-sequence neural network model to generate a sequence of outputs, each including a probability distribution; generating second source code in a second higher-level programming language by, for each output in the sequence of outputs: determining a highest probability in the probability distribution associated with the output; in response to the highest probability exceeding a first threshold, generating a predicted portion of the second source code based on a token that corresponds to the highest probability; and in response to the highest probability not exceeding the first threshold, generating a placeholder; and outputting the second source code.

Claims (57)

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

receiving first source code in a first higher-level programming language;

processing the first source code, or an intermediate representation of the first source code, using a neural network model to generate a sequence of outputs, wherein each output in the sequence of outputs comprises a probability distribution;

generating second source code in a second higher-level programming language by, for each output in the sequence of outputs, generating a predicted portion of the second source code based on the probability distribution, wherein in response to a highest probability in the probability distribution not exceeding a threshold, the predicted portion of the second source code is determined to be a low-confidence translation;

outputting the second source code;

for at least one of the predicted portions of the second source code, receiving confirmation that the predicted portion of the second source code is a correct translation of a corresponding portion of the first source code; and

retraining the neural network model by using in a feedback loop the confirmation that the predicted portion of the second source code is the correct translation.

2 . The method according to claim 1 , further comprising compiling the second source code using a compiler for the second higher-level programming language to generate a compiled representation of the second source code.

3 . The method according to claim 1 , further comprising:

for an additional one of the predicted portions of the second source code, receiving a rejection indicating that the additional one of the predicted portions of the second source code is an incorrect translation of a corresponding portion of the first source code; and

retraining the neural network model by using in a feedback loop the rejection indicating that the additional one of the predicted portions of the second source code is the incorrect translation.

4 . The method according to claim 1 , further comprising:

for an additional one of the predicted portions of the second source code, receiving a rejection indicating that the additional one of the predicted portions of the second source code is an incorrect translation of a corresponding portion of the first source code, and receiving a replacement portion of the second source code;

replacing the additional one of the predicted portions of the second source code with the replacement portion of the second source code; and

retraining the neural network model by using in a feedback loop the rejection indicating that the additional one of the predicted portions of the second source code is the incorrect translation and the replacement portion of the second source code.

5 . The method according to claim 1 , wherein the processing is performed on the intermediate representation of the first source code, and

further comprising generating the intermediate representation of the first source code by compiling the first source code using a compiler for the first higher-level programming language.

6 . The method according to claim 1 , further comprising, for each of the predicted portions of the second source code that are determined to be the low-confidence translation, providing, in a user interface, a visual indication that the predicted portion of the second source code is the low-confidence translation.

7 . The method according to claim 6 , wherein the visual indication is based on a confidence level that the predicted portion of the second source code is a correct translation of a corresponding portion of the first source code.

8 . A computer program product comprising one or more non-transitory computer-readable storage media having program instructions collectively stored on the one or more non-transitory computer-readable storage media, the program instructions executable to:

receive first source code in a first higher-level programming language;

process the first source code, or an intermediate representation of the first source code, using a neural network model to generate a sequence of outputs, wherein each output in the sequence of outputs comprises a probability distribution;

generate second source code in a second higher-level programming language by, for each output in the sequence of outputs, generating a predicted portion of the second source code based on the probability distribution, wherein in response to a highest probability in the probability distribution not exceeding a threshold, the predicted portion of the second source code is determined to be a low-confidence translation;

output the second source code;

for at least one of the predicted portions of the second source code, receive confirmation that the predicted portion of the second source code is a correct translation of a corresponding portion of the first source code; and

retrain the neural network model by using in a feedback loop the confirmation that the predicted portion of the second source code is the correct translation.

9 . The computer program product according to claim 8 , wherein the program instructions are further executable to compile the second source code using a compiler for the second higher-level programming language to generate a compiled representation of the second source code.

10 . The computer program product according to claim 8 , wherein the program instructions are further executable to:

for an additional one of the predicted portions of the second source code, receive a rejection indicating that the additional one of the predicted portions of the second source code is an incorrect translation of a corresponding portion of the first source code; and

retrain the neural network model by using in a feedback loop the rejection indicating that the additional one of the predicted portions of the second source code is the incorrect translation.

11 . The computer program product according to claim 8 , wherein the program instructions are further executable to:

for an additional one of the predicted portions of the second source code, receive a rejection indicating that the additional one of the predicted portions of the second source code is an incorrect translation of a corresponding portion of the first source code, and receive a replacement portion of the second source code;

replace the additional one of the predicted portions of the second source code with the replacement portion of the second source code; and

retrain the neural network model by using in a feedback loop the rejection indicating that the additional one of the predicted portions of the second source code is the incorrect translation and the replacement portion of the second source code.

12 . The computer program product according to claim 8 , wherein the processing is performed on the intermediate representation of the first source code, and

further comprising generating the intermediate representation of the first source code by compiling the first source code using a compiler for the first higher-level programming language.

13 . The computer program product according to claim 8 , wherein the program instructions are further executable to, for each of the predicted portions of the second source code that are determined to be the low-confidence translation, provide, in a user interface, a visual indication that the predicted portion of the second source code is the low-confidence translation.

14 . The computer program product according to claim 13 , wherein the visual indication is based on a confidence level that the predicted portion of the second source code is a correct translation of a corresponding portion of the first source code.

15 . A system comprising:

a processor, a computer-readable memory, one or more non-transitory computer-readable storage media, and program instructions collectively stored on the one or more non-transitory computer-readable storage media, the program instructions executable to:

receive first source code in a first higher-level programming language;

process the first source code, or an intermediate representation of the first source code, using a neural network model to generate a sequence of outputs, wherein each output in the sequence of outputs comprises a probability distribution;

generate second source code in a second higher-level programming language by, for each output in the sequence of outputs, generating a predicted portion of the second source code based on the probability distribution, wherein in response to a highest probability in the probability distribution not exceeding a threshold, the predicted portion of the second source code is determined to be a low-confidence translation;

output the second source code;

for at least one of the predicted portions of the second source code, receive confirmation that the predicted portion of the second source code is a correct translation of a corresponding portion of the first source code; and

retrain the neural network model by using in a feedback loop the confirmation that the predicted portion of the second source code is the correct translation.

16 . The system according to claim 15 , wherein the program instructions are further executable to compile the second source code using a compiler for the second higher-level programming language to generate a compiled representation of the second source code.

17 . The system according to claim 15 , wherein the program instructions are further executable to:

for an additional one of the predicted portions of the second source code, receive a rejection indicating that the additional one of the predicted portions of the second source code is an incorrect translation of a corresponding portion of the first source code; and

retrain the neural network model by using in a feedback loop the rejection indicating that the additional one of the predicted portions of the second source code is the incorrect translation.

18 . The system according to claim 15 , wherein the program instructions are further executable to:

for an additional one of the predicted portions of the second source code, receive a rejection indicating that the additional one of the predicted portions of the second source code is an incorrect translation of a corresponding portion of the first source code, and receive a replacement portion of the second source code;

replace the additional one of the predicted portions of the second source code with the replacement portion of the second source code; and

retrain the neural network model by using in a feedback loop the rejection indicating that the additional one of the predicted portions of the second source code is the incorrect translation and the replacement portion of the second source code.

19 . The system according to claim 15 , wherein the processing is performed on the intermediate representation of the first source code, and

further comprising generating the intermediate representation of the first source code by compiling the first source code using a compiler for the first higher-level programming language.

20 . The system according to claim 15 , wherein the program instructions are further executable to, for each of the predicted portions of the second source code that are determined to be the low-confidence translation, provide, in a user interface, a visual indication that the predicted portion of the second source code is the low-confidence translation.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 10, 2024
From: SINGH, RISHABH; GONCHARUK, ARTEM; DAVIS, KAREN; ANDRE, DAVID
To: X DEVELOPMENT LLC
Reel/Frame 067376/0759 →
NUNC PRO TUNC ASSIGNMENT Recorded Mar 6, 2024
From: X DEVELOPMENT LLC
To: GOOGLE LLC
Reel/Frame 066669/0491 →
Continuity (2)
Continuation 17316331 · May 10, 2021
Provisional Application 63025762 · May 15, 2020
References Cited (14)
US 10133738B2 · Huang · 2018 [cited by applicant]
US 10613844B2 · Ravindar · 2020 [cited by applicant]
US 11775271B1 · Singh · 2023 [cited by examiner]
US 12045592B2 · Clement · 2024 [cited by examiner]
US 20140358519A1 · Mirkin · 2014 [cited by applicant]
US 20200286002A1 · Szanto · 2020 [cited by applicant]
US 20230236813A1 · Strenski · 2023 [cited by examiner]
Corbiere et al., “Addressing failure prediction by learning model confidence”, 2019, Proceedings of the 33rd International Conference on Neural Information Processing Systems, 12 pages. (Year: 2019). [cited by examiner]
Lachaux et al., “Unsupervised Translation of Programming Languages”, 2020, arXiv, 21 pages. (Year: 2020). [cited by examiner]
Agarwal et al., “Quality Estimation & Interpretability for Code Translation”, 2021, arXiv, 7 pages. (Year: 2021). [cited by examiner]
Eklind, R.; Compositional Decompilation Using LLVM IR; University of Portsmouth; England; 112 pages; dated 2015. [cited by applicant]
Kartz, D. et al.; Using Recurrent Neural Networks of Decompilation; IEEE; pp. 346-356; dated 2018. [cited by applicant]
Kartz, O. et al.; Towards Neural Decompilation; Computer Science—ArXiv; pp. 1-18; dated 2019. [cited by applicant]
Vemuri N.; Scoring Confidence in Neural Networks; University of California at Berkeley; 36 pages; dated 2020. [cited by applicant]