Autoregressive Language Model Code Migration

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Machine learning models face challenges in obtaining sufficient training data for tasks like source code translation and migration, leading to issues such as overfitting, and require extensive data for accurate performance, while humans can detect patterns with fewer examples.

Innovation Solution

Implementing an autoregressive language model conditioned with a small number of demonstration tuples, including source code snippets before and after migration, to perform tasks like translating source code between programming languages, leveraging computer programming-specific corpuses for improved accuracy and generating natural language documentation.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Manufacturing precision

If machine learning models are trained with extensive labeled training data to improve translation accuracy, then manufacturing precision improves, but loss of time and resources increases due to data collection and processing requirements

Engineering Contradiction:
Improvetranslation accuracyVSAvoiddata collection and processing time
Core Design Contradiction:
Manufacturing precisionVSLoss of time

Solution Approach 1:

The system performs preliminary actions by collecting demonstration tuples (source code snippets with their migrated versions) and processing them into intermediate embeddings before actual translation tasks. This pre-processing creates a ready-to-use knowledge base that eliminates the need for extensive real-time training data collection, allowing the model to be conditioned on relevant patterns immediately when needed.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system changes the parameter of training data quantity from extensive labeled pairs to a small number of demonstration tuples. By transforming the input format and using few-shot demonstrations instead of large-scale supervised training data, the system achieves accurate code migration without the time and resource costs of processing extensive training datasets.

Inventive Principle:
Principle #35Parameter changes

2Reliability

If supervised training with extensive labeled data is used to improve model performance, then reliability improves, but device complexity increases due to data processing infrastructure requirements

Engineering Contradiction:
Improvemodel performanceVSAvoiddata processing infrastructure
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The system extracts only the essential patterns from code migration tasks by collecting demonstration tuples that capture source-to-target transformations. Instead of processing extensive labeled training data through complex infrastructure, the system extracts and stores intermediate embeddings from these demonstrations, which can be directly applied to new translation tasks without requiring heavy data processing infrastructure.

Inventive Principle:
Principle #2Taking out (Extraction)

3Manufacturing precision

If humans manually perform code migration tasks to ensure accuracy, then manufacturing precision improves, but productivity decreases due to the cumbersome and time-consuming nature of manual work

Engineering Contradiction:
Improvemigration accuracyVSAvoidcode migration throughput
Core Design Contradiction:
Manufacturing precisionVSProductivity

Solution Approach 1:

The system creates copies of successful migration patterns by collecting demonstration tuples that represent proven source-to-target code transformations. These demonstrations are processed into intermediate embeddings that serve as templates, allowing the model to replicate accurate migration patterns across many code snippets automatically, thereby maintaining high accuracy while dramatically improving productivity over manual methods.

Inventive Principle:
Principle #26Copying

4Loss of time

If few-shot demonstrations are used to condition the model, then loss of time improves by reducing data processing requirements, but manufacturing precision may worsen without sufficient training data

Engineering Contradiction:
Improvedata processing timeVSAvoidtranslation accuracy
Core Design Contradiction:
Loss of timeVSManufacturing precision

Solution Approach 1:

The system changes the quality parameter of the demonstration data by carefully selecting and processing demonstration tuples into intermediate embeddings. Instead of using raw few-shot examples, the system transforms them into structured representations that capture essential migration patterns, thereby maintaining translation accuracy while minimizing data processing time requirements.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS11656867B2Conditioning autoregressive language model to improve code migration
Publication Date: 2023.05.23 GOOGLE LLC
  • US11656867B2 patent drawing
  • US11656867B2 patent drawing
  • US11656867B2 patent drawing

AI summary

Implementations are described herein for using machine learning to perform various tasks related to migrating source code based on relatively few (“few shots”) demonstrations. In various implementations, an autoregressive language model may be conditioned based on demonstration tuple(s). In some implementations, a demonstration tuple may include a pre-migration version of a first source code snippet and a post-migration version of the first source code snippet. In other implementations, demonstration tuples may include other data, such as intermediate forms (e.g., natural language descriptions or pseudocode), input-output pairs demonstrating intended behavior, etc. The autoregressive language model may be trained on corpora of source code and natural language documentation on the subject of computer programming. A pre-migration version of a source code file may be processed based on the conditioned autoregressive language model, and a post-migration version may be generated based on output generated based on the conditioned autoregressive model.