IP Library Granted Patent US 12,417,084
Granted Patent B2
US 12,417,084 · App. 18/076,199 · Granted Sep 16, 2025

Hierarchical translation between low-level programming languages and high-level programming languages

Inventor: Rishabh Singh (San Jose, CA)
Assignee: GOOGLE LLC
G06F8/51G06N20/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 12,417,084
App. No.
18/076,199
Granted
Sep 16, 2025
Kind
B2
Abstract

Techniques are described herein for translating between low-level languages and high-level languages. A method includes: receiving first source code in assembly language, the first source code including a plurality of code blocks, and each code block of the plurality of code blocks including a plurality of lines of assembly code; for each of the plurality of code blocks: for each of the plurality of lines of assembly code in the code block, processing the line of assembly code to generate a natural language description of the line of assembly code; and processing the code block and the natural language descriptions of the plurality of lines of assembly code in the code block to generate a natural language description of the code block; and processing the natural language descriptions of the plurality of code blocks to generate a natural language description of the first source code.

Claims (48)

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

receiving first source code in assembly language, the first source code comprising a plurality of code blocks, and each code block of the plurality of code blocks comprising a plurality of lines of assembly code;

for each of the plurality of code blocks:

generating natural language descriptions of the plurality of lines of assembly code in the code block, comprising, for each of the plurality of lines of assembly code in the code block, processing the line of assembly code using a first machine learning model to generate a respective natural language description of the line of assembly code; and

processing the code block and the natural language descriptions of the plurality of lines of assembly code in the code block using a second machine learning model to generate a natural language description of the code block;

processing the natural language descriptions of the plurality of code blocks using a third machine learning model to generate a natural language description of the first source code; and

translating the first source code in assembly language to a higher-level programming language based on the natural language description of the first source code.

2. The method according to claim 1 , further comprising automatically generating second source code in a high-level programming language based on the natural language descriptions of the plurality of lines of assembly code in each of the plurality of code blocks, the natural language descriptions of the plurality of code blocks, and the natural language description of the first source code.

3. The method according to claim 1 , wherein the first machine learning model, the second machine learning model, and the third machine learning model are trained on a supervised set of annotated assembly code.

4. The method according to claim 3 , wherein a plurality of code blocks in the supervised set of annotated assembly code are identified based on block-level comments.

5. The method according to claim 1 , wherein the first machine learning model is a first transformer, the second machine learning model is a second transformer, and the third machine learning model is a third transformer.

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

for each of the plurality of code blocks, generating a vector representation of the code block; and

generating a summary vector by concatenating the vector representations of the plurality of code blocks,

wherein processing the natural language descriptions of the plurality of code blocks using the third machine learning model to generate the natural language description of the first source code comprises applying the summary vector and the natural language descriptions of the plurality of code blocks as inputs across the third machine learning model.

7. The method according to claim 6 , wherein the vector representations of the plurality of code blocks are generated using the second machine learning model.

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 computer-readable storage media, the program instructions executable to:

receive first source code in a lower-level programming language, the first source code comprising a plurality of code blocks, and each code block of the plurality of code blocks comprising a plurality of lines of code;

for each of the plurality of code blocks:

generating intermediate representations of the plurality of lines of code in the code block, comprising, for each of the plurality of lines of code in the code block, process the line of code using a first machine learning model to generate an intermediate representation of the line of code; and

process the code block and the intermediate representations of the plurality of lines of code in the code block using a second machine learning model to generate a respective intermediate representation of the code block;

process the intermediate representations of the plurality of code blocks using a third machine learning model to generate an intermediate representation of the first source code; and

translate the first source code into second source code in a high-level programming language based on the intermediate representations of the plurality of lines of code in each of the plurality of code blocks, the intermediate representations of the plurality of code blocks, and the intermediate representations of the first source code.

9. The computer program product according to claim 8 , wherein the intermediate representations of the plurality of lines of code, the intermediate representations of the plurality of code blocks, and the intermediate representations of the first source code are natural language descriptions.

10. The computer program product according to claim 8 , wherein the first machine learning model, the second machine learning model, and the third machine learning model are trained on a supervised set of annotated code in the lower-level programming language.

11. The computer program product according to claim 10 , wherein a plurality of code blocks in the supervised set of annotated code in the lower-level programming language are identified based on block-level comments.

12. The computer program product according to claim 8 , wherein the first machine learning model is a first transformer, the second machine learning model is a second transformer, and the third machine learning model is a third transformer.

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

for each of the plurality of code blocks, generate a vector representation of the code block; and

generate a summary vector by concatenating the vector representations of the plurality of code blocks,

wherein processing the intermediate representations of the plurality of code blocks using a third machine learning model to generate an intermediate representation of the first source code comprises applying the summary vector and the intermediate representations of the plurality of code blocks as inputs across the third machine learning model.

14. A system comprising:

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

receive first source code in assembly language, the first source code comprising a plurality of code blocks, and each code block of the plurality of code blocks comprising a plurality of lines of assembly code;

for each of the plurality of code blocks:

generate natural language descriptions of the plurality of lines of assembly code in the code block, comprising, for each of the plurality of lines of assembly code in the code block, process the line of assembly code using a first machine learning model to generate a respective natural language description of the line of assembly code; and

process the code block and the natural language descriptions of the plurality of lines of assembly code in the code block using a second machine learning model to generate a natural language description of the code block;

process the natural language descriptions of the plurality of code blocks using a third machine learning model to generate a natural language description of the first source code; and

translate the first source code in assembly language to a higher-level programming language based on the natural language description of the first source code.

15. The system according to claim 14 , wherein the program instructions are further executable to automatically generate second source code in a high-level programming language based on the natural language descriptions of the plurality of lines of assembly code in each of the plurality of code blocks, the natural language descriptions of the plurality of code blocks, and the natural language description of the first source code.

16. The system according to claim 14 , wherein the first machine learning model, the second machine learning model, and the third machine learning model are trained on a supervised set of annotated assembly code.

17. The system according to claim 16 , wherein a plurality of code blocks in the supervised set of annotated assembly code are identified based on block-level comments.

18. The system according to claim 14 , wherein the first machine learning model is a first transformer, the second machine learning model is a second transformer, and the third machine learning model is a third transformer.

19. The system according to claim 14 , wherein the program instructions are further executable to:

for each of the plurality of code blocks, generate a vector representation of the code block; and

generate a summary vector by concatenating the vector representations of the plurality of code blocks,

wherein processing the natural language descriptions of the plurality of code blocks using the third machine learning model to generate the natural language description of the first source code comprises applying the summary vector and the natural language descriptions of the plurality of code blocks as inputs across the third machine learning model.

20. The system according to claim 19 , wherein the vector representations of the plurality of code blocks are generated using the second machine learning model.

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 Dec 8, 2022
From: SINGH, RISHABH
To: X DEVELOPMENT LLC
Reel/Frame 062030/0787 →
Continuity (1)
Related Publication 20240184556A1 · Jun 6, 2024
References Cited (17)
US 9804946B2 · Conlon et al. · 2017 [cited by applicant]
US 9971581B1 · Nandanuru et al. · 2018 [cited by applicant]
US 10656940B1 · Hogan · 2020 [cited by examiner]
US 10691434B2 · Shah et al. · 2020 [cited by applicant]
US 10761839B1 · Migoya · 2020 [cited by examiner]
US 11455146B2 · Rajesh et al. · 2022 [cited by applicant]
US 11693641B1 · G Rao · 2023 [cited by examiner]
US 11734584B2 · A R · 2023 [cited by examiner]
US 12190086B1 · Hanebutte · 2025 [cited by examiner]
US 20200272432A1 · Shaikh · 2020 [cited by examiner]
US 20210286598A1 · Luo · 2021 [cited by examiner]
US 20210319369A1 · Nimmagadda · 2021 [cited by examiner]
US 20220261241A1 · Balasubramanian · 2022 [cited by examiner]
US 20230040412A1 · Ramsl · 2023 [cited by examiner]
US 20240168728A1 · Wareus · 2024 [cited by examiner]
Ruigang Liang, Semantics-Recovering Decompilation through Neural Machine Translation, 2021, pp. 1-13. chrome-extension://efaidnbmnnnibpcajpcglclefindmkaj/https://arxiv.org/pdf/2112.15491 (Year: 2021). [cited by examiner]
Meet Shah, Natural Language to Python Source Code using Transformers, 2021, pp. 1-4. https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=9498268 (Year: 2021). [cited by examiner]