Question and answer model training method and device, computer equipment and storage medium

By training the Q&A model and generating a sample set, the problem of inefficient customer-friendly querying server questions is solved, and the effect of reducing labor costs and improving user experience is achieved.

CN119513253AActive Publication Date: 2025-02-25INSPUR SUZHOU INTELLIGENT TECH CO LTD

Patent Information

Application Number
CN202411574829.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2025-02-25
Estimated Expiration
2044-11-06

AI Technical Summary

Technical Problem

The customer querying the answers corresponding to the server questions is inefficient, resulting in high labor costs and poor user experience.

Method used

By training the Q&A model, obtaining the initial model and server statements, analyzing the statements, generating a sample set, and training the initial model based on these sample sets to obtain a target Q&A model with the ability to answer server questions.

Benefits of technology

It improves the efficiency of customers in querying answers to server questions, reduces labor costs, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119513253A_ABST
    Figure CN119513253A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of artificial intelligence, and discloses a question and answer model training method and device, computer equipment and a storage medium, and the method comprises the steps: obtaining an initial model and L server statements; replacing at least one target word in the plurality of words in the server statements with a preset identifier, and generating L new server statements to form a first sample set; extracting a plurality of groups of continuous server statements to obtain a plurality of groups of positive samples, sequentially exchanging the two server statements to obtain a plurality of groups of negative samples, and forming a second sample set with the plurality of groups of positive samples; and generating server questions according to the grammatical structures and contents of the server statements, generating server answers based on the dependency relationship of words in each server statement, and forming a third sample set with the server questions. And training the initial model based on the first sample set, the second sample set and the third sample set to obtain a target question and answer model. According to the invention, the efficiency of querying answers corresponding to server questions by clients can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a training method, device, computer equipment and storage medium for a question-answering model. Background Art

[0002] With the rapid development of server technology, the functions of servers are becoming more and more comprehensive. As a result, the relevant professional knowledge of servers is becoming more and more complicated. After customers purchase servers, manufacturers will provide a series of server-related manuals for customers to query and refer to during the later operation and maintenance process. In addition, manufacturers will also be equipped with FAE teams to manually answer customer questions. However, since some professional knowledge is difficult to understand and remember, the manual content is complicated and most of it is in English, the efficiency of users extracting information is very low, which in turn causes many users to skip the self-query stage and directly ask the FAE team, which ultimately increases the manufacturer's labor costs.

[0003] Therefore, how to improve the efficiency of obtaining answers to customer inquiries about server issues, reduce labor costs, and provide good after-sales services have become practical issues that server manufacturers need to solve. Summary of the invention

[0004] In view of this, the present invention provides a training method, apparatus, computer device and storage medium for a question-answering model to solve the problems of low efficiency, high labor cost and poor user experience in obtaining answers corresponding to client query server questions.

[0005] In a first aspect, the present invention provides a training method for a question-answering model, the method comprising: obtaining an initial model and L server statements, where L≥1 and is an integer; parsing the L server statements, obtaining multiple words corresponding to each server statement in the L server statements, the grammatical structure and content of each server statement, and the dependency relationship of the words included in each server statement; extracting at least one target word included in the multiple words, and replacing the at least one target word with a preset identifier to generate new L server statements, the new L server statements constitute a first sample set; extracting multiple groups of two consecutive server statements from the L server statements to obtain multiple groups of positive samples, and sequentially exchanging the two server statements included in each group of positive samples to obtain multiple groups of negative samples, and forming the multiple groups of positive samples and the multiple groups of negative samples into a second sample set; generating multiple server questions based on the grammatical structure and content of the L server statements, and generating multiple server answers corresponding to the multiple server questions based on the dependency relationship of the words included in each server statement, and forming the multiple server questions and the multiple server answers into a third sample set.

[0006] The initial model is trained based on the first sample set, the second sample set, and the third sample set to obtain a target question-answering model, and the target question-answering model is sent to the baseboard management controller. The target question-answering model has the ability to answer questions in response to the server.

[0007] Based on the method of the first aspect above, an initial model and L server statements can be obtained, and the L data are processed differently to obtain a first sample set, a second sample set and a third sample set, and the initial model is trained based on the first sample set, the second sample set and the third sample set to obtain a target question-answering model. Since the first number of target words included in the first sample set are replaced with preset identifiers, the trained initial model has the ability to predict words; since the second sample set is determined by the order of server statements, the trained initial model has the ability to predict the order of statements; after the initial model is trained based on the first sample set and the second sample set, it is further trained based on the third sample set. Since the third sample set splits the L server statements into server questions and server answers, the trained target question-answering model has the ability to respond to server questions. After the target question-answering model is sent to the baseboard management controller, the client can directly query the answer corresponding to the server question on the client side of the server, thereby improving the efficiency of the client querying the answer corresponding to the server question, reducing labor costs, and ensuring customer experience.

[0008] In an optional implementation, obtaining L server statements includes: obtaining at least one server document, wherein the language type of each first server statement is a first language type; translating each first server statement expressed in the first language type into a second server statement expressed in a second language type to obtain N second server statements, wherein one second server statement expressed in the second language type can be translated into at least one server statement expressed in the first language type; and translating each second server statement expressed in the second language type into a server statement expressed in the first language type to obtain L server statements, where L≥N.

[0009] Based on the above method, since the number of at least one server document is small, the server statement is expanded through the translation and back-translation method. For example, the Chinese document of the server statement is translated into English or the English document is translated into Chinese, and then the server statement is translated into the original language. This can quickly and efficiently make the same server statement have different expressions, thereby achieving the purpose of expanding the server statement and making the model training more accurate.

[0010] In an optional embodiment, the initial model is trained based on the first sample set, the second sample set, and the third sample set to obtain a target question-answering model, including: inputting the first sample set into the initial model for word prediction task training to obtain a first prediction model, the first prediction model has the ability to predict words replaced with preset identifiers; inputting the second sample set into the first prediction model for sentence sequence prediction training to obtain a second prediction model, the second prediction model has the ability to predict whether the order of two server statements is correct; inputting the third sample set into the second prediction model for question-answering training to obtain a third prediction model, the third prediction model has the ability to answer questions in response to server questions; and pruning the third prediction model to obtain the target question-answering model.

[0011] Based on the above method, the initial model can be trained based on the first sample set, the second sample set, and the third sample set to obtain a trained third prediction model, and the third prediction model can be pruned to obtain a target question and answer model to achieve model lightweighting so that the target question and answer model can be embedded in the baseboard management controller.

[0012] In an optional embodiment, the number of at least one target word is a first number; the first sample set is input into the initial model for word prediction task training to obtain a first prediction model, including: using the first number of target words as the first number of first true labels; the first sample set is input into the initial model for word prediction task training to obtain the first number of first prediction labels, and the first prediction labels are used to indicate the predicted words corresponding to the target words.

[0013] Compare a first number of first predicted labels with a first number of first true labels to obtain a first evaluation result of the initial model, where the first evaluation result is used to indicate the ratio of the number of times the first predicted label is consistent with the first true label to the first number; determine whether the first evaluation result is greater than or equal to a first threshold; if so, determine the trained initial model as the first prediction model; if not, adjust the model parameters of the trained initial model, and retrain based on the first sample set until the first evaluation result is greater than or equal to the first threshold.

[0014] Based on the above method, the initial model can be trained based on the first sample set to obtain a first prediction model, so that the first prediction model has the ability to predict the words to be replaced with the preset identifier.

[0015] In an optional embodiment, the second sample set includes a second number of groups of positive samples; the second sample set is input into the first prediction model for prediction statement sequence training to obtain a second prediction model, including: recording the order of two server statements included in each group of positive samples in the second sample set as a second number of second true labels; the second sample set is input into the first prediction model to obtain a second number of second prediction labels, and the second prediction labels are used to indicate the prediction order of the two server statements included in each group of positive samples or each group of negative samples.

[0016] Compare the second number of second predicted labels with the second number of second true labels to obtain a second evaluation result of the first prediction model, where the second evaluation result is used to indicate the ratio of the number of times the second predicted label is consistent with the second true label to the second number; determine whether the second evaluation result is greater than or equal to a second threshold; if so, determine the trained first prediction model as the second prediction model; if not, adjust the model parameters of the trained first prediction model, and retrain based on the second sample set until the second evaluation result is greater than or equal to the second threshold.

[0017] Based on the above method, the first prediction model can be trained based on the second sample set to obtain a second prediction model, so that the second prediction model has the ability to predict whether the order of two server statements is correct.

[0018] In an optional embodiment, the third sample set includes a third number of server questions, each server question corresponds to a server answer; the third sample set is input into the second prediction model for question-and-answer training to obtain a third prediction model, including: taking each server question in the third number of server questions and the server answer corresponding to each server question as a third number of third true labels; the third sample set is input into the second prediction model to obtain a third number of third prediction labels, and the third prediction label is used to indicate the predicted server answer corresponding to each service question.

[0019] Compare the third number of third predicted labels with the third number of third true labels to obtain a third evaluation result of the second prediction model, where the third evaluation result is used to indicate the ratio of the number of times the third predicted label is consistent with the third true label to the third number; determine whether the third evaluation result is greater than or equal to a third threshold; if so, determine the trained second prediction model as the third prediction model; if not, adjust the model parameters of the trained second prediction model, and retrain based on the third sample set until the third evaluation result is greater than or equal to the third threshold.

[0020] Based on the above method, the second prediction model can be trained based on the third sample set to obtain a third prediction model, so that the third prediction model has the ability to answer questions in response to the server.

[0021] In an optional embodiment, the third prediction model includes an embedding layer, an attention layer, and a fully connected layer; the third prediction model is pruned to obtain a target question-answering model, including: reducing the dimension of the embedding vector in the embedding layer, the number of attention heads in the attention layer, and the dimension of each attention head or the number of hidden units in the fully connected layer included in the third prediction model to obtain the pruned target question-answering model, wherein the memory resources required by the target question-answering model are less than or equal to a fourth threshold, and the required central processing unit resources are less than or equal to a fifth threshold.

[0022] Based on the above method, the third prediction model can be pruned so that the memory resources and central processing unit resources required by the obtained target question-answering model meet the conditions for being embedded in the baseboard management controller.

[0023] In a second aspect, the present invention provides a training device for a question-answering model, including an acquisition module for acquiring an initial model and L server statements, where L≥1 and is an integer; the acquisition module is also used to parse the L server statements, acquire multiple words corresponding to each of the L server statements, the grammatical structure and content of each server statement, and the dependency relationship of the words included in each server statement.

[0024] The processing module is used to extract at least one target word included in multiple words, and replace the at least one target word with a preset identifier to generate new L server statements, and the new L server statements constitute a first sample set; the processing module is also used to extract multiple groups of two consecutive server statements from the L server statements to obtain multiple groups of positive samples, and sequentially exchange the two server statements included in each group of positive samples to obtain multiple groups of negative samples, and the multiple groups of positive samples and the multiple groups of negative samples constitute a second sample set; the processing module is also used to generate multiple server questions according to the grammatical structure and content of the L server statements, and based on the dependency relationship of the words included in each server statement, generate multiple server answers corresponding to the multiple server questions, and the multiple server questions and the multiple server answers constitute a third sample set; the processing module is also used to train the initial model based on the first sample set, the second sample set, and the third sample set to obtain a target question-answering model, and send the target question-answering model to the baseboard management controller, and the target question-answering model has the ability to answer responses to server questions.

[0025] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the question-answering model training method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0026] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the training method for a question-answering model of the first aspect or any corresponding embodiment thereof.

[0027] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions, which are used to enable a computer to execute the training method of the question-answering model of the above-mentioned first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0029] Figure 1 is an architecture diagram of a BERT model according to an embodiment of the present invention;

[0030] Figure 2 is a topological diagram of a training system for a question-answering model according to an embodiment of the present invention;

[0031] Figure 3 is a flowchart of a method for training a question-answering model according to an embodiment of the present invention;

[0032] Figure 4 is a structural block diagram of a training device for a question-answering model according to an embodiment of the present invention;

[0033] Figure 5 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0034] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0035] Before introducing the specific embodiments of the present invention, relevant technical terms of the present invention are first introduced.

[0036] BERT model: The BERT model is a natural language processing model based on deep learning. Figure 1 As shown, Figure 1 : is an architecture diagram of the BERT model of an embodiment of the present invention. Figure 1 In the BERT model, there are Input layer, Embedding layer, Network structure of BERT layer and Output layer. The Embedding layer is divided into three sub-parts, namely Token embedding, Segment embedding and Position embedding.

[0037] Low-Rank Adaptation (LoRA) method: In deep learning, the parameters of the model are usually represented as a high-dimensional weight matrix W. The core idea of ​​the LoRA method is to add a small, low-rank matrix ΔW to these weight matrices to obtain a new weight matrix W+ΔW. This low-rank matrix ΔW can be obtained through training without changing the original pre-trained weight W.

[0038] Specifically, assuming that the dimension of the original weight matrix W is m×n, LoRA introduces a low-rank matrix ΔW, which can be decomposed into the product of two smaller matrices A and B, that is, ΔW=AB, where the dimension of A is m×r, the dimension of B is r×n, and r<<min(m,n). In this way, by adjusting the values ​​of A and B, ΔW can be indirectly adjusted, and then the weight of the entire model can be adjusted. Update of the weight matrix: W_new=W+ΔW=W+AB. Forward propagation: During the forward propagation of the model, the updated weight matrix W_new is used for calculation. Backward propagation: During the back propagation process, the gradient with respect to ΔW (i.e. A and B) is calculated, and these parameters are updated to minimize the loss function. The gradient can be calculated by the chain rule and applied to A and B. Use gradient descent or other optimization algorithms to update the values ​​of A and B until the stopping condition is met (such as reaching the maximum number of iterations, the loss function value no longer decreases significantly (converges), etc.).

[0039] The present invention is applied to the field of server operation and maintenance. The target question-answering model trained by the present invention needs to be embedded in the baseboard management controller (BMC). BMC is an independent system that does not rely on other hardware on the system (such as a central processing unit, memory, etc.), nor does it rely on an input-output system or an operating system. In addition, the program server manufacturer inside the BMC can develop it by itself. Therefore, it is feasible for the manufacturer to implant the target question-answering model inside the BMC, and the customer can use it by visiting the web page of the BMC after purchasing the server.

[0040] As described in the background technology, since the answers corresponding to customer query server questions are inefficient, have high labor costs, and have poor user experience, an embodiment of the present invention provides a method for training a question-answering model, by which a question-answering model is obtained through training to improve the efficiency of answers corresponding to customer query server questions and reduce labor costs.

[0041] Below Figure 2 Taking the training system 200 of the question-answering model shown as an example, the method provided in the embodiment of the present application is described. Figure 2 It is only a schematic diagram and does not constitute a limitation on the applicable scenarios of the technical solution provided in this application.

[0042] like Figure 2 As shown, Figure 2 4 is a topological diagram of a training system for a question-answering model according to an embodiment of the present invention. Figure 2 In the example, the question-answering model training system 200 may include a question-answering model training device 201 and a baseboard management controller 202 .

[0043] The question-answering model training device 201 in the embodiment of the present invention can be any device with computing and communication capabilities, such as a processor or a central processing unit.

[0044] The baseboard management controller 202 in the embodiment of the present application can be a hardware manager integrated in a server, a network device, or other computer systems. The baseboard management controller is used to monitor the hardware status of the device, perform remote management operations, and provide monitoring and control functions for the device.

[0045] Figure 2 The question-answering model training system 200 shown is only used as an example and is not used to limit the technical solution of the present application. Those skilled in the art should understand that in the specific implementation process, the question-answering model training system 200 may also include other devices without limitation.

[0046] According to an embodiment of the present invention, an embodiment of a training method for a question-answering model is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0047] In this embodiment, a method for training a question-answering model is provided, which can be used in the training device for the question-answering model. Figure 3 is a flowchart of a method for training a question-answering model according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:

[0048] S301: Obtain an initial model and L server statements.

[0049] The initial model may be a pre-trained model, for example, an ALBERT model.

[0050] It can be understood that the ALBERT model is a lightweight variant of the BERT model, which significantly reduces the number of model parameters through techniques such as parameter sharing and embedding parameterization decomposition, while maintaining performance comparable to the BERT model. The ALBERT model can reduce the number of parameters and computational costs while retaining the basic architecture of the BERT model, so it can continue to be pre-trained and fine-tuned like the BERT model.

[0051] In some optional embodiments, the training device of the question-answering model obtains at least one server document, each server document includes N first server statements; translates each first server statement expressed in a first language type into a second server statement expressed in a second language type, to obtain N second server statements; and translates each second server statement expressed in the second language type into a server statement expressed in the first language type, to obtain L server statements.

[0052] Among them, L≥N.

[0053] In the embodiment of the present invention, at least one server document may be any one or more professional documents in the server field. For example, the server document may be a Redfish manual, an IPMI manual, a BMC document, a BIOS document, or a server operation and maintenance document.

[0054] In the embodiment of the present invention, the language type of each first server statement is the first language type. A second server statement expressed in the second language type can be translated into at least one server statement expressed in the first language type. For example, the first language type can be Chinese; the second language type can be English.

[0055] Optionally, the training device of the question-answering model may further perform deduplication processing on the N first server statements before translating each first server statement expressed in the first language type into a second server statement expressed in the second language type.

[0056] It can be understood that the training device of the question-answering model deduplicates the N server statements and deletes the repeated content in the N server statements, which can prevent the model from learning repeated patterns during the training process and affecting the generalization ability.

[0057] S302: Parse L server statements to obtain a plurality of words corresponding to each of the L server statements, a grammatical structure and content of each server statement, and dependency relationships of the words included in each server statement.

[0058] Exemplarily, the training device of the question-answering model can parse L server statements through a word segmentation tool (for example, the jieba tool or the HanLP tool), perform word segmentation on the L server statements, divide the L server statements into multiple sentences or shorter text fragments (usually called tokens), and extract the grammatical structure and content of each server statement, as well as the dependency relationship of the words included in each server statement.

[0059] Optionally, the training device of the question-answering model can also mark specific words or entities included in each server statement to improve the accuracy of word segmentation or facilitate the initial model to recognize and learn important information during the training process.

[0060] S303: extract at least one target word included in the multiple words, and replace the at least one target word with a preset identifier to generate new L server statements, and the new L server statements constitute a first sample set.

[0061] The target word may be a word randomly selected from a plurality of words. The number of at least one target word may be a first number. For example, the first number may be a preset proportion of words in all words. The preset proportion may be set according to actual needs. For example, the preset proportion may be 15%.

[0062] The preset logo can be any logo or symbol.

[0063] Exemplarily, the training device of the question-answering model extracts at least one target word included in multiple words, and replaces the at least one target word with a preset identifier, generates L new server statements, and saves the new L server statements as a first sample set in a preset format.

[0064] The preset format may be a TFRecord file format of TensorFlow or a Dataset object format of PyTorch.

[0065] S304: extract multiple groups of two consecutive server statements from the L server statements to obtain multiple groups of positive samples, and sequentially exchange the two server statements included in each group of positive samples to obtain multiple groups of negative samples, and form the multiple groups of positive samples and the multiple groups of negative samples into a second sample set.

[0066] Among them, the positive sample includes two consecutive server sentences, and the negative sample includes two server sentences with the order swapped. It can be understood that the negative sample is similar to the positive sample in vocabulary and topic, but the order between sentences is wrong.

[0067] The second sample set includes a second number of groups of positive samples.

[0068] S305: Generate multiple server questions based on the grammatical structure and content of the L server statements, and generate multiple server answers corresponding to the multiple server questions based on the dependency relationship of the words included in each server statement, and form the multiple server questions and the multiple server answers into a third sample set.

[0069] For example, take the server sentence "When the server model is the first model, the server operating system defaults to the first operating system" as an example. The training device of the question-answering model generates a server question "What is the operating system of the first model server" according to the grammatical structure (subject-predicate-object structure) and content of the server sentence; based on the dependency relationship of the words included in the server sentence, generates a server answer corresponding to the server question as "the first operating system", and saves "What is the operating system of the first model server" and "the first operating system" in the third sample set.

[0070] The third sample set includes a third number of server problems.

[0071] S306: Train the initial model based on the first sample set, the second sample set, and the third sample set to obtain a target question-answering model, and send the target question-answering model to the baseboard management controller.

[0072] Among them, the target question-answering model has the ability to answer questions in response to the server.

[0073] The following introduces the specific process of the training device of the question-answering model training the initial model based on the first sample set, the second sample set, and the third sample set to obtain the target question-answering model.

[0074] In one example, a training device for a question-answering model inputs a first sample set into an initial model for word prediction task training to obtain a first prediction model; inputs a second sample set into the first prediction model for sentence sequence prediction training to obtain a second prediction model; inputs a third sample set into the second prediction model for question-answering training to obtain a third prediction model; and prunes the third prediction model to obtain a target question-answering model.

[0075] The first prediction model has the ability to predict words to be replaced with preset identifiers.

[0076] The second prediction model has the ability to predict whether the order of two server statements is correct.

[0077] The third predictive model has answering capabilities in response to server questions.

[0078] The training process of the first prediction model is as follows:

[0079] In one example, a training device for a question-answering model uses a first number of target words as a first number of first true labels; inputs a first sample set into an initial model for word prediction task training to obtain a first number of first predicted labels; compares the first number of first predicted labels with the first number of first true labels to obtain a first evaluation result of the initial model; determines whether the first evaluation result is greater than or equal to a first threshold; if so, determines the trained initial model as the first prediction model; if not, adjusts the model parameters of the trained initial model, and retrains based on the first sample set until the first evaluation result is greater than or equal to the first threshold.

[0080] The first prediction tag is used to indicate the predicted word corresponding to the target word.

[0081] The first evaluation result is used to indicate the ratio of the number of times the first predicted label is consistent with the first true label to the first number.

[0082] The first threshold value can be set according to actual needs without limitation. For example, the first threshold value can be 90%.

[0083] The training process of the second prediction model is as follows:

[0084] In one example, a training device for a question-answering model records the order of two server statements included in each group of positive samples in a second sample set as a second number of second true labels; inputs the second sample set into a first prediction model to obtain a second number of second prediction labels; compares the second number of second prediction labels with the second number of second true labels to obtain a second evaluation result of the first prediction model; determines whether the second evaluation result is greater than or equal to a second threshold; if so, determines the trained first prediction model as the second prediction model; if not, adjusts the model parameters of the trained first prediction model, and retrains based on the second sample set until the second evaluation result is greater than or equal to the second threshold.

[0085] The second prediction label is used to indicate the prediction order of the two server statements included in each group of positive samples or each group of negative samples.

[0086] The second evaluation result is used to indicate the ratio of the number of times the second predicted label is consistent with the second true label to the second number.

[0087] The second threshold value can be set according to actual needs without limitation. For example, the second threshold value can be 95%.

[0088] Optionally, the training device of the question-answering model can compare the second number of second predicted labels with the second number of second true labels by using a cross entropy loss function to obtain a second evaluation result of the first prediction model. When the second evaluation result is less than a second threshold, the model parameters of the trained first prediction model are adjusted by a back propagation algorithm until the second evaluation result is greater than or equal to the second threshold.

[0089] The training process of the third prediction model is as follows:

[0090] In one example, a training device for a question-and-answer model uses each server question in a third number of server questions and the server answer corresponding to each server question as a third number of third true labels; inputs a third sample set into a second prediction model to obtain a third number of third prediction labels; compares the third number of third prediction labels with the third number of third true labels to obtain a third evaluation result of the second prediction model; determines whether the third evaluation result is greater than or equal to a third threshold; if so, determines the trained second prediction model as the third prediction model; if not, adjusts the model parameters of the trained second prediction model, and retrains the model based on the third sample set until the third evaluation result is greater than or equal to the third threshold.

[0091] The third prediction tag is used to indicate the predicted server answer corresponding to each service question.

[0092] The third evaluation result is used to indicate the ratio of the number of times the third predicted label is consistent with the third true label to the third number.

[0093] Optionally, before the training device of the question-answering model trains the third prediction model, the parameters of the second prediction model may be fine-tuned by an efficient parameter fine-tuning algorithm.

[0094] It is understandable that efficient parameter fine-tuning may include additive methods, selective methods or reparameterization methods. Considering the limitation on the size of the question-answering model and to achieve the best model training effect, the training device of the question-answering model is fine-tuned by the low-rank adaptation (LoRA) method under the reparameterization category.

[0095] The LoRA method reduces the number of parameters that need to be trained by introducing two trainable low-rank matrices (A and B). During training, the second prediction model parameters are frozen and only these two low-rank matrices are trained, thereby enabling rapid adjustments to the model behavior without having to train the entire model from scratch. During inference, these two low-rank matrices are merged back into the second prediction model parameters to generate the final third prediction model.

[0096] Furthermore, the third prediction model includes an embedding layer, an attention layer, and a fully connected layer. Among them, the embedding layer (InputEmbedding) includes three embedding methods: token, segment, and position. The attention layer (Multi-HeadAttention) includes multi-head attention. The fully connected layer (Feed Forward) is used to further map the output vector of the attention layer.

[0097] In one example, a training device for a question-answering model reduces the dimension of an embedding vector in an embedding layer, the number of attention heads in an attention layer, and the dimension of each attention head or the number of hidden units in a fully connected layer included in a third prediction model to obtain a target question-answering model after pruning.

[0098] Among them, the memory resources required by the target question and answer model are less than or equal to the fourth threshold, and the required central processing unit resources are less than or equal to the fifth threshold.

[0099] The fourth threshold may be a portion of the memory of the baseboard management controller. For example, the fourth threshold may be 50% of the total memory of the baseboard management controller.

[0100] The fifth threshold may be a portion of the central manager resources of the baseboard management controller. For example, the fifth threshold may be 30% of the central manager resources of the baseboard management controller.

[0101] It can be understood that the embedding layer is usually used to convert the input text into a vector representation of a fixed size. In the third prediction model, the training device of the question-answering model can reduce the number of parameters and the amount of calculation of the model by reducing the dimension of the embedding vector. For example, the third prediction model uses a 768-dimensional embedding vector, which is reduced to 384 dimensions or less by dimensionality pruning.

[0102] The attention layer (especially the multi-head attention layer) is a computationally intensive part. In the third prediction model, the training device of the question-answering model reduces the number of attention heads or the dimension of each head, which can significantly reduce the amount of calculation and parameters. For example, the third prediction model has 12 attention heads, each with 64 dimensions, which can be reduced to 6 heads or 32 dimensions per head through dimension pruning.

[0103] Fully connected layers (especially fully connected layers in the middle layer) usually have a large number of parameters. In the third prediction model, the training device of the question-answering model reduces the number of hidden units in the fully connected layer, which can reduce the number of parameters of the model. For example, the fully connected layer of the third prediction model has 3072 hidden units, which can be reduced to 1536 or less (768 dimensions) through dimension pruning.

[0104] The target question answering model performs dimension pruning to reduce the dimensions of each layer of the model to achieve model lightweighting. In the third prediction model, dimension pruning can be performed on different components such as the embedding layer, attention layer, and fully connected layer.

[0105] In one example, after the training device of the question-answering model performs dimension pruning on the third prediction model, the third prediction model after dimension pruning is trained based on the third sample set to obtain a target question-answering model.

[0106] It can be understood that after the training device of the question-answering model performs dimension pruning on the third prediction model, it can train again to restore the model performance and avoid the problem of reduced prediction accuracy of the target question-answering model due to dimension pruning.

[0107] Furthermore, the training device of the question-and-answer model converts the format of the finally generated target question-and-answer model into a .gguf format file, and sends the .gguf format file corresponding to the target question-and-answer model to the baseboard management controller.

[0108] It is understandable that since the original image of the baseboard management controller does not have the operating environment of the large model, the training device of the question and answer model needs to use a cross-compilation tool chain to transplant the environment required for the model operation into the BMC, and then import the model file into the baseboard management controller to run and realize the question and answer function.

[0109] Based on the above Figure 2 The method can obtain an initial model and L server statements, and process the L data differently to obtain a first sample set, a second sample set, and a third sample set, and train the initial model based on the first sample set, the second sample set, and the third sample set to obtain a target question-answering model.

[0110] Since the first number of target words included in the first sample set are replaced with preset identifiers, the trained initial model has the ability to predict words; since the second sample set is determined by the order of server statements, the trained initial model has the ability to predict the order of statements; after the initial model is trained based on the first sample set and the second sample set, it is further trained based on the third sample set. Since the third sample set splits L server statements into server questions and server answers, the trained target question and answer model has the ability to respond to server questions. After the target question and answer model is sent to the baseboard management controller, the customer can directly query the answer corresponding to the server question on the client side of the server, thereby improving the efficiency of the customer's query for the answer corresponding to the server question, reducing labor costs, and ensuring customer experience.

[0111] In this embodiment, a training device for a question-answering model is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0112] This embodiment provides a training device for a question-answering model. Figure 4 As shown, Figure 4 is a structural block diagram of a training device for a question-answering model according to an embodiment of the present invention; the device comprises:

[0113] The acquisition module 401 is used to acquire an initial model and L server statements, where L≥1 and is an integer.

[0114] The acquisition module 401 is further used to parse the L server statements, and acquire multiple words corresponding to each of the L server statements, the grammatical structure and content of each server statement, and the dependency relationship of the words included in each server statement.

[0115] The processing module 402 is used to extract at least one target word included in the multiple words, and replace the at least one target word with a preset identifier to generate new L server statements, and the new L server statements constitute a first sample set.

[0116] The processing module 402 is also used to extract multiple groups of two consecutive server statements from the L server statements to obtain multiple groups of positive samples, and sequentially exchange the two server statements included in each group of positive samples to obtain multiple groups of negative samples, and form the multiple groups of positive samples and the multiple groups of negative samples into a second sample set.

[0117] The processing module 402 is also used to generate multiple server questions according to the grammatical structure and content of the L server statements, and generate multiple server answers corresponding to the multiple server questions based on the dependency relationship of the words included in each server statement, and form the multiple server questions and the multiple server answers into a third sample set.

[0118] The processing module 402 is also used to train the initial model based on the first sample set, the second sample set, and the third sample set to obtain a target question-answering model, and send the target question-answering model to the baseboard management controller. The target question-answering model has the ability to answer server questions.

[0119] In some optional implementations, the acquisition module 401 is specifically used to acquire at least one server document, each server document includes N first server statements, and the language type of each first server statement is the first language type; the acquisition module 401 is also specifically used to translate each first server statement expressed in the first language type into a second server statement expressed in the second language type to obtain N second server statements, and one second server statement expressed in the second language type can be translated into at least one server statement expressed in the first language type; the acquisition module 401 is also specifically used to translate each second server statement expressed in the second language type into a server statement expressed in the first language type to obtain L server statements, where L≥N.

[0120] In some optional embodiments, processing module 402 is further specifically used to input the first sample set into the initial model for word prediction task training to obtain a first prediction model, and the first prediction model has the ability to predict words replaced with preset identifiers; processing module 402 is further specifically used to input the second sample set into the first prediction model for sentence sequence prediction training to obtain a second prediction model, and the second prediction model has the ability to predict whether the sequence of two server statements is correct; processing module 402 is further specifically used to input the third sample set into the second prediction model for question and answer training to obtain a third prediction model, and the third prediction model has the ability to answer questions in response to server questions; processing module 402 is further specifically used to prune the third prediction model to obtain a target question and answer model.

[0121] In some optional embodiments, the number of at least one target word is a first number; the processing module 402 further specifically uses the first number of target words as the first number of first true labels; the first sample set is input into the initial model for word prediction task training to obtain the first number of first predicted labels, and the first predicted labels are used to indicate the predicted words corresponding to the target words; the first number of first predicted labels are compared with the first number of first true labels to obtain a first evaluation result of the initial model, and the first evaluation result is used to indicate the ratio of the number of times the first predicted label is consistent with the first true label to the first number; it is determined whether the first evaluation result is greater than or equal to a first threshold; if so, the trained initial model is determined as the first prediction model; if not, the model parameters of the trained initial model are adjusted, and retrained based on the first sample set until the first evaluation result is greater than or equal to the first threshold.

[0122] In some optional embodiments, the second sample set includes a second number of groups of positive samples; the processing module 402 further specifically records the order of the two server statements included in each group of positive samples in the second sample set as the second number of second true labels; the second sample set is input into the first prediction model to obtain a second number of second prediction labels, and the second prediction labels are used to indicate the predicted order of the two server statements included in each group of positive samples or each group of negative samples; the second number of second prediction labels are compared with the second number of second true labels to obtain a second evaluation result of the first prediction model, and the second evaluation result is used to indicate the ratio of the number of times the second prediction label is consistent with the second true label to the second number; it is determined whether the second evaluation result is greater than or equal to a second threshold; if so, the trained first prediction model is determined as the second prediction model; if not, the model parameters of the trained first prediction model are adjusted, and re-trained based on the second sample set until the second evaluation result is greater than or equal to the second threshold.

[0123] In some optional embodiments, the third sample set includes a third number of server questions; the processing module 402 is further specifically used to take each server question in the third number of server questions and the server answer corresponding to each server question as the third number of third true labels; the third sample set is input into the second prediction model to obtain the third number of third prediction labels, and the third prediction labels are used to indicate the predicted server answer corresponding to each service question; the third number of third prediction labels are compared with the third number of third true labels to obtain a third evaluation result of the second prediction model, and the third evaluation result is used to indicate the ratio of the number of times the third prediction label is consistent with the third true label to the third number; it is determined whether the third evaluation result is greater than or equal to a third threshold; if so, the trained second prediction model is determined as the third prediction model; if not, the model parameters of the trained second prediction model are adjusted, and retrained based on the third sample set until the third evaluation result is greater than or equal to the third threshold.

[0124] In some optional embodiments, the third prediction model includes an embedding layer, an attention layer, and a fully connected layer; the processing module 402 is further specifically used to reduce the dimension of the embedding vector in the embedding layer, the number of attention heads in the attention layer, and the dimension of each attention head or the number of hidden units in the fully connected layer included in the third prediction model to obtain a target question-answering model after pruning, wherein the memory resources required by the target question-answering model are less than or equal to the fourth threshold, and the required central processing unit resources are less than or equal to the fifth threshold.

[0125] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0126] The training device of the question-answering model in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0127] The embodiment of the present invention also provides a computer device having the above Figure 4 The training setup for the question-answering model shown.

[0128] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 5As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.

[0129] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0130] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0131] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0132] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0133] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0134] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0135] Part of the present application may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present application through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes but is not limited to source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.

[0136] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A training method for a question-answering model, characterized in that: The method comprises: Get the initial model and L server statements, where L ≥ 1 and is an integer; Parsing the L server statements, obtaining a plurality of words corresponding to each of the L server statements, a grammatical structure and content of each of the server statements, and a dependency relationship of the words included in each of the server statements; Extracting at least one target word included in the multiple words, and replacing the at least one target word with a preset identifier to generate new L server statements, wherein the new L server statements constitute a first sample set; Extracting multiple groups of two consecutive server statements from the L server statements to obtain multiple groups of positive samples, and sequentially exchanging the two server statements included in each group of positive samples to obtain multiple groups of negative samples, and combining the multiple groups of positive samples and the multiple groups of negative samples into a second sample set; Generate multiple server questions according to the grammatical structure and content of the L server statements, and generate multiple server answers corresponding to the multiple server questions based on the dependency relationship of the words included in each of the server statements, and form the multiple server questions and the multiple server answers into a third sample set; The initial model is trained based on the first sample set, the second sample set, and the third sample set to obtain a target question-answering model, and the target question-answering model is sent to a baseboard management controller. The target question-answering model has the ability to answer questions in response to server questions.

2. The method according to claim 1, characterized in that The obtaining of L server statements comprises: Obtain at least one server document, each server document comprising N first server statements, and the language type of each first server statement is a first language type; Translate each of the first server statements expressed in the first language type into a second server statement expressed in a second language type, to obtain N second server statements, wherein one of the second server statements expressed in the second language type can be translated into at least one server statement expressed in the first language type; Each of the second server statements expressed in the second language type is translated into a server statement expressed in the first language type to obtain the L server statements, where L≥N.

3. The method according to claim 2, characterized in that The training of the initial model based on the first sample set, the second sample set, and the third sample set to obtain a target question-answering model includes: Inputting the first sample set into the initial model for word prediction task training to obtain a first prediction model, wherein the first prediction model has the ability to predict the word replaced by the preset identifier; Inputting the second sample set into the first prediction model to perform sentence sequence prediction training to obtain a second prediction model, wherein the second prediction model has the ability to predict whether the sequence of two server statements is correct; Inputting the third sample set into the second prediction model for question-answering training to obtain a third prediction model, wherein the third prediction model has the ability to answer the server question; The third prediction model is pruned to obtain the target question-answering model.

4. The method according to claim 3, characterized in that The number of the at least one target word is a first number; the first sample set is input into the initial model for word prediction task training to obtain a first prediction model, including: Using the first number of target words as the first number of first true labels; Inputting the first sample set into the initial model for word prediction task training to obtain a first number of first prediction labels, where the first prediction labels are used to indicate predicted words corresponding to the target words; Compare the first number of first predicted labels with the first number of first true labels to obtain a first evaluation result of the initial model, where the first evaluation result is used to indicate a ratio of the number of times the first predicted label is consistent with the first true label to the first number; Determining whether the first evaluation result is greater than or equal to a first threshold; If yes, the trained initial model is determined as the first prediction model; If not, the model parameters of the trained initial model are adjusted, and retraining is performed based on the first sample set until the first evaluation result is greater than or equal to the first threshold.

5. The method according to claim 3, characterized in that: The second sample set includes a second number of groups of positive samples; the second sample set is input into the first prediction model for prediction statement sequence training to obtain a second prediction model, including: Recording the order of the two server statements included in each group of positive samples in the second sample set as the second number of second true labels; Inputting the second sample set into the first prediction model to obtain a second number of second prediction labels, where the second prediction labels are used to indicate a prediction order of the two server statements included in each group of positive samples or each group of negative samples; Compare the second number of second predicted labels with the second number of second true labels to obtain a second evaluation result of the first prediction model, where the second evaluation result is used to indicate the ratio of the number of times the second predicted label is consistent with the second true label to the second number; Determining whether the second evaluation result is greater than or equal to a second threshold; If yes, determining the first prediction model after training as the second prediction model; If not, adjust the model parameters of the trained first prediction model, and retrain based on the second sample set until the second evaluation result is greater than or equal to the second threshold.

6. The method according to claim 3, characterized in that: The third sample set includes a third number of server questions; each server question corresponds to a server answer; the third sample set is input into the second prediction model for question-answering training to obtain a third prediction model, including: taking each server question in the third number of server questions and the server answer corresponding to each server question as a third number of third true labels; Inputting the third sample set into the second prediction model to obtain a third number of third prediction labels, wherein the third prediction labels are used to indicate a predicted server answer corresponding to each service question; Compare the third number of third predicted labels with the third number of third true labels to obtain a third evaluation result of the second prediction model, wherein the third evaluation result is used to indicate the ratio of the number of times that the third predicted label is consistent with the third true label to the third number; Determining whether the third evaluation result is greater than or equal to a third threshold; If yes, the trained second prediction model is determined as the third prediction model; If not, the model parameters of the trained second prediction model are adjusted, and retraining is performed based on the third sample set until the third evaluation result is greater than or equal to the third threshold.

7. The method according to claim 3, characterized in that The third prediction model includes an embedding layer, an attention layer, and a fully connected layer; the pruning process of the third prediction model to obtain the target question-answering model includes: Reduce the dimension of the embedding vector in the embedding layer, the number of attention heads in the attention layer and the dimension of each attention head or the number of hidden units in the fully connected layer included in the third prediction model, and obtain the target question-answering model after pruning, wherein the memory resources required by the target question-answering model are less than or equal to the fourth threshold, and the required central processing unit resources are less than or equal to the fifth threshold.

8. A training device for a question-answering model, characterized in that: The device comprises: An acquisition module, used to acquire an initial model and L server statements, where L ≥ 1 and is an integer; The acquisition module is further used to parse the L server statements, obtain a plurality of words corresponding to each of the L server statements, a grammatical structure and content of each of the server statements, and a dependency relationship of the words included in each of the server statements; a processing module, configured to extract at least one target word included in the plurality of words, and replace the at least one target word with a preset identifier to generate L new server statements, wherein the L new server statements constitute a first sample set; The processing module is further used to extract multiple groups of two consecutive server statements from the L server statements to obtain multiple groups of positive samples, and sequentially exchange the two server statements included in each group of positive samples to obtain multiple groups of negative samples, and form the multiple groups of positive samples and the multiple groups of negative samples into a second sample set; The processing module is further configured to generate a plurality of server questions according to the grammatical structure and content of the L server statements, and generate a plurality of server answers corresponding to the plurality of server questions based on dependency relationships of terms included in each of the server statements, and form the plurality of server questions and the plurality of server answers into a third sample set; The processing module also trains the initial model based on the first sample set, the second sample set, and the third sample set to obtain a target question-answering model, and sends the target question-answering model to the baseboard management controller. The target question-answering model has the ability to answer questions in response to server questions.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the training method of the question-answering model described in any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the training method of the question-answering model described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Answer generation method based on deep learning, electronic device and readable storage medium

    CN111241304A

  • Question and answer method, computing equipment and storage medium

    CN112417126A

  • Training method of subject term generation model and computing equipment

    CN113609841A

  • Artificial intelligence-based pre-training language model processing method, device and equipment

    CN113688245A

  • Small sample multi-label text classification model training method and text classification method

    CN114818891A

Cited By

  • Method and device for constructing field consanguinity tree, storage medium and terminal

    CN120780710A

  • Method, device, storage medium and terminal for constructing a field bloodline tree

    CN120780710B