Context-Aware Agent Enhances LLM Code Generation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing generative machine learning models, such as large language models, are unable to understand individual organizations' policies, standards, and controls, resulting in generated source code that may not align with organizational requirements or be aware of global application contexts.
Innovation Solution
A method and system that utilize a generative platform to receive a project specification, determine a set of tasks, and execute these tasks with corresponding agents. Each agent is context-aware and enhances output from a general large language model with context information, ensuring compliance with organizational policies and standards.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If a general large language model is used to generate source code, then the code generation speed and efficiency are improved, but the code does not align with organizational policies, standards, and controls
Solution Approach 1:
The patent introduces an intermediary system between the general LLM and the final code output. This intermediary includes context providers that supply organizational policies, standards, and controls, and a code reviewer that evaluates and refines the generated code to ensure compliance. The LLM generates code quickly, then the intermediary processes it to meet organizational requirements, thus maintaining both speed and compliance.
Solution Approach 2:
The code generation process is segmented into distinct stages: initial code generation by the LLM, context provision from organizational sources, code review against standards, and iterative refinement. Each segment handles a specific aspect of the process, allowing the system to maintain high generation speed while ensuring compliance through specialized review and refinement stages.
2Device complexity
If a general large language model generates source code without context information, then the generation process is simple and fast, but the code lacks awareness of global application context
Solution Approach 1:
The system performs preliminary actions by collecting and preparing context information from multiple sources (organizational policies, project requirements, technical standards) before the code generation process begins. This pre-prepared context is then fed to the LLM along with the generation prompt, ensuring the model has all necessary contextual information upfront without complicating the generation process itself.
Solution Approach 2:
The patent implements a feedback mechanism where the generated code is reviewed against the provided context information, and corrections or refinements are fed back to the LLM for iterative improvement. This feedback loop ensures the code develops contextual awareness while keeping the overall process manageable through automated evaluation and refinement cycles.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
In some aspects, the techniques described herein relate to a method including: receiving, at a generative platform, a project specification; determining, by the generative platform and based on the project specification, a set of tasks; executing each task in the set of tasks with a corresponding agent, wherein the executing includes: determining context information; receiving output from a general large language model; enhancing the output from the general large language model with the context information; and saving the output to an integrated development environment.