AI Code Generation Using Symbol Graphs and Code Skeletons
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing AI platforms generate code hallucinations due to limited understanding of codebase semantics and structure, leading to inaccuracies, inefficiencies, and reduced reliability.
Innovation Solution
Utilize dynamically constructed symbol graphs and code skeletons to enhance AI model understanding by providing grounding context, selecting relevant symbols, and generating code that accurately reflects requested functionality.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If LLMs are used to generate code from complex or unique codebases, then code generation capability is provided, but hallucinations occur due to limited understanding of codebase semantics and structure
Solution Approach 1:
The system performs preliminary analysis of the codebase to construct a symbol graph and extract code skeletons before code generation. This preliminary action provides the LLM with structured context about the codebase semantics and relationships, enabling more accurate code generation without hallucinations.
Solution Approach 2:
The patent introduces an intermediary processing layer between the LLM and the codebase. This layer constructs symbol graphs and extracts code skeletons that serve as mediators, translating complex codebase structures into formats the LLM can understand and use for accurate code generation.
2Reliability
If more context from the codebase is provided to the AI model, then understanding of semantics and structure improves, but processing time and computational resources increase
Solution Approach 1:
The system extracts only the essential and relevant information from the codebase - specifically symbol relationships and code skeletons - rather than providing the entire codebase context. This extraction provides sufficient semantic understanding while minimizing processing time and computational overhead.
Solution Approach 2:
The codebase context is segmented into discrete, meaningful units (symbol graphs and code skeletons) rather than providing raw, unprocessed code. This segmentation organizes information efficiently, allowing the AI model to process only the essential structural and semantic relationships needed for accurate code generation.
Data Source
Figure 1
Figure 2
Figure 3
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.