US 12,450,034 B2
Neural method completion based on natural language and source code
Colin Bruce Clement, Seattle, WA (US); Dawn Drain, Bellevue, WA (US); Neelakantan Sundaresan, Bellevue, WA (US); and Alexey Svyatkovskiy, Bellevue, WA (US)
Assigned to Microsoft Technology Licensing, LLC, Redmond, WA (US)
Filed by MICROSOFT TECHNOLOGY LICENSING, LLC., Redmond, WA (US)
Filed on Apr. 11, 2024, as Appl. No. 18/632,290.
Application 18/632,290 is a continuation of application No. 16/897,802, filed on Jun. 10, 2020, granted, now 11,972,232.
Claims priority of provisional application 63/025,551, filed on May 15, 2020.
Prior Publication US 2024/0256230 A1, Aug. 1, 2024
Int. Cl. G06F 9/44 (2018.01); G06F 8/33 (2018.01); G06F 8/35 (2018.01); G06F 40/274 (2020.01); G06N 3/08 (2023.01)
CPC G06F 8/33 (2013.01) [G06F 8/35 (2013.01); G06F 40/274 (2020.01); G06N 3/08 (2013.01)] 19 Claims
OG exemplary drawing
 
1. A system comprising:
a processor; and
a memory that stores one or more programs that are configured to be executed by the processor, the one or more programs including instructions to perform actions that:
obtain a method signature from a source code program in a source code development tool, wherein the method signature comprises a method name and at least one parameter;
convert the method signature into an input sequence of tokens;
form a context tensor for the input sequence of tokens, wherein the context tensor comprises a token embedding for each token of the input sequence of tokens;
provide the context tensor to a neural transformer model with attention;
perform a beam search to generate the method body for the method signature in the source code development tool using the context tensor to invoke the neural transformer model with attention, wherein the beam search generates partial sequences of tokens iteratively at each of a plurality of timesteps, wherein the beam search invokes the neural transformer model with attention, given the method signature, to generate a probability distribution, at each timestep of the plurality of timesteps, to identify top tokens to be a next token in a respective partial sequence, wherein the beam search expands each partial sequence from the top tokens identified by the probability distribution generated from the neural transformer model with attention, wherein the beam search ends when a termination token appears as the most probable next token for a select partial sequence which is then output as the method body, wherein the neural transformer model with attention generates the method body given the method signature; and
present the method body in the source code program as a candidate for code completion in the source code development tool.