Software defect processing method and device and storage medium

By constructing a weighted cause-effect graph and performing counterfactual reasoning, the problem of low accuracy in software defect handling was solved, enabling precise location of software defects and code repair, thus improving the accuracy and efficiency of processing.

CN121833461APending Publication Date: 2026-04-10AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
AGRICULTURAL BANK OF CHINA
Filing Date
2025-11-26
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

The accuracy of software defect handling in existing technologies is low. Traditional methods are difficult to effectively locate the root cause, easily confuse causal relationships, and lead to misjudgment.

Method used

By acquiring multimodal data to generate a weighted causal graph, counterfactual reasoning techniques are used to determine the root causes of software defects. This includes acquiring defective code, runtime data, and log events, constructing a causal graph and performing Monte Carlo simulations, pruning and optimizing the causal graph, and using a large language model to generate diagnostic reports and code repair solutions.

Benefits of technology

It improves the accuracy of software defect handling, enables accurate location of software defects, avoids black-box decision-making, and provides detailed diagnostic reports and code repair solutions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121833461A_ABST
    Figure CN121833461A_ABST
Patent Text Reader

Abstract

The invention discloses a software defect processing method and device and a storage medium. Relates to the field of financial science and technology, and comprises the following steps: obtaining multi-modal data of software defects to be processed, the multi-modal data being data associated with the software defects, and the multi-modal data at least comprising defect codes, runtime data and log events; according to the multi-modal data, a weighted causal graph is generated, the weighted causal graph is used for modeling the causal relationship between the nodes, and the weight in the weighted causal graph is used for representing the conditional probability of the causal relationship; and performing anti-fact reasoning according to the weighted causal graph to obtain a root cause conclusion corresponding to the software defect. Through the method and the device, the problem of relatively low accuracy of software defect processing in related technologies is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of financial technology, and more specifically, to a method, apparatus, and storage medium for handling software defects. Background Technology

[0002] As software systems become increasingly complex, especially in multi-threaded and distributed environments, relying solely on traditional experience-based judgment or log analysis is no longer sufficient to effectively pinpoint the causes of software defects. Root cause analysis is an important troubleshooting method that aims to identify the root causes of software defects.

[0003] In existing technologies, the handling of software defects is usually based on methods such as log analysis, code analysis, and machine learning classification. However, since these methods are based on static code and rely on statistical correlation, they are prone to confusing causal relationships, which can easily lead to misjudgments of the root causes of software defects.

[0004] There is currently no effective solution to the problem of low accuracy in software defect handling in related technologies. Summary of the Invention

[0005] The main objective of this application is to provide a method, apparatus, and storage medium for handling software defects, in order to solve the problem of low accuracy in software defect handling in related technologies.

[0006] To achieve the above objectives, according to one aspect of this application, a method for processing software defects is provided. The method includes: acquiring multimodal data of the software defect to be processed, wherein the multimodal data is data associated with the software defect, and the multimodal data includes at least defect code, runtime data, and log events; generating a weighted causal graph based on the multimodal data, wherein the weighted causal graph is used to model causal relationships between nodes, and the weights in the weighted causal graph are used to represent the conditional probabilities of the causal relationships; and performing counterfactual reasoning based on the weighted causal graph to obtain the root cause conclusion corresponding to the software defect.

[0007] Furthermore, generating a weighted causal graph based on multimodal data includes: obtaining conditional probability information of historical defect data; determining multiple nodes and multiple edges based on multimodal data, and determining the weights between different nodes based on the conditional probability information, wherein the edges are used to represent causal relationships; adjusting multiple edges based on multimodal data to obtain adjusted edges; and determining a weighted causal graph based on multiple nodes, weights, and adjusted edges.

[0008] Furthermore, obtaining multimodal data of the software defects to be processed includes: extracting defect code, runtime data, and log events related to the software defects; and performing time alignment on the defect code, runtime data, and log events to obtain multimodal data.

[0009] Furthermore, after determining the weighted causal graph based on multiple nodes, weights, and adjusted edges, the method further includes: obtaining a preset weight threshold; pruning the weights in the weighted causal graph based on the preset weight threshold to obtain a pruned weighted causal graph; merging preset nodes in the pruned weighted causal graph to obtain an optimized weighted causal graph, wherein the optimized weighted causal graph is used for counterfactual reasoning.

[0010] Furthermore, counterfactual reasoning based on the weighted causal graph yields the following root cause conclusions for software defects: obtaining custom query information and determining hypothetical intervention information based on the custom query information; applying perturbation intervention to the weighted causal graph using the hypothetical intervention information to obtain the intervened weighted causal graph; performing Monte Carlo simulation based on the intervened weighted causal graph to obtain multiple simulation results; and statistically analyzing the defect state distribution in the multiple simulation results to obtain the root cause conclusions.

[0011] Furthermore, after obtaining the root cause conclusions corresponding to the software defects through counterfactual reasoning based on the weighted causal graph, the method also includes: obtaining root cause description prompts and code repair prompts; inputting the multimodal data, root cause conclusions, and root cause description prompts into the first large language model, and using the first large language model to output a diagnostic report; inputting the diagnostic report and code repair prompts into the second large language model, and using the second large language model to output a code modification plan.

[0012] To achieve the above objectives, according to another aspect of this application, a software defect processing apparatus is provided. The apparatus includes: a data acquisition unit for acquiring multimodal data of the software defect to be processed, wherein the multimodal data is data associated with the software defect, and the multimodal data includes at least defect code, runtime data, and log events; a cause-effect graph generation unit for generating a weighted cause-effect graph based on the multimodal data, wherein the weighted cause-effect graph is used to model causal relationships between nodes, and the weights in the weighted cause-effect graph represent the conditional probabilities of the causal relationships; and a counterfactual reasoning unit for performing counterfactual reasoning based on the weighted cause-effect graph to obtain the root cause conclusion corresponding to the software defect.

[0013] Furthermore, the causal graph generation unit includes: an information acquisition module for acquiring conditional probability information of historical defect data; a data determination module for determining multiple nodes and multiple edges based on multimodal data, and determining the weights between different nodes based on conditional probability information, wherein edges are used to represent causal relationships; an edge adjustment module for adjusting multiple edges based on multimodal data to obtain adjusted edges; and a causal graph determination module for determining a weighted causal graph based on multiple nodes, weights, and adjusted edges.

[0014] Furthermore, the data acquisition unit includes: a data extraction module for extracting defect code, runtime data, and log events related to software defects; and a time alignment module for performing time alignment on the defect code, runtime data, and log events to obtain multimodal data.

[0015] Furthermore, the causal graph generation unit also includes: a threshold acquisition module, used to acquire a preset weight threshold after determining the weighted causal graph based on multiple nodes, weights, and adjusted edges; a weight pruning module, used to prune the weights in the weighted causal graph based on the preset weight threshold to obtain a pruned weighted causal graph; and a node merging module, used to merge preset nodes in the pruned weighted causal graph to obtain an optimized weighted causal graph, wherein the optimized weighted causal graph is used for counterfactual reasoning.

[0016] Furthermore, the counterfactual reasoning unit includes: a hypothesis intervention module, used to obtain custom query information and determine hypothetical intervention information based on the custom query information; a perturbation intervention module, used to apply perturbation intervention to the weighted causal graph using the hypothetical intervention information to obtain the intervened weighted causal graph; a Monte Carlo simulation module, used to perform Monte Carlo simulation based on the intervened weighted causal graph to obtain multiple simulation results; and a defect statistics module, used to statistically analyze the defect state distribution in multiple simulation results to obtain root cause conclusions.

[0017] Furthermore, the device also includes: a prompt word acquisition unit, used to acquire root cause description prompt words and code repair prompt words after obtaining the root cause conclusion corresponding to the software defect through counterfactual reasoning based on the weighted causal graph; a first output unit, used to input the multimodal data, root cause conclusion, and root cause description prompt words into a first large language model, and use the first large language model to output a diagnostic report; and a second output unit, used to input the diagnostic report and code repair prompt words into a second large language model, and use the second large language model to output a code modification plan.

[0018] According to another aspect of this application, a computer-readable storage medium is provided, which includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform any software defect handling method.

[0019] According to another aspect of this application, an electronic device is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include a processing method for performing any kind of software defect.

[0020] According to another aspect of this application, a computer program product is provided, including computer instructions, and steps for a method of handling software defects that implement any of the above when the computer instructions are executed by a processor.

[0021] In this embodiment, multimodal data of the software defect to be processed is obtained, wherein the multimodal data is data associated with the software defect, and the multimodal data includes at least defect code, runtime data, and log events; a weighted causal graph is generated based on the multimodal data, wherein the weighted causal graph is used to model the causal relationship between nodes, and the weight in the weighted causal graph is used to represent the conditional probability of the causal relationship; counterfactual reasoning is performed based on the weighted causal graph to obtain the root cause conclusion corresponding to the software defect, thereby solving the technical problem of low accuracy in software defect processing in the prior art.

[0022] By acquiring multimodal data on software defects, not only static data such as defect code and log events are obtained, but also dynamic data such as runtime data are acquired. This solves the problem that traditional static analysis methods cannot capture environmental dependency traps. The weighted cause-effect graph constructed can comprehensively reflect the actual situation of software defects. Furthermore, the root cause conclusion is obtained through counterfactual reasoning, avoiding black-box decision-making and achieving accurate location of the target root cause. Therefore, the accuracy of software defect handling is improved. Attached Figure Description

[0023] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0024] Figure 1 A hardware structure block diagram of a computer terminal for implementing a method for handling software defects is shown.

[0025] Figure 2 This is a flowchart of a software defect handling method provided according to an embodiment of this application;

[0026] Figure 3 This is a schematic diagram of a software defect processing apparatus provided according to an embodiment of this application;

[0027] Figure 4 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation

[0028] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0029] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0030] It should be noted that the information collected in this application (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) are information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of this data all comply with relevant laws, regulations, and standards, necessary confidentiality measures have been taken, and they do not violate public order and good morals. Corresponding access points are provided for users to choose to authorize or refuse. For example, interfaces are set up between this system and relevant users or organizations, providing users with corresponding access points to choose to agree to or refuse automated decision-making results; if the user chooses to refuse, the process proceeds to the expert decision-making stage.

[0031] Example 1

[0032] According to an embodiment of this application, a method embodiment for processing software defects is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0033] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1A hardware block diagram of a computer terminal (or mobile device) for implementing a method for handling software defects is shown. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0034] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).

[0035] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the software defect handling method in the embodiments of this application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the aforementioned software defect handling method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0036] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0037] The display may be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10 (or mobile device).

[0038] Under the aforementioned operating environment, this application provides the following: Figure 2 The software defect handling method shown. Figure 2 This is a flowchart of a software defect handling method according to Embodiment 1 of this application.

[0039] Step S201: Obtain multimodal data of the software defect to be processed. The multimodal data is data associated with the software defect and includes at least defect code, runtime data, and log events.

[0040] Optionally, software defects refer to situations in the software development process of a target financial institution that do not meet expected functional or performance requirements, or contain operational errors. Software defects include functional defects, performance defects, and compatibility defects. Multimodal data refers to a collection of multiple types of data associated with software defects, which together constitute a three-dimensional perspective for analyzing software defects. Defect code refers to the code segment containing errors corresponding to software defects, which can be extracted from the source code of the software defect using source code analysis tools. Runtime data refers to the state information of the software during operation. Runtime data can include thread state snapshots (e.g., blocked states, lock holding information), memory usage (e.g., stack overflow points, object instance values), and network request latency, which can be obtained through performance monitoring tools or by analyzing system logs. Log events refer to exception stack logs related to software defects, such as key event timestamps and NullPointerException. In addition, multimodal data can also include visual data of user interface defects, such as rendering coordinates of interface controls and snapshots of control interaction states.

[0041] Step S202: Generate a weighted causal graph based on multimodal data. The weighted causal graph is used to model the causal relationships between nodes, and the weights in the weighted causal graph are used to represent the conditional probabilities of the causal relationships.

[0042] Optionally, a weighted causal graph is a graph model where nodes represent variables, events, and states, and edges represent causal relationships between different nodes. Weights are calculated based on conditional probabilities and are used to characterize the strength (i.e., reliability) of the causal relationship. Weights can be labeled on edges representing causal relationships, or they can be used as separate edges (in which case the edges in the weighted causal graph have two types: edges representing causal relationships and edges representing weights). For example, in a weighted causal graph, P(SessionExpired|ActiveSessions>1000): represents the probability that a session expires when the number of active sessions exceeds 1000.

[0043] Step S203: Perform counterfactual reasoning based on the weighted cause-effect graph to obtain the root cause conclusions corresponding to the software defects.

[0044] Optionally, counterfactual reasoning refers to a statistical method that uses hypothetical interventions (e.g., the assumption that variable X does not exist) to simulate changes in the state of a defect, thereby verifying causal relationships. Specifically, counterfactual reasoning can involve selecting one or more nodes in a weighted causal graph for hypothetical interventions. For example, the value of a variable at a node can be directly modified, or additional constraints can be added to the node. Monte Carlo simulations can be used to run the causal graph after the hypothetical interventions multiple times, evaluating the impact of these interventions on the probability of software defects occurring. Each simulation produces a set of possible results. By repeating the simulation multiple times, the probability distribution of software defects occurring under different hypothetical interventions can be statistically determined. Based on the simulation results, the hypothetical intervention that significantly reduces the probability of software defects occurring is identified, and the variable corresponding to this hypothetical intervention is the root cause of the software defect. For example, if the hypothetical intervention of a variable corresponding to a certain node makes the probability of the software defect disappearing greater than a preset probability threshold, then this variable is the target root cause of the software defect. By collecting the target root causes that meet the above conditions, the root cause conclusion corresponding to the software defect can be obtained.

[0045] In summary, by acquiring multimodal data on software defects, not only static data such as defect code and log events are obtained, but also dynamic data such as runtime data are acquired. This solves the problem that traditional static analysis methods cannot capture environmental dependency traps. The weighted cause-effect graph constructed can comprehensively reflect the actual situation of software defects. Furthermore, the root cause conclusion is obtained through counterfactual reasoning, avoiding black-box decision-making and achieving accurate location of the target root cause. Therefore, the accuracy of software defect handling is improved.

[0046] To improve the accuracy of software defect handling, optionally, generating a weighted causal graph based on multimodal data includes: obtaining conditional probability information of historical defect data; determining multiple nodes and multiple edges based on the multimodal data, and determining the weights between different nodes based on the conditional probability information, wherein the edges are used to represent causal relationships; adjusting multiple edges based on the multimodal data to obtain adjusted edges; and determining a weighted causal graph based on multiple nodes, weights, and adjusted edges.

[0047] Optionally, historical defect data from multiple software systems of the target financial institution can be obtained, and statistical analysis can be performed based on this data to obtain conditional probability information. Conditional probability information represents the probability of another event occurring given a certain condition. This information is crucial for quantifying the strength of causal relationships between nodes in a weighted causal graph. Three types of nodes can be extracted from the multimodal data: code variable nodes (e.g., LockA.holder, a variable node), runtime event nodes (e.g., Thread_Blocked, a thread blocking event), and log exception nodes (e.g., NPE_Event, a null pointer exception). Edges are used to represent causal relationships between nodes. Weights between different nodes can be initialized based on the conditional probability information of historical defect events. For example, if P(deadlock|LockA not released) = 0.92 in the conditional probability information, and if LockA is not released, the probability of a deadlock is 92%, then the weight between the node "LockA not released" and the node "deadlock" can be set to 0.92. Adjusting multiple edges can be achieved by using Monte Carlo simulation to inject runtime state constraints into a weighted causal graph. This involves dynamically adding edges by simulating random changes in runtime state (such as the state of a thread holding a lock) to reflect the causal effects in the actual system operation. For example, when simulating thread T1 holding LockA and being in a blocked state, an edge is added between node "T1" and node "LockA".

[0048] In summary, by acquiring the conditional probability information of historical defect data, the strength of causal relationships between nodes can be quantified more accurately, thereby constructing a weighted causal graph, achieving more precise cause localization of software defects, and improving the accuracy of software defect handling.

[0049] To improve the accuracy of software defect handling, optionally, obtaining multimodal data of the software defect to be processed includes: extracting defect code, runtime data, and log events for the software defect; and performing time alignment on the defect code, runtime data, and log events to obtain multimodal data.

[0050] Optionally, the source code fragment where the error occurred can be extracted, and the abstract syntax tree (AST) of the entire source code can be obtained. This source code fragment and AST can then be identified as defective code. Thread state snapshots and memory usage during program runtime can be extracted, as well as exception stack logs. Visual data such as rendering coordinates and interaction state snapshots of UI controls can also be extracted. The timestamps of all the above data can be synchronized using a network time protocol, and a timeline can be created to map the line numbers of the defective code to log events. For example, `LoginActivity.java:25` can be mapped to the `NullPointerException` (log event for a null pointer exception).

[0051] For example, the obtained multimodal data can be as follows:

[0052] {

[0053] Tags: component.clickevent(),

[0054] Log event: NullPointerException @ line 25

[0055] Running status: {Thread: T1 @ Blocked state, Memory utilization: 85%}

[0056] Interface layout: {Button 1: coordinates 1200px}

[0057] }

[0058] In summary, by extracting defect code, runtime data, and log events related to software defects, and by performing time alignment on the defect code, runtime data, and log events, multimodal data is obtained, laying a data foundation for software defect processing and improving the accuracy of software defect processing.

[0059] To improve the accuracy of software defect handling, the method may optionally include, after determining the weighted causal graph based on multiple nodes, weights, and adjusted edges, the method further includes: obtaining a preset weight threshold; pruning the weights in the weighted causal graph based on the preset weight threshold to obtain a pruned weighted causal graph; merging preset nodes in the pruned weighted causal graph to obtain an optimized weighted causal graph, wherein the optimized weighted causal graph is used for counterfactual reasoning.

[0060] For example, a preset weight threshold of 0.7 can be set, and all edges with weights below 0.7 in the weighted causal graph can be pruned to reduce the complexity of the weighted causal graph and focus on strong causal relationships. Preset nodes can be redundant; for example, if multiple log event nodes point to the same variable node, these log event nodes can be merged.

[0061] In summary, by obtaining a preset weight threshold and pruning the weights in the weighted causal graph according to the preset weight threshold, a pruned weighted causal graph is obtained. Then, preset nodes in the pruned weighted causal graph are merged to obtain an optimized weighted causal graph. This achieves the optimization of the weighted causal graph and improves the accuracy of software defect handling.

[0062] To improve the accuracy of software defect handling, optionally, counterfactual reasoning based on the weighted causal graph can be used to obtain root cause conclusions corresponding to software defects, including: obtaining custom query information and determining hypothetical intervention information based on the custom query information; applying perturbation intervention to the weighted causal graph using the hypothetical intervention information to obtain the intervened weighted causal graph; performing Monte Carlo simulation based on the intervened weighted causal graph to obtain multiple simulation results; and statistically analyzing the defect state distribution in the multiple simulation results to obtain root cause conclusions.

[0063] For example, custom query information is used to provide direction for counterfactual reasoning. Hypothetical intervention information sets the thread pool size to 20 and is used to identify nodes that need to be changed. Then, corresponding changes are applied to the nodes corresponding to the hypothetical intervention information in the weighted causal graph to exert perturbation intervention. Multiple hypothetical intervention information can be included, and 1000 Monte Carlo simulations can be performed. The distribution of defect states in multiple simulation results can be statistically analyzed by calculating the probability of defect disappearance after each intervention (i.e., the number of simulations without defects divided by the total number of simulations). If the probability of defect disappearance corresponding to a certain hypothetical intervention information is greater than (1-5%), then the variable corresponding to that hypothetical intervention is the root cause of the software defect. That is, if the hypothetical intervention of a variable corresponding to a certain node causes the probability of software defect disappearance to be greater than a preset probability threshold, then that variable is the target root cause of the software defect. By combining at least one target root cause, the root cause conclusion corresponding to the software defect can be obtained.

[0064] For example, a custom query could be whether the deadlock probability drops below 5% when the number of threads is increased to 20. After Monte Carlo simulation, the probability of the defect disappearing is 96%. At this point, since the deadlock probability drops from 98% to 4% after intervention, the root cause is thread pool overload.

[0065] In summary, by applying a perturbation to the weighted causal graph using hypothetical intervention information, a post-intervention weighted causal graph is obtained. Monte Carlo simulation is then performed based on the post-intervention weighted causal graph, enabling the determination of the root causes of software defects through quantitative dynamic verification, thereby improving the accuracy of software defect handling.

[0066] To improve the accuracy of software defect handling, optionally, after obtaining the root cause conclusion corresponding to the software defect through counterfactual reasoning based on the weighted cause-effect graph, the method further includes: obtaining root cause description prompts and code repair prompts; inputting the multimodal data, root cause conclusion, and root cause description prompts into a first large language model, and using the first large language model to output a diagnostic report; inputting the diagnostic report and code repair prompts into a second large language model, and using the second large language model to output a code modification plan.

[0067] Optionally, root cause description prompts are used to guide the first language model to output a diagnostic report detailing the environment, conditions, and causes of the defect, while code repair prompts are used to guide the second language model to output code modification solutions. Both the first and second language models can be open-source, general-purpose large models.

[0068] For example, the root cause description prompt could be: "Please generate a diagnostic report. The core conflict is A, and the chain of evidence is B." The code repair prompt could be: "Generate a code modification plan based on the above diagnostic report. The plan should fix the abnormal state of A, comply with thread safety rules, and the output code modification plan should conform to code standards."

[0069] In summary, by utilizing the two-stage mechanism of the first and second language models, code modification schemes corresponding to root cause conclusions were generated, thereby improving the accuracy of software defect handling.

[0070] In one specific implementation, assuming the target financial institution discovers a deadlock defect in order submission during software testing, the software defect handling method of this embodiment can be processed according to the following steps:

[0071] The defective code is `synchronized(LockA){call LockB}` and `synchronized(LockB){call LockA}`. At runtime: thread T1 holds LockA waiting for LockB, and thread T2 holds LockB waiting for LockA. In the weighted causal graph, some nodes have LockA.holder=T1 and LockB.holder=T2, the deadlock state is True, and the edges are P(deadlock|LockA not released)=0.95 and P(deadlock|LockB not released)=0.93. Through counterfactual reasoning, it is found that removing variable LockA will eliminate the deadlock with a 98% probability. LockA is marked as the target root cause, and the root cause conclusion is obtained. Code modification schemes are generated using the first and second language models.

[0072] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0073] Example 2

[0074] This application also provides a software defect processing apparatus. It should be noted that the software defect processing apparatus of this application can be used to execute the software defect processing method provided in this application. The software defect processing apparatus provided in this application will be described below.

[0075] According to an embodiment of this application, an apparatus for implementing the above-described method for handling software defects is also provided, such as... Figure 3 As shown, the device includes:

[0076] The data acquisition unit 301 is used to acquire multimodal data of the software defect to be processed, wherein the multimodal data is data associated with the software defect, and the multimodal data includes at least defect code, runtime data and log events;

[0077] The causal graph generation unit 302 is used to generate a weighted causal graph based on multimodal data. The weighted causal graph is used to model the causal relationship between nodes, and the weight in the weighted causal graph is used to represent the conditional probability of the causal relationship.

[0078] Counterfactual reasoning unit 303 is used to perform counterfactual reasoning based on a weighted causal graph to obtain the root cause conclusions corresponding to software defects.

[0079] The software defect processing apparatus provided in this application embodiment acquires multimodal data of the software defect to be processed through a data acquisition unit 301. The multimodal data is data associated with the software defect and includes at least defect code, runtime data, and log events. A causal graph generation unit 302 generates a weighted causal graph based on the multimodal data. The weighted causal graph is used to model the causal relationships between nodes, and the weights in the weighted causal graph represent the conditional probabilities of the causal relationships. A counterfactual reasoning unit 303 performs counterfactual reasoning based on the weighted causal graph to obtain the root cause conclusion corresponding to the software defect, thus solving the problem of low accuracy in software defect processing in related technologies. This improves the accuracy of software defect processing.

[0080] Optionally, in the software defect processing apparatus provided in this application embodiment, the causal graph generation unit 302 includes: an information acquisition module for acquiring conditional probability information of historical defect data; a data determination module for determining multiple nodes and multiple edges based on multimodal data, and determining the weights between different nodes based on the conditional probability information, wherein the edges are used to represent causal relationships; an edge adjustment module for adjusting multiple edges based on multimodal data to obtain adjusted multiple edges; and a causal graph determination module for determining a weighted causal graph based on multiple nodes, weights, and adjusted multiple edges.

[0081] Optionally, in the software defect processing apparatus provided in this application embodiment, the data acquisition unit 301 includes: a data extraction module, used to extract defect code, runtime data, and log events for the software defect; and a time alignment module, used to perform time alignment on the defect code, runtime data, and log events to obtain multimodal data.

[0082] Optionally, in the software defect processing apparatus provided in this application embodiment, the cause-effect graph generation unit 302 further includes: a threshold acquisition module, used to acquire a preset weight threshold after determining a weighted cause-effect graph based on multiple nodes, weights, and adjusted multiple edges; a weight pruning module, used to prune the weights in the weighted cause-effect graph based on the preset weight threshold to obtain a pruned weighted cause-effect graph; and a node merging module, used to merge preset nodes in the pruned weighted cause-effect graph to obtain an optimized weighted cause-effect graph, wherein the optimized weighted cause-effect graph is used for counterfactual reasoning.

[0083] Optionally, in the software defect processing apparatus provided in this application embodiment, the counterfactual reasoning unit 303 includes: a hypothesis intervention module, used to obtain custom query information and determine hypothetical intervention information based on the custom query information; a perturbation intervention module, used to apply perturbation intervention to the weighted causal graph using the hypothetical intervention information to obtain the intervened weighted causal graph; a Monte Carlo simulation module, used to perform Monte Carlo simulation based on the intervened weighted causal graph to obtain multiple simulation results; and a defect statistics module, used to statistically analyze the defect state distribution in the multiple simulation results to obtain root cause conclusions.

[0084] Optionally, in the software defect processing apparatus provided in this application embodiment, the apparatus further includes: a prompt word acquisition unit, used to acquire root cause description prompt words and code repair prompt words after obtaining the root cause conclusion corresponding to the software defect through counterfactual reasoning based on a weighted causal graph; a first output unit, used to input multimodal data, root cause conclusion, and root cause description prompt words into a first large language model, and output a diagnostic report using the first large language model; and a second output unit, used to input the diagnostic report and code repair prompt words into a second large language model, and output a code modification scheme using the second large language model.

[0085] It should be noted that the data acquisition unit 301, the cause-effect graph generation unit 302, and the counterfactual reasoning unit 303 mentioned above correspond to steps S201 to S203 in Embodiment 1. The instances and application scenarios implemented by the units and their corresponding steps are the same, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above modules or units can be hardware or software components stored in memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above modules can also be part of a device and can run in the computer terminal 10 provided in Embodiment 1.

[0086] Example 3

[0087] Embodiments of this application may provide an electronic device. Figure 4 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 4 As shown, the electronic device may include: one or more ( Figure 4 (Only one is shown) processor 1002, memory 1004, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.

[0088] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the above-described methods. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0089] The processor can access information and applications stored in memory via a transmission device to perform the following steps: acquiring multimodal data of the software defect to be processed, wherein the multimodal data is data associated with the software defect, and the multimodal data includes at least defect code, runtime data, and log events; generating a weighted causal graph based on the multimodal data, wherein the weighted causal graph is used to model the causal relationships between nodes, and the weights in the weighted causal graph are used to represent the conditional probabilities of the causal relationships; and performing counterfactual reasoning based on the weighted causal graph to obtain the root cause conclusion corresponding to the software defect.

[0090] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: obtain conditional probability information of historical defect data; determine multiple nodes and multiple edges based on multimodal data, and determine the weights between different nodes based on the conditional probability information, wherein the edges are used to represent causal relationships; adjust multiple edges based on multimodal data to obtain adjusted multiple edges; determine a weighted causal graph based on multiple nodes, weights and adjusted multiple edges.

[0091] The processor can also access information and applications stored in memory via a transmission device to perform the following steps: extracting defect code, runtime data, and log events related to software defects; and aligning the defect code, runtime data, and log events in time to obtain multimodal data.

[0092] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: obtain a preset weight threshold; prune the weights in the weighted causal graph according to the preset weight threshold to obtain a pruned weighted causal graph; merge the preset nodes in the pruned weighted causal graph to obtain an optimized weighted causal graph, wherein the optimized weighted causal graph is used for counterfactual reasoning.

[0093] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: obtain custom query information and determine hypothetical intervention information based on the custom query information; apply perturbation intervention to the weighted causal graph using the hypothetical intervention information to obtain the weighted causal graph after intervention; perform Monte Carlo simulation based on the weighted causal graph after intervention to obtain multiple simulation results; and statistically analyze the distribution of defect states in the multiple simulation results to obtain the root cause conclusion.

[0094] The processor can also access information and applications stored in the memory via a transmission device to perform the following steps: obtain root cause description prompts and code repair prompts; input multimodal data, root cause conclusions, and root cause description prompts into the first language model and output a diagnostic report using the first language model; input the diagnostic report and code repair prompts into the second language model and output a code modification plan using the second language model.

[0095] This application provides a solution for handling software defects. It involves acquiring multimodal data of the software defect to be processed, wherein the multimodal data is data associated with the software defect and includes at least defect code, runtime data, and log events; generating a weighted causal graph based on the multimodal data, wherein the weighted causal graph is used to model the causal relationships between nodes, and the weights in the weighted causal graph represent the conditional probabilities of the causal relationships; and performing counterfactual reasoning based on the weighted causal graph to obtain the root cause conclusion corresponding to the software defect, thus solving the technical problem of low accuracy in software defect handling in the prior art.

[0096] Those skilled in the art will understand that Figure 4 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones, tablets, handheld computers, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 4 This does not limit the structure of the aforementioned electronic device. For example, electronic devices may also include components that are more... Figure 4 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 4 The different configurations shown.

[0097] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0098] Example 4

[0099] Embodiments of this application also provide a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the software defect handling method provided in Embodiment 1.

[0100] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.

[0101] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: acquiring multimodal data of a software defect to be processed, wherein the multimodal data is data associated with the software defect, and the multimodal data includes at least defect code, runtime data, and log events; generating a weighted causal graph based on the multimodal data, wherein the weighted causal graph is used to model causal relationships between nodes, and the weights in the weighted causal graph are used to represent the conditional probabilities of causal relationships; and performing counterfactual reasoning based on the weighted causal graph to obtain the root cause conclusion corresponding to the software defect.

[0102] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: obtaining conditional probability information of historical defect data; determining multiple nodes and multiple edges based on multimodal data, and determining the weights between different nodes based on the conditional probability information, wherein the edges are used to represent causal relationships; adjusting the multiple edges based on the multimodal data to obtain adjusted multiple edges; and determining a weighted causal graph based on the multiple nodes, weights, and adjusted multiple edges.

[0103] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: extracting defect code, runtime data, and log events for software defects; and performing time alignment on the defect code, runtime data, and log events to obtain multimodal data.

[0104] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: obtaining a preset weight threshold; pruning the weights in the weighted causal graph according to the preset weight threshold to obtain a pruned weighted causal graph; merging preset nodes in the pruned weighted causal graph to obtain an optimized weighted causal graph, wherein the optimized weighted causal graph is used for counterfactual reasoning.

[0105] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: obtaining custom query information and determining hypothetical intervention information based on the custom query information; applying perturbation intervention to the weighted causal graph using the hypothetical intervention information to obtain the intervened weighted causal graph; performing Monte Carlo simulation based on the intervened weighted causal graph to obtain multiple simulation results; and statistically analyzing the distribution of defect states in the multiple simulation results to obtain root cause conclusions.

[0106] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: obtaining root cause description prompts and code repair prompts; inputting multimodal data, root cause conclusions, and root cause description prompts into a first large language model, and using the first large language model to output a diagnostic report; inputting the diagnostic report and code repair prompts into a second large language model, and using the second large language model to output a code modification scheme.

[0107] This application also provides a computer program product that, when executed on a data processing device, is suitable for performing steps of a method for handling software defects.

[0108] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0109] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0110] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0111] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0112] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0113] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0114] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for handling software defects, characterized in that, include: Acquire multimodal data of the software defect to be processed, wherein the multimodal data is data associated with the software defect, and the multimodal data includes at least defect code, runtime data, and log events; A weighted causal graph is generated based on the multimodal data, wherein the weighted causal graph is used to model the causal relationships between nodes, and the weights in the weighted causal graph are used to represent the conditional probabilities of the causal relationships; Counterfactual reasoning is performed based on the weighted causal graph to obtain the root cause conclusions corresponding to the software defects.

2. The method according to claim 1, characterized in that, Generating a weighted cause-effect graph based on the multimodal data includes: Obtain conditional probability information from historical defect data; Multiple nodes and multiple edges are determined based on the multimodal data, and the weights between different nodes are determined based on the conditional probability information, wherein the edges are used to represent the causal relationship; The multiple edges are adjusted based on the multimodal data to obtain the adjusted multiple edges; The weighted causal graph is determined based on the plurality of nodes, the weights, and the adjusted plurality of edges.

3. The method according to claim 1, characterized in that, The acquisition of multimodal data for software defects to be processed includes: Extract the defect code, runtime data, and log events related to the software defect; The defective code, runtime data, and log events are time-aligned to obtain the multimodal data.

4. The method according to claim 2, characterized in that, After determining the weighted causal graph based on the plurality of nodes, the weights, and the adjusted plurality of edges, the method further includes: Obtain the preset weight threshold; The weights in the weighted causal graph are pruned according to the preset weight threshold to obtain the pruned weighted causal graph. The preset nodes in the pruned weighted causal graph are merged to obtain an optimized weighted causal graph, which is used for counterfactual reasoning.

5. The method according to claim 1, characterized in that, Based on the weighted cause-effect graph, counterfactual reasoning yields the following root cause conclusions corresponding to the software defect: Obtain custom query information and determine hypothetical intervention information based on the custom query information; The hypothetical intervention information is used to apply a perturbation intervention to the weighted causal graph to obtain the intervened weighted causal graph; Monte Carlo simulations were performed based on the weighted causal graph after the intervention, yielding multiple simulation results; The root cause conclusion is obtained by statistically analyzing the distribution of defect states in the multiple simulation results.

6. The method according to claim 1, characterized in that, After obtaining the root cause conclusion corresponding to the software defect by performing counterfactual reasoning based on the weighted cause-effect graph, the method further includes: Get root cause description prompts and code repair prompts; The multimodal data, the root cause conclusions, and the root cause description prompts are input into the first large language model, and a diagnostic report is output using the first large language model. The diagnostic report and the code repair prompts are input into the second language model, which then outputs a code modification plan.

7. A software defect processing apparatus, characterized in that, include: A data acquisition unit is used to acquire multimodal data of a software defect to be processed, wherein the multimodal data is data associated with the software defect, and the multimodal data includes at least defect code, runtime data, and log events; The causal graph generation unit is used to generate a weighted causal graph based on the multimodal data, wherein the weighted causal graph is used to model the causal relationships between nodes, and the weights in the weighted causal graph are used to represent the conditional probabilities of the causal relationships. The counterfactual reasoning unit is used to perform counterfactual reasoning based on the weighted causal graph to obtain the root cause conclusions corresponding to the software defects.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored executable program, wherein, when the executable program is executed, it controls the device on which the computer-readable storage medium is located to perform the software defect handling method according to any one of claims 1 to 6.

9. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program, when running, performs the method for handling software defects as described in any one of claims 1 to 6.

10. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the steps of the software defect handling method according to any one of claims 1 to 6.