# US 2026/0064561 A1 · Automated source code generation and optimization using large language models and reinforcement learning

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2026/0064561 A1
- Document ID: US20260064561A1
- Status: Published application
- Kind: A1
- Application number: 18/825,007
- Filed: 2024-09-05
- Published: 2026-03-05
- Earliest claimed: 2024-09-05
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Bo Wen; Chen Wang; Huamin Chen
- Web page: https://patentgrep.com/patent/US20260064561A1

## CPC

- G06F 11/3466: {Performance evaluation by tracing or monitoring}
- G06F 8/443: {Optimisation}
- G06F 8/77: Software metrics
- G06F 11/3428: {Benchmarking}
- G06F 11/3688: {for test execution, e.g. scheduling of test suites}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Examples described herein provide a computer-implemented method for automated source code generation and optimization. The method includes receiving goals and parameters via a user interface, such as performance, resource utilization, functionality, security, and sustainability metrics. An initial source code is generated by a large language model based on these goals and parameters, and then compiled into an executable program. The executable program is benchmarked to obtain results, including performance, resource utilization, functionality, security, and sustainability metrics. These benchmarking results are compared to the predefined goals and parameters. If the benchmarking results meet all the specified metrics, the source code and benchmarking results are output via the user interface.

## Claims

### Claim 1

A computer-implemented method for automated source code generation and optimization, the method comprising:
receiving, via a user interface, goals and parameters for a source code generation process, wherein the goals and parameters include at least one of performance metrics, resource utilization metrics, functionality metrics, security metrics, or sustainability metrics;
obtaining, from a large language model (LLM), an initial source code based on the goals and parameters;
compiling the initial source code into an executable program;
benchmarking the executable program to obtain benchmarking results, wherein the benchmarking results include at least one of performance results, resource utilization results, functionality results, security results, or sustainability results;
comparing the benchmarking results to the at least one of performance metrics, resource utilization metrics, functionality metrics, security metrics, or sustainability metrics; and
based on a determination that the benchmarking results meet all of the least one of performance metrics, outputting, via the user interface, the source code and the benchmarking results.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, further comprising:
based on a determination that the benchmarking results does not meet all of the least one of performance metrics, resource utilization metrics, functionality metrics, security metrics, and sustainability metrics, providing the source code and benchmarking results to the LLM to obtain a revised source code; and
iteratively compiling, benchmarking and comparing the revised source code until the benchmarking results meet all of the least one of performance metrics, resource utilization metrics, functionality metrics, security metrics, and sustainability metrics.

### Claim 3 (depends on 2)

The computer-implemented method of claim 2, further comprising terminating the iterative compiling, benchmarking and comparing steps based on a determination that a termination condition has been reached.

### Claim 4 (depends on 3)

The computer-implemented method of claim 3, wherein the termination condition includes at least one of reaching a maximum number of iterations, meeting convergence criteria, time constraints, resource constraints, manual termination by the user, error thresholds, or maximum cost constraints.

### Claim 5 (depends on 3)

The computer-implemented method of claim 3, further comprising outputting a selected version of the source code to the user, wherein the selected version is identified based on the comparison of the benchmarking results to the at least one of performance metrics, resource utilization metrics, functionality metrics, security metrics, or sustainability metrics.

### Claim 6 (depends on 1)

The computer-implemented method of claim 1, further comprising obtaining one or more test cases from the LLM.

### Claim 7 (depends on 6)

The computer-implemented method of claim 6, wherein benchmarking the executable program to obtain benchmarking results includes executing the one or more test cases using the executable program.

### Claim 8 (depends on 1)

The computer-implemented method of claim 1, further comprising providing one or more prompts to the LLM based on the goal and parameters and based on a set of templates stored in a software development environment.

### Claim 9

A system comprising:
a memory comprising computer readable instructions; and
a processing device for executing the computer readable instructions, the computer readable instructions controlling the processing device to perform operations comprising:
receiving, via a user interface, goals and parameters for a source code generation process, wherein the goals and parameters include at least one of performance metrics, resource utilization metrics, functionality metrics, security metrics, or sustainability metrics;
obtaining, from a large language model (LLM), an initial source code based on the goals and parameters;
compiling the initial source code into an executable program;
benchmarking the executable program to obtain benchmarking results, wherein the benchmarking results include at least one of performance results, resource utilization results, functionality results, security results, or sustainability results;
comparing the benchmarking results to the at least one of performance metrics, resource utilization metrics, functionality metrics, security metrics, or sustainability metrics; and
based on a determination that the benchmarking results meet all of the least one of performance metrics, outputting, via the user interface, the source code and the benchmarking results.

### Claim 10 (depends on 9)

The system of claim 9, wherein the operations further comprise:
based on a determination that the benchmarking results does not meet all of the least one of performance metrics, resource utilization metrics, functionality metrics, security metrics, and sustainability metrics, providing the source code and benchmarking results to the LLM to obtain a revised source code; and
iteratively compiling, benchmarking and comparing the revised source code until the benchmarking results meet all of the least one of performance metrics, resource utilization metrics, functionality metrics, security metrics, and sustainability metrics.

### Claim 11 (depends on 10)

The system of claim 10, wherein the operations further comprise terminating the iterative compiling, benchmarking and comparing steps based on a determination that a termination condition has been reached.

### Claim 12 (depends on 11)

The system of claim 11, wherein the termination condition includes at least one of reaching a maximum number of iterations, meeting convergence criteria, time constraints, resource constraints, manual termination by the user, error thresholds, or maximum cost constraints.

### Claim 13 (depends on 11)

The system of claim 11, wherein the operations further comprise outputting a selected version of the source code to the user, wherein the selected version is identified based on the comparison of the benchmarking results to the at least one of performance metrics, resource utilization metrics, functionality metrics, security metrics, or sustainability metrics.

### Claim 14 (depends on 9)

The system of claim 9, wherein the operations further comprise obtaining one or more test cases from the LLM.

### Claim 15 (depends on 14)

The system of claim 14, wherein benchmarking the executable program to obtain benchmarking results includes executing the one or more test cases using the executable program.

### Claim 16 (depends on 9)

The system of claim 9, wherein the operations further comprise providing one or more prompts to the LLM based on the goal and parameters and based on a set of templates stored in a software development environment.

### Claim 17

A computer program product for circuit design optimization, the computer program product comprising:
a set of one or more computer-readable storage media;
program instructions, collectively stored in the set of one or more storage media, for causing a processor set to perform the following computer operations:
receiving, via a user interface, goals and parameters for a source code generation process, wherein the goals and parameters include at least one of performance metrics, resource utilization metrics, functionality metrics, security metrics, or sustainability metrics;
obtaining, from a large language model (LLM), an initial source code based on the goals and parameters;
compiling the initial source code into an executable program;
benchmarking the executable program to obtain benchmarking results, wherein the benchmarking results include at least one of performance results, resource utilization results, functionality results, security results, or sustainability results;
comparing the benchmarking results to the at least one of performance metrics, resource utilization metrics, functionality metrics, security metrics, or sustainability metrics; and
based on a determination that the benchmarking results meet all of the least one of performance metrics, outputting, via the user interface, the source code and the benchmarking results.

### Claim 18 (depends on 17)

The computer program product of claim 17, wherein the operations further comprise:
based on a determination that the benchmarking results does not meet all of the least one of performance metrics, resource utilization metrics, functionality metrics, security metrics, and sustainability metrics, providing the source code and benchmarking results to the LLM to obtain a revised source code; and
iteratively compiling, benchmarking and comparing the revised source code until the benchmarking results meet all of the least one of performance metrics, resource utilization metrics, functionality metrics, security metrics, and sustainability metrics.

### Claim 19 (depends on 18)

The computer program product of claim 18, wherein the operations further comprise terminating the iterative compiling, benchmarking and comparing steps based on a determination that a termination condition has been reached.

### Claim 20 (depends on 19)

The computer program product of claim 19, wherein the termination condition includes at least one of reaching a maximum number of iterations, meeting convergence criteria, time constraints, resource constraints, manual termination by the user, error thresholds, or maximum cost constraints.
