LLM Code Translation Dataset Creation for Low-Resource Languages
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The availability of parallel data for training machine learning systems to translate code from low-resource languages like COBOL and FORTRAN is limited, hindering the development of effective code translation systems.
Innovation Solution
A method utilizing a large language model (LLM) and automated unit-test case generation to create a parallel corpus for code translation, involving unit-test case generation, filtering, translation, validation, and fine-tuning, which generates functionally equivalent code samples across multiple programming languages.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If manual code translation is performed by large teams of programmers, then translation accuracy can be maintained, but the time and effort required increases significantly
Solution Approach 1:
The patent introduces an automated code translation system with multiple processing stages (parsing, intermediate representation generation, code generation, validation) as an intermediary between source and target code. This automated system performs the translation task without requiring large teams of programmers, thereby reducing time loss while maintaining translation quality through systematic validation processes.
Solution Approach 2:
The patent replaces the mechanical system of manual programming with an automated computational system. The translation process is transformed from human-driven manual coding to an automated system that uses parsing, intermediate representation, and code generation techniques, significantly reducing the time and human effort required while maintaining translation accuracy.
2Productivity
If machine learning systems are trained for code translation, then translation speed and automation improve, but the requirement for large amounts of parallel training data increases
Solution Approach 1:
The patent performs preliminary actions by generating synthetic parallel training data through automated code generation from intermediate representations. Instead of relying on existing parallel corpora, the system pre-generates training data by translating validated code samples across multiple language pairs, thereby reducing the dependency on large amounts of manually collected parallel data while maintaining high translation productivity.
Solution Approach 2:
The system serves itself by automatically generating its own training data through the code translation and validation process. The validated translated code samples are reused as training data for future translation tasks, creating a self-sustaining system that reduces external data requirements while maintaining high translation speed and accuracy.
3Loss of time
If automated translation systems are implemented, then time and effort are reduced, but the availability of training data for low-resource languages remains limited
Solution Approach 1:
The patent introduces an intermediate representation layer that serves as a mediator between source code and target code. This intermediate representation enables the system to generate target code for low-resource languages without requiring extensive parallel training data, as the translation process is decomposed into language-agnostic intermediate steps that can be validated systematically.
Solution Approach 2:
The system performs preliminary code validation and testing before deployment, generating verified translation pairs that can be used as training data. This preliminary action creates a foundation of validated translations for low-resource languages, enabling automated translation systems to operate effectively even with limited initial data availability.
Data Source
AI summary
One or more unit-test cases are generated from a monolingual code corpus and the generated unit-test cases are filtered to generate a corpus of unit-test cases which have acceptability scores exceeding one or more predefined thresholds. One or more of the code samples of the monolingual code corpus are translated from a source language to a target language using a pretrained Large Language Model and the generated unit-test cases are translated from the source language to the target language. The LLM-translated code samples are validated using the translated unit-test cases and a parallel-data training corpus comprising the LLM-translated code samples that pass the validation is created. The pretrained large language model (LLM) is fine-tuned using the parallel-data training corpus, a given code segment is translated using the fine-tuned large language model (LLM), the translated given code segment is tested and the tested given code segment is deployed.


