Facebook researcher's team have developed a code-generating AI systems that can convert codes from one high-level programming language to another - like C++, Java, and Python. These systems were trained under an unsupervised learning method.
This system known as TransCoder is first initialized with cross-lingual language model pretraining, which maps pieces of code expressing the same instructions to identical representations regardless of programming language. (Input streams of source code sequences are randomly masked out, and TransCoder is tasked with predicting the masked-out portions based on context.)
A process called denoising auto-encoding trains the system to generate valid sequences even when fed with noisy input data, and back-translation allows TransCoder to generate parallel data that can be used for training.
The number of common tokens — anchor points — available across programming languages, which come from common keywords like “for,” “while,” “if,” and “try” and also digits, mathematical operators, and English strings that appear in the source code contributes to the cross-lingual nature of TransCoder. Facebook commented that TransCoder's translations had high computational accuracy. This is attributed to the incorporation of beam search, a method that maintains a set of partially decoded sequences that are appended to form sequences and then scored so the best sequences bubble to the top.
The researchers, said that TransCoder demonstrated an understanding of the syntax specific to each language as well as the languages’ data structures and their methods during experiments, and it correctly aligned libraries across programming languages while adapting to small modifications (like when a variable in the input was renamed).
Yet, just like many projects, TransCoder is not perfect, it failed to account for certain variable types during generation for instance - it outperformed frameworks that rewrites rules manually built using expert knowledge.
Programs like this can benefits in ways such as; help in accelerating productivity by taking care of bugging, could increase number of jobs in tech because people who don’t have a programming background will be able to take their creative intuition and capture that via machine by these intentionality interfaces.