Program Generation Apparatus Using Attention-Based Token Synthesis
Find Innovative SolutionsGenerate 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
Engineering 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
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.
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.
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
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.
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.
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
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.
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.
Data Source
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.


