IP Library Granted Patent US 12,360,745
Granted Patent B2
US 12,360,745 · App. 17/964,961 · Granted Jul 15, 2025

Performing code completion using data flow

Inventors: Wenting Zhao (Ithaca, NY); Ibrahim Abdelaziz (Tarrytown, NY); Julian Timothy Dolby (Bronx, NY); Kavitha Srinivas (Port Chester, NY)
Assignee: International Business Machines Corporation
G06F8/33G06F8/36G06N5/04
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,360,745
App. No.
17/964,961
Granted
Jul 15, 2025
Kind
B2
Abstract

A corpus of source code from a code database is accessed and a language prediction model is trained based on the corpus of source code. A given program is accessed and a completion of a given line of the given program is predicted by performing inferencing using the language prediction model and at least a portion of the given program. The given line is completed based upon the prediction.

Claims (43)

1. A method for generating computer code, the method comprising:

accessing, using a hardware processor, a corpus of source code from a code database;

training, using the hardware processor, a language prediction model based on the corpus of source code, wherein the training of the language prediction model is performed by inputting a trimmed data flow graph;

accessing, using the hardware processor, a given program;

predicting, using the hardware processor, a completion of a given line of the given program by performing inferencing using the language prediction model and at least a portion of the given program; and

completing, using the hardware processor, the given line based upon the prediction.

2. The method of claim 1 , wherein the training of the language prediction model is performed by inputting a trimmed node.

3. The method of claim 1 , wherein the predicting of the completion of the given line further comprises converting a representation of a code snippet to an actual code snippet that conforms to rules of a given compiler.

4. The method of claim 1 , further comprising rendering the completed code into machine-executable form and running the machine-executable code.

5. The method of claim 1 , wherein the predicting operation predicts a plurality of completions of the given line and the method further comprising ranking the predicted completions.

6. The method of claim 1 , further comprising:

generating a data flow graph for each of a plurality of programs in the corpus of source code; and

trimming all edges to a node that represents a method invocation to be predicted, to generate the trimmed data flow graph.

7. The method of claim 6 , further comprising iteratively repeating the trimming operation to generate additional trimmed data flow graphs.

8. The method of claim 6 , wherein the training operation is performed by inputting the trimmed data flow graph and the trimmed node.

9. The method of claim 6 , further comprising generating an abstraction of the generated data flow graph, wherein the trimming of the edges is performed on the abstraction of the generated data flow graph and wherein the training is based on the trimmed abstracted data flow graph.

10. A computer readable medium comprising computer executable instructions which when executed by a computer cause the computer to perform the method of:

accessing a corpus of source code from a code database;

training a language prediction model based on the corpus of source code, wherein the training of the language prediction model is performed by inputting a trimmed data flow graph;

accessing a given program;

predicting a completion of a given line of the given program by performing inferencing using the language prediction model and at least a portion of the given program; and

completing the given line based upon the prediction.

11. The computer readable medium of claim 10 , the method further comprising:

generating a data flow graph for each of a plurality of programs in the corpus of source code; and

trimming all edges to a node that represents a method invocation to be predicted to generate the trimmed data flow graph, wherein the training operation is performed by inputting the trimmed data flow graph and the trimmed node.

12. An apparatus comprising:

a memory; and

at least one processor, coupled to said memory, and operative to perform operations comprising:

accessing a corpus of source code from a code database;

training a language prediction model based on the corpus of source code, wherein the training of the language prediction model is performed by inputting a trimmed data flow graph;

accessing a given program;

predicting a completion of a given line of the given program by performing inferencing using the language prediction model and at least a portion of the given program; and

completing the given line based upon the prediction.

13. The apparatus of claim 12 , wherein the at least one processor is operative to train the language prediction model by inputting a trimmed node.

14. The apparatus of claim 12 , wherein the at least one processor is operative to predict the completion of the given line by converting a representation of a code snippet to an actual code snippet that conforms to rules of a given compiler.

15. The apparatus of claim 12 , wherein the at least one processor is further operative to render the completed code into machine-executable form and run the machine-executable code.

16. The apparatus of claim 12 , wherein the at least one processor is operative to predict a plurality of completions of the given line and wherein the at least one processor is further operative to rank the predicted completions.

17. The apparatus of claim 12 , wherein the at least one processor is further operative to:

generate a data flow graph for each of a plurality of programs in the corpus of source code; and

trim all edges to a node that represents a method invocation to be predicted to generate the trimmed data flow graph.

18. The apparatus of claim 17 , wherein the at least one processor is further operative to iteratively repeat the trimming operation to generate additional trimmed data flow graphs.

19. The apparatus of claim 17 , wherein the at least one processor is operative to train the language prediction model by inputting the trimmed data flow graph and the trimmed node.

20. The apparatus of claim 17 , wherein the at least one processor is further operative to generate an abstraction of the generated data flow graph, and wherein the at least one processor is operative to trim the edges by performing the trimming on the abstraction of the generated data flow graph and to train the language prediction model based on the trimmed abstracted data flow graph.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 13, 2022
From: ZHAO, WENTING; ABDELAZIZ, IBRAHIM; DOLBY, JULIAN TIMOTHY; SRINIVAS, KAVITHA
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 061407/0980 →
Continuity (1)
Related Publication 20240126513A1 · Apr 18, 2024
References Cited (39)
US 9928040B2 · Tarlow · 2018 [cited by examiner]
US 10628130B2 · Fu · 2020 [cited by applicant]
US 10956579B2 · Youngberg · 2021 [cited by applicant]
US 11568055B2 · Olson · 2023 [cited by applicant]
US 11604883B2 · Bhalla · 2023 [cited by applicant]
US 11693637B1 · Singh · 2023 [cited by examiner]
US 20180089064A1 · Duer · 2018 [cited by examiner]
US 20200097261A1 · Smith · 2020 [cited by examiner]
US 20210034335A1 · Svyatkovskiy · 2021 [cited by applicant]
US 20210279042A1 · Allamanis · 2021 [cited by applicant]
US 20210357187A1 · Clement · 2021 [cited by examiner]
US 20210357193A9 · Fu · 2021 [cited by applicant]
US 20220300835A1 · Ghosh · 2022 [cited by examiner]
CN 112527273A · 2021 [cited by applicant]
CN 113064586A · 2021 [cited by applicant]
Barath, “Improving Code Completion with Machine Learning”, 2020, Imperial College London (Year: 2020). [cited by examiner]
Peter Mell and Timothy Grance, The NIST Definition of Cloud Computing, NIST Special Publication 800-145, Sep. 2011, cover, pages i-iii and 1-3. [cited by applicant]
Michael Hicks. The Programming Languages Enthusiast. Oct. 23, 2017, pp. 14. [cited by applicant]
Eclipse (software). Downloaded from https://en.wikipedia.org/wiki/Eclipse_(software) Oct. 3, 2022. pp. 15. [cited by applicant]
In Defense of Soundiness: A Manifesto. Article in Communications of the ACM . Jan. 2015. pp. 4. [cited by applicant]
Wenting Zhao et al. Serenity: Analysis for Library Based Python Code. Conference'17, Jul. 2017, Washington, DC, pp. 14. [cited by applicant]
A. Svyatkovskiy et al. 2019. Pythia: AI-assisted Code Completion System. pp. 19. [cited by applicant]
D. Guo et al. 2021. Graphcodebert: Pre-training code representations with data flow. pp. 18. [cited by applicant]
A. Svyatkovskiy et al. 2021. Fast and memory efficient neural code completion. pp. 12. [cited by applicant]
Y. Yang et al. 2019. Improve Language Modelling for Code Completion by Tree Language Model with Tree Encoding of Context. pp. 6. [cited by applicant]
S. Prokosch et al. 2015. Intelligent Code Completion with Bayesian networks. pp. 1-31. [cited by applicant]
TabNine: https://spectrum.ieee.org/qa-this-autocompletion-tool-aims-to-supercharge-your-coding. pp. 7. [cited by applicant]
Github Co-pilot: https://siliconangle.com/2021/06/29/githubs-new-copilot-programming-assistant-uses-ai-generate-code/. pp. 11. [cited by applicant]
D. Vagavolu et al., 2021, A Mocktail of Source Code Representations. pp. 5. [cited by applicant]
W. Ahmad et al, 2021 Unified Pre-training for Program Understanding and Generation. pp. 14. [cited by applicant]
S. Gao et al. 2021 Code Structure Guided Transformer for Source Code Summarization. pp. 13. [cited by applicant]
“Mypy”, downloaded Jan. 8, 2025 from https://mypy-lang.org/ © 2014 the mypy project, 2 pages. [cited by applicant]
Chen et al. “Evaluating large language models trained on code.” arXiv preprint arXiv:2107.03374 (2021), 35 Pages. [cited by applicant]
Grove et al. “A framework for call graph construction algorithms.” ACM Transactions on Programming Languages and Systems (TOPLAS) 23.6 (2001): pp. 685-746. [cited by applicant]
Pytype, downloaded Jan. 8, 2025 from https://github.com/google/pytype, © 2025 GitHub, Inc., 8 pages. [cited by applicant]
Raychev et al. “Probabilistic Model for Code with Decision Trees”, SIGPLAN Not. 51, 10 (Oct. 2016), pp. 731-747. https://doi.org/10.1145/3022671.2984041. [cited by applicant]
Vaswani et al. “Attention is all you need”, In Advances in neural information processing systems, obtained from arXiv:1706.03762v5 Dec. 6, 2017, 15 pages. [cited by applicant]
Wang et al. “Codet5: Identifier-aware unified pre-trained encoder-decoder models for code understanding and generation.” arXiv preprint arXiv:2109.00859 (2021), 13 pages. [cited by applicant]
Wolf et al. “Transformers: State-of-the-Art Natural Language Processing”, In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations. Association for Computational L… [cited by applicant]
Cited By (1)
US 12,710,934