US 12,406,072 B2
Code-change based prompt for code repair
Aaron Yue-Chiu Chan, Provo, UT (US); Anant Kharkar, Huntersville, NC (US); Yevhen Mohylevskyy, Redmond, WA (US); Kalpathy Sitaraman Sivaraman, Redmond, WA (US); Neelakantan Sundaresan, Bellevue, WA (US); and Roshanak Zilouchian Moghaddam, Kirkland, WA (US)
Assigned to Microsoft Technology Licensing, LLC., Redmond, WA (US)
Filed by MICROSOFT TECHNOLOGY LICENSING, LLC., Redmond, WA (US)
Filed on Jun. 2, 2023, as Appl. No. 18/205,470.
Prior Publication US 2024/0403438 A1, Dec. 5, 2024
Int. Cl. G06F 21/57 (2013.01)
CPC G06F 21/577 (2013.01) [G06F 2221/033 (2013.01)] 20 Claims
OG exemplary drawing
 
8. A computer-implemented method, comprising:
accessing a plurality of groups having code changes, wherein a group of the plurality of groups is associated with a particular software vulnerability type, wherein a code change is associated with a vector comprising an embedding of a respective code change and a natural language description of the respective code change, wherein each group of the plurality of groups comprises code changes comprising similar vectors, wherein each group of the plurality of groups comprises a representative code change, wherein the representative code change comprises a closest mean intra-cluster distance to other code changes of the group;
obtaining a source code snippet having the first type of software vulnerability;
selecting one or more code changes from the group associated with the first type of software vulnerability based on a closest distance to the representative code change for the group;
generating an input to a large language model, wherein the input includes the source code snippet having the first type of vulnerability and the one or more code changes;
causing the large language model to generate repair code to correct the first type of software vulnerability, wherein the large language model is given the input; and
obtaining from the large language model the repair code.