IP Library Granted Patent US 12,535,995
Granted Patent B2
US 12,535,995 · App. 18/105,211 · Granted Jan 27, 2026

Computer code generation from task descriptions using neural networks

Inventors: Yujia Li (London, GB); David Hugo Choi (London, GB); Junyoung Chung (London, GB); Nathaniel Arthur Kushman (Cambridge, GB); Julian Schrittwieser (London, GB); Rémi Leblond (Cachan, FR); Thomas Edward Eccles (London, GB); James Thomas Keeling (Haddenham, GB); Felix Axel Gimeno Gil (London, GB); Agustín Matías Dal Lago (London, GB); Thomas Keisuke Hubert (London, GB); Peter Choy (London, GB); Cyprien de Masson d′Autume (London, GB); Esme Sutherland Robson (Petworth, GB); Oriol Vinyals (London, GB)
Assignee: GDM Holding LLC
G06F8/30
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,535,995
App. No.
18/105,211
Granted
Jan 27, 2026
Kind
B2
Abstract

Methods, systems, and apparatus, including computer programs encoded on computer storage media, for generating computer code using neural networks. One of the methods includes receiving description data describing a computer programming task; receiving a first set of inputs for the computer programming task; generating a plurality of candidate computer programs by sampling a plurality of output sequences from a set of one or more generative neural networks; for each candidate computer program in a subset of the candidate computer programs and for each input in the first set: executing the candidate computer program on the input to generate an output; and selecting, from the candidate computer programs, one or more computer programs as synthesized computer programs for performing the computer programming task based at least in part on the outputs generated by executing the candidate computer programs in the subset on the inputs in the first set of inputs.

Claims (71)

1 . A method performed by one or more computers, the method comprising:

receiving description data describing a computer programming task, the description data comprising a plurality of text tokens;

receiving a first set of inputs for the computer programming task;

generating a plurality of candidate computer programs by sampling a plurality of output sequences from a set of one or more generative neural networks, wherein each generative neural network in the set is deployed as a plurality of instances on a respective set of one or more devices, and wherein each instance of each generative neural network in the set is configured to, in parallel with each other instance of each generative neural network, receive an input sequence that includes the plurality of text tokens in the description data and to process the input sequence to generate an output sequence comprising a plurality of computer code tokens that specifies a candidate computer program for performing the computer programming task described by the description data;

for each candidate computer program in a subset of the candidate computer programs and for each input in the first set:

executing the candidate computer program on the input on the respective set of one or more devices on which the instance that generated the candidate computer program is deployed to generate an output; and

selecting, from the candidate computer programs, one or more computer programs as synthesized computer programs for performing the computer programming task based at least in part on the outputs generated by executing the candidate computer programs in the subset on the inputs in the first set of inputs, comprising:

clustering the candidate computer programs in the subset into a plurality of clusters based on the outputs generated by executing the candidate computer programs on the inputs in the first set; and

selecting, as a synthesized computer program, one or more respective candidate computer programs from each of one or more of the clusters.

2 . The method of claim 1 , further comprising:

receiving a new input for the computer programming task; and

executing one or more of the synthesized computer programs on the new input to generate an output for the computer programming task for the new input.

3 . The method of claim 1 , further comprising:

receiving, for each input in the first set, a respective expected output generated by performing the computer programming task on the input, wherein the selecting comprises:

for each candidate computer program in the subset and for each input in the first set:

determining whether the output generated by executing the candidate computer program on the input matches the respective expected output for the input; and

selecting, as an initial set of computer programs, only candidate computer programs that, for each input in the first set, generated an output that matched the respective expected output for the input when executed on the input;

wherein selecting, from the candidate computer programs, one or more computer programs as synthesized computer programs for performing the computer programming task based at least in part on the outputs generated by executing the candidate computer programs in the subset on the inputs in the first set of inputs comprises selecting, as a synthesized computer program, one or more respective computer programs from the initial set of computer programs.

4 . The method of claim 1 , wherein the subset of candidate computer programs includes all of the plurality of candidate computer programs.

5 . The method of claim 1 , wherein selecting, as a synthesized computer program, one or more respective computer programs from each of one or more of the clusters comprises:

selecting, as a synthesized computer program, one or more respective computer programs from each of a predetermined number of largest clusters of the plurality of clusters.

6 . The method of claim 1 , wherein obtaining the first set of inputs for the computer programming task comprises:

processing one or more description sequences that each include the plurality of text tokens from the description data using a test input generation neural network that is configured to process each description sequence to generate as output one or more test inputs for the computer programming task described by the description sequence.

7 . The method of claim 1 , wherein the subset of candidate computer programs includes only candidate computer programs that were not filtered out from the plurality of candidate computer programs based on, for each candidate computer program and for each input in a second set of inputs, whether the output generated by executing the candidate computer program on the input matched a respective expected output for the input.

8 . The method of claim 1 , wherein the set of one or more generative neural networks includes only a single generative neural network.

9 . The method of claim 1 , wherein the set of one or more generative neural networks includes a plurality of generative neural networks, wherein each generative neural network in the set has a different combination of values for a set of one or more properties than each other neural network in the set, and wherein the properties include one or more of (i) training data used to train the generative neural network, (ii) a number of parameters of the generative neural network, or (iii) a sampling temperature for sampling output sequences from the generative neural network.

10 . The method of claim 1 , wherein one or more of the generative neural networks in the set include:

an encoder neural network configured to process the input sequence to generate an encoded representation of the input sequence; and

a decoder neural network configured to process the encoded representation to generate the output sequence.

11 . The method of claim 10 , wherein the encoder neural network is a Transformer encoder that applies self-attention over the input sequence and the decoder neural network is an auto-regressive Transformer decoder that applies cross-attention into the encoded representation.

12 . The method of claim 1 , wherein generating a plurality of candidate computer programs by sampling a plurality of output sequences from a set of one or more generative neural networks comprises repeatedly performing operations comprising:

generating a current input sequence from the description data; and

sampling one or more output sequences by processing the current input sequence using one of the generative neural networks in the set.

13 . The method of claim 12 , wherein each input sequence comprises the plurality of text tokens from the description data and one or more tokens identifying a programming language, and wherein generating a current input sequence from the description data comprises:

sampling a programming language from a distribution over a set of programming languages; and

including one or more tokens identifying the programming language in the current input sequence.

14 . The method of claim 12 , wherein each input sequence comprises the plurality of text tokens from the description data and one or more tokens indicating whether the output sequence generated by the generative neural network should specify a correct or incorrect solution for the computer programming task, and wherein generating a current input sequence from the description data comprises:

including one or more tokens indicating that the output sequence generated by the generative neural network should specify a correct solution for the computer programming task.

15 . The method of claim 12 , wherein each input sequence comprises the plurality of text tokens from the description data and zero or more tags that each comprise one or more tokens and that identify an algorithm that should be implemented by the output sequence generated by the generative neural network, and wherein generating a current input sequence from the description data comprises:

sampling one or more tags from a distribution over a set of tags; and

including the sampled tags in the current output sequence.

16 . The method of claim 12 , wherein each input sequence comprises the plurality of text tokens from the description data and one or more tokens that specify a difficulty rating for the computer programming task, and wherein generating a current input sequence from the description data comprises:

selecting a difficulty rating for the computer programming task; and

including one or more tokens specifying the selected difficulty rating in the current output sequence.

17 . The method of claim 16 , wherein selecting a difficulty rating for the computer programming task comprises:

selecting a fixed difficulty rating that is the same for all computer programming tasks after training of the generative neural networks.

18 . The method of claim 16 , wherein selecting a difficulty rating for the computer programming task comprises:

sampling a difficulty rating from a distribution over a set of difficulty ratings.

19 . The method of claim 1 , wherein each generative neural network has been pre-trained on a language modeling objective on a first set of training data and fine-tuned on a code generation objective on a second set of training data that includes a plurality of training examples that each include (i) a training input sequence representing a computer programming task and (ii) a training output sequence that represents a computer program.

20 . The method of claim 19 , wherein the first set of training data comprises a set of sequences that each represent a segment of computer code.

21 . The method of claim 19 , wherein the plurality of training examples includes a first subset of training examples for which the training output sequence in the training example is a correct solution to the computer programming task represented by the training input sequence in the training example and a second set of training examples for which the training output sequence in the training example is not a correct solution to the computer programming task represented by the training input sequence in the training example.

22 . The method of claim 19 , wherein the code generation objective is GOLD with tempering.

23 . The method of claim 1 , wherein the text tokens and the computer code tokens are selected from a same vocabulary of tokens.

24 . A system comprising one or more computers and one or more storage devices storing instructions that when executed by the one or more computers cause the one or more computers to perform operations comprising:

receiving description data describing a computer programming task, the description data comprising a plurality of text tokens;

receiving a first set of inputs for the computer programming task;

generating a plurality of candidate computer programs by sampling a plurality of output sequences from a set of one or more generative neural networks, wherein each generative neural network in the set is deployed as a plurality of instances on a respective set of one or more devices, and wherein each instance of each generative neural network in the set is configured to, in parallel with each other instance of each generative neural network, receive an input sequence that includes the plurality of text tokens in the description data and to process the input sequence to generate an output sequence comprising a plurality of computer code tokens that specifies a candidate computer program for performing the computer programming task described by the description data;

for each candidate computer program in a subset of the candidate computer programs and for each input in the first set:

executing the candidate computer program on the input on the respective set of one or more devices on which the instance that generated the candidate computer program is deployed to generate an output; and

selecting, from the candidate computer programs, one or more computer programs as synthesized computer programs for performing the computer programming task based at least in part on the outputs generated by executing the candidate computer programs in the subset on the inputs in the first set of inputs, comprising:

clustering the candidate computer programs in the subset into a plurality of clusters based on the outputs generated by executing the candidate computer programs on the inputs in the first set; and

selecting, as a synthesized computer program, one or more respective candidate computer programs from each of one or more of the clusters.

25 . One or more non-transitory computer-readable storage media storing instructions that when executed by one or more computers cause the one or more computers to perform operations comprising:

receiving description data describing a computer programming task, the description data comprising a plurality of text tokens;

receiving a first set of inputs for the computer programming task;

generating a plurality of candidate computer programs by sampling a plurality of output sequences from a set of one or more generative neural networks, wherein each generative neural network in the set is deployed as a plurality of instances on a respective set of one or more devices, and wherein each instance of each generative neural network in the set is configured to, in parallel with each other instance of each generative neural network, receive an input sequence that includes the plurality of text tokens in the description data and to process the input sequence to generate an output sequence comprising a plurality of computer code tokens that specifies a candidate computer program for performing the computer programming task described by the description data;

for each candidate computer program in a subset of the candidate computer programs and for each input in the first set:

executing the candidate computer program on the input on the respective set of one or more devices on which the instance that generated the candidate computer program is deployed to generate an output; and

selecting, from the candidate computer programs, one or more computer programs as synthesized computer programs for performing the computer programming task based at least in part on the outputs generated by executing the candidate computer programs in the subset on the inputs in the first set of inputs, comprising:

clustering the candidate computer programs in the subset into a plurality of clusters based on the outputs generated by executing the candidate computer programs on the inputs in the first set; and

selecting, as a synthesized computer program, one or more respective candidate computer programs from each of one or more of the clusters.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 6, 2025
From: DEEPMIND TECHNOLOGIES LIMITED
To: GDM HOLDING LLC
Reel/Frame 071498/0210 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 12, 2023
From: LI, YUJIA; CHOI, DAVID HUGO; CHUNG, JUNYOUNG; KUSHMAN, NATHANIEL ARTHUR; SCHRITTWIESER, JULIAN; LEBLOND, REMI; ECCLES, THOMAS EDWARD; KEELING, JAMES THOMAS; GIMENO GIL, FELIX AXEL; DAL LAGO, AGUSTIN MATIAS; HUBERT, THOMAS KEISUKE; CHOY, PETER; DE MASSON D'AUTUME, CYPRIEN; SUTHERLAND ROBSON, ESME; VINYALS, ORIOL
To: DEEPMIND TECHNOLOGIES LIMITED
Reel/Frame 064871/0472 →
Continuity (2)
Provisional Application 63306043 · Feb 2, 2022
Related Publication 20230244452A1 · Aug 3, 2023
References Cited (39)
US 8972930B2 · Gulwani · 2015 [cited by examiner]
US 9552335B2 · Gulwani · 2017 [cited by examiner]
US 10831451B2 · Udupa · 2020 [cited by examiner]
US 20080282108A1 · Jojic · 2008 [cited by examiner]
US 20130283274A1 · Mimran · 2013 [cited by examiner]
US 20130346982A1 · Kalai · 2013 [cited by examiner]
US 20180275967A1 · Mohamed et al. · 2018 [cited by applicant]
US 20190212989A1 · Polozov · 2019 [cited by examiner]
US 20200301672A1 · Li · 2020 [cited by examiner]
US 20200364505A1 · Poole et al. · 2020 [cited by applicant]
US 20210073330A1 · Inagaki · 2021 [cited by examiner]
US 20210295822A1 · Tomkins · 2021 [cited by examiner]
US 20220138240A1 · Bahrami · 2022 [cited by examiner]
US 20220254006A1 · Jin · 2022 [cited by examiner]
US 20230176829A1 · Rahmani · 2023 [cited by examiner]
US 20240281226A1 · Zheng · 2024 [cited by examiner]
JP 2002182913A · 2002 [cited by applicant]
JP 2002251603A · 2002 [cited by applicant]
JP 2015043140A · 2015 [cited by applicant]
WO WO2023148286A1 · 2023 [cited by applicant]
International Preliminary Report on Patentability in International Appln. No. PCT/EP2023/052595, dated Aug. 15, 2024, 13 pages. [cited by applicant]
Adiwardana et al., “Towards a human-like open-domain chatbot,” CoRR, Jan. 27, 2020, 38 pages. [cited by applicant]
Bonthu et al., “Text2PyCode: Machine Translation of Natural Language Intent to Python Source Code,” 16th European Conference—Computer Vision, Aug. 28, 2020, 12844:51-60. [cited by applicant]
Budnik et al., “Guided test case generation through AI enabled output space exploration,” 2018 IEEE/ACM 13th international workshop on automation of software test, May 28, 2018, 4:53-56. [cited by applicant]
Devlin et al., “Bert: Pre-training of deep bidirectional transformers for language understanding,” CoRR, Oct. 11, 2018, arXiv:1810.04805, 16 pages. [cited by applicant]
Hong et al., “Latent Programmer; discrete latent codes for program synthesis,” CoRR, Dec. 1, 2020, arXiv:2012.00377v1, 15 pages. [cited by applicant]
International Search Report and Written Opinion in International Appln. No. PCT/EP2023/052595, dated Apr. 19, 2023, 20 pages. [cited by applicant]
Raffel et al., “Exploring the limits of transfer learning with a unified text-to-text transformer,” CoRR, Oct. 23, 2019, arXiv:1910.10683, 67 pages. [cited by applicant]
Triet et al., “Deep learning for source code modeling and generation: Models, applications and challenges,” CoRR, Feb. 13, 2020, arXiv:2002.05442v1, 37 pages. [cited by applicant]
Vaswani et al., “Attention Is All You Need,” CoRR, Jun. 12, 2017, arXiv:1706.03762, 15 pages. [cited by applicant]
Office Action in Australian Appln. No. 2023215615, mailed on Jul. 11, 2025, 3 pages. [cited by applicant]
Office Action in Canadian Appln. No. 3,243,657, mailed on Aug. 8, 2025, 8 pages. [cited by applicant]
Office Action in Japanese Appln. No. 2024-545992, mailed on Aug. 5, 2025, 6 pages (with English translation). [cited by applicant]
Gulwani, “Synthesis from Examples,” 3rd Workshop on Advances on Model Based Software Engineering, Feb. 2012, 9 pages. [cited by applicant]
Le et al., “Interactive Program Synthesis,” CoRR, Mar. 10, 2017, 13 pages. [cited by applicant]
Office Action in European Appln. No. 23703210.7, mailed on Aug. 12, 2025, 19 pages. [cited by applicant]
Pu et al., “Selecting Representative Examples for Program Synthesis,” cs.Ai, Nov. 9, 2017, arXiv:1711.03243v3, 10 pages. [cited by applicant]
Shriver et al., “At the End of Synthesis: Narrowing Program Candidates,” 2017 IEEE/ACM 39th International Conference on Software Engineering: New Ideas And Emerging Results Track, May 20, 2017, 13 pages. [cited by applicant]
Notice of Allowance in Japanese Appln. No. 2024-545992, mailed on Dec. 16, 2025, 5 pages (with English translation). [cited by applicant]