Method and system for learning project code base and locating erroneous code

By constructing a knowledge graph and large language model for the project codebase, the system automatically learns and locates erroneous code, solving the problem of low efficiency in codebase learning and error location in existing technologies, and improving R&D efficiency and code quality.

CN122132275APending Publication Date: 2026-06-02BAYERISCHE MOTOREN WERKE AG

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BAYERISCHE MOTOREN WERKE AG
Filing Date
2024-12-02
Publication Date
2026-06-02

Smart Images

  • Figure CN122132275A_ABST
    Figure CN122132275A_ABST
Patent Text Reader

Abstract

The present disclosure provides a method for learning a project code base and locating error codes, comprising: constructing a knowledge graph of a project code base based on a code framework of the project code base; generating an exploration task based on the knowledge graph; formulating an action plan comprising specific exploration steps and retrieving associated code snippets based on the exploration task; and learning the retrieved code snippets by executing the action plan to update the knowledge graph. The present disclosure can automatically learn the knowledge of the project code base.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of machine learning, and more specifically, to methods and systems for learning project codebases and locating error codes based on machine learning models. Background Technology

[0002] On the one hand, the field of software engineering still relies heavily on human involvement. For example, developing code and handling code errors require collaborative work from R&D personnel such as feature owners, project owners, developers, and testers, making the process cumbersome, time-consuming, and labor-intensive. In particular, as software projects become increasingly complex, developers are finding it increasingly difficult to know the details of the entire software project, lack sufficient understanding of the project's codebase, and may encounter difficulties in developing new features and correcting code errors.

[0003] On the other hand, with the advancement of machine learning technology, the use of machine learning models is becoming increasingly widespread. However, due to the complexity and diversity of software projects, it remains difficult to use machine learning models to learn the code in a project's codebase.

[0004] One aspect of this disclosure provides a solution for automating the learning of a project codebase; another aspect of this disclosure provides a solution for locating erroneous code in a project codebase. Summary of the Invention

[0005] This summary is provided to introduce, in a simplified form, some concepts that will be further described in the following detailed description. This summary is not intended to identify key or essential features of the claimed subject matter, nor is it intended to help determine the scope of the claimed subject matter.

[0006] To address the above issues, this disclosure utilizes the understanding and reasoning capabilities of large language models to design a complete solution for automating the learning of project codebases using large language models. This disclosure also utilizes large language models to locate and / or resolve errors in the project codebase.

[0007] According to a first aspect of this disclosure, a method for learning a project codebase using a machine learning model is provided, comprising: constructing a knowledge graph of the project codebase based on a code framework of the project codebase, the code framework indicating the components of the project codebase and the relationships between the components; generating exploration tasks based on the knowledge graph, the exploration tasks exploring components in the project codebase; formulating an action plan including specific exploration steps based on the exploration tasks and retrieving associated code snippets; and learning the retrieved code snippets by executing the action plan to update the knowledge graph.

[0008] According to a further embodiment of this disclosure, the operations of the method are implemented by providing prompt words to a large language model.

[0009] According to a further embodiment of this disclosure, the generation of exploration tasks is further based on a history of completed and failed exploration tasks.

[0010] According to further embodiments of this disclosure, developing an action plan further includes extracting knowledge from a knowledge graph that is associated with the exploration task.

[0011] According to a second aspect of this disclosure, a method is provided for locating erroneous code in a project codebase using a machine learning model, comprising: determining the code segment to be reviewed in the project codebase based on a problem description and a knowledge graph of the project codebase; searching for associated log information in log records based on the problem description; and reviewing the code segment to be reviewed in conjunction with the log information to determine the erroneous code that caused the problem in the problem description.

[0012] According to a further embodiment of this disclosure, the operations of the method are implemented by providing prompt words to a large language model.

[0013] According to a further embodiment of this disclosure, it further includes: generating a problem analysis plan based on the problem description and knowledge graph.

[0014] According to a further embodiment of this disclosure, it further includes: retrieving additional content to determine code snippets in the project codebase to be reviewed.

[0015] According to a further embodiment of this disclosure, it further includes: outputting an error code and suggesting modifications to the error code.

[0016] According to a further embodiment of this disclosure, it further includes: automatically modifying the error code.

[0017] According to a further embodiment of this disclosure, the method further includes: after making modifications, automatically performing tests to determine whether the problem is resolved; if the problem is not resolved, then re-determining the error code and modifying the determined error code until the problem is resolved.

[0018] According to a third aspect of this disclosure, a system is provided for learning a project codebase using a machine learning model, comprising: an initial learning module for constructing a knowledge graph of the project codebase based on the code framework of the project codebase; an automatic learning guidance module for generating exploration tasks based on the knowledge graph; a planning module for developing an action plan including specific exploration steps based on the exploration tasks and retrieving associated code snippets; and a knowledge generation module for learning the retrieved code snippets by executing the action plan to update the knowledge graph.

[0019] According to a fourth aspect of this disclosure, a system is provided for locating erroneous code in a project codebase using a machine learning model, comprising: an automatic analysis module for determining code segments to be reviewed in the project codebase based on a problem description and a knowledge graph of the project codebase; a log search module for searching for associated log information in log records based on the problem description; and a code analysis module for reviewing the code segments to be reviewed in conjunction with the log information to determine the erroneous code causing the problem in the problem description.

[0020] According to a fifth aspect of this disclosure, a computer-readable storage medium storing instructions that, when executed by a computer, cause the computer to perform the methods provided in this disclosure.

[0021] According to a sixth aspect of this disclosure, a computer system is provided, including: a memory, and one or more processors coupled to the memory, the one or more processors being configured to perform the methods provided in this disclosure.

[0022] One or more embodiments of this disclosure can achieve at least one of the following technical effects:

[0023] Automated learning of the project's codebase;

[0024] Improve learning efficiency and / or accuracy;

[0025] The error code is automatically determined based on the problem description;

[0026] Assisted error correction or automated error correction.

[0027] These and other features and advantages will become apparent from the following detailed description and with reference to the accompanying drawings. It should be understood that the foregoing general description and the following detailed description are illustrative only and do not limit the scope of the claims. Attached Figure Description

[0028] To gain a more detailed understanding of the manner in which the features of this disclosure are described above, reference can be made to the various embodiments for a more specific description of the above-briefly summarized aspects, some of which are illustrated in the accompanying drawings. However, it should be noted that the drawings illustrate only certain typical aspects of this disclosure and should not be considered as limiting its scope, as this description may allow for other equivalent and effective aspects.

[0029] Figure 1 A schematic diagram illustrating an example architecture of a large language model agent according to one or more embodiments of the present disclosure is shown.

[0030] Figure 2 A flowchart illustrating an example method for learning a project codebase using a machine learning model, according to one or more embodiments of this disclosure.

[0031] Figure 3 A schematic block diagram of an example system for learning a project codebase using a machine learning model according to one or more embodiments of the present disclosure is shown.

[0032] Figure 4 An overall flowchart illustrating an example method for using a machine learning model to help process error codes according to one or more embodiments of this disclosure is shown.

[0033] Figure 5 A flowchart illustrating an example method for using a machine learning model to locate erroneous code in a project codebase, according to one or more embodiments of this disclosure.

[0034] Figure 6 A schematic block diagram of an example system that uses a machine learning model to learn a project codebase is shown.

[0035] Figure 7 A schematic diagram of the structure of a computer system according to one or more embodiments of the present disclosure is shown. Detailed Implementation

[0036] The present invention will now be described in detail with reference to the accompanying drawings, and its features will become further apparent in the following specific description.

[0037] As mentioned above, the field of software engineering still relies heavily on human intervention. Although machine learning models are widely used, they are currently difficult to apply to learning and understanding the knowledge within a project's codebase.

[0038] With the emergence of large language models, the understanding and reasoning abilities of machine learning models have been significantly improved. However, effective solutions for leveraging large language models to learn from project codebases, especially large-scale project codebases, still lack effective methods.

[0039] One or more embodiments of this disclosure design a scheme for automating the learning of a project codebase using a large language model. Specifically, one or more embodiments of this disclosure use an agent constructed based on a large language model, which enables the large language model agent to learn the project codebase step by step by providing the large language model with a series of interrelated cue words.

[0040] Through one or more embodiments of this disclosure, machine learning models can learn and understand project codebases. This can bring a series of beneficial effects. For example, it can help R&D personnel quickly and accurately understand and acquire knowledge of project codebases, thereby improving development efficiency and team collaboration efficiency; it can discover potential problems in existing project codebases, such as design flaws and coding style issues, thereby reducing maintenance costs and improving code quality; it enables machine learning models to assist in code development and code correction, thereby improving development efficiency and code quality; and it can transform the knowledge of the codebase into a knowledge base, facilitating knowledge sharing and inheritance, and avoiding knowledge loss due to personnel turnover.

[0041] One or more embodiments of this disclosure also utilize the learned knowledge to locate error codes using a large language model, and can automate or assist developers in code correction.

[0042] In one or more embodiments of this disclosure, the machine learning model is a large language model. In a narrow sense, a large language model refers to a deep learning-based natural language processing model with the ability to understand and generate natural language; while in a broader sense, a large language model has the ability to understand and generate data from other modalities (e.g., speech, images, videos, etc.). The large language model in one or more embodiments of this disclosure adopts the above broad definition and is interchangeable with generative artificial intelligence models. Generally, large language models typically use neural network architectures such as Transformer and are trained on large-scale datasets. Examples of large language models include Transformer-based models such as the GPT series, LaMDA series, BERT series, and MT-NLG series, as well as other models such as the Jurassic series, Cohere series, and OPT series.

[0043] It should be understood that the large language models of one or more embodiments of this disclosure are not limited thereto. Models trained on large-scale datasets that possess strong understanding and generation capabilities for natural language and other modalities should be considered as large language models of one or more embodiments of this disclosure.

[0044] In some embodiments, the large language model can be a publicly available large language model. Examples of publicly available large language models include the ChatGPT series, Gemini series, and Claude series models. This publicly available large language model can be invoked using its provided API or other methods.

[0045] In a more preferred embodiment, the large language model is a customized large language model deployed locally or remotely. For example, it can be based on the basic large language model described above, and fine-tuned using customized data (such as project repository code and / or other corpora). For example, the LoRA method can be used to fine-tune the basic large language model.

[0046] Based on a large language model, a large language model agent (LLM agent) can be constructed and used to perform specific tasks. In the following text, "large language model" and "large language model agent" will sometimes be used interchangeably.

[0047] See Figure 1 This illustration shows a schematic diagram of an example architecture of a large language model agent 100 according to one or more embodiments of the present disclosure. It should be understood that the architecture described herein is not intended to limit the scope of the invention, but is merely exemplary. Other architectures may also be used to implement the invention. In fact, any suitable manner known to those skilled in the art can be employed to construct the large language model agent.

[0048] like Figure 1 As shown, the large language model agent 100 may include one or more of the following modules:

[0049] Interface module 102: Interface module 102 is responsible for receiving input from users, such as problem descriptions, code snippets, or other text information related to the project codebase.

[0050] Retrieval Module 104: Retrieval module 104 is responsible for retrieving relevant information. For example, retrieval module 104 can search internal knowledge bases (such as internal wikis, historical code issue records), project code repositories, log repositories, etc., to obtain relevant information.

[0051] Prompt word generation module 106: Prompt word generation module 106 is responsible for converting user input into prompt words suitable for processing by a large language model. This may involve adding instructions, contextual information, or other necessary elements to guide the large language model in generating the desired output.

[0052] Large Language Model Invocation Module 108: The Large Language Model Invocation Module 108 is responsible for invoking the local or remote large language model (e.g., through the large language model's application programming interface API) and receiving responses from the large language model.

[0053] Storage module 110: Storage module 110 is responsible for storing information used during the operation of the large language model agent. Through storage module 110, information can be shared among the various operations of the large language model agent.

[0054] Action Module 112: Action Module 112 is responsible for executing corresponding actions based on the output of the large language model, such as modifying code, running tests, or deploying software, etc.

[0055] It should be understood that large language model agents may include more or fewer modules, or may use a completely different architecture.

[0056] See Figure 2 The diagram illustrates a flowchart of an example method 200 for learning a project codebase using a machine learning model, according to one or more embodiments of the present disclosure.

[0057] Method 200 may include: In operation 202, a knowledge graph of the project codebase may be constructed based on the code framework of the project codebase. This knowledge graph is a preliminary knowledge graph and will be gradually updated during the learning process of the large language model. Operation 202 can be implemented by providing cue words to the large language model. The cue words may, for example, include at least the code framework. The code framework may, for example, indicate the components of the project codebase and the relationships between the components.

[0058] In one example, the code framework of the project codebase can be manually entered by developers. In another example, a large language model agent can retrieve relevant knowledge bases to learn the code framework. Such knowledge bases may include, for example, project documentation, code comments, commit history, etc.

[0059] In a preferred example, the prompt word may also include other information. For instance, the prompt word may include project background. Project background helps the large language model understand the project's context, which is beneficial for more accurately constructing a preliminary knowledge graph of the project's codebase.

[0060] Here is an example of the prompt word for Operation 202:

[0061] You are a senior programmer, and now you need to learn a new project until you fully master it.

[0062] [Project Background] is as follows:

[0063] <<

[0064] >>

[0065] The project framework is as follows:

[0066] <<

[0067] >>

[0068] Please carefully consider and analyze the following step by step:

[0069] Knowledge graph construction: Based on the [project background] and [project framework], construct a preliminary knowledge graph of the project codebase in the form of a graph.

[0070] For example:

[0071] Response format:

[0072] Structured knowledge graphs.

[0073] Input information in prompts (such as portions indicated by "<<", e.g., project background and project framework) can be accessed through interface modules proxied by the large language model (e.g., Figure 1 Interface module 102) and / or retrieval module (e.g.) Figure 1 The retrieval module 104 in the middle is used to obtain it.

[0074] The information used in the prompt words can be stored in the large language model agent's storage module (e.g. Figure 1 The storage module 110 in the middle is used to store the data so that it can be shared between operations.

[0075] The prompt words can be generated by a prompt word generation module that is proxies a large language model (e.g.) Figure 1 The prompt word generation module 106 generates prompts by adding corresponding instructions and context information.

[0076] Large language model calling modules that can be proxied by large language models (e.g.) Figure 1 The large language model is invoked by module 108 in order to invoke the local or remote large language model and receive the relevant response from the large language model for output.

[0077] In addition, system commands can be invoked or corresponding actions can be performed in other ways through the action module of the large language model agent, such as code modification and testing as described below.

[0078] The above example illustrates how to implement operation 202 using a large language model proxy. Other operations described below can be implemented similarly using a large language model proxy.

[0079] It should be understood that any prompts included in the various embodiments of this disclosure are merely examples and not limitations.

[0080] Method 200 may include: in operation 204, generating an exploration task based on a knowledge graph.

[0081] Operation 204 aims to maximize the project exploration process. Specifically, it involves continuously learning about different components within the project's codebase through Operation 204. Many projects (especially large ones) may contain a large number of components, each with complex data exchange interfaces, which presents a challenge for exploring large projects using a large language model.

[0082] In one or more embodiments of this disclosure, to efficiently maximize the exploration of the project codebase, operation 204 may employ a bottom-up exploration process under the overall goal of "exploring as much project code as possible." For example, functions and their relationships may be explored first, followed by components and their relationships, and then functional modules and their relationships. Ultimately, all components in the project codebase will be explored as much as possible to understand the implementation details of the entire project codebase.

[0083] Operation 204 can be achieved by providing cue words to a large language model. These cue words may include, for example, at least the knowledge graph generated in previous operations (e.g., the initial knowledge graph and the subsequently updated knowledge graph).

[0084] In a preferred example, the prompt may also include the project framework described above. The project framework helps the large language model understand the overall project structure, thereby facilitating the generation of exploration tasks.

[0085] In a preferred example, the prompt may also include the current exploration status. The current exploration status includes the current exploration progress, such as which modules or components have been explored, and which modules or components are planned to be explored next.

[0086] In a preferred example, the prompt may also include a history of completed and failed exploration tasks. The exploration process may encounter many complex parts. For example, a data interaction interface may involve many different components, but some of these components have not yet been explored, meaning the large language model lacks knowledge about these components, and the exploration task is incomplete. It is necessary to log these similar failed tasks in this state and prioritize them after all suitable tasks have been completed.

[0087] In the preferred example, multiple exploration tasks can be generated, making the exploration more organized and improving exploration efficiency.

[0088] Here is an example of the prompt word for Operation 204:

[0089] You are a senior programmer, and now you need to learn a new project until you fully master it.

[0090] [Project Background] is as follows:

[0091] <<

[0092] >>

[0093] The project framework is as follows:

[0094] <<

[0095] >>

[0096] The [learned knowledge graph] is as follows (including the relationships between the components):

[0097] <<

[0098] >>

[0099] The current exploration status is as follows:

[0100] <<

[0101] >>

[0102] The history of previously completed and failed exploration missions is as follows:

[0103] <<

[0104] >>

[0105] Please carefully consider and analyze the following steps:

[0106] Project Background Review: Based on the [Project Background] and [Project Framework], review the overall project background and organizational structure;

[0107] Review of Explored Content: Based on the [current exploration status] and [history of previously completed and failed exploration tasks], summarize the content that has been explored and consider whether some content needs to be re-explored;

[0108] New exploration plan: Based on the content of the previous exploration and the [project framework], please develop the next exploration plan to explore as much of the project code as possible.

[0109] For example:

[0110] Response format:

[0111] Project background review;

[0112] Review of previously explored content;

[0113] New exploration plans:

[0114] [Task 1]: [Content]

[0115] [Task 2]: [Content]

[0116]

[0117] [Task N]:[Content].

[0118] Method 200 may include: in operation 206, retrieving relevant knowledge and code snippets based on the exploration task.

[0119] Operation 206 can be used to formulate an action plan, including specific exploration steps, based on the exploration task and to retrieve associated code snippets. Operation 206 can be achieved by providing cue words to a large language model. These cue words may, for example, include at least the exploration task generated in operation 204.

[0120] In a preferred example, the prompt may also include the project framework described above. The project framework helps the large language model understand the overall project structure, thereby aiding in the development of an action plan.

[0121] In a preferred example, the prompt word may also include the knowledge graph described above.

[0122] When developing an action plan, operation 206 can extract relevant knowledge from the knowledge graph based on specific exploration tasks. As the learning process progresses, the knowledge graph may become increasingly large, making the extraction process extremely important. In one example, keywords from the action plan can be used to search the knowledge graph to extract relevant knowledge. This extraction operation can be performed, for example, using a retrieval module of a large language model agent (such as retrieval module 104 described above).

[0123] Here is an example of the prompt word for operation 206:

[0124] You are a senior programmer, and now you need to learn a project codebase until you fully master it.

[0125] The code framework for the content to be explored is as follows:

[0126] <<

[0127] >>

[0128] The [learned knowledge graph] is as follows (including the relationships between the components):

[0129] <<

[0130] >>

[0131] The tasks currently awaiting exploration are as follows:

[0132] <<

[0133] >>

[0134] The current exploration status is as follows:

[0135] <<

[0136] >>

[0137] The history of previously completed and failed exploration missions is as follows:

[0138] <<

[0139] >>

[0140] Please carefully consider and analyze the following steps:

[0141] Project background review: Based on the code framework under [the content to be explored], analyze the content that needs to be explored under the content to be explored;

[0142] New exploration plan: Based on the [current tasks to be explored], [current exploration status], and [history of previously completed and failed exploration tasks], formulate a specific action plan and output relevant code snippets from the project codebase.

[0143] For example:

[0144] Response format:

[0145] Specific action plans;

[0146] Related code snippets.

[0147] When there are multiple tasks, they can be executed one by one, in parallel or in combination until all tasks are completed.

[0148] Method 200 may include: in operation 208, learning retrieved code snippets to update the knowledge graph.

[0149] Operation 208 can be used to learn code snippets to gain knowledge about the project's codebase. Operation 208 can be achieved by providing prompt words to a large language model. These prompt words may, for example, include at least the code snippets retrieved in operation 206.

[0150] In a preferred example, the prompt may also include the project background described above. Project background helps large language models accurately understand the function of code snippets.

[0151] In a preferred example, the prompt word may also include the knowledge graph described above.

[0152] Operation 208 can generate natural language knowledge, which can be used to update the knowledge graph.

[0153] For different functions within different components, this operation serves to summarize the function's purpose using natural language. After summarizing each function, the functions and interrelationships of the components they form can be further summarized using natural language. After summarizing each component, a bottom-up summary process can continue. For example, the functions and interrelationships of functional modules comprising multiple components can be summarized until the entire project codebase is finally understood.

[0154] The generated knowledge can then be stored in a knowledge graph. In addition to the knowledge graph, the learned instructions can also be stored in other locations, such as an internal wiki.

[0155] In a preferred example, knowledge graph fragments can be generated using the generated natural language knowledge, and the knowledge graph can be updated by merging these fragments into the knowledge graph. Alternatively, the knowledge graph can be updated in other ways using the output natural language knowledge, such as by correcting the knowledge graph.

[0156] In one or more embodiments of this disclosure, a knowledge graph is used to represent the learned knowledge. Since data interactions between different modules can better reflect the logical relationships between different components through the textual form of the knowledge graph, and large language models are adept at processing textual information, the knowledge generation module can learn the data interactions and internal data processing relationships between different components or modules, and generate these relationships in the form of a knowledge graph. For example, the knowledge graph can be in UML format.

[0157] Here is an example of the prompt word for operation 208:

[0158] You are a senior programmer, and now you need to look at the code to learn the entire project structure.

[0159] [Project Background] is as follows:

[0160] <<

[0161] >>

[0162] The [learned knowledge graph] is as follows (including the relationships between the components):

[0163] <<

[0164] >>

[0165] The tasks currently awaiting exploration are as follows:

[0166] <<

[0167] >>

[0168] The following is a code snippet to be learned corresponding to the task to be explored:

[0169] <<

[0170] >>

[0171] Please carefully consider and analyze the following steps:

[0172] Project Background Review: Based on the [Project Background] and the [Knowledge Graph You Have Learned], summarize the project processes you have learned so far;

[0173] Code Learning: Based on the [current task to be explored] and the [code snippets to be learned corresponding to the task to be explored], analyze the code's execution logic from the bottom up. First, analyze the function's purpose, then analyze the relationships between functions, and finally summarize the code's macro-level task.

[0174] Update the knowledge graph: Based on the code learning in the previous step, supplement the knowledge of the code to be learned in this step with the [learned knowledge graph].

[0175] For example:

[0176] Response format:

[0177] Project background review;

[0178] Code learning;

[0179] Generate a knowledge graph.

[0180] See Figure 3 It shows a schematic block diagram of an example system 300 that uses a machine learning model to learn a project codebase.

[0181] like Figure 3 As shown, system 300 may include an initial learning module 302, an automatic learning guidance module 304, a planning module 306, and a knowledge generation module 308. These modules can be part of a single large language model agent, thereby enabling mutual calls and information sharing between the modules.

[0182] The following sections will introduce each module in turn:

[0183] The initial learning module 302 can be used to build a knowledge graph of the project codebase based on the code framework of the project codebase. For specific details of its operation, please refer to the description of operation 202 above.

[0184] The automatic learning guidance module 304 can be used to generate exploration tasks based on knowledge graphs. For specific details of its operation, please refer to the description of operation 204 above.

[0185] The planning module 306 can be used to develop an action plan that includes specific exploration steps based on the exploration task and to retrieve related code snippets. For details of its operation, please refer to the description of operation 206 above.

[0186] The knowledge generation module 308 can be used to learn retrieved code snippets by executing action plans to update the knowledge graph. For specific details of its operation, please refer to the description of operation 208 above.

[0187] As needed, system 300 may include more or fewer modules to implement the operations described in one or more embodiments of this disclosure.

[0188] See Figure 4 This illustrates an overall flowchart of an example method 400 for using a machine learning model to help process error codes, according to one or more embodiments of the present disclosure. It should be understood that method 400 is merely intended to illustrate application scenarios of methods for solving problems according to one or more embodiments of the present disclosure, and is not intended to be limiting.

[0189] Method 400 may include: code issues can be discovered in operation 402. For example, code issues can be discovered by testers during testing. This is not the only way to discover code issues; other methods can be used, such as collecting code issues after the project goes live.

[0190] Method 400 may also include: in operation 404, submitting a problem description associated with the code issue. For example, testers can submit a problem description associated with the code issue to the server (e.g., via a ticket). In some examples, attachments, such as log files, can also be uploaded to the server together.

[0191] Method 400 may also include: in operation 406, using a large language model to analyze the problem description to find the erroneous code snippet. Specific details of this operation will be described in more detail below.

[0192] In some cases, large language models can also determine suggested modifications to error codes.

[0193] Method 400 may also include: in operation 408, the large language model can output the found erroneous code snippets (and / or modification suggestions) to the developers for their reference, automatically attempt to fix the erroneous code using the large language model without the involvement of developers, or a combination thereof.

[0194] See Figure 5 The diagram illustrates a flowchart of an example method 500 for locating erroneous code in a project codebase using a machine learning model, according to one or more embodiments of the present disclosure.

[0195] Method 500 may include, in operation 502, determining the code snippets in the project codebase to be reviewed based on the problem description and a knowledge graph of the project codebase. Operation 502 may be implemented by providing prompt words to a large language model. These prompt words may include, for example, the problem description and the knowledge graph of the project codebase.

[0196] The problem description is as shown in the reference above. Figure 4 The problem described.

[0197] Preferably, the knowledge graph is, for example, a knowledge graph generated in accordance with one or more embodiments of this disclosure as described above. However, the invention is not limited thereto. In some examples, the knowledge graph may be a knowledge graph obtained by other means, such as a knowledge graph obtained through manual editing.

[0198] In a preferred example, the prompt may also include other information.

[0199] For example, the prompt word could include project background. Project background helps large language models understand the context of the project, making it easier to find the code snippet to review more accurately.

[0200] In some cases, during problem analysis, it may be discovered that the existing information is insufficient to accurately determine the code snippet to be reviewed. In such cases, the prompt may also include an additional project content framework. This additional project content framework, for example, can indicate how to obtain additional content, helping the large language model determine what further content to retrieve when additional content is needed. The process of searching for additional content will be described later.

[0201] In this operation, preferably, preliminary conclusions can also be generated using a large language model.

[0202] Preferably, to perform problem analysis more efficiently and systematically, in operation 502, before or during the actual determination of the code snippets to be reviewed, a problem analysis plan may first be generated, at least in part, based on the problem description and the knowledge graph of the project codebase. This problem analysis plan may include, for example, the order of operations to be performed, the order of code snippets to be reviewed, etc.

[0203] Here is an example of the prompt word for Operation 502:

[0204] You are a senior programmer, and you need to analyze the potential causes based on the log records found by the testers.

[0205] [Project Background] is as follows:

[0206] <<

[0207] >>

[0208] The problem description is as follows:

[0209] <<

[0210] >>

[0211] The knowledge graph of the project codebase is as follows (including the relationships between components):

[0212] <<

[0213] >>

[0214] [Additional content] is as follows:

[0215] <<

[0216] >>

[0217] The [Supplementary Project Content Framework] is as follows:

[0218] <<

[0219] >>

[0220] Please think carefully and analyze step by step according to the following steps:

[0221] 1. Project Background Review: Please review the [Project Background];

[0222] 2. Problem Analysis: Based on the [problem description] and reviewing the [project codebase knowledge graph], and considering [additional content] (if any), consider the possible causes of this problem;

[0223] 3. Code Review: Based on your thoughts in the previous step and the [project codebase knowledge graph], identify the parts of the code that need to be reviewed.

[0224] 4. Additional Content Request: If you believe that the existing knowledge is insufficient to pinpoint the cause of the problem, you can submit an additional content request based on the [Additional Content Framework].

[0225] For example:

[0226] Response format:

[0227] Project background review;

[0228] Problem analysis;

[0229] Code review;

[0230] Additional content request.

[0231] Method 500 may further include: in operation 504, searching for associated log information in the log records based on the problem description. Operation 504 can be implemented by providing prompt words to the large language model. These prompt words may include, for example, the problem description and the log records.

[0232] The problem description is, for example, the problem description described above.

[0233] Log entries can be, for example, the text you type in, a log database, or a log file.

[0234] In a preferred example, the prompt may also include other information. For example, the prompt may include project background, knowledge graph, etc. Preferably, the prompt may also include previously generated preliminary conclusions. Preferably, the prompt may also include log keywords. For example, the log keywords may be log keywords determined in previous operations.

[0235] Here is an example of a prompt word for a 504 error:

[0236] You are a senior programmer, and you need to analyze the potential causes based on the log records found by the testers.

[0237] [Project Background] is as follows:

[0238] <<

[0239] >>

[0240] The knowledge graph of the project codebase is as follows (including the relationships between components):

[0241] <<

[0242] >>

[0243] The problem description is as follows:

[0244] <<

[0245] >>

[0246] The preliminary conclusions reached earlier are as follows:

[0247] <<

[0248] >>

[0249] The following are the log filter keywords that can be added:

[0250] <<

[0251] >>

[0252] Please think carefully and analyze step by step according to the following steps:

[0253] 1. Problem Analysis: Based on the [problem description] and by reviewing the [project codebase knowledge graph], consider potential problems and identify related log information in the log records;

[0254] 2. Adding Log Keywords: Since logs can be very large, you may not be able to view all the content at once. Based on the questions in the previous step, consider which log filtering keywords you need to add to filter out important content. The log filtering keywords you can add are listed in [Accessible Log Filtering Keywords].

[0255] 3. After adding log filtering keywords, you can more accurately locate related log information in the log records.

[0256] For example:

[0257] Problem analysis;

[0258] Log filter keywords to add;

[0259] Related log information.

[0260] Method 500 may further include: in operation 506, reviewing the code snippet to be reviewed in conjunction with log information to identify the erroneous code causing the problem in the problem description. Operation 506 can be implemented by providing cue words to the large language model. These cue words may include, for example, log information and the code snippet to be reviewed.

[0261] Log information, for example, is the associated log information identified in the previous operation 504.

[0262] The code segment to be reviewed is, for example, the code segment to be reviewed as determined in previous operation 502. When there are multiple code segments to be reviewed, they can be reviewed one by one.

[0263] In a preferred example, the prompt may also include other information. For instance, the prompt may include project background, knowledge graph, problem description, etc.

[0264] Preferably, the prompt may also include previously obtained preliminary conclusions.

[0265] Here is an example of the prompt word for Operation 506:

[0266] You are a senior programmer, and you need to analyze the potential causes based on the log records found by the testers.

[0267] [Project Background] is as follows:

[0268] <<

[0269] >>

[0270] The knowledge graph of the project codebase is as follows (including the relationships between components):

[0271] <<

[0272] >>

[0273] The problem description is as follows:

[0274] <<

[0275] >>

[0276] The preliminary conclusions reached earlier are as follows:

[0277] <<

[0278] >>

[0279] The code snippet to be reviewed is as follows:

[0280] <<

[0281] >>

[0282] The associated log information is as follows:

[0283] <<

[0284] >>

[0285] Please think carefully and analyze step by step according to the following steps:

[0286] 1. Problem Analysis: Based on the [problem description] and [preliminary conclusions], analyze the causes of the problem;

[0287] 2. Additional code and log requests: If you believe that the existing code snippets and log information are insufficient to pinpoint the cause of the problem, you can request additional content based on the [project codebase knowledge graph].

[0288] 3. Problem finding: Based on the previous step, and using the [code snippets to be reviewed] and [related log information], simulate the input and output of each code snippet according to the function to find the erroneous code.

[0289] 4. Modification Suggestions: Provide modification suggestions for the error code; or perform modifications to the error code; if modifications are performed, run tests to determine if the problem is resolved; if not, iterate through the above process until the problem is resolved.

[0290] For example:

[0291] Problem analysis;

[0292] Request for additional information;

[0293] Error code;

[0294] Suggested revisions;

[0295] Code used for testing.

[0296] It is understood that the examples above are not limiting. Other implementations will be apparent to those skilled in the art from the examples provided in this disclosure.

[0297] See Figure 6 It shows a schematic block diagram of an example system 600 that uses a machine learning model to learn a project codebase.

[0298] like Figure 6As shown, system 600 may include an automatic analysis module 602, a log search module 604, and a code analysis module 606. These modules can function as part of a single large language model agent, enabling inter-module calls and information sharing.

[0299] The following sections will introduce each module in turn:

[0300] The automatic analysis module 602 can be used to determine the code segments in the project codebase to be reviewed based on the problem description and the knowledge graph of the project codebase. For specific details of its operation, please refer to the description of operation 502 above.

[0301] The log search module 604 can be used to search for related log information in the log records based on the problem description. For specific details of its operation, please refer to the description of operation 504 above.

[0302] The code analysis module 606 can be used to review the code snippets to be reviewed in conjunction with log information in order to identify the erroneous code that caused the problem in the problem description. For specific details of its operation, please refer to the description of operation 506 above.

[0303] As needed, system 600 may include more or fewer modules to implement the operations described in one or more embodiments of this disclosure.

[0304] Figure 7 A schematic diagram of the structure of a computer system 700 according to one or more embodiments of the present disclosure is shown. Figure 7 As shown, system 700 can be used to perform the operations described above, such as referring to Figure 3 The operations described.

[0305] For example, system 700 may include one or more processors 702 and memory 704. Memory may include RAM, ROM, or a combination thereof. Memory may store computer-executable instructions that, when executed by one or more processors, cause the one or more processors to perform the various functions described herein (e.g., regarding...). Figure 1 (Described functions).

[0306] One or more processors may include a CPU, which in some examples may be a multi-core CPU. Instructions executed at the CPU may be loaded, for example, from program memory associated with the CPU or from memory 505. The one or more processors may also include additional processing components tailored for specific functions, such as a graphics processing unit (GPU), a digital signal processor (DSP), a neural processing unit (NPU), or a multimedia processing unit. In some examples, the one or more processors may be based on the ARM or RISC-V instruction set.

[0307] An NPU is generally a dedicated circuit configured to implement the control and arithmetic logic for executing machine learning algorithms, such as those for processing artificial neural networks (ANNs), deep neural networks (DNNs), random forests (RF), etc. NPUs are sometimes alternatively referred to as neural signal processors (NSPs), tensor processing units (TPUs), neural network processors (NNPs), intelligent processing units (IPUs), or vision processing units (VPUs). NPUs can be configured to accelerate the execution of common machine learning tasks, such as image classification and various other prediction tasks. In some examples, multiple NPUs may be instantiated on a single chip (such as a system-on-a-chip (SoC)), while in other examples, multiple NPUs may be part of a dedicated neural network accelerator. NPUs can be optimized for training or inference, or in some cases, configured to balance performance between training and inference. For an NPU capable of performing both training and inference, these two tasks may often still be performed independently. NPUs designed to accelerate training are typically configured to speed up the optimization of new models. This involves a highly computationally intensive operation: taking an existing dataset (often labeled or sublabeled), iterating over the dataset, and then tuning model parameters (such as weights and biases) to improve model performance. Generally, optimization based on incorrect predictions involves backtracking through the layers of the model and determining gradients to reduce prediction errors. NPUs designed to accelerate inference are typically configured to operate on trained models. Such NPUs can thus be configured to take new data segments as input and rapidly process those segments using an already trained model to generate model outputs (e.g., inference).

[0308] In some cases, the memory may contain a BIOS, which controls basic hardware or software operations, such as interaction with peripheral components or devices. The processor may include intelligent hardware devices (e.g., general-purpose processors, DSPs, CPUs, microcontrollers, ASICs, FPGAs, programmable logic devices, discrete gate or transistor logic components, discrete hardware components, or any combination thereof).

[0309] Additionally, system 700 may include one or more wireless transceivers for transmitting and receiving data via various means, protocols, and standards. In some embodiments, the wireless transceivers may be configured to transmit and receive data via short-range wireless communication protocols (e.g., Data messages and elements may be transmitted and received via (etc.) and / or via local area networks and / or wide area networks, and / or via cellular networks, and / or via any suitable wireless network. It should be understood, of course, that these are merely examples of networks that System 700 may utilize on a wireless link, and the subject matter claimed for protection is not limited in this respect.

[0310] It is understood that the functions described herein can be implemented in hardware, software executed by a processor, firmware, or any combination thereof. If implemented in software executed by a processor, the functions can be stored or transmitted as one or more instructions or code on a computer-readable medium. Other examples and implementations fall within the scope of this disclosure and the appended claims. For example, due to the nature of software, the functions described herein can be implemented using software executed by a processor, hardware, firmware, hardwired, or any combination thereof. Features implementing the functions can also be physically located in various locations, including being distributed such that different parts of the function are implemented at different physical locations.

[0311] It is understood that, unless otherwise stated, features described with reference to one or more embodiments of this disclosure may be combined with features described with reference to other embodiments.

[0312] The foregoing description includes examples of various aspects of the claimed subject matter. It is certainly impossible to describe every conceivable combination of components or methods for the purpose of depicting the claimed subject matter, but those skilled in the art will recognize that many further combinations and arrangements of the claimed subject matter are possible. Thus, the disclosed subject matter is intended to cover all such changes, modifications, and variations that fall within the spirit and scope of the appended claims.

Claims

1. A method for learning a project codebase using a machine learning model, characterized in that, The machine learning model is a large language model, and the method includes: A knowledge graph of the project codebase is constructed based on the code framework of the project codebase, wherein the code framework indicates the components of the project codebase and the relationships between the components; An exploration task is generated based on the knowledge graph, and the exploration task explores the components in the project code; Based on the exploration task, develop an action plan including specific exploration steps and retrieve relevant code snippets; and The retrieved code snippets are learned and updated by executing the action plan.

2. The method according to claim 1, characterized in that, Each operation of the method is implemented by providing prompt words to the large language model.

3. The method according to claim 1, characterized in that, The exploration task is generated further based on the history of completed and failed exploration tasks.

4. The method according to claim 1, characterized in that, Developing the action plan further includes extracting knowledge from the knowledge graph that is relevant to the exploration task.

5. A method for locating erroneous code in a project codebase using a machine learning model, characterized in that, The machine learning model is a large language model, and the method includes: The code segments to be reviewed in the project codebase are determined based on the problem description and the knowledge graph of the project codebase. Search for related log information in the log records based on the problem description; and The code segment to be reviewed is examined in conjunction with the log information to identify the erroneous code causing the problem described in the problem description.

6. The method according to claim 5, characterized in that, Each operation of the method is implemented by providing prompt words to the large language model.

7. The method according to claim 5, characterized in that, Further includes: A problem analysis plan is generated based on the problem description and the knowledge graph.

8. The method according to claim 5, characterized in that, Further includes: Retrieve additional content to identify code snippets in the project's codebase to be reviewed.

9. The method according to claim 5, characterized in that, Further includes: Output the error code and suggested modifications to the error code.

10. The method according to claim 5, characterized in that, Further includes: The error code will be automatically modified.

11. The method according to claim 10, characterized in that, Further includes: After the modifications are implemented, tests are automatically run to determine if the issue has been resolved. as well as If the problem is not resolved, the process of identifying and modifying the error code is repeated until the problem is resolved.

12. A system for learning a project codebase using a machine learning model, characterized in that, The machine learning model is a large language model, and the system includes: The initial learning module is used to construct a knowledge graph of the project codebase based on the code framework of the project codebase; An automatic learning guidance module is used to generate exploration tasks based on the knowledge graph; The planning module is used to formulate an action plan, including specific exploration steps, based on the exploration task and to retrieve associated code snippets; and A knowledge generation module is used to learn the retrieved code snippets by executing the action plan in order to update the knowledge graph.

13. A system for locating erroneous code in a project codebase using a machine learning model, characterized in that, The machine learning model is a large language model, and the system includes: An automatic analysis module is used to analyze the code snippets to be reviewed in the project codebase based on the problem description and the knowledge graph of the project codebase. A log search module is used to search for related log information in log records based on the problem description; and The code analysis module is used to review the code segment to be reviewed in conjunction with the log information in order to identify the erroneous code that causes the problem in the problem description.

14. A computer-readable storage medium storing instructions, characterized in that, When the instructions are executed by a computer, the computer performs the method as described in any one of claims 1-11.

15. A computer system, characterized in that, include: Memory, and One or more processors coupled to the memory, the one or more processors being configured to perform the method as described in any one of claims 1-11.