Context-Aware Agent Enhances LLM Code Generation

Resolve Bottlenecks,
Find Innovative Solutions
Generate 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

VSEngineering 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

Engineering Contradiction:
Improvecode generation speedVSAvoidcode compliance with organizational standards
Core Design Contradiction:
ProductivityVSManufacturing precision

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.

Inventive Principle:
Principle #24Intermediary (Mediator)

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.

Inventive Principle:
Principle #1Segmentation

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

Engineering Contradiction:
Improvegeneration process complexityVSAvoidcode contextual awareness
Core Design Contradiction:
Device complexityVSReliability

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.

Inventive Principle:
Principle #10Preliminary action

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.

Inventive Principle:
Principle #23Feedback

Data Source

PatentEP4495758A1Systems and methods for automated application and platform generation using large language models and context information
Publication Date: 2025.01.22 JPMORGAN CHASE BANK NA
  • EP4495758A1 patent drawingFigure 1
  • EP4495758A1 patent drawingFigure 2
  • EP4495758A1 patent drawingFigure 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.