Program Generation Apparatus Using Attention-Based Token Synthesis

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing automatic programming methods face challenges in generating the correct program due to the likelihood of changing tokens that should not be altered, leading to an increased risk of not producing the desired program.

Innovation Solution

A program generation device that calculates the similarity between source codes and natural language specifications, and generates synthesis codes by focusing on tokens with high attention degrees, ensuring that important tokens are preserved during the synthesis process.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Extent of automation

If program synthesis is performed by randomly combining program components to satisfy input/output examples, then the program can be generated automatically, but tokens that should not be changed may be altered, reducing the probability of generating the correct program

Engineering Contradiction:
Improveautomatic program generationVSAvoidprobability of generating correct program
Core Design Contradiction:
Extent of automationVSReliability

Solution Approach 1:

The patent performs preliminary actions by calculating similarity between source code and natural language specifications before synthesis, and determining attention degrees for each token in advance. This preliminary analysis identifies which tokens are critical and should be preserved, preventing random alteration of important tokens during synthesis.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent applies local quality by treating different tokens differently based on their attention degrees. Tokens with high attention degrees (critical tokens) are protected from change, while tokens with low attention degrees can be modified during synthesis. This selective approach ensures that important program components remain intact while still allowing necessary modifications.

Inventive Principle:
Principle #3Local quality

2Adaptability or versatility

If all tokens in the template program are allowed to be changed during synthesis, then the program can adapt to satisfy input/output examples, but the correctness of the generated program cannot be guaranteed

Engineering Contradiction:
Improveprogram adaptability to input/output examplesVSAvoidfidelity of generated code
Core Design Contradiction:
Adaptability or versatilityVSManufacturing precision

Solution Approach 1:

The patent implements local quality by differentiating between tokens that require adaptability and those that require precision. Based on calculated attention degrees, the system allows flexible modification of non-critical tokens to satisfy input/output examples while strictly preserving critical tokens to maintain code fidelity and correctness.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The patent performs preliminary calculation of attention degrees for each token before the synthesis process. This preliminary action identifies which tokens should maintain high fidelity and which can be adapted, allowing the system to balance adaptability and precision throughout the synthesis process rather than treating all tokens uniformly.

Inventive Principle:
Principle #10Preliminary action

3Device complexity

If the program synthesis uses only input/output examples without similar program templates, then the generation process is simpler, but the likelihood of generating overfitted or incorrect programs increases

Engineering Contradiction:
Improvesimplicity of generation processVSAvoidprogram correctness
Core Design Contradiction:
Device complexityVSReliability

Solution Approach 1:

The patent performs preliminary actions by searching for similar programs and calculating their similarity to the natural language specification before synthesis. This preliminary step provides a reliable template that guides the synthesis process, reducing the risk of generating overfitted or incorrect programs while maintaining a relatively simple overall process.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent uses copying by utilizing similar existing programs as templates for synthesis. Instead of generating programs from scratch using only input/output examples, the system copies structure and patterns from similar programs, which improves reliability by leveraging proven code structures while still adapting to the specific requirements.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS20240248685A1Program generation apparatus, program generation method and program
Publication Date: 2024.07.25 NT T INC
  • US20240248685A1 patent drawing
  • US20240248685A1 patent drawing
  • US20240248685A1 patent drawing

AI summary

A program generation device includes a calculation unit that calculates, for a plurality of first source codes, a similarity between the first source code and a sentence explaining a specification of a desired program in a natural language, and calculates an attention degree of each token constituting the first source code in calculation of the similarity, and a generation unit that generates a plurality of synthesis codes by synthesizing a token having a relatively high attention degree among the first source codes having a relatively high similarity with a second source code prepared in advance, thereby improving a probability that a desired program is generated.