# US 12,769,543 B2 · Generative models for refactoring software programs

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

- Number: US 12,769,543 B2
- Document ID: US12769543B2
- Status: Granted
- Kind: B2
- Application number: 19/385,926
- Filed: 2025-11-11
- Published: 2026-03-05
- Granted: 2026-10-20
- Earliest claimed: 2020-02-03
- Assignees: Architecture Technology Corporation
- Applicants: Architecture Technology Corporation
- Inventors: Colleen Kimball; Judson Powers; Jordan C. Bonney; Yuliy Tsank
- Web page: https://patentgrep.com/patent/US12769543B2

## CPC

- G06F 8/72: Code refactoring
- G06F 8/34: Graphical or visual programming
- G06F 8/42: {Syntactic analysis}
- G06F 9/541: {via adapters, e.g. between incompatible applications}
- G06F 11/302: {where the computing system component is a software system}
- G06F 11/3495: {for systems}
- G06F 11/3688: {for test execution, e.g. scheduling of test suites}
- G06N 20/00: Machine learning
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

Presented herein are systems and methods for optimizing legacy source code using generative models. A computing system may generate, for each function of a plurality of functions of a software program, a performance profile comprising a performance attribute during runtime. The computing system may identify, from the plurality of functions of the software program, a function based on the performance attribute of the performance profile for the function being lower than a threshold. The computing system may select first source code of the function for refactoring, responsive to identifying the function. The computing system may provide the first source code of the function to a generative model to determine refactoring opportunities within the first source code. The computing system may generate, based on providing the first source code to the generative model, second source code for the function corresponding to the refactoring opportunities within the first source code.

## Claims

### Claim 1

A computer-implemented method, comprising:
executing, by one or more processors, a performance profiling test on a plurality of functions of a software program during runtime to generate, for each function of the plurality of functions, a performance profile comprising a performance attribute;
identifying, by the one or more processors, from the plurality of functions of the software program, a function based on the performance attribute of the performance profile for the function being lower than a threshold;
selecting, by the one or more processors, for the software program, source code of the function to be refactored, responsive to identifying the function; and
generating, by the one or more processors executing a generative model using as input the source code of the function having the performance attribute lower than the threshold, refactored source code for the function corresponding to at least one of one or more refactoring actions, the refactored source code comprising a modified version of the source code of the function.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
determining, by the one or more processors, based on applying the source code to the generative model, one or more refactoring actions to refactor the source code;
providing, by the one or more processors, for presentation via a user interface, the one or more refactoring actions; and
receiving, by the one or more processors, via the user interface, a selection of a refactoring action from the one or more refactoring actions,
wherein generating the refactored source code further comprises generating the refactored source code corresponding to the refactoring action selected from the one or more refactoring actions.

### Claim 3 (depends on 1)

The method of claim 1, further comprising receiving, by the one or more processors, via a user interface, a configuration indicating one or more refactoring priorities corresponding to one or more performance attributes,
wherein identifying the function further identifying the function based on the refactoring priorities of the configuration and the performance profile.

### Claim 4 (depends on 1)

The method of claim 1, further comprising creating, by the one or more processors, an input prompt for the generative model based on at least a portion of the source code and the performance attribute for the function,
wherein generating the refactored source code further comprises applying the input prompt to the generative model to determine one or more refactoring actions.

### Claim 5 (depends on 1)

The method of claim 1, further comprising generating, by the one or more processors, a syntax tree defining a syntactic structure of the source code,
wherein generating the refactored source code further comprises generating, based on applying the syntax tree to the generative model, a refactored syntax tree corresponding to the refactored source code.

### Claim 6 (depends on 1)

The method of claim 1, further comprising:
identifying, by the one or more processors, based on applying the source code to the generative model, a portion of the source code corresponding to a code violation; and
providing, by the one or more processors, for presentation via a user interface, an identification of the portion of the source code corresponding to the code violation.

### Claim 7 (depends on 1)

The method of claim 1, further comprising:
receiving., by the one or more processors, via a user interface, feedback identifying one or more modifications to the refactored source code; and
updating, by the one or more processors, based on the feedback, generation of the refactored source code by at least one of fine-tuning the generative model or modifying a template defining creation of an input prompt.

### Claim 8 (depends on 1)

The method of claim 1, wherein the generative model is trained using a corpus comprising a third source code of a second function, an identification of a second code violation within the third source code, one or more second refactoring actions for the third source code to address the second code violation, and a second refactored source code for the second function corresponding to at least one of the one or more second refactoring actions.

### Claim 9 (depends on 1)

The method of claim 1, wherein selecting the source code further comprises selecting the source code from a database for the software program responsive to identifying the function associated with the source code based on the performance attribute,
wherein generating the refactored source code further comprises generating the refactored source code to transition the software program to a service-oriented architecture, and further comprising:
storing, by the one or more processors, on the database, the refactored source code to substitute the source code.

### Claim 10

A system, comprising:
one or more processors coupled with memory, configured to:
execute a performance profiling test on a plurality of functions of a software program during runtime to generate, for each function of the plurality of functions, a performance profile comprising a performance attribute during runtime;
identify, from the plurality of functions of the software program, a function based on the performance attribute of the performance profile for the function being lower than a threshold;
select, for the software program, source code of the function to be refactored, responsive to identifying the function; and
generate, executing a generative model using as input, the source code of the function having the performance attribute lower than the threshold, refactored source code for the function corresponding to at least one of one or more refactoring actions, the refactored source code comprising a modified version of the source code of the function.

### Claim 11 (depends on 10)

The system of claim 10, wherein the one or more processors are further configured to:
determine, based on applying the source code to the generative model, one or more refactoring actions to refactor the source code;
provide, for presentation via a user interface, the one or more refactoring actions;
receive, via the user interface, a selection of a refactoring action from the one or more refactoring actions; and
generate the refactored source code corresponding to the refactoring action selected from the one or more refactoring actions.

### Claim 12 (depends on 10)

The system of claim 10, wherein the one or more processors are further configured to:
receive, via a user interface, a configuration indicating one or more refactoring priorities corresponding to one or more performance attributes; and
identify the function based on the refactoring priorities of the configuration and the performance profile.

### Claim 13 (depends on 10)

The system of claim 10, wherein the one or more processors are further configured to:
create an input prompt for the generative model based on at least a portion of the source code and the performance attribute for the function; and
apply the input prompt to the generative model to determine one or more refactoring actions.

### Claim 14 (depends on 10)

The system of claim 10, wherein the one or more processors are further configured to:
generate a syntax tree defining a syntactic structure of the source code; and
generate, based on applying the syntax tree to the generative model, a refactored syntax tree corresponding to the refactored source code.

### Claim 15 (depends on 10)

The system of claim 10, wherein the one or more processors are further configured to
identify, based on applying the source code to the generative model, a portion of the source code corresponding to a code violation; and
provide, for presentation via a user interface, an identification of the portion of the source code corresponding to the code violation.

### Claim 16 (depends on 10)

The system of claim 10, wherein the one or more processors are further configured to
receive, via a user interface, feedback identifying one or more modifications to the refactored source code; and
update, based on the feedback, generation of the refactored source code by at least one of fine-tuning the generative model or modifying a template defining creation of an input prompt.

### Claim 17 (depends on 10)

The system of claim 10, wherein the generative model is trained using a corpus comprising a third source code of a second function, an identification of a second code violation within the third source code, one or more second refactoring actions for the third source code to address the second code violation, and a second refactored source code for the second function corresponding to at least one of the one or more second refactoring actions.

### Claim 18 (depends on 10)

The system of claim 10, wherein the one or more processors are further configured to:
select the source code from a database for the software program, responsive to identifying the function associated with the source code based on the performance attribute;
generate the refactored source code to transition the software program to a service-oriented architecture; and
store, on the database, the refactored source code to substitute the source code.
