US 12,014,160 B2
Translating between programming languages independently of sequence-to-sequence decoders
Rishabh Singh, San Jose, CA (US); and Manzil Zaheer, Mountain View, CA (US)
Assigned to GOOGLE LLC, Mountain View, CA (US)
Filed by Google LLC, Mountain View, CA (US)
Filed on Apr. 11, 2022, as Appl. No. 17/717,609.
Prior Publication US 2023/0325164 A1, Oct. 12, 2023
Int. Cl. G06F 8/51 (2018.01); G06F 8/73 (2018.01); G06F 18/23213 (2023.01)
CPC G06F 8/51 (2013.01) [G06F 8/73 (2013.01); G06F 18/23213 (2023.01)] 14 Claims
OG exemplary drawing
 
1. A method for translating a source code snippet from a first programming language to a second programming language, the method implemented by one or more processors and comprising:
processing the source code snippet written in the first programming language using an encoder portion of a transformer network to generate an embedding of the source code snippet;
processing the embedding of the source code snippet using an all-pair attention layer to generate an attended embedding of the source code snippet;
processing the attended embedding of the source code snippet using an output layer to generate, independently of sequence-to-sequence decoding by way of a single transformation of the attended embedding of the source code snippet, a matrix of probability distributions, wherein the matrix comprises an x by y matrix, with x being a non-zero integer equal to a number of tokens extracted from the source code snippet; and
once the matrix of probability distributions is generated, sampling a plurality of candidate second programming language snippets based on the matrix of probability distributions.