Method and system for improving code generation quality of large language model through code guardrails

US2025370721A1 · US · A1

Patent metadata
FieldValue
Publication numberUS-2025370721-A1
Application numberUS-202418675688-A
CountryUS
Kind codeA1
Filing dateMay 28, 2024
Priority dateMay 28, 2024
Publication dateDec 4, 2025
Grant date

How to read this patent

A practical reading order for non-experts. Skip the full description unless you need deep technical detail.

  1. Title

    What the patent document calls the invention.

  2. Abstract

    A short plain-language summary of the technical disclosure.

  3. Assignees and inventors

    Who owns or filed the patent and who is credited as inventor.

  4. Key dates

    Filing, priority, publication, and grant dates set the timeline.

  5. First independent claim

    The legal scope of protection — read this for what is actually claimed.

  6. CPC / IPC classifications

    Technology tags used to group this patent with similar filings.

  7. Citations and related patents

    Prior art links and similar publications in this corpus.

Abstract

Official abstract text for this publication.

A method and a system for improving a quality of software code generated by using a large language model (LLM) via code guardrails are provided. The method includes: receiving a request for performing a task; providing the request as an input to the LLM; receiving, from the LLM, a first set of executable code that is intended to be usable for performing the task; automatically executing the first set of executable code in an environment that includes at least one guardrail component that is configured to detect errors; detecting at least one error, such as a hallucination error, based on a result of the execution; determining at least one feedback item based on the at least one error; and prompting the LLM to generate a second set of executable code based on the request, the first set of executable code, and the at least one feedback item.

First claim

Opening claim text (preview).

What is claimed is: 1 . A method for improving a quality of software code, the method being implemented by at least one processor, the method comprising: receiving, by the at least one processor, a first request for performing a first task; providing, by the at least one processor as an input to a first large language model (LLM), the first request; receiving, by the at least one processor from the first LLM, a first set of executable code that is intended to be usable for performing the first task; automatically executing the first set of executable code in an environment that includes at least one guardrail component that is configured to detect at least one type of error; detecting at least one error based on a result of the executing; determining at least one feedback item based on the at least one error; and prompting the first LLM to generate a second set of executable code based on the first request, the first set of executable code, and the at least one feedback item. 2 . The method of claim 1 , wherein the at least one error includes at least one from among a hallucination error, an application programming interface (API) type error, an execution error, a runtime error, a syntax error, and a return none error that relates to a failure to generate a return to a call. 3 . The method of claim 1 , wherein the hallucination error includes at least one from among a first hallucination error that relates to a tool that is usable for performing the first task, a second hallucination error that relates to a parameter that is usable for performing the first task, a third hallucination error that relates to a context of the first task, and a fourth hallucination error that relates to a semantic meaning of a variable that is usable for performing the first task. 4 . The method of claim 1 , wherein the at least one feedback item includes an identification of a specific line of code from within the first set of executable code that is indicated as causing the at least one error. 5 . The method of claim 1 , further comprising providing, as an input for training the first LLM, a third set of executable code and information indicating that the third set of executable code is effective for performing a task that corresponds to the third set of executable code. 6 . The method of claim 5 , further comprising providing, as an additional input for training the first LLM, a fourth set of executable code and information indicating that the fourth set of executable code is not effective for performing a task that corresponds to the fourth set of executable code. 7 . The method of claim 1 , further comprising: automatically executing the second set of executable code in the environment that includes the at least one guardrail component; detecting at least one additional error based on a result of the executing of the second set of executable code; determining at least one additional feedback item based on the at least one additional error; and prompting the first LLM to generate a third set of executable code based on the first request, the first set of executable code, the second set of executable code, the at least one feedback item, and the at least one additional feedback item. 8 . The method of claim 1 , further comprising: providing the second set of executable code as an input to a second LLM; and receiving, from the second LLM, information that relates to an evaluation of a suitability of the second set of executable code with respect to performing the first task. 9 . The method of claim 8 , wherein the information received from the second LLM includes at least one from among information that relates to whether the second set of executable code calls proper application programming interfaces (APIs) for performing the first task and an indication of an optimality of the second set of executable code. 10 . A computing apparatus for improving a quality of software code, the computing apparatus comprising: a processor; a memory; and a communication interface coupled to each of the processor, the memory, and the display, wherein the processor is configured to: receive, via the communication interface, a first request for performing a first task; provide, as an input to a first large language model (LLM), the first request; receive, from the first LLM via the communication interface, a first set of executable code that is intended to be usable for performing the first task; automatically execute the first set of executable code in an environment that includes at least one guardrail component that is configured to detect at least one type of error; detect at least one error based on a result of the executing; determine at least one feedback item based on the at least one error; and prompt the first LLM to generate a second set of executable code based on the first request, the first set of executable code, and the at least one feedback item. 11 . The computing apparatus of claim 10 , wherein the at least one error includes at least one from among a hallucination error, an application programming interface (API) type error, an execution error, a runtime error, a syntax error, and a return none error that relates to a failure to generate a return to a call. 12 . The computing apparatus of claim 10 , wherein the hallucination error includes at least one from among a first hallucination error that relates to a tool that is usable for performing the first task, a second hallucination error that relates to a parameter that is usable for performing the first task, a third hallucination error that relates to a context of the first task, and a fourth hallucination error that relates to a semantic meaning of a variable that is usable for performing the first task. 13 . The computing apparatus of claim 10 , wherein the at least one feedback item includes an identification of a specific line of code from within the first set of executable code that is indicated as causing the at least one error. 14 . The computing apparatus of claim 10 , wherein the processor is further configured to provide, as an input for training the first LLM, a third set of executable code and information indicating that the third set of executable code is effective for performing a task that corresponds to the third set of executable code. 15 . The computing apparatus of claim 14 , wherein the processor is further configured to provide, as an additional input for training the first LLM, a fourth set of executable code and information indicating that the fourth set of executable code is not effective for performing a task that corresponds to the fourth set of executable code. 16 . The computing apparatus of claim 10 , wherein the processor is further configured to: automatically execute the second set of executable code in the environment that includes the at least one guardrail component; detect at least one additional error based on a result of the executing of the second set of executable code; determine at least one additional feedback item based on the at least one additional error; and prompt the first LLM to generate a third set of executable code based on the first request, the first set of executable code, the second set of executable code, the at least one feedback item, and the at least one additional feedback item. 17 . The computing apparatus of claim 10 , wherein the processor is further configured to: provide the second set of executable code as an input to a second LLM; and receive, from the second LLM via the communication interface, information th

Assignees

Inventors

Classifications

  • G06F8/30Primary

    Creation or generation of source code · CPC title

Patent family

Related publications grouped by family.

External sources

Frequently asked questions

Answers are generated from the same data shown on this page.

What does patent US2025370721A1 cover?
A method and a system for improving a quality of software code generated by using a large language model (LLM) via code guardrails are provided. The method includes: receiving a request for performing a task; providing the request as an input to the LLM; receiving, from the LLM, a first set of executable code that is intended to be usable for performing the task; automatically executing the fir…
Who is the assignee on this patent?
Jpmorgan Chase Bank Na
What technology area does this patent fall under?
Primary CPC classification G06F8/30. Mapped technology areas include Physics.
When was this patent published?
Publication date Thu Dec 04 2025 00:00:00 GMT+0000 (Coordinated Universal Time) (A1). Legal status and post-grant events are not shown on this page.
What related patents are in patentsdb?
We list 8 related publications on this page (citations in our corpus or others sharing the same primary CPC).