hottub.patents
US 12,748,922 B2#3125141 Most CitedActiveUnited States (USPTO)Utility

Deriving heterogenous context for evaluating generated code

0Forward Citations (#3125141 Global)
0.0/yrCitation Velocity (#3125141 Global)
0.00Citation PageRank (#3125141 Global)
23Prior Art Cited
8Claims (1 Indep. · 7 Dep.)
0Drawings / Sheets

Abstract

A method, computer system, and a computer program product for code evaluation are provided. Knowledge bases in first and/or second programming languages are searched to find code and associated natural language explanations that correspond to code generated by a machine learning model. Additionally and/or alternatively, the code generated by the machine learning model undergoes code-to-natural language translation by another machine learning model and text summarization via an additional machine learning model. Machine learning semantic comparison of (A) an original prompt submitted to the first machine learning model to generate the code and (B) a natural language explanation obtained via one or more of the above approaches is performed. The machine learning semantic comparison generates a first semantic correctness score which is presented.

Interactive Citation Constellation Global Citation Ranking

Interactive SVG Citation Constellation renders in Rust/WebAssembly. Prior art cited: 23 · Forward citations: 0.

Claims (8 — 1 Independent, 7 Dependent)

  1. Claim 1Independent Claim

    A computer-implemented method comprising: receiving a first code-generation prompt submitted to a first machine learning model, the first code-generation prompt requesting generation of first code in a first programming language; receiving first code generated by the first machine learning model in response to the first machine learning model receiving the first code-generation prompt; comparing the first code to a first knowledge base built for the first programming language, wherein the first knowledge base comprises sets of paired: code samples written in the first programming language, and natural language descriptions that respectively describe the code samples, wherein the comparing finds: corresponding code of the code samples, and a first natural language explanation of the natural language descriptions associated with the corresponding code, and wherein the comparing comprises comparing code-string of the first code to respective code-strings of the code samples to find a best

  2. Claim 2Depends on #1

    The computer-implemented method of claim 1, further comprising: receiving a second code-generation prompt submitted to the first machine learning model the second code-generation prompt requesting generation of second code in the first programming language; receiving the second code generated by the first machine learning model in response to the first machine learning model receiving the second code-generation prompt; comparing the second code to the first knowledge base; and in response to the comparison of the second code to the first knowledge base not finding code in the first knowledge base that corresponds to the second code, comparing the second code to a second knowledge base built for a second programming language to find corresponding code and a natural language explanation associated with the corresponding code, the second programming language being different from the first programming language.

  3. Claim 3Depends on #2

    The computer-implemented method of claim 2, wherein the comparison of the second code to the second knowledge base comprises: generating a first embedding from the second code; generating additional embeddings from code from the second knowledge base; comparing the first embedding to the additional embeddings, respectively, to produce similarity rankings to find a best match; and forwarding the natural language explanation that corresponds to the corresponding code that corresponds to the best match of the additional embeddings.

  4. Claim 4Depends on #3

    The computer-implemented method of claim 3, wherein a similarity score for the best match is above a pre-determined threshold value.

  5. Claim 5Depends on #3

    The computer-implemented method of claim 3, further comprising: performing, via the second machine learning model, semantic comparison of the forwarded natural language explanation to the second code-generation prompt to generate a second semantic correctness score; and presenting the second semantic correctness score.

  6. Claim 6Depends on #1

    The computer-implemented method of claim 1, further comprising: receiving a third code-generation prompt submitted to the first machine learning model, the third code-generation prompt requesting generation of the first code in the first programming language; receiving third code generated by the first machine learning model in response to the first machine learning model receiving the third code-generation prompt; inputting the third code into a third machine learning model so that the third machine learning model generates a first set of natural language explanations that describe the third code; inputting the first set of natural language explanations into a fourth machine learning model so that the third machine learning model generates a first text summarization of the first set of natural language explanations; performing, via the second machine learning model, semantic comparison of the first text summarization to the third code-generation prompt to generate a third semantic cor

  7. Claim 7Depends on #1

    The computer-implemented method of claim 1, further comprising presenting the generated first code to a subject matter expert for at least one of verification and enhancement, wherein the presenting is performed in response to the first semantic correctness score passing a test with a pre-determined threshold value.

  8. Claim 8Depends on #7

    The computer-implemented method of claim 7, further comprising updating the first knowledge base based on the at least one of the verification and the enhancement.

Technical Overview & Description

The present invention relates generally to the fields of generative artificial intelligence, software code evaluation, and machine learning and artificial intelligence for software code evaluation. SUMMARY According to one exemplary embodiment, a computer-implemented method is provided. A first code-generation prompt submitted to a first machine learning model is received. The first code-generation prompt requests generation of the first code in a first programming language. First code generated by the first machine learning model in response to the first machine learning model receiving the first code-generation prompt is received. The first code is compared to a first knowledge base built for the first programming language to find corresponding code and a first natural language explanation associated with the corresponding code. A second machine learning model performs semantic comparison of the first natural language explanation to the first code-generation prompt to generate a first semantic correctness score. The first semantic correctness score is presented. According to another exemplary embodiment, a computer program product is provided that includes a set of one or more computer-readable storage media and program instructions, collectively stored in the set of one or more computer-readable storage media. The program instructions cause a processor set to perform computer operations. A first code-generation prompt submitted to a first machine learning model is received. The first code-generation prompt requests generation of the first code in a first programming language. First code generated by the first machine learning model in response to the first machine learning model receiving the first code-generation prompt is received. The first code is compared to a first knowledge base built for a second programming language to find corresponding code and a first natural language explanation associated with the corresponding code. The second programming language

Cited By — Indexed Forward Citations (0 of 0 total)

No indexed citing patents in this generation yet. Ingest USPTO/PatentsView bulk citation tables via patents-ingest to expand the local forward citation graph.

Non-Patent Literature (10)

  • Ren, Shuo, et al.
  • “
  • Codebleu: a method for automatic evaluation of code synthesis.
  • ”
  • arXiv preprint arXiv:2009.10297 (2020).
  • Shin, Jiho, et al.
  • “
  • The good, the bad, and the missing: Neural code generation for machine learning tasks.
  • ”
  • ACM Transactions on Software Engineering and Methodology 33.2 (2023): 1-24.