API-Based LLM Code Evaluation for Accuracy and Robustness

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

The evaluation of software code generated by large language models (LLMs) is challenging due to the difficulty in assessing the impact of prompt variations on code quality, with no standard method to determine accuracy, robustness, and efficiency, which is crucial for ensuring reliable code execution.

Innovation Solution

A method and system for evaluating code quality by receiving instructions, generating code using an LLM, and executing it to assess accuracy, robustness, and consistency through multiple runs, using an API-based evaluation dataset.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If LLM is used to generate code quickly, then code generation speed is improved, but code quality reliability deteriorates

Engineering Contradiction:
Improvecode generation speedVSAvoidcode quality reliability
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The patent introduces an evaluation system as an intermediary between the LLM code generator and the final code execution. This evaluation system acts as a mediator that assesses generated code across multiple dimensions (accuracy, robustness, consistency) before deployment, thereby maintaining fast generation speeds while ensuring code quality reliability through systematic evaluation.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent implements a feedback mechanism where the evaluation results of generated code are fed back into the system. By evaluating code quality across multiple runs and dimensions, the system generates feedback that can be used to improve future code generation, thus resolving the contradiction between speed and reliability through continuous improvement based on evaluation data.

Inventive Principle:
Principle #23Feedback

2Reliability

If prompt variations are made to improve code quality, then code quality may be improved, but evaluation complexity increases

Engineering Contradiction:
Improvecode qualityVSAvoidevaluation complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent segments the code quality evaluation into three distinct dimensions: accuracy evaluation (whether code runs and produces correct output), robustness evaluation (performance across different difficulty levels and prompt variations), and consistency evaluation (results across multiple runs). This segmentation allows systematic evaluation of code quality without overwhelming complexity, as each dimension can be assessed independently with specific criteria.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent changes evaluation parameters by establishing specific measurable criteria for each evaluation dimension. Instead of vague quality assessments, the system uses concrete parameters such as execution success, output correctness, performance across difficulty levels, and result consistency across multiple runs. This parameterization makes the evaluation process systematic and manageable.

Inventive Principle:
Principle #35Parameter changes

3Measurement precision

If multiple evaluation dimensions are assessed, then code quality evaluation comprehensiveness is improved, but evaluation time increases

Engineering Contradiction:
Improveevaluation comprehensivenessVSAvoidevaluation time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The patent applies partial action by evaluating code across multiple dimensions but using a structured approach that doesn't require exhaustive testing in all areas simultaneously. The evaluation system assesses accuracy, robustness, and consistency with specific targeted tests for each dimension, providing comprehensive evaluation without requiring excessive time by focusing on key evaluation points for each dimension.

Inventive Principle:
Principle #16Partial or excessive action

Solution Approach 2:

The patent implements periodic action by evaluating code consistency across multiple runs (at least three runs) rather than a single exhaustive evaluation. This periodic approach allows the system to assess code reliability through repeated measurements while managing time efficiently by establishing a minimum number of runs rather than continuous evaluation.

Inventive Principle:
Principle #19Periodic action

Data Source

PatentUS20250298731A1Method and system for evaluation of code generation by large language model
Publication Date: 2025.09.25 JPMORGAN CHASE BANK NA
  • US20250298731A1 patent drawing
  • US20250298731A1 patent drawing
  • US20250298731A1 patent drawing

AI summary

A method and a system for obtaining an evaluation of a quality of software code that is generated by using a large language model (LLM) are provided. The method includes: receiving a set of instructions for performing a task and generating an output; providing, as an input to an LLM, a list of available application programming interfaces (APIs) and the instructions, together with a submission of a request to the LLM to select one API and to generate a set of executable code based on the instructions; receiving, from the LLM, a selection of one API and the set of executable code; executing the set of executable code in order to perform the first task and generate the output; and evaluating an accuracy, a robustness, and/or a consistency of the set of executable code.