Optimized code summarization using artificial intelligence

By using a machine learning model to enforce code entity coverage preferences and budgets, the system generates comprehensive and readable code summaries, addressing the inefficiencies of existing AI models and improving application maintainability.

US20260377177A1Pending Publication Date: 2026-11-26INTERNATIONAL BUSINESS MACHINE CORPORATION
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
US19/214513
Authority / Receiving Office
US · United States
Patent Type
Applications(United States)
Current Assignee / Owner
Filing Date
2025-05-21
Publication Date
2026-11-26

AI Technical Summary

Technical Problem

Existing generative AI models, such as large language models (LLMs), fail to allocate sufficient token resources to specific sections of code summaries, leading to incomplete or sub-optimal summaries that miss important program information due to a lack of understanding of code entity importance and section boundaries, resulting in reduced maintainability of computer applications.

Method used

A system and method that uses a machine learning model to learn a code entity coverage preference and summary budget, iteratively generating natural language summaries while enforcing these constraints through guidance templates and budget flags to ensure comprehensive and readable code summaries.

Benefits of technology

Ensures that code summaries contain all relevant information with sufficient detail, improving maintainability by allocating resources effectively to ensure readability and completeness, thus enhancing application maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure US20260377177A1-D00000_ABST
    Figure US20260377177A1-D00000_ABST
Patent Text Reader

Abstract

Systems and methods are provided for optimized code summarization using artificial intelligence. A code entity coverage preference for sections within a program code summary can be learned using a machine learning model. A code summary budget based on a type and importance of the sections can be identified by the machine learning model by utilizing the code entity coverage preference. Natural language (NL) summaries of the program code can be iteratively generated, by the machine learning model, based on guidance templates while enforcing the code summary budget by, generating the guidance templates by identifying code entities within the NL summaries based on the code entity coverage preference, generating a budget flag by comparing a computed budget score for the NL summaries with the code summary budget, and updating the NL summaries based on the budget flag and the code entity coverage preference.
Need to check novelty before this filing date? Find Prior Art

Description

BACKGROUND

[0001] The present invention generally relates to generating computer code summaries using artificial intelligence, and more particularly to optimized code summarization using artificial intelligence.

[0002] Application maintenance enables software providers to ensure reliability and robustness of deployed computer applications. Customer satisfaction is directly influenced by their perception of how the application performs which is dependent on how the application is maintained. Ease of application maintenance for software providers ensures customer satisfaction. However, ease of application maintenance is tied to how the application is programmed. It is impractical to expect that the same team of programmers will maintain the application indefinitely. Thus, the readability of program code is key to ease of maintenance for different teams of programmers.

[0003] However, code intricacies (e.g., program flow, variable and method dependencies, external dependencies, etc.) cannot be discerned from the code itself and even subject experts, including programmers of the code themselves, rely on code documentation to discern them. This presents an issue when the documentation is lacking or missing as it becomes impossible to maintain a deployed application when customers expect fast responses and solutions to vulnerabilities, bugs, etc.SUMMARY

[0004] In accordance with an embodiment of the present invention, a method is provided including, learning a code entity coverage preference for sections within a program code summary using a machine learning model, identifying a code summary budget based on a type and importance of the sections by utilizing the code entity coverage preference, iteratively generating, by the machine learning model, natural language (NL) summaries of the sections based on guidance templates while enforcing the code summary budget by, generating the guidance templates by identifying code entities within the NL summaries based on the code entity coverage preference, generating a budget flag by comparing a computed budget score for the NL summaries with the code summary budget, and updating the NL summaries based on the budget flag and the code entity coverage preference.

[0005] In accordance with another embodiment of the present invention, a computer system is provided including, a processor set, one or more computer-readable storage media, and program instructions stored on the one or more computer-readable storage media to cause the processor set to perform operations having, learning a code entity coverage preference for sections within a program code summary using a machine learning model, identifying a code summary budget based on a type and importance of the sections by utilizing the code entity coverage preference, iteratively generating, by the machine learning model, natural language (NL) summaries of the sections based on guidance templates while enforcing the code summary budget by, generating the guidance templates by identifying code entities within the NL summaries based on the code entity coverage preference, generating a budget flag by comparing a computed budget score for the NL summaries with the code summary budget, and updating the NL summaries based on the budget flag and the code entity coverage preference.

[0006] In accordance with yet another embodiment of the present invention, a computer program product is provided including, one or more computer-readable storage media, and program instructions stored on the one or more computer-readable storage media to perform operations having, learning a code entity coverage preference for sections within a program code summary using a machine learning model, identifying a code summary budget based on a type and importance of the sections by utilizing the code entity coverage preference, iteratively generating, by the machine learning model, natural language (NL) summaries of the sections based on guidance templates while enforcing the code summary budget by, generating the guidance templates by identifying code entities within the NL summaries based on the code entity coverage preference, generating a budget flag by comparing a computed budget score for the NL summaries with the code summary budget, and updating the NL summaries based on the budget flag and the code entity coverage preference.

[0007] These and other features and advantages will become apparent from the following detailed description of illustrative embodiments thereof, which is to be read in connection with the accompanying drawings.BRIEF DESCRIPTION OF THE DRAWINGS

[0008] The following description will provide details of preferred embodiments with reference to the following figures wherein:

[0009] FIG. 1 is a flow diagram showing a high-level overview of a method for optimized code summarization using artificial intelligence, in accordance with an embodiment of the present invention;

[0010] FIG. 2 is a block diagram showing a method of determining the code entity coverage preference and code summary budget based on a code snippet, in accordance with an embodiment of the present invention;

[0011] FIG. 3 is a block diagram showing a system that implements practical applications for optimized code summarization using artificial intelligence, in accordance with an embodiment of the present invention;

[0012] FIG. 4 is a block diagram showing a computer system for optimized code summarization using artificial intelligence, in accordance with an embodiment of the present invention;

[0013] FIG. 5 is a block diagram showing hardware and software components of a system for optimized code summarization using artificial intelligence, in accordance with an embodiment of the present invention; and

[0014] FIG. 6 is a block diagram showing artificial neural networks for optimized code summarization using artificial intelligence, in accordance with an embodiment of the present invention.DETAILED DESCRIPTION

[0015] In accordance with embodiments of the present invention, systems and methods are provided for optimized code summarization using artificial intelligence.

[0016] In the present embodiments, a code entity coverage preference for sections within a program code summary can be learned using a machine learning model. A code summary budget based on a type and importance of the sections can be identified by the machine learning model by utilizing the code entity coverage preference. Natural language (NL) summaries of the program code can be iteratively generated, by the machine learning model, based on guidance templates while enforcing the code summary budget by, generating the guidance templates by identifying code entities within the NL summaries based on the code entity coverage preference, generating a budget flag by comparing a computed budget score for the NL summaries with the code summary budget, and updating the NL summaries based on the budget flag and the code entity coverage preference.

[0017] NL summaries for the program code can refer to a description of program code written in natural language which can include program logic, methods, variables, etc. A good NL summary can contain diverse information about the code snippet in sufficient detail that is understandable to novice and expert developers. Subject matter experts (SMEs) can identify templates that will be beneficial for their target users in the domain. However, current generative artificial intelligence (AI) models such as large language models (LLMs) do not fully understand this and may not allocate sufficient token resources to specific section or aspect explanation of code summaries.

[0018] Because of this lack of understanding, program information can be lost due to a code summary budget (e.g., allotted number of words / sentences to a code snippet). The majority of the code summary budget is spent in listing out records in the program which leaves less allocation for sections that covers the functional behavior of the program. As a result, a generated summary can miss information from the program code relevant to the understanding of programmers.

[0019] Prompting based approaches do not enforce limitations that summaries contain all relevant information with sufficient detail at inference time. Most approaches do not understand the importance of code entities (e.g., variables, methods, code purpose, program logic, code snippets, etc.) at section level or program code level boundaries. These approaches also cannot deterministically enforce boundaries between different sections that cover different aspects of program.

[0020] Additionally, generated code summaries, such as summaries for input or output of a section, may have more budget allocated than desired and leave less budget for the functional summary. Moreover, application level summarization may miss out program methods due to the broad scope of the summarization task.

[0021] Generative models, such as LLMs, are not trained for identifying and enforcing budgets while covering primary information, e.g., method-level coverage in code summaries. As a result, generative models produce incomplete or sub-optimal code summaries. For example, program flow details, such as methods in the middle of the program, can be skipped, unintelligible summaries can arise if sentences are prematurely stopped in the middle, and irrelevant sentences can be formed at the end of the summary.

[0022] To resolve these issues, the present embodiments provide a system and method for allocating and enforcing a code summary budget for identified entities as per template in the generated NL summary. By allocating and enforcing a code summary budget for the code summaries, readability of the code summaries are ensured which directly affects the maintainability of the computer application.

[0023] Exemplary applications / uses to which the present invention can be applied include, but are not limited to: program code understanding, code question and answering, code assistants to improve developer productivity, computer application maintenance, network system maintenance (e.g., through the application that utilizes the network), etc.

[0024] Referring now to the drawings in which like numerals represent the same or similar elements and initially to FIG. 1, a flow diagram showing a high-level overview of a method for optimized code summarization using artificial intelligence, in accordance with an embodiment of the present invention.

[0025] In an embodiment, a code entity coverage preference for sections within a program code summary can be learned using a machine learning model. A code summary budget based on a type and importance of the sections can be identified by the machine learning model by utilizing the code entity coverage preference. Natural language (NL) summaries of the program code can be iteratively generated, by the machine learning model, based on guidance templates while enforcing the code summary budget by, generating the guidance templates by identifying code entities within the NL summaries based on the code entity coverage preference, generating a budget flag by comparing a computed budget score for the NL summaries with the code summary budget, and updating the NL summaries based on the budget flag and the code entity coverage preference.

[0026] In block 110, code entity coverage preference for sections within a program code summary can be learned using a machine learning model.

[0027] The code entity coverage preference can refer to a decision-making entity's inclination that an entity within a section of a program code can be covered by a program code summary. The code entity coverage preference can include a ranking of the entities to be summarized. The code entity coverage preference can be learned by a machine learning model based on at least the following: user input, program analysis, subject matter expert (SME) domain information, etc.

[0028] The program code summary is a text written in natural language that describes syntactic (e.g., how the code are structured and written) and semantic information (e.g., how the code functions and behaves) of the sections. The program code summary can be obtained from past NL summaries generated for the program code.

[0029] User input can include boundaries of the sections to be processed within a prompt used to instruct the machine learning model that generates the NL summaries.

[0030] Program analysis can include ranking methods that can be based on cyclomatic complexity. Program analysis can identify code aspects like central code entities and dependencies. The cyclomatic complexity can quantify the complexity of a program code based on the number of linearly independent paths through the code.

[0031] The SME domain information can include data based on a ranking of control structures (e.g., if, switch, end, loops, etc.) in the code. The SME domain information can include guidance of SMEs based on past experience and client interaction that can be used to identify factors for optimal budget allocation for code types.

[0032] A code template can be learned by the machine learning model to identify the semantic and syntactic information of the program code. The code template can be utilized to generate code summaries for the program code. The code template can also be utilized to generate program code snippets based on an instruction code provided.

[0033] The machine learning model can include frameworks trained for natural language processing such as recurrent neural networks, long short-term memory, transformers, etc. The machine learning model can be trained for the domain of computer program code. In another embodiment, the machine learning model can include large language models (LLM) such as GPT™, BERT™, etc.

[0034] The machine learning model can learn the code entity coverage preference based on rule-based or statistical-based methods. For rule-based methods, predefined rules can be utilized. For example, A rule prioritizing database calls can proceed with determining that entities (e.g., function calls, objects, variables, etc.) related to a database are preferred. For statistical-based methods, a statistic (e.g., mean, proportion, etc.) of the entities can computed. For example, the number of lines containing a variable compared with other variables can be utilized.

[0035] In block 120, a code summary budget based on a type and importance of the sections can be identified by the machine learning model by utilizing the code entity coverage preference.

[0036] The code summary budget can refer to the amount of text that is allotted for summaries of sections. The code summary budget can be defined as a function of code type and code importance.

[0037] Code type can refer to the kind of code used. For example, function calls for a database can have the code type “database.” Code importance can refer a metric that can be used to quantify the ranking of preference of a particular code type. For example, for database calls, code importance can be calculated as a function of the number of reads and writes. For virtual storage access method (VSAM), importance can be a function of the number of accesses of data read or written to the file.

[0038] The code type and code importance can be obtained from the code entity coverage preference.

[0039] For each section Si (e.g., i is the current section), a code summary budget B(Si) can be identified as a function of expected code entities, code types, code importance and program complexity metrics such as the number of program paths, cyclomatic complexity, data access complexity etc., such that Σ B(Si)<=Total_Summary_Budget. The total summary budget can be a predefined score that considers the size of the code, the capabilities of the machine learning model, the user preferences, etc.

[0040] In an embodiment, the code summary budget can computed as:B(Si)=αi*D+βi*F+γi*pgmpaths+δi*v where αi, βi, γi are learned parameters for the model that can vary per section depending on a code importance given to the corresponding feature for that section and can be based on alignment with human feedback scores by learning a linear regression model for each section, pgmpaths are the number of program paths, F can refer to the number of files, D can refer to the number of databases, and v can refer to the number of variables. For instance, a higher code importance can be placed to γi in the functional summary section, while higher value for δi can be placed in the input-output section of the summary. An example of how the code entity coverage preference and the code summary budget are determined is shown in FIG. 2.

[0042] Referring now to FIG. 2, a block diagram showing a method of determining the code entity coverage preference and code summary budget based on a code snippet, in accordance with an embodiment of the present invention.

[0043] Code snippet 201 can contain code entities 203. The code entities 203 correspond with lines of code within code snippet 201 such as “day type String” corresponding to “String day” in code snippet 201. Based on the identified code entities 203, the code entity coverage preference 205 and the code summary budget can be identified as described herein. An example of code entity coverage preference 205 for an entity “Functional Summary” (e.g., which can refer to the program logic) can include variables day, weather, methods “getRealTimeWeatherData” and “getAvailableRooms.” The code entity coverage preference 205 can include an ordered list. An example of the code summary budget 207 can include code summary budgets for sections “Biz purpose”, “input / output (IO),” and “functional summary.”

[0044] In block 130, natural language (NL) summaries of the program code can be iteratively generated, by the machine learning model, based on guidance templates while enforcing the code summary budget. This process is performed by performing blocks 131-139 iteratively.

[0045] NL summaries can refer to text that describes syntactic (e.g., how the code are structured and written) and semantic information (e.g., how the code functions and behaves) of the sections of program code.

[0046] In block 131, guidance templates can be generated by identifying code entities within the NL summaries generated based on the code entity coverage preference.

[0047] The code entities can refer to entities that are integral to the program flow such as variables, methods, functions, program logic, etc.

[0048] The guidance templates can refer to text that the machine learning model can process that can instruct how the machine learning model can generate the NL summaries. The guidance templates can be tailored for each code entity identified within the code entity coverage preference. The guidance template can utilize standardized formats such as regular expression (regex). For example, for code entity “Business Purpose” the guidance template can include “{{gen( )}}\n+”, for code entities “inputs and outputs” the guidance template can include “{{gen(regex=[*[a−zA−S]+{db1}*[a−zA−Z]+{db2}) . . . }\n+”, for the code entity “functional summary” the guidance template can include “{[a−zA−Z]+[reads, writes, computes, processes]*}. \n”.

[0049] In another embodiment, the machine learning model can generate the guidance templates based on learned syntactic data and the relationships of the syntactic data across past code snippets. The negative log-likelihoods (NLL) of the probabilities of the individual tokens within the code snippets can be utilized to learn the relationships of the syntactic data across past code snippets.

[0050] In block 133, a budget flag can be generated by comparing a computed budget score for the NL summaries with the code summary budget.

[0051] A computed budget score can include the NLL of the probabilities of the individual tokens and factors such as structure of the generated summary, coverage of the content in each section and well-formedness of each section.

[0052] The structure of the generated summary can be obtained by parsing the generated summary and learning the syntactic and semantic data of the generated summary. The coverage of the content can refer to the quality of coverage of the NL summaries based on the budget, the code type, code importance, and the code entity coverage preference. The well-formedness of the section refers to the completeness of the NL summaries based on heuristics such as ensuring that the each section is not cut off abruptly and are grammatically correct. These factors can be obtained and observed as metrics by using the machine learning model.

[0053] The computed budget score can be computed as:

[0054] BudgetScore=NLL+α*S+β*C+γ*W, where S is the structure metric, C is the coverage metric, W is the well-formedness metric, and α, β, and γ are model parameters.

[0055] Based on the computed budget score, the code entity coverage preference can be updated. Consequently, the generation templates can be updated based on the updated code entity coverage preference. For example, the budget score for a section with a code entity “day” has a budget score of five and the budget score for a section with a code entity “weather” has a budget score of ten. The section with a code entity “weather” can have a higher code entity coverage preference, and the generation template can be updated based on this code entity coverage preference.

[0056] A budget flag can include a determination whether the computed budget score for the section is within the total summary budget which can be represented with a value. The budget flag can include information about the code snippet being processed, the iteration number of the summary generation, the entities covered by the section, the code snippet, and the total summary budget. The budget flag can be saved as metadata for the NL summaries generated. In another embodiment, the budget flag can be shown as a text bubble within the NL summaries generated.

[0057] In block 135, the NL summaries can be updated based on the budget flag and the code entity coverage preference.

[0058] Based on the budget flag, the NL summaries can be updated. When the budget flag indicates the code summary budget has not been reached, the NL summary generation process continues by continuously checking whether the code entity coverage preference is met and until the code summary budget is met or the end of sentence of the code snippet has been reached.

[0059] However, there are instances when the budget flag indicates that the code summary budget has been reached for a section but the code entity coverage preference is not met. The present embodiments can resolve this issue in multiple ways.

[0060] When the code summary budget has been met and the last sentence of the NL summaries generated does not meet the code entity coverage preference, that last sentence can be deleted.

[0061] When the end of sentence has been met and there is still code summary budget left, the NL summaries generation stops for the section and the remaining code summary budget is carried over to the next section.

[0062] When the code summary budget has been met and the code entity coverage preference is not met, a extraneous sentence can be identified and deleted. After identifying and deleting the extraneous sentence, the NL summary generation process continues by re-prompting the machine learning model with an instruction code given the current NL summaries state. The current NL summaries state can refer to the status of the code summary budget, the current token from the program code being processed by the machine learning model. The extraneous sentence can refer to a sentence without code entities for the program performance. The extraneous sentence can be identified based on program analysis performed during the code-generation process.

[0063] In block 137, code header information can be inserted to the NL summaries to re-prompt the machine learning model to generate a NL summaries for a next section.

[0064] The code header information can refer to metadata flags that prompt the NL summaries generation process to process the next section. If there is available code summary budget remaining from previous sections processed, it will be carried over to later sections.

[0065] In block 139, an end of summary marker can be inserted to the NL summaries to terminate the NL summaries generation process.

[0066] The end of summary marker can refer to metadata flags that signals that the NL summaries generation process has completed for the section. The end of summary marker can be generated once the end of sentence of the section has been reached and the machine learning model has finished its NL summary generation process.

[0067] After the NL summaries are generated for the code snippet, the NL summaries can be compiled into a budget-aware NL summaries and utilized for downstream tasks such as maintenance of the computer application. This is shown in more detail in FIG. 3.

[0068] Referring now to FIG. 3, a block diagram showing a system that implements practical applications for optimized code summarization using artificial intelligence, in accordance with an embodiment of the present invention.

[0069] In system 300, computer code 303 from a computer application 301 can be transmitted through an analytic server 305 that implements optimized code summarization using artificial intelligence 100 to generate budget-aware NL summaries 307. The analytic server 305 can utilize an artificial intelligence (AI) assistant 310 that can utilize machine learning (ML) model 309 and process the budget-aware NL summaries 307 to perform downstream tasks 311. The downstream tasks 311 can be related to the maintenance of the computer application can be performed by using the NL summaries. The downstream tasks 311 can include vulnerability detection 313, code refactoring 315, code compatibility verification 317.

[0070] In vulnerability detection 313, the budget-aware NL summaries 307 can include the entities and the program logic utilizing the entities. The AI assistant 310 can learn to identify the vulnerabilities of code snippets within the computer application 301 based on learn domain expertise on application vulnerabilities. For example, the AI assistant 310 learned application vulnerabilities for a web-based Java™ application. The current Java™ version of the processed computer application can be version 6. However, version 6 is known to have vulnerabilities such as remote code execution. The application can be tested to verify the existence of the vulnerability by utilizing vulnerability management tools. After verifying the existence of the vulnerability, a correction action 319 can be performed by the AI assistant 310 to resolve the verified vulnerabilities such as installing version patches, and updating code snippets to conform to the version patches.

[0071] In code refactoring 315, the AI assistant 310 can learn to determine code updates to the code of the application to increase its maintainability and efficiency. For example, to increase its maintainability and efficiency, the computer code 303 can be updated to conform to a programming framework such as the model-view-controller framework including Spring™, JavaServerFaces (JSF), Angular.Js™, Apache™ Spark™, etc. The AI assistant 310 can perform corrective action 319 such as autonomously updating the computer code 303 to conform to a selected programming framework (e.g., after recommending to a decision-making entity).

[0072] In code compatibility verification 317, the AI assistant 310 can learn to verify whether the computer code 303 can run on a computing device based on its configuration. For example, a web-based application requires at least version 11 of a web browser due to its code prerequisites, however, the computing device only runs version 10. The AI assistant 310 can identify a code version (e.g., programming language version, application programming interface version, etc.) of the web-based application that is compatible with version 10. After verifying the code version is compatible with version 10, the AI assistant 310 can perform corrective action 319 such as autonomously updating the code version of the application code. The AI assistant 310 can also perform corrective action 319 to alert the user of the computing device that the application is not compatible with the current version of the web browser and recommend upgrading.

[0073] Other practical applications are contemplated.

[0074] Various aspects of the present disclosure are described by narrative text, flowcharts, block diagrams of computer systems and / or block diagrams of the machine logic included in computer program product (CPP) embodiments. With respect to any flowcharts, depending upon the technology involved, the operations can be performed in a different order than what is shown in a given flowchart. For example, again depending upon the technology involved, two operations shown in successive flowchart blocks may be performed in reverse order, as a single integrated step, concurrently, or in a manner at least partially overlapping in time.

[0075] A computer program product embodiment (“CPP embodiment” or “CPP”) is a term used in the present disclosure to describe any set of one, or more, storage media (also called “mediums”) collectively included in a set of one, or more, storage devices that collectively include machine readable code corresponding to instructions and / or data for performing computer operations specified in a given CPP claim. A “storage device” is any tangible device that can retain and store instructions for use by a computer processor. Without limitation, the computer readable storage medium may be an electronic storage medium, a magnetic storage medium, an optical storage medium, an electromagnetic storage medium, a semiconductor storage medium, a mechanical storage medium, or any suitable combination of the foregoing. Some known types of storage devices that include these mediums include: diskette, hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), static random access memory (SRAM), compact disc read-only memory (CD-ROM), digital versatile disk (DVD), memory stick, floppy disk, mechanically encoded device (such as punch cards or pits / lands formed in a major surface of a disc) or any suitable combination of the foregoing. A computer readable storage medium, as that term is used in the present disclosure, is not to be construed as storage in the form of transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide, light pulses passing through a fiber optic cable, electrical signals communicated through a wire, and / or other transmission media. As will be understood by those of skill in the art, data is typically moved at some occasional points in time during normal operations of a storage device, such as during access, de-fragmentation or garbage collection, but this does not render the storage device as transitory because the data is not transitory while it is stored.

[0076] Referring now to FIG. 4, a block diagram showing a computer system for optimized code summarization using artificial intelligence, in accordance with an embodiment of the present invention.

[0077] Computing environment 400 contains an example of an environment for the execution of at least some of the computer code involved in performing the inventive methods, such as optimized code summarization using artificial intelligence 100. In addition to block 100, computing environment 400 includes, for example, computer 401, wide area network (WAN) 402, end user device (EUD) 403, remote server 404, public cloud 405, and private cloud 406. In this embodiment, computer 401 includes processor set 410 (including processing circuitry 420 and cache 421), communication fabric 411, volatile memory 412, persistent storage 413 (including operating system 422 and block 100, as identified above), peripheral device set 414 (including user interface (UI) device set 423, storage 424, and Internet of Things (IoT) sensor set 425), and network module 415. Remote server 404 includes remote database 440. Public cloud 405 includes gateway 440, cloud orchestration module 441, host physical machine set 442, virtual machine set 443, and container set 444.

[0078] COMPUTER 401 may take the form of a desktop computer, laptop computer, tablet computer, smart phone, smart watch or other wearable computer, mainframe computer, quantum computer or any other form of computer or mobile device now known or to be developed in the future that is capable of running a program, accessing a network or querying a database, such as remote database 440. As is well understood in the art of computer technology, and depending upon the technology, performance of a computer-implemented method may be distributed among multiple computers and / or between multiple locations. On the other hand, in this presentation of computing environment 400, detailed discussion is focused on a single computer, specifically computer 401, to keep the presentation as simple as possible.

[0079] Computer 401 may be located in a cloud, even though it is not shown in a cloud in FIG. 4. On the other hand, computer 401 is not required to be in a cloud except to any extent as may be affirmatively indicated.

[0080] PROCESSOR SET 410 includes one, or more, computer processors of any type now known or to be developed in the future. Processing circuitry 420 may be distributed over multiple packages, for example, multiple, coordinated integrated circuit chips. Processing circuitry 420 may implement multiple processor threads and / or multiple processor cores. Cache 421 is memory that is located in the processor chip package(s) and is typically used for data or code that should be available for rapid access by the threads or cores running on processor set 410. Cache memories are typically organized into multiple levels depending upon relative proximity to the processing circuitry. Alternatively, some, or all, of the cache for the processor set may be located “off chip.” In some computing environments, processor set 410 may be designed for working with qubits and performing quantum computing.

[0081] Computer readable program instructions are typically loaded onto computer 401 to cause a series of operational steps to be performed by processor set 410 of computer 401 and thereby effect a computer-implemented method, such that the instructions thus executed will instantiate the methods specified in flowcharts and / or narrative descriptions of computer-implemented methods included in this document (collectively referred to as “the inventive methods”). These computer readable program instructions are stored in various types of computer readable storage media, such as cache 421 and the other storage media discussed below. The program instructions, and associated data, are accessed by processor set 410 to control and direct performance of the inventive methods. In computing environment 400, at least some of the instructions for performing the inventive methods may be stored in block 100 in persistent storage 413.

[0082] COMMUNICATION FABRIC 411 is the signal conduction path that allows the various components of computer 401 to communicate with each other. Typically, this fabric is made of switches and electrically conductive paths, such as the switches and electrically conductive paths that make up buses, bridges, physical input / output ports and the like. Other types of signal communication paths may be used, such as fiber optic communication paths and / or wireless communication paths.

[0083] VOLATILE MEMORY 412 is any type of volatile memory now known or to be developed in the future. Examples include dynamic type random access memory (RAM) or static type RAM. Typically, volatile memory 412 is characterized by random access, but this is not required unless affirmatively indicated. In computer 401, the volatile memory 412 is located in a single package and is internal to computer 401, but, alternatively or additionally, the volatile memory may be distributed over multiple packages and / or located externally with respect to computer 401.

[0084] PERSISTENT STORAGE 413 is any form of non-volatile storage for computers that is now known or to be developed in the future. The non-volatility of this storage means that the stored data is maintained regardless of whether power is being supplied to computer 401 and / or directly to persistent storage 413. Persistent storage 413 may be a read only memory (ROM), but typically at least a portion of the persistent storage allows writing of data, deletion of data and re-writing of data. Some familiar forms of persistent storage include magnetic disks and solid state storage devices.

[0085] Operating system 422 may take several forms, such as various known proprietary operating systems or open source Portable Operating System Interface-type operating systems that employ a kernel. The code included in block 100 typically includes at least some of the computer code involved in performing the inventive methods.

[0086] PERIPHERAL DEVICE SET 414 includes the set of peripheral devices of computer 401. Data communication connections between the peripheral devices and the other components of computer 401 may be implemented in various ways, such as Bluetooth connections, Near-Field Communication (NFC) connections, connections made by cables (such as universal serial bus (USB) type cables), insertion-type connections (for example, secure digital (SD) card), connections made through local area communication networks and even connections made through wide area networks such as the internet. In various embodiments, UI device set 423 may include components such as a display screen, speaker, microphone, wearable devices (such as goggles and smart watches), keyboard, mouse, printer, touchpad, game controllers, and haptic devices. Storage 424 is external storage, such as an external hard drive, or insertable storage, such as an SD card. Storage 424 may be persistent and / or volatile. In some embodiments, storage 424 may take the form of a quantum computing storage device for storing data in the form of qubits. In embodiments where computer 401 is required to have a large amount of storage (for example, where computer 401 locally stores and manages a large database) then this storage may be provided by peripheral storage devices designed for storing very large amounts of data, such as a storage area network (SAN) that is shared by multiple, geographically distributed computers. IoT sensor set 425 is made up of sensors that can be used in Internet of Things applications. For example, one sensor may be a thermometer and another sensor may be a motion detector.

[0087] NETWORK MODULE 415 is the collection of computer software, hardware, and firmware that allows computer 401 to communicate with other computers through WAN 402. Network module 415 may include hardware, such as modems or Wi-Fi signal transceivers, software for packetizing and / or de-packetizing data for communication network transmission, and / or web browser software for communicating data over the internet. In some embodiments, network control functions and network forwarding functions of network module 415 are performed on the same physical hardware device. In other embodiments (for example, embodiments that utilize software-defined networking (SDN)), the control functions and the forwarding functions of network module 415 are performed on physically separate devices, such that the control functions manage several different network hardware devices. Computer readable program instructions for performing the inventive methods can typically be downloaded to computer 401 from an external computer or external storage device through a network adapter card or network interface included in network module 415.

[0088] WAN 402 is any wide area network (for example, the internet) capable of communicating computer data over non-local distances by any technology for communicating computer data, now known or to be developed in the future. In some embodiments, the WAN 402 may be replaced and / or supplemented by local area networks (LANs) designed to communicate data between devices located in a local area, such as a Wi-Fi network. The WAN and / or LANs typically include computer hardware such as copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and edge servers.

[0089] END USER DEVICE (EUD) 403 is any computer system that is used and controlled by an end user (for example, a customer of an enterprise that operates computer 401), and may take any of the forms discussed above in connection with computer 401. EUD 403 typically receives helpful and useful data from the operations of computer 401. For example, in a hypothetical case where computer 401 is designed to provide a recommendation to an end user, this recommendation would typically be communicated from network module 415 of computer 401 through WAN 402 to EUD 403. In this way, EUD 403 can display, or otherwise present, the recommendation to an end user. In some embodiments, EUD 403 may be a client device, such as thin client, heavy client, mainframe computer, desktop computer and so on.

[0090] REMOTE SERVER 404 is any computer system that serves at least some data and / or functionality to computer 401. Remote server 404 may be controlled and used by the same entity that operates computer 401. Remote server 404 represents the machine(s) that collect and store helpful and useful data for use by other computers, such as computer 401. For example, in a hypothetical case where computer 401 is designed and programmed to provide a recommendation based on historical data, then this historical data may be provided to computer 401 from remote database 440 of remote server 404.

[0091] PUBLIC CLOUD 405 is any computer system available for use by multiple entities that provides on-demand availability of computer system resources and / or other computer capabilities, especially data storage (cloud storage) and computing power, without direct active management by the user. Cloud computing typically leverages sharing of resources to achieve coherence and economies of scale. The direct and active management of the computing resources of public cloud 405 is performed by the computer hardware and / or software of cloud orchestration module 441. The computing resources provided by public cloud 405 are typically implemented by virtual computing environments that run on various computers making up the computers of host physical machine set 442, which is the universe of physical computers in and / or available to public cloud 405. The virtual computing environments (VCEs) typically take the form of virtual machines from virtual machine set 443 and / or containers from container set 444. It is understood that these VCEs may be stored as images and may be transferred among and between the various physical machine hosts, either as images or after instantiation of the VCE. Cloud orchestration module 441 manages the transfer and storage of images, deploys new instantiations of VCEs and manages active instantiations of VCE deployments. Gateway 440 is the collection of computer software, hardware, and firmware that allows public cloud 405 to communicate through WAN 402.

[0092] Some further explanation of virtualized computing environments (VCEs) will now be provided. VCEs can be stored as “images.” A new active instance of the VCE can be instantiated from the image. Two familiar types of VCEs are virtual machines and containers. A container is a VCE that uses operating-system-level virtualization. This refers to an operating system feature in which the kernel allows the existence of multiple isolated user-space instances, called containers. These isolated user-space instances typically behave as real computers from the point of view of programs running in them. A computer program running on an ordinary operating system can utilize all resources of that computer, such as connected devices, files and folders, network shares, CPU power, and quantifiable hardware capabilities. However, programs running inside a container can only use the contents of the container and devices assigned to the container, a feature which is known as containerization.

[0093] PRIVATE CLOUD 406 is similar to public cloud 405, except that the computing resources are only available for use by a single enterprise. While private cloud 406 is depicted as being in communication with WAN 402, in other embodiments a private cloud may be disconnected from the internet entirely and only accessible through a local / private network. A hybrid cloud is a composition of multiple clouds of different types (for example, private, community or public cloud types), often respectively implemented by different vendors. Each of the multiple clouds remains a separate and discrete entity, but the larger hybrid cloud architecture is bound together by standardized or proprietary technology that enables orchestration, management, and / or data / application portability between the multiple constituent clouds. In this embodiment, public cloud 405 and private cloud 406 are both part of a larger hybrid cloud.

[0094] Referring now to FIG. 5, a block diagram showing hardware and software components of a system for optimized code summarization using artificial intelligence, in accordance with an embodiment of the present invention.

[0095] In system 500, computer code 303 can be analyzed by a program analysis module 503 to obtain importance score 509 for sections within computer code 303. The computer code 303 can be analyzed by a code entity coverage preference module 505 to obtain code entity coverage preference 205 for sections within computer code 303. The importance score 509 and code entity coverage preference 205 can be analyzed by a budget computation module 510 to compute code summary budget 207 for the sections. Based on the code summary budget 207, the budget-aware summary generator 511 can generate budget-aware NL summaries 307 for the sections of computer code 303. The budget computation module 510, code entity coverage preference module 505 and program analysis module 503 can utilize machine learning (ML) model 309 which can implement neural network 507.

[0096] The budget-aware summary generator 511 can instruct a large language model (LLM) 517 to generate NL summaries 519 for a masked code snippet 515. The masked code snippet 515 ensures that the summary only includes text that is expected to be in the section at the given generation step and ensures tokens corresponding to unexpected behaviors are zeroed out. For example, in the workflow section of the NL summaries 519, variable names can be masked out during the LLM decoding phase. By comparing a budget score 521 with the code summary budget and the code entity coverage preference 205, the budget-aware summary generator 511 can generate a budget flag 520. Based on the budget flag520, snippet updates 523 can be generated. The snippet updates 523 can include deleting previous sentence based on the budget flag and whether the previous sentence contains extraneous sentences. The snippet updates 523 can include additional NL summaries 519 generated by re-prompting the LLM 517. The snippet updates 523 can include the code header information to switch to a new section and the end of summary marker to terminate the NL summaries generation process.

[0097] An artificial neural network (ANN) is an information processing system that is inspired by biological nervous systems, such as the brain. One element of ANNs is the structure of the information processing system, which includes a large number of highly interconnected processing elements (called “neurons”) working in parallel to solve specific problems. ANNs are furthermore trained using a set of training data, with learning that involves adjustments to weights that exist between the neurons. An ANN is configured for a specific application, such as pattern recognition or data classification, through such a learning process.

[0098] Referring now to FIG. 6, a block diagram showing artificial neural networks for optimized code summarization using artificial intelligence, in accordance with an embodiment of the present invention.

[0099] Although a specific structure of an ANN is shown, having three layers and a set number of fully connected neurons, it should be understood that this is intended solely for the purpose of illustration. In practice, the present embodiments may take any appropriate form, including any number of layers and any pattern or patterns of connections therebetween.

[0100] ANNs demonstrate an ability to derive meaning from complicated or imprecise data and can be used to extract patterns and detect trends that are too complex to be detected by humans or other computer-based systems. The structure of a neural network is known generally to have input neurons 602 that provide information to one or more “hidden” neurons 604. Connections 608 between the input neurons 602 and hidden neurons 604 are weighted, and these weighted inputs are then processed by the hidden neurons 604 according to some function in the hidden neurons 604. There can be any number of layers of hidden neurons 604, and as well as neurons that perform different functions. There exist different neural network structures as well, such as a convolutional neural network, a maxout network, etc., which may vary according to the structure and function of the hidden layers, as well as the pattern of weights between the layers. The individual layers may perform particular functions, and may include convolutional layers, pooling layers, fully connected layers, softmax layers, or any other appropriate type of neural network layer. Finally, a set of output neurons 606 accepts and processes weighted input from the last set of hidden neurons 604.

[0101] This represents a “feed-forward” computation, where information propagates from input neurons 602 to the output neurons 606. Upon completion of a feed-forward computation, the output is compared to a desired output available from training data. The error relative to the training data is then processed in “backpropagation” computation, where the hidden neurons 604 and input neurons 602 receive information regarding the error propagating backward from the output neurons 606. Once the backward error propagation has been completed, weight updates are performed, with the weighted connections 608 being updated to account for the received error. It should be noted that the three modes of operation, feed forward, back propagation, and weight update, do not overlap with one another. This represents just one variety of ANN computation, and that any appropriate form of computation may be used instead.

[0102] To train an ANN, training data can be divided into a training set and a testing set. The training data includes pairs of an input and a known output. During training, the inputs of the training set are fed into the ANN using feed-forward propagation. After each input, the output of the ANN is compared to the respective known output. Discrepancies between the output of the ANN and the known output that is associated with that particular input are used to generate an error value, which may be backpropagated through the ANN, after which the weight values of the ANN may be updated. This process continues until the pairs in the training set are exhausted. In an embodiment, the neural network 507 of the ML model 309 can be trained using past code snippets and corresponding NL summaries to learn the entity code preference 205, importance score 509 or code summary budget 207.

[0103] After the training has been completed, the ANN may be tested against the testing set, to ensure that the training has not resulted in overfitting. If the ANN can generalize to new inputs, beyond those which it was already trained on, then it is ready for use. If the ANN does not accurately reproduce the known outputs of the testing set, then additional training data may be needed, or hyperparameters of the ANN may need to be adjusted.

[0104] In an embodiment, the hidden neurons 604 the neural network 507 of the ML model 309 can learn the relationships between tokens of the sections and learned syntactic and semantic information. The output neurons 606 of the neural network 507 of the ML model 309 can generate likelihoods of a code entity coverage preference 205, an importance score 509, or code summary budget 207. In another embodiment, the neural network 507 of the ML model 309 can generate instruction code 513 based on past user inputs and prompts. In another embodiment, the neural network 507 of the ML model 309 can generate masked code snippet 515 by learning the relationships of the tokens between the sections and learn the boundaries of each sections.

[0105] ANNs may be implemented in software, hardware, or a combination of the two. For example, each weight 608 may be characterized as a weight value that is stored in a computer memory, and the activation function of each neuron may be implemented by a computer processor. The weight value may store any appropriate data value, such as a real number, a binary value, or a value selected from a fixed number of possibilities, that is multiplied against the relevant neuron outputs. Alternatively, the weights 608 may be implemented as resistive processing units (RPUs), generating a predictable current output when an input voltage is applied in accordance with a settable resistance.

[0106] The present invention may be a system, a method, and / or a computer program product at any possible technical detail level of integration. The computer program product may include a computer readable storage medium (or media) having computer readable program instructions thereon for causing a processor to carry out aspects of the present invention.

[0107] The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of the computer readable storage medium includes the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.

[0108] Computer readable program instructions described herein can be downloaded to respective computing / processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and / or a wireless network. The network may comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and / or edge servers. A network adapter card or network interface in each computing / processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing / processing device.

[0109] Computer readable program instructions for carrying out operations of the present invention may be assembler instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, configuration data for integrated circuitry, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++, or the like, and procedural programming languages, such as the “C” programming language or similar programming languages. The computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) may execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present invention.

[0110] Aspects of the present invention are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer readable program instructions.

[0111] These computer readable program instructions may be provided to a processor of a computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, a programmable data processing apparatus, and / or other devices to function in a particular manner, such that the computer readable storage medium having instructions stored therein comprises an article of manufacture including instructions which implement aspects of the function / act specified in the flowchart and / or block diagram block or blocks.

[0112] The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable apparatus, or other device implement the functions / acts specified in the flowchart and / or block diagram block or blocks.

[0113] Reference in the specification to “one embodiment” or “an embodiment” of the present invention, as well as other variations thereof, means that a particular feature, structure, characteristic, and so forth described in connection with the embodiment is included in at least one embodiment of the present invention. Thus, the appearances of the phrase “in one embodiment” or “in an embodiment”, as well any other variations, appearing in various places throughout the specification are not necessarily all referring to the same embodiment.

[0114] The descriptions of the various embodiments of the present invention have been presented for purposes of illustration, but are not intended to be exhaustive or limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein was chosen to best explain the principles of the embodiments, the practical application or technical improvement over technologies found in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

[0115] It is to be appreciated that the use of any of the following “ / ”, “and / or”, and “at least one of”, for example, in the cases of “A / B”, “A and / or B” and “at least one of A and B”, is intended to encompass the selection of the first listed option (A) only, or the selection of the second listed option (B) only, or the selection of both options (A and B). As a further example, in the cases of “A, B, and / or C” and “at least one of A, B, and C”, such phrasing is intended to encompass the selection of the first listed option (A) only, or the selection of the second listed option (B) only, or the selection of the third listed option (C) only, or the selection of the first and the second listed options (A and B) only, or the selection of the first and third listed options (A and C) only, or the selection of the second and third listed options (B and C) only, or the selection of all three options (A and B and C). This may be extended, as readily apparent by one of ordinary skill in this and related arts, for as many items listed.

[0116] The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the blocks may occur out of the order noted in the Figures. For example, two blocks shown in succession may, in fact, be accomplished as one step, executed concurrently, substantially concurrently, in a partially or wholly temporally overlapping manner, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and / or flowchart illustration, and combinations of blocks in the block diagrams and / or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts or carry out combinations of special purpose hardware and computer instructions.

[0117] Having described preferred embodiments of a system and method (which are intended to be illustrative and not limiting), it is noted that modifications and variations can be made by persons skilled in the art in light of the above teachings. It is therefore to be understood that changes may be made in the particular embodiments disclosed which are within the scope of the invention as outlined by the appended claims. Having thus described aspects of the invention, with the details and particularity required by the patent laws, what is claimed and desired protected by Letters Patent is set forth in the appended claims.

Claims

1. A method, comprising:learning a code entity coverage preference for sections within a program code summary using a machine learning model;identifying a code summary budget based on a type and importance of the sections by utilizing the code entity coverage preference;iteratively generating, by the machine learning model, natural language (NL) summaries of the sections based on guidance templates while enforcing the code summary budget by:generating the guidance templates by identifying code entities within the NL summaries based on the code entity coverage preference;generating a budget flag by comparing a computed budget score for the NL summaries with the code summary budget; andupdating the NL summaries based on the budget flag and the code entity coverage preference.

2. The method of claim 1, wherein generating the budget flag further comprises computing the budget score based on at least one of a structure metric, a coverage metric, and a well-formedness metric.

3. The method of claim 1, wherein updating the NL summaries further comprises deleting code summary snippets when the budget flag indicates that the section budget has been reached.

4. The method of claim 2, wherein updating the NL summaries further comprises deleting a code summary snippet identified as an extraneous sentence.

5. The method of claim 3, wherein updating the NL summaries further comprises re-prompting a large language model to generate NL summaries given a current NL summaries state.

6. The method of claim 1, further comprising inserting code header information to the NL summaries to generate a next NL summaries for a next section.

7. The method of claim 1, further comprising inserting end of summary marker to the NL summaries to terminate the NL summaries generation.

8. The method of claim 1, further comprising performing autonomous code refactoring using the NL summaries to increase maintainability and efficiency of the program code.

9. A computer system comprising:a processor set;one or more computer-readable storage media; andprogram instructions stored on the one or more computer-readable storage media to cause the processor set to perform operations comprising:learning a code entity coverage preference for sections within a program code summary using a machine learning model;identifying a code summary budget based on a type and importance of the sections by utilizing the code entity coverage preference;iteratively generating, by the machine learning model, natural language (NL) summaries of the sections based on guidance templates while enforcing the code summary budget by:generating the guidance templates by identifying code entities within the NL summaries based on the code entity coverage preference;generating a budget flag by comparing a computed budget score for the NL summaries with the code summary budget; andupdating the NL summaries based on the budget flag and the code entity coverage preference.

10. The computer system of claim 9, wherein the generating the budget flag further comprises computing the budget score based on at least one of a structure metric, coverage metric and a well-formedness metric.

11. The computer system of claim 9, wherein the updating the NL summaries further comprises deleting code summary snippets when the budget flag indicates that the section budget has been reached.

12. The computer system of claim 11, wherein the updating the NL summaries further comprises deleting a code summary snippet identified as an extraneous sentence.

13. The computer system of claim 12, wherein the updating the NL summaries further comprises re-prompting a large language model to generate NL summaries given a current NL summaries state.

14. The computer system of claim 9, wherein the operations further comprise inserting code header information to the NL summaries to generate a next NL summaries for a next section.

15. The computer system of claim 9, wherein the operations further comprise inserting end of summary marker to the NL summaries to terminate the NL summaries generation.

16. The computer system of claim 9, wherein the operations further comprise performing autonomous code refactoring using the NL summaries to increase maintainability and efficiency of the program code.

17. A computer program product comprising:one or more computer-readable storage media; andprogram instructions stored on the one or more computer-readable storage media to perform operations comprising:learning a code entity coverage preference for sections within a program code summary using a machine learning model;identifying a code summary budget based on a type and importance of the sections by utilizing the code entity coverage preference;iteratively generating, by the machine learning model, natural language (NL) summaries of the sections based on guidance templates while enforcing the code summary budget by:generating the guidance templates by identifying code entities within the NL summaries based on the code entity coverage preference;generating a budget flag by comparing a computed budget score for the NL summaries with the code summary budget; andupdating the NL summaries based on the budget flag and the code entity coverage preference.

18. The computer program product of claim 17, wherein the operations further comprise inserting code header information to the NL summaries to generate a next NL summaries for a next section.

19. The computer program product of claim 17, wherein the operations further comprise inserting end of summary marker to the NL summaries to terminate the NL summaries generation.

20. The computer program product of claim 17, wherein the operations further comprise performing autonomous code refactoring using the NL summaries to increase maintainability and efficiency of the program code.