LLM Code Translation and Program Synthesis via Dependency Graphs

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing transpilers and neural networks struggle with generating accurate and human-readable code translations across vastly different languages, often producing suboptimal and inconsistent outputs due to the lack of universal methods and adequate parallel datasets, leading to potential bugs and inefficiencies.

Innovation Solution

A system leveraging large language models (LLMs) trained on multi-language data corpora, combined with dependency graph analysis and iterative generation, employs formal verification and context-based code generation to produce human-readable and performant target code by segmenting tasks and caching solutions, ensuring consistency and accuracy.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If LLMs are used for code translation, then code generation speed is improved, but translation accuracy deteriorates

Engineering Contradiction:
Improvecode generation speedVSAvoidtranslation accuracy
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The patent divides the code translation task into multiple segments by creating dependency graphs that identify independent code modules. Each module is translated separately through targeted prompts, allowing the LLM to focus on smaller units and reduce errors while maintaining overall translation speed. This segmentation resolves the contradiction by enabling parallel processing of accurate translations.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent implements a feedback mechanism where generated code is validated against the dependency graph and original source code. Errors are detected and corrected iteratively, with the LLM refining translations based on validation results. This feedback loop maintains high accuracy while preserving the speed advantage of LLM-based generation.

Inventive Principle:
Principle #23Feedback

2Adaptability or versatility

If universal transpilation method is developed, then language compatibility is improved, but translation quality deteriorates

Engineering Contradiction:
Improvelanguage compatibilityVSAvoidtranslation quality
Core Design Contradiction:
Adaptability or versatilityVSManufacturing precision

Solution Approach 1:

The patent creates a universal transpilation framework that handles multiple language pairs through a single system. The dependency graph analyzer and prompt generator are configured to work with various source and target languages, enabling the same infrastructure to translate between Python-C, Java-C++, and other language combinations while maintaining high quality through language-specific prompt tuning.

Inventive Principle:
Principle #6Universality (Multi-functionality)

3Loss of time

If code translation is automated, then development time is reduced, but code reliability deteriorates

Engineering Contradiction:
Improvedevelopment timeVSAvoidcode reliability
Core Design Contradiction:
Loss of timeVSReliability

Solution Approach 1:

The patent performs preliminary analysis by generating dependency graphs before translation begins. This pre-computation of code relationships and identification of independent modules enables the automated system to translate efficiently while maintaining reliability through structured approach. The preliminary organization of code structure guides the translation process and facilitates subsequent validation.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS20250342017A1Systems, methods, and articles for code translation and program synthesis based on large language models
Publication Date: 2025.11.06 CODE METAL
  • US20250342017A1 patent drawing
  • US20250342017A1 patent drawing
  • US20250342017A1 patent drawing

AI summary

Technologies for code-to-code translation and program synthesis are disclosed. An example method includes analyzing input source code to generate dependency graphs corresponding to the input source code, creating a set of code generation tasks for generating target code based on the dependency graphs, and feeding the set of code generation tasks to a trained large language model (LLM) to generate one or more parts of the target code.