Machine learning based code migration engine
AssigneeExlService Holdings, Inc.
InventorsSwati Malhotra, Shubham Jain
Life of this patent
Estimating the term…
Abstract
The systems, methods, and computer-readable media disclosed herein relate generally to machine learning based code migration engines. In an example, a code generator can generate input chunks using legacy code, use the input chunks to generate a prompt, use the prompt to cause a neural network to generate output code, and monitor the output window size of the neural network. To ensure conversion accuracy and minimize code truncation, the code generator can progressively adjust the output window size of the neural network and/or progressively adjust the size of input chunks while preserving internal integrity of code units in the chunks.
Claims20
At least one non-transitory, computer-readable storage medium comprising instructions recorded thereon, the instructions, when executed by at least one processor of a code generator, causing the code generator to perform migration of computer code from a computer language to a different computer language by:
- using a first code unit in a source language, generating a set of input chunks,
- wherein a size of the input chunks is normalized across the set of input chunks, and
- wherein the size of the input chunks does not exceed a predetermined token limit for a trained code converter neural network;
- using a first subset of input chunks from the set of input chunks, generating a first prompt for the trained code converter neural network,
- wherein the first prompt is structured to preserve at least one of a code dependency, data dependency, code type, or sequence dependency in the first code unit;
- applying the trained code converter neural network to the first subset of input chunks from the set of input chunks to generate an output item that comprises a second code unit in a target language,
- wherein the trained code converter neural network is configured to generate output in conformance to a size threshold;
- in response to a determination that a size of the output item exceeds the size threshold,
- dynamically reducing the size threshold and generating a second prompt for the trained code converter neural network, wherein the second prompt is structured to operate on a second subset of input chunks of size M selected at least in part from a first subset of input chunks of size N, wherein N<M;
- and
- applying the trained code converter neural network to the second subset of input chunks to generate a third code unit;
- and
- causing a computing device to display the generated second code unit or third code unit.
A computing system comprising at least one processor and at least one non-transitory, computer-readable storage medium comprising instructions recorded thereon, the instructions, when executed by the at least one processor, causing a code generator of the computing system to perform migration of computer code from a computer language to a different computer language by:
- using a first code unit in a source language, generating a set of input chunks,
- wherein a size of the input chunks is normalized across the set of input chunks, and
- wherein the size of the input chunks does not exceed a predetermined token limit for a trained code converter neural network;
- using a first subset of input chunks from the set of input chunks, generating a first prompt for the trained code converter neural network,
- wherein the first prompt is structured to preserve at least one of a code dependency, data dependency, code type, or sequence dependency in the first code unit;
- applying the trained code converter neural network to the first subset of input chunks from the set of input chunks to generate an output item that comprises a second code unit in a target language,
- wherein the trained code converter neural network is configured to generate output in conformance to a size threshold;
- in response to a determination that a size of the output item exceeds the size threshold,
- dynamically reducing the size threshold and generating a second prompt for the trained code converter neural network, wherein the second prompt is structured to operate on a second subset of input chunks of size M selected at least in part from a first subset of input chunks of size N, wherein N<M;
- and
- applying the trained code converter neural network to the second subset of input chunks to generate a third code unit;
- and
- causing a computing device to display the generated second code unit or third code unit.
A computer-implemented method for causing a code generator to perform migration of computer code from a computer language to a different computer language by:
- using a first code unit in a source language, generating a set of input chunks,
- wherein a size of the input chunks is normalized across the set of input chunks, and
- wherein the size of the input chunks does not exceed a predetermined token limit for a trained code converter neural network;
- using a first subset of input chunks from the set of input chunks, generating a first prompt for the trained code converter neural network,
- wherein the first prompt is structured to preserve at least one of a code dependency, data dependency, code type, or sequence dependency in the first code unit;
- applying the trained code converter neural network to the first subset of input chunks from the set of input chunks to generate an output item that comprises a second code unit in a target language,
- wherein the trained code converter neural network is configured to generate output in conformance to a size threshold;
- in response to a determination that a size of the output item exceeds the size threshold,
- dynamically reducing the size threshold and generating a second prompt for the trained code converter neural network, wherein the second prompt is structured to operate on a second subset of input chunks of size M selected at least in part from a first subset of input chunks of size N, wherein N<M;
- and
- applying the trained code converter neural network to the second subset of input chunks to generate a third code unit;
- and
- causing a computing device to display the generated second code unit or third code unit.
Dependencies are inferred from the claim text.