Symbol Graph and Code Skeletons for Reliable AI Code Generation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
AI platforms often generate hallucinations when asked to create code due to limited understanding of the semantics and structure of a codebase, leading to inaccurate, unreliable, and inefficient code generation.
Innovation Solution
Utilize dynamically constructed symbol graphs and code skeletons to enhance the AI model's understanding of the codebase by providing grounding context, allowing it to generate code more accurately and reliably.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If an AI platform uses large language models to generate code, then the code generation speed is improved, but the accuracy and reliability deteriorate due to hallucinations
Solution Approach 1:
The patent introduces an intermediary processing system between the LLM and the codebase. This system constructs a symbol graph that maps relationships between code symbols and retrieves relevant code skeletons, serving as a mediator that guides the LLM to generate accurate code by providing structured context about the codebase semantics and structure
Solution Approach 2:
The system performs preliminary actions by constructing the symbol graph and retrieving relevant code skeletons before the LLM generates code. This pre-processing step prepares the contextual information about code symbols, relationships, and existing code structures, enabling the LLM to generate more accurate code with reduced hallucinations
2Device complexity
If the AI model has limited understanding of codebase semantics and structure, then the system complexity is reduced, but the code generation quality deteriorates
Solution Approach 1:
The patent segments the code understanding task into distinct components: symbol identification, relationship mapping through the symbol graph, and relevant code skeleton retrieval. This segmentation allows the system to progressively build understanding of codebase semantics and structure without overwhelming complexity, while improving code generation quality through structured information provision
Data Source
AI summary
Techniques are described herein that are capable of performing AI-based code generation using a dynamically constructed symbol graph and code skeletons. A query, which requests code, is received. A symbol graph, which maps relationships between subsets of a symbol corpus, is dynamically constructed. Symbols are selected from the symbol corpus based on relevancy to the user-generated query. Code skeletons associated with the symbols are retrieved. An AI model is caused to generate at least a portion of the code from at least a subset of the symbols by providing an AI prompt, which requests the code, together with the code skeletons as inputs to the AI model. A response to the AI prompt, including at least the portion of the code, is received from the AI model. Presentation of a response to the query is triggered. The response to the query includes at least the portion of the code.


