An answer generation method and device, electronic equipment and medium
By filtering target firmware and firmware sets from the firmware database and inputting semantic and execution information into the inference model, the problem of insufficient accuracy of answers in existing technologies is solved, improving the accuracy and efficiency of answers and reducing labor costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-21
- Publication Date
- 2026-03-27
AI Technical Summary
Existing reasoning models lack in-depth understanding when generating firmware query answers, resulting in insufficient accuracy of the answers. This fails to meet the core requirements of symbolic semantic matching and execution logic association, increasing the cost of software development, maintenance, and troubleshooting.
By filtering target firmware and target firmware sets from a pre-built firmware database, combining semantic firmware sets and execution firmware sets, and inputting the results into the first inference model, the answer is generated, ensuring that the answer conforms to the semantics of the firmware and the actual calling logic.
It improves the accuracy and efficiency of answers, and significantly reduces the human resource costs of firmware development, maintenance and troubleshooting.
Smart Images

Figure CN121543747B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computers, and in particular to an answer generation method and device, electronic equipment and a medium. BACKGROUND
[0002] With the rapid development of cloud computing, big data and artificial intelligence technology, the scale and complexity of software systems in private cloud management platforms and large enterprise-level applications gradually increase, and the firmware lines in the firmware library involved cover complex business logic, multi-module interaction and long-term technology evolution. In this scenario, it brings great challenges to software development, maintenance and upgrade, and fault troubleshooting. Developers need to spend a lot of time understanding firmware structure, clarifying business logic, and locating fault problems, resulting in low development efficiency and high labor costs. In related technologies, a reasoning model is used to understand the firmware in the firmware library, which can generate firmware fragments and explain firmware functions according to the input firmware query question. However, these general models lack in-depth understanding of firmware, and the accuracy of the answers generated based on the input question needs to be improved. SUMMARY
[0003] The present application provides an answer generation method, device, electronic equipment and medium to at least solve the problem of low accuracy of answers generated by reasoning models.
[0004] The present application provides an answer generation method, which comprises:
[0005] obtaining a firmware query question;
[0006] based on the firmware query question, filtering at least one target firmware and at least one target firmware set corresponding to the firmware query question from a pre-constructed firmware database, wherein the firmware database includes a plurality of firmwares, a plurality of semantic firmware sets and a plurality of execution firmware sets, the semantic information corresponding to all firmwares in each semantic firmware set satisfies a preset semantic condition, the firmwares in the execution firmware set are called in the corresponding historical execution process, and the target firmware set is a semantic firmware set or an execution firmware set;
[0007] inputting the at least one target firmware, the at least one target firmware set and the firmware query question into a pre-constructed first reasoning model to generate an answer corresponding to the firmware query question.
[0008] The present application also provides an answer generation device, comprising:
[0009] an obtaining module configured to obtain a firmware query question;
[0010] The screening module is configured to screen at least one target firmware and at least one target firmware set corresponding to the firmware query question from a pre-built firmware database based on the firmware query question, wherein the firmware database comprises a plurality of firmwares, a plurality of semantic firmware sets and a plurality of execution firmware sets, semantic information corresponding to all firmwares in each semantic firmware set satisfies a preset semantic condition, and the firmwares in the execution firmware set are firmwares called in a corresponding historical execution process, and the target firmware set is a semantic firmware set or an execution firmware set.
[0011] The generating module is configured to input the at least one target firmware, the at least one target firmware set and the firmware query question into a pre-built first inference model to generate an answer corresponding to the firmware query question.
[0012] The present application also provides an electronic device, comprising a memory configured to store a computer program and a processor configured to execute the computer program to implement the steps of any of the above answer generation methods.
[0013] The present application also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of any of the above answer generation methods.
[0014] The present application also provides a computer program product comprising a computer program, and the computer program is executed by a processor to implement the steps of any of the above answer generation methods.
[0015] According to the present application, the target firmware and the target firmware set associated with the firmware query question are screened from the firmware database, the target firmware set is a semantic firmware set or an execution firmware set, the firmware query question, the target firmware and the target firmware set are input into the first inference model, the answer generated by the first inference model based on the semantic firmware set is more consistent with the semantics of the firmware query question, the problem of missing semantics in the related art is solved, the answer generated based on the execution firmware set can meet the actual calling logic of the firmware, the one-sidedness of single firmware matching is solved, the accuracy of the answer is greatly improved, the efficiency and quality of the firmware query are improved, and the labor cost of firmware development, maintenance and troubleshooting is significantly reduced. BRIEF DESCRIPTION OF DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present application, the drawings needed in the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0017] Figure 1A flowchart of an answer generation method provided by an embodiment of the present application;
[0018] Figure 2 A flowchart of another answer generation method provided by an embodiment of the present application;
[0019] Figure 3 A structural schematic diagram of an answer generation apparatus provided by an embodiment of the present application;
[0020] Figure 4 A structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0021] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, any other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0022] It should be noted that, in the description of the present application, the terms “comprise”, “contain” or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such a process, method, article or device. The terms “first”, “second” and the like in the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0023] In order for those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the drawings and specific embodiments.
[0024] First, the application scenario of the embodiments of the present application is exemplarily introduced.
[0025] With the rapid development of cloud computing, big data and artificial intelligence technologies, the difficulty and complexity of software development and maintenance are gradually increasing. In the process of software development and maintenance, developers need to spend a long time to sort out the underlying architecture design of firmware, the dependency relationship between firmware, business logic, etc. For example, in the firmware maintenance stage, in the face of software version function iteration light demand, it is necessary to accurately locate the associated firmware in a large number of firmware. In the fault troubleshooting scenario, the developer needs to analyze the fault from the complex firmware call link.
[0026] To improve the efficiency of firmware development and maintenance, in the related art, a reasoning model (such as a large language model (LLM)) is used to assist developers in understanding the firmware in the firmware library. Specifically, the reasoning model generates firmware fragments, explains firmware functions, and the like according to an input firmware query question. However, these general models lack a deep understanding of firmware and do not fully consider the semantic association characteristics and execution call rules in specific scenarios such as firmware, resulting in insufficient accuracy of the generated answers, making it difficult to meet the core needs of symbol semantic matching and execution logic association in firmware queries, and there is a problem of low accuracy of answer generation.
[0027] Therefore, an embodiment of the present application provides an answer generation method to solve the problem of low accuracy of answer generation by the reasoning model.
[0028] It should be noted that the answer generation method provided by the embodiments of the present application can be implemented by software, hardware or a combination of software and hardware to become part or all of an electronic device, and the electronic device can be a server or a terminal. The server in the embodiments of the present application can be a server or a server cluster composed of multiple servers, and the terminal in the embodiments of the present application can be a smartphone, a personal computer, a tablet computer, a wearable device, a smart robot and other smart hardware devices. In the following method embodiments, the execution subject is taken as an example to illustrate the method.
[0029] According to the embodiments of the present application, an answer generation method is provided. It should be noted that the steps shown in the flowchart can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order from here.
[0030] Figure 1 is a flowchart of an answer generation method according to an embodiment of the present application. As shown in Figure 1 , the flowchart includes the following steps:
[0031] S101, obtaining a firmware query question.
[0032] Specifically, the firmware query question refers to a natural language query raised by a developer on the function, fault, call logic and the like of the firmware. The firmware query question can be an abnormal query question, a performance optimization question, a function implementation question, a code understanding question, a configuration query question and the like. Taking the performance optimization question as an example, the firmware query question can be "analyze the virtual machine creation process and find out the performance bottleneck point that may cause timeout".
[0033] S102, based on the firmware query question, screening at least one target firmware and at least one target firmware set corresponding to the firmware query question from the pre-constructed firmware database respectively.
[0034] Wherein, the firmware database includes a plurality of firmware, a plurality of semantic firmware sets and a plurality of execution firmware sets, all firmware in each semantic firmware set respectively corresponding to the semantic information between them satisfies the preset semantic condition, the firmware in the execution firmware set is the firmware called in the corresponding historical execution process, and the target firmware set is the semantic firmware set or the execution firmware set.
[0035] Specifically, the plurality of firmware in the firmware database refers to independent code blocks, such as functions, classes, etc. A firmware (also known as a syntax block) ensures the integrity and independence of the syntax level. For example, a function, together with its function signature and comments, constitutes a firmware.
[0036] The firmware in the semantic firmware set is a plurality of firmware constituted according to semantic features, and the semantic information of each firmware in the semantic firmware set satisfies a preset condition, such as a semantic similarity between the semantic information corresponding to each firmware being less than a preset threshold. Here, the semantic information of the firmware can be semantic features converted from the text description, function description, symbol features, etc. of the firmware.
[0037] The execution firmware set refers to all firmware involved in a historical execution process (such as a certain business process), that is, the execution firmware set is a firmware group aggregated according to the actual execution link.
[0038] The target firmware refers to a single firmware selected from the plurality of firmware in the firmware database. The target firmware set is a firmware set matched with the firmware query question selected from the plurality of semantic firmware sets and the plurality of execution firmware sets in the firmware database.
[0039] Considering that a single firmware as a prompt word of the firmware query question may lead to insufficient accuracy of the generated answer due to insufficient firmware granularity, in the embodiments of the present application, in addition to the target firmware, a firmware set is introduced to provide context information and associated firmware information, so that the generated answer is more comprehensive and accurate. Among them, the semantic firmware set can enhance the semantic matching degree between the generated answer and the firmware query question, and the execution firmware set can ensure that the execution logic of the generated answer conforms to the actual calling link.
[0040] In a possible implementation, the target firmware can be screened from the plurality of firmware in the firmware database based on the semantic information of the firmware query question, and the target firmware set can be screened from the semantic firmware set or the execution firmware set in the firmware database based on the semantic information of the firmware query question.
[0041] In a possible implementation, whether the target firmware set is a semantic firmware set or an execution firmware set can be determined based on the type of the firmware query question. For example, for an abnormal query type question, the target firmware set can be an execution firmware set. For another example, for a function implementation type question, the target firmware set can be a semantic firmware set.
[0042] It should be noted that specific implementation of screening at least one target firmware and at least one target firmware set corresponding to the firmware query question from the firmware database will be described in subsequent embodiments, which will not be described here.
[0043] S103, input the at least one target firmware, the at least one target firmware set, and the firmware query question into the pre-built first inference model to generate an answer corresponding to the firmware query question.
[0044] Specifically, the first inference model can be a large language model, such as an LLM model. In the embodiments of the present application, the target firmware and the target firmware set are used as prompt words of the first inference model to provide the first inference model with syntax, semantics, execution logic, etc. basis for generating answers.
[0045] In the embodiments of the present application, the target firmware and the target firmware set associated with the firmware query question are screened from the firmware database, the target firmware set is a semantic firmware set or an execution firmware set, the firmware query question and the target firmware and the target firmware set are input into the first inference model, so that the semantic firmware set makes the answer generated by the first inference model more consistent with the semantics of the firmware query question, which makes up for the semantic missing problem in the related art, and the execution firmware set ensures that the generated answer can conform to the actual calling logic of the firmware, which makes up for the one-sidedness of single firmware matching, greatly improves the accuracy of the answer, improves the efficiency and quality of firmware query, and significantly reduces the labor cost of firmware development, maintenance and troubleshooting.
[0046] In the embodiments of the present application, the plurality of firmwares, the plurality of semantic firmware sets and the plurality of execution firmware sets in the firmware database can be obtained from the firmware library of the application scenario. By splitting and aggregating the firmwares in the firmware library in different dimensions, a more rich and flexible plurality of firmware sets is formed.
[0047] For example, each source code file in the firmware library is subjected to lexical and syntax analysis to generate an abstract syntax tree (AST), and by traversing the syntax tree, a plurality of firmwares (also referred to as syntax blocks) are obtained.
[0048] Specifically, the abstract syntax tree is a tree-like data structure representing the hierarchical syntax structure of the code. Further, the firmware includes but is not limited to functions, classes, interface names, global variables, constants, and various control flow structures (such as conditions, loops, exception capture blocks). In addition, for each firmware, its metadata can also be recorded in the firmware database, such as firmware name, source file path, start and end code line number, access modifier, parameter list, return value type, etc. Taking the code base of a private cloud management platform as an example, the parsed multiple firmware can be a controller class responsible for creating a virtual server instance, a service function processing storage volume mounting logic, and a data structure class defining network security group rules.
[0049] In the embodiments of the present application, in order to break the limitations of physical firmware files and syntax structures, logically related and functionally cohesive firmware in multiple firmware are aggregated together.
[0050] For example, using natural language processing technology, the comments and document strings in the firmware are analyzed, and functions and code segments describing similar functions or business logic are classified into the same semantic firmware set through topic modeling or semantic clustering algorithms. For example, all functions related to tenant quota management, including checking quota, increasing quota, and deducting quota, are aggregated into a semantic firmware set.
[0051] In the embodiments of the present application, the dynamic execution behavior of the firmware is crucial for performance analysis, troubleshooting, and other scenarios. In order to focus on the dynamic execution behavior of the firmware, all firmware called in the same historical execution process are aggregated into an execution firmware set.
[0052] For example, in a controlled sandbox environment, by executing unit tests or integration tests of the firmware library in the application scenario or by sampling real firmware query problems through instrumentation technology, the actual function call sequence is recorded, and the call chain (also known as hot path) that is frequently executed or appears in the key business process is obtained. All functions on the hot path are combined into an execution firmware set according to the execution order. For example, in a simulation test of creating a high-availability database cluster, a series of core function calls from receiving a user request to finally returning a success status constitute an execution firmware set, and the execution firmware set reflects the behavior pattern of the firmware in real runtime.
[0053] In the embodiments of the present application, three groups of parallel basic blocks are generated from the firmware source files in the same firmware library, namely multiple firmware, multiple semantic firmware sets, and multiple execution firmware sets. All blocks are assigned unique identifiers and their types and corresponding source firmware location information are recorded and stored in the firmware database.
[0054] In some embodiments, based on the foregoing embodiments, the method provided by the embodiments of the present application further includes the following content:
[0055] a1, parsing all the firmware to obtain the calling relationship between all the firmware.
[0056] Specifically, the calling relationship refers to the calling / called logic between firmware, which reflects the upstream and downstream dependencies of firmware in the business process. For example, firmware A calls firmware B. At this time, firmware A is the superior firmware of firmware B, and firmware B is the subordinate firmware of firmware A. The calling logic, function description and other information in the firmware are extracted by parsing the firmware, so as to obtain the calling relationship between the firmware.
[0057] In a possible implementation, the calling relationship between the firmware is identified by constructing a calling graph between the firmware. The calling graph is a directed graph, and each node in the graph represents a firmware (such as a function, a class, etc.), and the directed edge in the graph represents the calling relationship between two functions, such as function A calling function B.
[0058] For example, through the definition search and reference search functions provided by the code analysis tool, the internal calling expression of each firmware is parsed from the triggering of each firmware, and the specific definition position of the callee is determined through symbol analysis, so as to establish a calling edge. For example, in the calling graph, it can be clearly shown that how a virtual machine deployment application programming interface (Application Programming Interface, API) call in an upper layer triggers a series of function calls in a plurality of modules such as calculation, network and storage in a lower layer. All the parsed AST metadata and calling graph data are stored in a graph database or a relational database.
[0059] a2, based on the calling relationship between all the firmware, determining the superior firmware and the subordinate firmware corresponding to the first firmware in all the firmware.
[0060] Among them, the first firmware is one of the plurality of firmware.
[0061] Specifically, the superior firmware is the firmware that calls the first firmware. The subordinate firmware refers to the firmware called by the first firmware.
[0062] a3, based on the superior firmware and the subordinate firmware, determining the final description information of the first firmware.
[0063] Specifically, the final description information of the first firmware refers to the description information that integrates the function of the first firmware itself, the calling relationship of the superior and subordinate, and the core features.
[0064] In a possible implementation, based on the superior firmware and the subordinate firmware, the final description information of the first firmware is determined, and the specific steps include:
[0065] First, the first firmware, the upper firmware, the lower firmware are respectively input to the pre-constructed second inference model, and the description information of the first firmware, the description information of the upper firmware, and the description information of the lower firmware are obtained.
[0066] Specifically, the second inference model is used to generate the basic description information of the firmware. The description information of the first firmware refers to the basic description information of the first firmware, including but not limited to the core function of the firmware itself, the key symbol, the business positioning, etc. Similarly, the description information of the upper firmware is the basic description information of the upper firmware, and the description information of the lower firmware is the basic description information of the lower firmware.
[0067] For example, the description information of the firmware includes but is not limited to the following contents:
[0068] "Function description: summarize the core function of this code block in one sentence. For example, "This function is responsible for asynchronously mounting a storage volume for a specified virtual server instance."
[0069] Parameter description: list the names, types and meanings of the main parameters.
[0070] Return value description: describe the type and business meaning of the return value, especially the different performances when successful and failed.
[0071] Main exceptions: clearly indicate the key exception types that this firmware block may throw and their triggering conditions."
[0072] Then, the description information of the first firmware, the description information of the upper firmware, and the description information of the lower firmware are determined as the final description information of the first firmware.
[0073] Specifically, the final description information of the first firmware includes not only its own basic description information (i.e. the description information), but also the basic description information of the upper firmware and the basic description information of the lower firmware, that is, the complete description information formed by integrating the basic description information of the first firmware, the upper firmware and the lower firmware, which not only contains the function of the first firmware itself, but also covers the upstream and downstream context in the call link. In this way, the first inference model can obtain the caller, the callee and the calling process of the firmware from the final description information of the first firmware, thereby improving the inference accuracy of the first inference model.
[0074] For example, for a caller function, its summary is augmented by the summary information of all functions it calls. Specifically, taking the calling function A as an example, the description information of the called function B and the called function C is extracted and added to the final description information of function A. For example, the summary of function A may be "create a virtual server" initially, and after upward propagation, the final description information of function A is "create a virtual server. This process includes: calling function B to allocate network address, and calling function C to mount system disk." In this way, the summary of the upper function automatically contains its key implementation details.
[0075] For another example, the functions of a called function may have subtle differences in different scenarios. By analyzing all calling functions thereof and extracting information from the business scenarios of the calling functions, the final description information of the called function is supplemented. For example, the final description information of the called function B includes typical calling scenario fields, such as being called to modify the user information table in the user update personal information process, and being called to update the instance state when the virtual machine state changes. This bottom-up information fusion and top-down scenario supplement constitute a two-way dependent propagation, so that the final description information of each firmware is rich in calling context information in the entire application scenario.
[0076] a4, adding the final description information of the first firmware to the firmware database.
[0077] In this way, the final firmware information of the first firmware not only contains information such as its own function, but also fuses the upstream and downstream calling relationship, so that the final description information of the first firmware changes from isolated function description to complete information with business link description and function description, providing more complete context information for the first reasoning model, and further improving the accuracy of generating answers.
[0078] In a possible implementation, the method provided by the embodiment of the present application further includes the following content:
[0079] First, the final description information corresponding to all firmware in the first firmware set is obtained from the firmware database.
[0080] The first firmware set is one of a plurality of semantic firmware sets and a plurality of execution firmware sets.
[0081] Then, the final description information corresponding to all firmware in the first firmware set is determined as the description information of the first firmware set.
[0082] Specifically, the description information of the first firmware set is a unified description that can reflect the overall function and internal member association of the first firmware set after integrating the final description information of all member firmware of the first firmware set. The final description information of a single firmware focuses on its own function and upstream and downstream calls. Unlike the description of a single firmware, the description information of the first firmware set is used to describe the group attributes of the set.
[0083] Finally, the description information of the first firmware set is added to the firmware database.
[0084] In this way, the final description information of a single firmware and the description information of a firmware set in the firmware database can make the hierarchy of the database more clear, provide high-quality context information for subsequent screening and reasoning, and avoid focusing on a single firmware while ignoring the overall business process.
[0085] In addition, the description information or the final description information of multiple firmwares in the same source code file in the firmware library or the description information or the final description information of multiple firmwares in the same business scenario can be fused to generate source file level description information or module level description information, which provides a basis for subsequent coarse-grained queries. For example, the firmware query question is "introduce how the authentication and authorization module of the platform works", at this time, the description information of the authentication and authorization module can be input into the first reasoning model so that the first reasoning model can provide a high-quality answer.
[0086] In a possible implementation, the method provided by the embodiment of the present application further includes the following content:
[0087] The firmware query question, all target firmwares, all target firmware sets, the final description information corresponding to all target firmwares respectively, and the description information corresponding to all target firmware sets respectively are input into the first reasoning model to generate an answer corresponding to the firmware query question.
[0088] Considering that the first reasoning model itself does not have the cognition of firmware syntax structure, call relationship, and business logic, and only the firmware query question is input, the first reasoning model can only generate a general answer and cannot fit the actual firmware scenario. The final description information of the target firmware and the description information of the target firmware set contain key information such as the function of the firmware itself, the upstream and downstream call links, and the coordination logic between firmwares, which can supplement the firmware domain knowledge for the first reasoning model, so that the first reasoning model can locate the firmware in the actual business process by combining the fine-grained description of a single target firmware and the overall coordination description of the target firmware set, avoid reasoning deviation caused by missing context, improve the accuracy and comprehensiveness of the generated answer, and enhance the landing ability of the answer.
[0089] In the embodiment of the present application, an answer generation method is provided, which includes the following steps: Figure 2As shown, the flow includes the following steps:
[0090] S201, acquire the firmware query question. For details, please refer to Figure 1 The step S101 of the embodiment shown will not be repeated here.
[0091] S202, based on the firmware query question, respectively filter at least one target firmware and at least one target firmware set corresponding to the firmware query question from the pre-built firmware database. For details, please refer to Figure 1 The step S102 of the embodiment shown will not be repeated here.
[0092] S203, input the at least one target firmware, the at least one target firmware set, and the firmware query question into the pre-built first reasoning model to generate an answer corresponding to the firmware query question.
[0093] Specifically, the above S203 includes:
[0094] S2031, determine the ordering sequence between all target firmwares based on the calling relationship between all target firmwares.
[0095] Specifically, the sorted target firmwares maintain the continuity of each target firmware in the actual execution link, and the sorted target firmwares conform to the order of the actual execution flow.
[0096] In one possible implementation, a calling graph containing target firmwares is generated with the target firmwares as nodes and the calling relationship between the target firmwares as directed edges; based on the calling graph, a preset sorting algorithm (such as Depth-First Search (DFS)) is used to determine the ordering sequence of all target firmwares.
[0097] S2032, sort all target firmwares based on the ordering sequence.
[0098] S2033, input the sorted target firmwares, the at least one target firmware set, and the firmware query question into the first reasoning model to obtain the answer.
[0099] Considering that if multiple target firmwares are input out of order, the first reasoning model may confuse the upstream and downstream relationships, the sorted target firmwares conform to the real calling flow of the firmware, which helps to strengthen the understanding ability of the first reasoning model to complex queries, so that the generated answer is highly consistent with the logic of the actual execution link.
[0100] In some embodiments, based on any of the preceding embodiments, at least one target firmware corresponding to the firmware query question is filtered from the firmware database based on the firmware query question, and the specific steps include:
[0101] b1, obtaining first semantic information corresponding to the firmware query question and firmware symbols in the firmware query question, and second semantic information corresponding to the second firmware and firmware symbols in the second firmware.
[0102] The second firmware is one of a plurality of firmwares in the firmware database.
[0103] Specifically, the first semantic information can reflect the intention and semantic connotation of the query question. For example, a semantic vector (i.e., a floating-point number vector) corresponding to the firmware query question is generated by a text embedding model (such as a Bidirectional Encoder Representations from Transformers (BERT) model) to represent the first semantic information. The second semantic information corresponding to the second firmware can be semantic information of the description information of the second firmware, i.e., the second semantic information of the second firmware is represented by a semantic vector of the description information of the second firmware.
[0104] The firmware symbols include, but are not limited to, identifiers, API names, exception types, and key constants. The identifiers refer to function names, class names, variable names, and the like. For example, the firmware query question is divided according to the naming specification (such as camel case or underscore) of the identifiers, such as function names, class names, and variable names, to generate the identifiers. The API name is used to indicate a key internal or external library function called in the firmware. The exception type refers to an exception class name in the firmware. The key constant refers to a string or numerical constant defined in the firmware with a clear business meaning.
[0105] b2, determining a semantic similarity between the firmware query question and the second firmware based on the first semantic information and the second semantic information.
[0106] Specifically, the semantic similarity is a quantitative indicator for measuring the degree of semantic association between the first semantic information of the firmware query question and the second semantic information of the second firmware. For example, the semantic information is represented in the form of a vector, and the cosine similarity is used as the semantic similarity between the first semantic vector and the second semantic vector.
[0107] For example, the semantic similarity is determined based on Approximate Nearest Neighbor (ANN) search.
[0108] b3, determining a firmware symbol matching indicator between the firmware query question and the second firmware based on the firmware symbols in the firmware query question and the firmware symbols in the second firmware.
[0109] Specifically, the firmware symbol matching indicator is used to measure the matching degree between the firmware symbol in the firmware query question and the firmware symbol in the second firmware. The higher the value of the firmware symbol matching indicator, the higher the matching degree between the firmware symbol in the firmware query question and the firmware symbol in the second firmware.
[0110] In a possible implementation, the firmware symbol matching indicator between the firmware query question and the second firmware is determined based on the firmware symbol in the firmware query question and the firmware symbol in the second firmware, and the specific steps include:
[0111] c1. According to a preset symbol screening rule, a target firmware symbol corresponding to the first firmware symbol is screened from the second firmware.
[0112] The first firmware symbol is one firmware symbol in the firmware query question.
[0113] Specifically, the preset symbol screening rule is used to screen a symbol related to the single query symbol, i.e., the first firmware symbol, from the second firmware. It can be understood that the preset symbol screening rule is not limited to a completely consistent symbol. For example, based on the type of the first firmware symbol in the target query question, the preset symbol screening rule is determined.
[0114] Optionally, the preset symbol screening rule can be a semantic association rule. For example, a symbol in the second firmware that is semantically the same as or similar to the first firmware symbol is taken as the target firmware symbol. For example, taking the first firmware symbol as an API name, if the semantic similarity of the API name in the second firmware to the first firmware symbol is greater than a threshold value, the API name in the second firmware is taken as the target firmware symbol.
[0115] For example, according to the preset symbol screening rule, the target firmware symbol corresponding to the first firmware symbol is screened from the second firmware, specifically including the following steps:
[0116] First, the semantic similarity between each firmware symbol in the second firmware and the first firmware symbol is determined.
[0117] Then, based on the semantic similarity between each firmware symbol in the second firmware and the first firmware symbol, the target firmware symbol corresponding to the first firmware symbol is screened from the second firmware.
[0118] For example, the firmware symbol in the second firmware whose semantic similarity threshold value is greater than a preset similarity threshold value is selected as the target firmware symbol.
[0119] Optionally, the preset symbol screening rule can also be an exact matching rule, such as a symbol in the second firmware that is completely the same as the first firmware symbol. For example, taking the first firmware symbol as a register address symbol, the register address in the second firmware that is the same as the register address in the firmware query question is taken as the target firmware symbol.
[0120] Optionally, the preset symbol screening rule can also be a type matching rule, such as matching symbols of the same type without the need for the symbols to be the same or the semantics of the symbols to be the same. For example, the first firmware symbol is a symbol related to the baud rate, and then a symbol related to the baud rate in the second firmware is taken as the target firmware symbol.
[0121] Considering that the firmware symbols include various types such as error codes, API names, and register addresses, and the matching logic of different types of symbols is different, the preset symbol screening rule is determined according to the type of the firmware symbol in the target query question, which can adapt to the diversity characteristics of the firmware symbols, improve the pertinence of matching, and more truly reflect the correlation degree between the symbols between the second firmware and the firmware query question, so that the target firmware symbol obtained by screening is more accurate.
[0122] c2, determining a firmware symbol matching sub-index corresponding to the first firmware symbol based on the semantic similarity between the target firmware symbol and the first firmware symbol.
[0123] Specifically, the firmware symbol matching sub-index is used to indicate the matching degree between a single first firmware symbol and the corresponding target firmware symbol. The higher the firmware symbol matching sub-index, the higher the matching degree between the first firmware symbol and the target firmware symbol.
[0124] For example, based on the semantic information of the target firmware symbol and the semantic information of the first firmware symbol, the cosine similarity algorithm is used to determine the semantic similarity between the target firmware symbol and the first firmware symbol.
[0125] Optionally, based on the semantic similarity between the target firmware symbol and the first firmware symbol, a firmware symbol matching sub-index corresponding to the first firmware symbol is determined, which specifically includes the following steps:
[0126] First, the word frequency of the target firmware symbol in the second firmware and the inverse document frequency of the target firmware symbol in the firmware database are counted.
[0127] Specifically, the word frequency refers to the frequency of the target firmware symbol appearing in the second firmware, which can reflect the importance of the target firmware symbol in the second firmware, that is, the more times the symbol appears in the second firmware, the stronger the symbol represents the core characteristics of the second firmware. In addition, the word frequency can also be the frequency after normalization of the frequency of the target firmware symbol appearing in the second firmware, so as to eliminate the length difference of the symbols in the firmware database. For example, the word frequency is the ratio of the frequency of the target firmware symbol appearing in the second firmware to the total number of symbols in the second firmware.
[0128] The inverse document frequency refers to the rarity of the target firmware symbol in the entire firmware database. The higher the rarity, that is, the fewer the firmware containing the symbol, the greater the inverse document frequency, reflecting that the symbol is more distinguishable for firmware and can more accurately represent the exclusive characteristics of the firmware. For example, the inverse document frequency of the target firmware symbol is calculated by the following formula:
[0129]
[0130] Wherein, IDF is the inverse document frequency of the target firmware symbol, N is the total number of firmware in the firmware database, and n is the number of firmware containing the target firmware symbol in the plurality of firmware.
[0131] Then, based on the word frequency, the inverse document frequency, and the semantic similarity between the target firmware symbol and the first firmware symbol, a firmware symbol matching sub-index is determined.
[0132] For example, the word frequency can be adjusted based on the semantic similarity between the target firmware symbol and the first firmware symbol to obtain an adjusted word frequency. For example, the word frequency and the semantic similarity between the target firmware symbol and the first firmware symbol are multiplied to obtain the adjusted word frequency. In this way, the high word frequency of the general symbol is compressed due to the low semantic similarity, avoiding the interference of high-frequency but irrelevant symbols on the matching result. Further, based on the adjusted word frequency and the inverse document frequency, the firmware symbol matching sub-index is determined.
[0133] Specifically, the adjusted word frequency reflects the importance of the target firmware symbol in the second firmware under the premise of semantic matching, and the inverse document frequency reflects the rarity of the target firmware symbol in the global firmware database. Considering that the word frequency only counts the number of occurrences of the target firmware symbol in the second firmware, it cannot determine whether the symbol is semantically related to the query symbol, therefore, the word frequency is adjusted using the semantic similarity to exclude high-frequency but semantically irrelevant symbols, improve the accuracy of the symbol matching sub-index, provide a basis for the target firmware screening and the subsequent reasoning process of the first reasoning model, thereby making the reliability of the answer higher.
[0134] For example, the firmware symbol matching sub-index is determined by the following formula:
[0135]
[0136] S is a firmware symbol matching sub-index; k is a word frequency saturation coefficient, which is an adjustment parameter for limiting the unlimited growth of word frequency, to avoid the score of high-frequency symbol matching being too high. The word frequency saturation coefficient can be determined based on the symbol frequency distribution characteristics in the firmware database. For example, if the frequency difference between the symbol frequencies of two symbols in the firmware library in the preset application scenario is greater than a preset difference threshold (i.e., the frequency difference is large, for example, symbol m appears hundreds of times in firmware 1, but only a few times in firmware 2), the word frequency saturation coefficient is greater than a preset saturation coefficient threshold (i.e., a large value is taken, such as 1.9). If the frequency difference between the symbol frequencies of any two symbols in the firmware library is less than or equal to the preset difference threshold (i.e., the frequency distribution is uniform), the word frequency saturation coefficient is less than or equal to the preset saturation coefficient threshold (i.e., a small value is taken, such as 1.5); TF is the word frequency; a is the semantic similarity between the target firmware symbol and the first firmware symbol, i.e., the adjusted word frequency; b is a length correction coefficient, which is used to balance the fairness of firmware matching of different lengths. The length correction coefficient can be determined based on the symbol length distribution characteristics of the firmware in the firmware database. If the firmware length difference between two symbols in the firmware library is greater than a preset length threshold (i.e., the firmware length difference is significantly different), the length correction coefficient is greater than a preset correction coefficient threshold (i.e., a larger value is taken, for example, 0.7). If the firmware length difference between any two symbols in the firmware library is less than or equal to the preset length threshold (i.e., the firmware length difference is small), the length correction coefficient is less than or equal to the preset correction coefficient threshold (i.e., a smaller value is taken, for example, 0.5); l is the total length of the firmware symbols of the second firmware; is the average firmware symbol length of all firmwares in the firmware database; and IDF is the inverse document frequency.
[0137] c3, after determining the firmware symbol matching sub-indexes corresponding to all firmware symbols in the firmware query question, determining a firmware symbol matching index based on the firmware symbol matching sub-indexes corresponding to all firmware symbols in the firmware query question.
[0138] Specifically, the firmware symbol matching index is the overall symbol matching degree between the firmware query question and the second firmware after integrating the firmware symbol matching sub-indexes of all symbols in the firmware query question.
[0139] Optionally, the firmware symbol matching index is obtained by summing the firmware symbol matching sub-indexes corresponding to all firmware symbols in the firmware query question.
[0140] In addition, the firmware symbol matching index can also be the ratio of the number of matching symbols in the second firmware to the total number of symbols in the firmware query question.
[0141] b4, after determining the semantic similarity and the firmware symbol matching indicator between each of the firmwares and the firmware query question, screening target firmwares from the firmware database based on the semantic similarity and the firmware symbol matching indicator between each of the firmwares and the firmware query question.
[0142] In a possible implementation, the semantic similarity and the firmware symbol matching indicator between the second firmware and the firmware query question are weighted and summed to obtain a final matching indicator between the second firmware and the firmware query question; and after determining the final matching indicator between each of the firmwares and the firmware query question, the target firmwares are screened based on the final matching indicator between each of the firmwares and the firmware query question.
[0143] For example, if the firmware query question contains a function name or a class name, the weight of the firmware symbol matching indicator is increased. For another example, if the firmware query question describes a complex business logic, the weight of the semantic similarity is increased.
[0144] For example, the firmware with the highest final matching indicator is taken as the target firmware, or the firmware with a final matching indicator higher than a preset indicator threshold is taken as the target firmware.
[0145] In the embodiments of the present application, considering that only relying on the semantic similarity may result in poor reasoning effect of the symbol matching, and only relying on the symbol matching may result in failure to understand the accurate intention of the firmware query question, the semantic similarity and the firmware symbol matching indicator are combined, the semantic similarity is used to reflect that the firmware can meet the query intention, the symbol matching indicator is used to reflect whether the firmware contains the core symbol characteristics of the query, both the semantic understanding and the firmware symbol matching are taken into account, and the accuracy of the screening result is improved to provide an accurate basis for generating an answer by the first reasoning model subsequently.
[0146] In some embodiments, based on any of the foregoing embodiments, at least one target firmware set corresponding to the firmware query question is screened from the firmware database based on the firmware query question, and specifically includes the following steps:
[0147] First, the firmware query question is parsed to determine the problem type corresponding to the firmware query question.
[0148] Specifically, the problem type of the firmware query question includes but is not limited to an abnormal query type question, a performance optimization type question, and a function implementation type question.
[0149] For example, if the extracted keywords include keywords such as error, troubleshooting, etc., it is determined that the firmware query question is an abnormal query type question. For another example, if the extracted keywords include keywords such as performance, optimization, etc., it is determined that the firmware query question is a performance optimization type question.
[0150] Then, based on the question type and a preset mapping relationship between the question type and the firmware collection type, the firmware collection type of the target firmware collection is determined.
[0151] Taking the firmware query question as an abnormal query type question as an example, the preset mapping relationship between the question type and the firmware collection type can be abnormal query type question-execution firmware collection. That is, the data filtered out from the firmware database includes not only the target firmware but also the execution firmware collection. This is because an abnormal query type question needs to locate the trigger point of an exception in an execution link and the firmware associated upstream and downstream. The execution firmware collection is grouped according to the actual business execution order, and the firmware in a collection contains complete calling links, execution conditions, and other logic, meeting the needs of exception positioning. Therefore, when the firmware query question is an abnormal query question, the execution firmware collection is taken as the target firmware collection.
[0152] Further, the firmware query question, the target firmware, and the target firmware collection are input into the first reasoning model to obtain an answer. The firmware query question, the target firmware, the target firmware collection, the final description information of the target firmware, and the description information of the target firmware collection can also be input into the first reasoning model to obtain an answer. Of course, when the firmware query question is an abnormal query type question, in addition to the above firmware query question, target firmware, target firmware collection, and corresponding description information, cross-modal data such as continuous integration / continuous deployment (CI / CD) logs, monitoring alarm information, etc. can also be input into the first reasoning model as input, thereby obtaining an answer. In this way, the combination of log information and fault information provides more data support for fault troubleshooting and improves the efficiency and accuracy of fault troubleshooting.
[0153] Taking the firmware query question as a performance optimization type question as an example, the preset mapping relationship between the question type and the firmware collection type can be abnormal query type question-execution firmware collection. That is, the data filtered out from the firmware database includes not only the target firmware but also the execution firmware collection. This is because the purpose of a performance optimization type question is to identify performance bottlenecks in an execution link and optimize the execution logic of key nodes, and the execution order and calling dependency relationship of the firmware in the execution firmware collection can directly reflect the execution link where the performance bottleneck is located. Therefore, when the firmware query question is a performance optimization type question, the execution firmware collection can be taken as the target firmware collection.
[0154] Taking the firmware query question as an example of the function implementation class question, the mapping relationship between the preset question type and the firmware set type can be an abnormal query class question-semantic firmware set, that is, the data filtered out from the firmware database includes the semantic firmware set in addition to the target firmware. This is because the function implementation class question aims to find firmware related to the semantic of the target function, and therefore, firmware with similar functions can be aggregated, and the semantic firmware set is divided according to the description information of the firmware, and therefore, the semantic firmware set related to the function in the firmware query question can be taken as the target firmware set, which provides a basis for the reasoning of the first reasoning model.
[0155] Finally, based on the firmware query question, the target firmware set corresponding to the firmware set type is filtered out from the firmware database.
[0156] In the embodiments of the present application, the firmware set features required by different types of firmware query questions are different, and therefore, determining the set type of the target firmware set based on the question type can avoid invalid information interference, and at the same time, narrow the filtering range of the firmware database and improve the response speed.
[0157] In some embodiments, based on any of the foregoing embodiments, the method provided in the embodiments of the present application further includes the following content:
[0158] d1, obtaining a historical answer corresponding to each of a plurality of historical query questions in a preset historical time period, with the current time as a reference.
[0159] The historical answer includes a historical firmware.
[0160] Specifically, the historical query question refers to a firmware-related query request obtained in the preset historical time period, which can reflect the actual demand for firmware questions. For example, the preset historical time period can be the last 7 days. For example, the historical query questions in the last 7 days include the troubleshooting method for Nova server creation error 0xE001, the firmware optimization scheme for serial port sending timeout, etc. The historical answer is the answer obtained by the first reasoning model for reasoning the historical query question.
[0161] d2, determining the firmware corresponding to the first historical answer in the firmware database based on the historical firmware in the first historical answer.
[0162] The first historical answer is one of the historical answers corresponding to the plurality of historical query questions, and the firmware corresponding to the first historical answer contains the historical firmware in the first historical answer.
[0163] d3, after determining all historical answers respectively corresponding to the firmware in the firmware database, adjusting the firmware in the firmware database based on the firmware corresponding to all historical answers respectively.
[0164] In a possible implementation, in the above d3, the firmware in the firmware database is adjusted by the following manner:
[0165] First, in all historical answers respectively corresponding to the firmware, the total number of times that any two firmwares appear simultaneously in the same historical answer is counted.
[0166] Specifically, the total number of times that any two firmwares appear simultaneously in the same historical answer can be referred to as co-occurrence times, that is, the cumulative number of times that two firmwares are mentioned simultaneously in the same historical answer, which can reflect the close degree of association of the two firmwares in the actual query scene. The more the total number of times that two firmwares appear simultaneously in the same historical answer, the more closely coupled the two firmwares are in function. For example, firmware a and firmware b appear simultaneously in historical answer 1 and historical answer 2, and the total number of times that the two firmwares appear simultaneously in the same historical answer is 2.
[0167] The first preset threshold is a co-occurrence time threshold value set based on the business scene and the historical data distribution, and can be used to determine whether the association of two firmwares reaches the strong binding level. The first preset threshold can be adjusted according to actual needs.
[0168] Then, if there are two firmwares with a total number of times greater than the first preset threshold, and it is determined based on the description information of the two firmwares that the two firmwares are used to process a preset business, the two firmwares in the firmware database are merged.
[0169] Specifically, the preset business is a preset firmware business scene, and is a standard for judging whether the firmwares belong to the same business domain. For example, the preset business can be the creation, rollback and deletion of a virtual machine snapshot, firmware upgrade, state monitoring, etc.
[0170] For example, if a very long function or class (a large syntax block) has different logical parts inside it that are hit by different types of queries, or if its overall hit rate continues to be below a split threshold, the system will attempt to split it. The basis for splitting can be internal logical blocks (such as code segments separated by comments) or control flow branches. For example, a large function that handles dozens of different request types internally can be split into multiple smaller sub-firmwares that are specific to a particular request type.
[0171] In this way, whether the two firmwares are strongly associated firmwares is determined by the co-occurrence number and the same preset service, avoiding the case of high frequency but cross-service only relying on the co-occurrence number, ensuring the rationality of the merged firmware, and meeting the actual service logic. Further, the strongly associated firmwares are merged to reduce redundant retrieval when the firmware database is screened based on the firmware query problem, which helps to screen complete context information when the firmware database is retrieved, and improves the query accuracy and efficiency.
[0172] In a possible implementation, in the d3 above, the firmware in the firmware database is adjusted in the following manner:
[0173] Firstly, it is determined whether the third firmware exists in the firmware corresponding to all historical answers respectively.
[0174] The different historical firmwares in the third firmware exist in the historical answers corresponding to the historical query problems of different problem types, or the number of historical answers corresponding to the third firmware is less than a second preset threshold.
[0175] Specifically, if the different historical firmwares in the third firmware exist in the historical answers of different problem types, it indicates that the third firmware contains multiple independent function sub-firmwares. The number of historical answers corresponding to the third firmware can be understood as the hit rate of the third firmware in the preset historical time, that is, the frequency of retrieval in the preset historical time period. The greater the number of historical answers corresponding to the third firmware, the higher the information value of the firmware. If the number of historical answers corresponding to the third firmware is less than the second preset threshold, it indicates that the overall attention of the third firmware is low, which is a low-value firmware. Therefore, the third firmware needs to be split to further mine valuable firmwares in the third firmware.
[0176] For example, the firmware 1 contains two sub-modules of permission verification and error code mapping, wherein the permission verification appears in the function implementation class answer, and the error code mapping appears in the exception query class answer. At this time, the firmware 1 is the third firmware. For another example, the historical answers corresponding to the firmware 2 are only 2, and the firmware 2 is the third firmware.
[0177] Then, if the third firmware exists in the firmware corresponding to all historical answers respectively, the third firmware is split according to a preset splitting rule to obtain multiple sub-firmwares in the third firmware.
[0178] For example, based on the problem types corresponding to the historical firmwares in the third firmware, the third firmware is split to obtain multiple sub-firmwares in the third firmware. In this way, each sub-firmware obtained by splitting the third firmware corresponds to different problem types respectively.
[0179] For example, based on the function description information of the third firmware, the third firmware is split to obtain a plurality of sub-firmwares in the third firmware. In this way, each sub-firmware obtained after splitting the third firmware is a firmware with a single function.
[0180] Of course, the third firmware can also be split based on the calling link or business field of the sub-firmware in the third firmware.
[0181] Finally, the plurality of sub-firmwares in the third firmware are added to the firmware database, and the third firmware is deleted from the firmware database.
[0182] In this way, if the third firmware contains a plurality of sub-firmwares with independent functions, the third firmware is split to make the sub-firmwares after splitting have a single function and correspond to a problem type one by one, so as to improve the accuracy and retrieval efficiency of searching the firmware database when searching the target firmware based on the firmware query problem. Further, when the first reasoning model generates an answer based on the target firmware, the interference of irrelevant function firmware can be avoided, the accuracy of answer generation is improved, and the answer generation is more in line with the actual query demand. If the number of historical answers corresponding to the third firmware is less than the second preset threshold, the third firmware is split, and whether the sub-firmwares after splitting meet the query demand is further concerned to further adjust the firmware database.
[0183] In a possible implementation, in the above d3, the firmware in the firmware database is adjusted in the following manner:
[0184] First, based on the firmware corresponding to all historical answers respectively, the redundancy rate between each two of the plurality of firmwares in the firmware database is determined.
[0185] Specifically, the higher the redundancy rate, the greater the degree of coincidence between the information contained by the two firmwares. For example, based on the semantic information corresponding to the firmware respectively, the cosine similarity of the two firmwares is determined, and the cosine similarity is taken as the redundancy rate.
[0186] Then, based on the redundancy rate between each two of the plurality of firmwares, the firmware in the firmware database is adjusted.
[0187] For example, the higher the redundancy rate, the higher the degree of coincidence between the information of the two firmwares, indicating that the granularity of the two firmwares is too fine after being divided, and therefore, the two firmwares with a redundancy rate greater than a preset redundancy rate are merged.
[0188] In addition, in order to manage the dynamic changes of the firmware database, the embodiment of the present application also introduces an evolutionary partition version table. The table is used to maintain a stable, logical partition identifier to its physical code boundary (file path, start and end line number list) mapping. When the firmware or firmware set adjustment in the firmware database occurs (such as firmware set merging or splitting), the old partition identifier is not deleted, but a new version record is created, the old identifier is marked as obsolete, and a new partition identifier and its corresponding code boundary are generated. In this way, both the dynamic optimization of the index and the analysis of the historical query behavior through version tracing are ensured, and the collaborative evolution of the partition boundary with the code base and the use scenario is realized.
[0189] In the embodiment of the present application, considering that the firmware library is in continuous update, such as adding new firmware and adjusting the calling relationship, the current firmware database is adjusted based on the feedback of historical queries, so that the firmware database dynamically follows the query requirements and the iteration changes of the firmware library, and the target firmware and the target firmware set selected from the firmware database can more accurately meet the actual requirements, thereby further providing a reliable basis for the first reasoning model reasoning.
[0190] In addition, in the embodiment of the present application, in order to ensure the timeliness of the firmware database, the firmware library is also integrated with the hook of the code version control system, or the update of the firmware library is perceived through real-time monitoring of the system. When the source code file in the firmware library is detected to change, an incremental update pipeline is triggered, and the source code file that has changed is re-parsed, partitioned, abstracted, and indexed, without the need for full processing of the entire firmware library. At the same time, the analysis task of the evolutionary partition is triggered to evaluate whether the boundary of the related partition needs to be adjusted due to the change of the source file. In this way, the maintenance cost is greatly reduced, and the quasi-real-time synchronization of the firmware database and the firmware library is ensured.
[0191] Further, in order to provide more rich troubleshooting and understanding perspectives, in the embodiment of the present application, the firmware database is associated with other development and operation assets. By analyzing the unit test cases, the test functions are associated with the firmware or firmware set covered by the test functions. Similarly, the build logs of the continuous integration system, the interface documents, and the alarm logs of the operation monitoring system can be analyzed, and these external information is associated to the corresponding firmware or firmware set as a metadata field through the file name, function name, and exception information. When the query intention of the user involves testing, exceptions, or performance, the abstracts of these associated cross-modal data are preferentially injected into the context of the firmware or firmware set, thereby providing the first reasoning model with more comprehensive operation information beyond the code.
[0192] The answer generation method provided by the present application is exemplarily described below according to a specific embodiment.
[0193] Scenario: A new DevOps engineer takes over a task to solve the frequent "virtual machine creation timeout" problem in the online environment.
[0194] User query: "Analyze the virtual machine creation process and find the performance bottleneck that may cause timeout."
[0195] The answer generation process provided by the present application is as follows:
[0196] Step 1, determine the problem type of the firmware query question.
[0197] For example, identify the keywords "analyze the process", "performance bottleneck" in the firmware query question, and determine the problem type as a composite intent of code understanding and performance optimization.
[0198] Step 2, based on the firmware query question, filter the target firmware from the firmware database.
[0199] First, perform semantic retrieval in multiple firmwares in the firmware database. Find the module-level description information and function description information in the semantic index that are most similar in semantics to "virtual machine creation process".
[0200] For example, the class description information of ComputeNodeManager exceeds the preset semantic similarity threshold, and its function description is "managing the virtual machine life cycle on the compute node".
[0201] Then, perform symbol retrieval in multiple firmwares in the firmware database.
[0202] For example, search for "virtual machine creation" and "timeout" in the symbol index, match the function named create_vm_instance, and the VM_CREATION_TIMEOUT constant defined in the code.
[0203] Step 3, based on the problem type, filter the target firmware set from the firmware database.
[0204] In this scenario, since the firmware query question contains performance optimization, the target firmware set is the execution firmware set.
[0205] Suppose the retrieved execution firmware set contains a series of called functions such as api_controller.create_vm→scheduler.select_host→compute_manager.create_instance→network_manager.allocate_ip→storage_manager.attach_volume.
[0206] All functions in the execution firmware set and their description information after the propagation of bidirectional dependencies are extracted.
[0207] For example, the final description information of compute_manager.create_instance already contains the description information of its invoked network and storage sub-functions by upward propagation; and the summary of network_manager.allocate_ip also indicates that it is invoked in the critical scenario of virtual machine creation by downward complement.
[0208] Step 4: Based on the target firmware, the target firmware set, and the respective description information, the context information of the first inference model is constructed.
[0209] For example, the reorganized code blocks and summaries are topologically sorted according to the invocation order in the execution blocks.
[0210] The constructed context information is sent to the first inference model, which has the following structure:
[0211] "[User Question]: Analyze the virtual machine creation process and find out the performance bottleneck points that may cause timeout.
[0212] [Context]:
[0213] [Module Summary: Compute Node Manager]
[0214] Function Overview: This module is responsible for…
[0215] [Execution Path Overview: Virtual Machine Creation Hot Path]
[0216] Execution Order: api_controller→scheduler→compute_manager→…
[0217] [Function 1: compute_manager.create_instance]
[0218] [Summary]: The function is…, this process will call [allocate_ip] and [attach_volume]…
[0219] [Code]:…
[0220] [Function 2: network_manager.allocate_ip]
[0221] [Summary]: The function is to allocate IP addresses… Typical scenario is when creating a virtual machine…
[0222] [Code]:…”
[0223] Based on this extremely detailed and logically clear context, large language models can generate high-quality analysis reports, such as: "The virtual machine creation process mainly involves the coordination of the three major modules of computing, network, and storage. According to the typical execution path, the performance bottleneck is likely to occur in the network IP allocation (allocate_ip) or storage volume mounting (attach_volume) two links, because they involve Input / Output (I / O) interaction with external systems. It is recommended to focus on checking the implementation of these two functions, especially the timeout settings and retry logic in communication with network devices or distributed storage."
[0224] As can be seen from the above embodiment, the method provided by the embodiment can accurately map a fuzzy and high-level user query to the deep structure and dynamic behavior of the code library, providing context information for large language models, thereby realizing code understanding and problem diagnosis capabilities far beyond traditional retrieval methods.
[0225] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software and the necessary general hardware platform, of course, it can also be realized by hardware, but in many cases the former is a better embodiment.
[0226] In the embodiments of the present application, an answer generation device is also provided, which is used to implement the above embodiments and preferred embodiments, and has been described. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware is also possible and is contemplated.
[0227] The embodiment provides an answer generation device, as shown in Figure 3 , comprising:
[0228] The acquisition module 301 is configured to acquire a firmware query question.
[0229] The screening module 302 is configured to screen at least one target firmware and at least one target firmware set corresponding to the firmware query question from the pre-constructed firmware database based on the firmware query question, wherein the firmware database includes a plurality of firmwares, a plurality of semantic firmware sets and a plurality of execution firmware sets, the semantic information corresponding to all firmwares in each semantic firmware set satisfies a preset semantic condition, the firmwares in the execution firmware set are called in the corresponding historical execution process, and the target firmware set is a semantic firmware set or an execution firmware set.
[0230] The generating module 303 is configured to input the at least one target firmware, the at least one target firmware set, and the firmware query question into the pre-built first inference model to generate an answer corresponding to the firmware query question.
[0231] In a possible implementation, the apparatus further includes a constructing module configured to parse all the firmwares to obtain a calling relationship among the firmwares.
[0232] Based on the calling relationship among the firmwares, the corresponding superior firmware and inferior firmware of the first firmware in all the firmwares are determined, where the first firmware is one of the plurality of firmwares.
[0233] Based on the superior firmware and the inferior firmware, the final description information of the first firmware is determined.
[0234] The final description information of the first firmware is added to the firmware database.
[0235] In a possible implementation, the constructing module is specifically configured to input the first firmware, the superior firmware, and the inferior firmware into a pre-built second inference model to obtain the description information of the first firmware, the description information of the superior firmware, and the description information of the inferior firmware.
[0236] The description information of the first firmware, the description information of the superior firmware, and the description information of the inferior firmware are determined as the final description information of the first firmware.
[0237] In a possible implementation, the constructing module is further configured to obtain, from the firmware database, the final description information corresponding to all the firmwares in the first firmware set respectively, where the first firmware set is one of the plurality of semantic firmware sets and the plurality of execution firmware sets.
[0238] The final description information corresponding to all the firmwares in the first firmware set respectively is determined as the description information of the first firmware set.
[0239] The description information of the first firmware set is added to the firmware database.
[0240] In a possible implementation, the generating module 303 is further configured to input the firmware query question, all the target firmwares, all the target firmware sets, the final description information corresponding to all the target firmwares respectively, and the description information corresponding to all the target firmware sets respectively into the first inference model to generate an answer corresponding to the firmware query question.
[0241] In a possible implementation, the generating module 303 is specifically configured to determine an order among all the target firmwares based on the calling relationship among the target firmwares.
[0242] All the target firmwares are sorted based on the order.
[0243] input the sorted target firmware, the at least one target firmware set, and the firmware query question to the first inference model to obtain an answer.
[0244] In a possible implementation, the screening module 302 is specifically configured to acquire first semantic information corresponding to the firmware query question and firmware symbols in the firmware query question, and second semantic information corresponding to the second firmware and firmware symbols in the second firmware, where the second firmware is one of the plurality of firmwares in the firmware database;
[0245] based on the first semantic information and the second semantic information, determine semantic similarity between the firmware query question and the second firmware;
[0246] based on the firmware symbols in the firmware query question and the firmware symbols in the second firmware, determine a firmware symbol matching indicator between the firmware query question and the second firmware;
[0247] After determining the semantic similarity and the firmware symbol matching indicator between all firmwares and the firmware query question respectively, the target firmware is screened from the firmware database based on the semantic similarity and the firmware symbol matching indicator between all firmwares and the firmware query question respectively.
[0248] In a possible implementation, the screening module 302 is specifically configured to screen, according to a preset symbol screening rule, a target firmware symbol corresponding to a first firmware symbol from the second firmware, where the first firmware symbol is one of the firmware symbols in the firmware query question;
[0249] based on the semantic similarity between the target firmware symbol and the first firmware symbol, determine a firmware symbol matching sub-indicator corresponding to the first firmware symbol;
[0250] After determining the firmware symbol matching sub-indicators corresponding to all firmware symbols in the firmware query question respectively, determine the firmware symbol matching indicator based on the firmware symbol matching sub-indicators corresponding to all firmware symbols in the firmware query question respectively.
[0251] In a possible implementation, the screening module 302 is specifically configured to determine semantic similarity between all firmware symbols in the second firmware and the first firmware symbol respectively;
[0252] based on the semantic similarity between each firmware symbol in the second firmware and the first firmware symbol, screen a target firmware symbol corresponding to the first firmware symbol from the second firmware.
[0253] In a possible implementation, the screening module 302 is specifically configured to count a word frequency of the target firmware symbol in the second firmware, and an inverse document frequency of the target firmware symbol in the firmware database;
[0254] The firmware symbol matching sub-index is determined based on the word frequency, the inverse document frequency, and semantic similarity between the target firmware symbol and the first firmware symbol.
[0255] In a possible implementation, the screening module 302 is specifically configured to adjust the word frequency based on the semantic similarity between the target firmware symbol and the first firmware symbol, to obtain an adjusted word frequency.
[0256] The firmware symbol matching sub-index is determined based on the adjusted word frequency and the inverse document frequency.
[0257] In a possible implementation, the screening module 302 is specifically configured to multiply the word frequency and the semantic similarity between the target firmware symbol and the first firmware symbol, to obtain the adjusted word frequency.
[0258] In a possible implementation, the screening module 302 is specifically configured to analyze the firmware query question, and determine a problem type corresponding to the firmware query question.
[0259] The firmware collection type of the target firmware collection is determined based on the problem type and a mapping relationship between preset problem types and firmware collection types.
[0260] The target firmware collection corresponding to the firmware collection type is screened from the firmware database based on the firmware query question.
[0261] In a possible implementation, the apparatus further includes an adjusting module configured to obtain historical answers corresponding to a plurality of historical query questions respectively in a preset historical time period, the historical answers including historical firmware.
[0262] The firmware corresponding to the first historical answer is determined based on the historical firmware in the first historical answer, the first historical answer being one of the historical answers corresponding to the plurality of historical query questions, and the firmware corresponding to the first historical answer containing the historical firmware in the first historical answer.
[0263] After determining the firmware corresponding to all the historical answers respectively in the firmware database, the firmware in the firmware database is adjusted based on the firmware corresponding to all the historical answers respectively.
[0264] In a possible implementation, the adjusting module is specifically configured to count a total number of times that any two firmwares appear simultaneously in a same historical answer among the firmware corresponding to all the historical answers respectively.
[0265] If there are two firmwares with a total number of times greater than a first preset threshold, and it is determined based on description information of the two firmwares that the two firmwares are used to process a preset service, the two firmwares in the firmware database are merged.
[0266] In a possible implementation, the adjusting module is specifically configured to determine whether the third firmware exists in the firmware corresponding to all the historical answers, wherein the different historical firmware in the third firmware exists in the historical answers corresponding to the historical query questions of different problem types, or the number of the historical answers corresponding to the third firmware is less than the second preset threshold value.
[0267] If the third firmware exists in the firmware corresponding to all the historical answers, the third firmware is split according to a preset splitting rule, and a plurality of sub-firmwares in the third firmware are obtained.
[0268] The plurality of sub-firmwares in the third firmware are added to the firmware database, and the third firmware is deleted from the firmware database.
[0269] The description of the features in the embodiments of the answer generation device can refer to the related description of the embodiments of the answer generation method, which will not be repeated here.
[0270] The embodiments of the present application also provide an electronic device, as shown in the figure, comprising a memory 10 and a processor 20, the memory 10 stores a computer program, and the processor 20 is configured to run the computer program to execute the steps in any of the above answer generation method embodiments. Figure 4
[0271] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program, wherein the computer program is configured to execute the steps in any of the above answer generation method embodiments when running.
[0272] In an exemplary embodiment, the above computer readable storage medium can include but is not limited to: U disk, read-only memory (Read-Only Memory, ROM for short), random access memory (Random Access Memory, RAM for short), mobile hard disk, magnetic disk or optical disk and various computer program storage media.
[0273] The embodiments of the present application also provide a computer program product, which comprises a computer program, and the computer program is executed by a processor to realize the steps in any of the above answer generation method embodiments.
[0274] The embodiments of the present application also provide another computer program product, which comprises a non-volatile computer readable storage medium, the non-volatile computer readable storage medium stores a computer program, and the computer program is executed by a processor to realize the steps in any of the above answer generation method embodiments.
[0275] Those skilled in the art will further realize that the mere concepts, teachings, and embodiments described herein are merely meant to provide an enabling description of the claimed application. Accordingly, modifications and / or additions, other than those explicitly described herein, can be obvious to those skilled in the art in the light of this disclosure. The claimed application is intended to embrace all such modifications and / or additions.
[0276] The above provides a detailed introduction to the answer generation method, device, electronic equipment and medium provided by the present application. The principles and implementation modes of the present application are described herein by applying specific examples, and the above description of the embodiments is only used to help understand the method of the present application and its core idea. It should be pointed out that, for those skilled in the art, without departing from the principles of the present application, some improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.
Claims
1. An answer generation method, characterized by, The method comprises: acquiring a firmware query question; based on the firmware query question, filtering at least one target firmware and at least one target firmware set corresponding to the firmware query question from a pre-built firmware database respectively, wherein the firmware database comprises a plurality of firmwares, a plurality of semantic firmware sets and a plurality of execution firmware sets, the semantic information corresponding to all firmwares in each semantic firmware set satisfies a preset semantic condition respectively, the firmwares in the execution firmware set are the firmwares called in the corresponding historical execution process, and the target firmware set is the semantic firmware set or the execution firmware set; inputting the at least one target firmware, the at least one target firmware set and the firmware query question into a pre-built first inference model to generate an answer corresponding to the firmware query question; based on the firmware query question, filtering at least one target firmware corresponding to the firmware query question from the firmware database, comprising: acquiring first semantic information corresponding to the firmware query question and firmware symbols in the firmware query question, and second semantic information corresponding to a second firmware and firmware symbols in the second firmware, wherein the second firmware is one of the plurality of firmwares in the firmware database; based on the first semantic information and the second semantic information, determining semantic similarity between the firmware query question and the second firmware; based on the firmware symbols in the firmware query question and the firmware symbols in the second firmware, determining firmware symbol matching indicators between the firmware query question and the second firmware; after determining the semantic similarity and the firmware symbol matching indicators between all the firmwares and the firmware query question respectively, filtering the target firmware from the firmware database based on the semantic similarity and the firmware symbol matching indicators between all the firmwares and the firmware query question respectively; based on the firmware query question, filtering at least one target firmware set corresponding to the firmware query question from the firmware database, comprising: analyzing the firmware query question to determine a problem type corresponding to the firmware query question; based on the problem type and a preset mapping relationship between problem types and firmware set types, determining a firmware set type of the target firmware set; based on the firmware query question, filtering a target firmware set corresponding to the firmware set type from the firmware database.
2. The method of claim 1, wherein, The method further comprises: analyzing all the firmwares to obtain a calling relationship between all the firmwares; based on the calling relationship between all the firmwares, determining upper and lower firmwares corresponding to a first firmware in all the firmwares, wherein the first firmware is one of the plurality of firmwares; based on the upper and lower firmwares, determining final description information of the first firmware; adding the final description information of the first firmware to the firmware database.
3. The method of claim 2, wherein, The method further comprises: based on the upper and lower firmwares, determining the final description information of the first firmware, comprising: The first firmware, the upper firmware and the lower firmware are respectively input into a pre-constructed second inference model to obtain description information of the first firmware, description information of the upper firmware and description information of the lower firmware. The description information of the first firmware, the description information of the upper firmware and the description information of the lower firmware are determined as final description information of the first firmware.
4. The method according to claim 2 or 3, characterized in that, The method further comprises: obtaining final description information corresponding to all firmware in a first firmware set from the firmware database, wherein the first firmware set is one of the plurality of semantic firmware sets and the plurality of execution firmware sets; determining the final description information corresponding to all firmware in the first firmware set as description information of the first firmware set; adding the description information of the first firmware set to the firmware database.
5. The method of claim 4, wherein, The method further comprises: inputting the firmware query question, all target firmware, all target firmware sets, final description information corresponding to all target firmware and description information corresponding to all target firmware sets into the first inference model to generate an answer corresponding to the firmware query question.
6. The method according to claim 2 or 3, characterized in that, The inputting the at least one target firmware, the at least one target firmware set and the firmware query question into the pre-constructed first inference model to generate an answer corresponding to the firmware query question comprises: determining an order sequence between all target firmware based on a calling relationship between the target firmware; ordering all target firmware based on the order sequence; inputting the ordered target firmware, the at least one target firmware set and the firmware query question into the first inference model to obtain the answer.
7. The method of claim 1, wherein, The determining a firmware symbol matching index between the firmware query question and the second firmware based on firmware symbols in the firmware query question and firmware symbols in the second firmware comprises: screening target firmware symbols corresponding to a first firmware symbol from the second firmware according to a preset symbol screening rule, wherein the first firmware symbol is one firmware symbol in the firmware query question; determining a firmware symbol matching sub-index corresponding to the first firmware symbol based on semantic similarity between the target firmware symbol and the first firmware symbol; when all firmware symbol matching sub-indices corresponding to all firmware symbols in the firmware query question are determined, determining the firmware symbol matching index based on all firmware symbol matching sub-indices corresponding to all firmware symbols in the firmware query question.
8. The method of claim 7, wherein, The screening target firmware symbols corresponding to the first firmware symbol from the second firmware according to the preset symbol screening rule comprises: determining semantic similarity between all firmware symbols in the second firmware and the first firmware symbol; screening target firmware symbols corresponding to the first firmware symbol from the second firmware based on semantic similarity between each firmware symbol in the second firmware and the first firmware symbol.
9. The method of claim 7, wherein, The determining the firmware symbol matching sub-index corresponding to the first firmware symbol based on the semantic similarity between the target firmware symbol and the first firmware symbol comprises: counting a word frequency of the target firmware symbol appearing in the second firmware, and an inverse document frequency of the target firmware symbol in the firmware database; determining the firmware symbol matching sub-index based on the word frequency, the inverse document frequency, and the semantic similarity between the target firmware symbol and the first firmware symbol.
10. The method of claim 9, wherein, The determining the firmware symbol matching sub-index based on the word frequency, the inverse document frequency, and the semantic similarity between the target firmware symbol and the first firmware symbol comprises: adjusting the word frequency based on the semantic similarity between the target firmware symbol and the first firmware symbol to obtain an adjusted word frequency; determining the firmware symbol matching sub-index based on the adjusted word frequency and the inverse document frequency.
11. The method of claim 10, wherein, The adjusting the word frequency based on the semantic similarity between the target firmware symbol and the first firmware symbol to obtain an adjusted word frequency comprises: multiplying the word frequency and the semantic similarity between the target firmware symbol and the first firmware symbol to obtain the adjusted word frequency.
12. The method of any one of claims 1-3, wherein, The method further comprises: obtaining historical answers corresponding to a plurality of historical query questions respectively in a preset historical time period backtracking from a current time, wherein the historical answers comprise historical firmwares; determining firmwares corresponding to the first historical answer in the firmware database based on the historical firmwares in the first historical answer, wherein the first historical answer is one of the historical answers corresponding to the plurality of historical query questions respectively, and the firmwares corresponding to the first historical answer contain the historical firmwares in the first historical answer; adjusting the firmwares in the firmware database based on the firmwares corresponding to all the historical answers respectively after determining the firmwares corresponding to all the historical answers respectively in the firmware database.
13. The method of claim 12, wherein, The adjusting the firmwares in the firmware database based on the firmwares corresponding to all the historical answers respectively after determining the firmwares corresponding to all the historical answers respectively in the firmware database comprises: counting a total number of times that any two firmwares appear simultaneously in the same historical answer among the firmwares corresponding to all the historical answers respectively; if there are two firmwares with a total number of times greater than a first preset threshold, and it is determined based on description information of the two firmwares that the two firmwares are used to process a preset service, then merging the two firmwares in the firmware database.
14. The method of claim 12, wherein, The adjusting the firmwares in the firmware database based on the firmwares corresponding to all the historical answers respectively after determining the firmwares corresponding to all the historical answers respectively in the firmware database comprises: determining whether there is a third firmware among the firmwares corresponding to all the historical answers respectively, wherein different historical firmwares in the third firmware exist in historical answers corresponding to historical query questions of different question types, or a number of historical answers corresponding to the third firmware is less than a second preset threshold; If all the historical answers correspond to the third firmware, the third firmware is split according to a preset splitting rule to obtain a plurality of sub-firmwares in the third firmware. The plurality of sub-firmwares in the third firmware are added to the firmware database, and the third firmware is deleted from the firmware database.
15. An answer generation apparatus characterized by comprising: The apparatus comprises: An acquisition module configured to acquire a firmware query question; A screening module configured to screen at least one target firmware and at least one target firmware set corresponding to the firmware query question from a pre-constructed firmware database based on the firmware query question, wherein the firmware database comprises a plurality of firmwares, a plurality of semantic firmware sets, and a plurality of execution firmware sets, semantic information of all firmwares in each semantic firmware set corresponds to each other and satisfies a preset semantic condition, firmwares in the execution firmware set are firmwares called in a historical execution process, and the target firmware set is the semantic firmware set or the execution firmware set; A generation module configured to input the at least one target firmware, the at least one target firmware set, and the firmware query question into a pre-constructed first inference model to generate an answer corresponding to the firmware query question; Screening at least one target firmware corresponding to the firmware query question from the firmware database based on the firmware query question comprises: Acquiring first semantic information corresponding to the firmware query question and firmware symbols in the firmware query question, and second semantic information corresponding to a second firmware and firmware symbols in the second firmware, wherein the second firmware is one of the plurality of firmwares in the firmware database; Determining semantic similarity between the firmware query question and the second firmware based on the first semantic information and the second semantic information; Determining a firmware symbol matching index between the firmware query question and the second firmware based on the firmware symbols in the firmware query question and the firmware symbols in the second firmware; After determining semantic similarity and firmware symbol matching indexes between all the firmwares and the firmware query question, screening the target firmware from the firmware database based on the semantic similarity and the firmware symbol matching indexes between all the firmwares and the firmware query question; Screening at least one target firmware set corresponding to the firmware query question from the firmware database based on the firmware query question comprises: Analyzing the firmware query question to determine a question type corresponding to the firmware query question; Determining a firmware set type of the target firmware set based on the question type and a preset mapping relationship between question types and firmware set types; Screening a target firmware set corresponding to the firmware set type from the firmware database based on the firmware query question.
16. An electronic device, comprising: Comprise: A memory configured to store a computer program; A processor configured to implement steps of the answer generation method in any one of claims 1-14 when executing the computer program.
17. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program, when executed by a processor, implements the steps of the answer generation method according to any one of claims 1-14.
18. A computer program product comprising a computer program, characterized in that, The computer program, when executed by a processor, implements the steps of the answer generation method according to any one of claims 1-14.
Citation Information
Patent Citations
Method and apparatus for generating answer to user query using graph database
KR102877684B1
Method and apparatus for recommending answer to question based on artificial intelligence
US20180373782A1