Model training method and device, equipment, storage medium and product

By combining the thinking chain method of factual reasoning and counterfactual reasoning, students' models are trained to solve the problem of insufficient knowledge processing ability and reasoning efficiency in IT system operation and maintenance tasks, and more accurate and efficient prediction answer output is achieved.

CN119398118APending Publication Date: 2025-02-07CHINA MOBILE COMM LTD RES INST +1
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202411412325.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-10
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

When the student model generated by distillation of the large language model is insufficient in the knowledge processing ability and reasoning efficiency when dealing with IT system operation and maintenance tasks, it often causes counterfactual reasoning of the predicted answers and question content, resulting in the 'answer answers'.

Method used

By obtaining the types of training text, including factual reasoning text and counterfactual reasoning text, input the input question into the student model, obtain predicted answers, and based on the predicted answers and standard answers of the student model, combining factual reasoning and counterfactual reasoning thinking chain methods with factual reasoning and counterfactual reasoning based on the predicted answers and standard answers of the student model, a thinking chain method is combined with factual reasoning and counterfactual reasoning. , train students' models to improve their knowledge processing ability and reasoning efficiency.

Benefits of technology

It improves the knowledge processing ability and reasoning efficiency of student models in IT system operation and maintenance tasks, reduces the probability of counterfactual reasoning answers, and ensures that the predicted answers output by the model are closer to the actual content of the question.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119398118A_ABST
    Figure CN119398118A_ABST
Patent Text Reader

Abstract

The invention discloses a model training method and device, equipment, a storage medium and a product, and the method comprises the steps: obtaining the type of a training text, the type of the training text comprises a fact reasoning text and an anti-fact reasoning text; inputting the input question of the training text into the student model to obtain a predicted answer of the student model; the student model is obtained based on teacher model distillation; training the student model based on the predicted answer of the student model, the standard answer of the training text and the type of the training text to obtain a trained student model; wherein the training text is obtained based on IT system operation and maintenance knowledge; the teacher model is a large language model, and the student model is an operation and maintenance small model. According to the embodiment of the invention, by sharing a thinking chain method of fact reasoning and anti-fact reasoning, the reasoning answering capability of the student model generated by distillation is improved, the anti-fact reasoning answering probability is reduced, and the IT system operation and maintenance knowledge processing capability of the student model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to model distillation technology, and in particular to a model training method and apparatus, equipment, storage medium and product. Background Art

[0002] Large Language Model (LLM) is a type of natural language processing model with a large number of parameters built using deep learning technology. This type of model can understand and generate natural language by training on large-scale text datasets, thereby performing a variety of language tasks such as text generation, translation, and question answering.

[0003] Since large language models require more resources for training and deployment, for knowledge processing tasks in specific fields, knowledge distillation technology can be used to compress large language models (teacher models) into small language models (student models), which greatly reduces the number of parameters in the student model and reduces the training and deployment resources of the model. However, since the student model generated by distillation has fewer trainable parameters, its knowledge processing capabilities and model performance are not as good as those of the teacher model, and there is a large deviation between the output predicted answers and the actual answers. When performing knowledge processing tasks in certain specific fields, due to the logical problems of the thinking chain of root cause analysis, there will be counterfactual reasoning between the output predicted answers and the content of the question, that is, "the answer is not what is asked." Summary of the invention

[0004] In view of this, the embodiments of the present application provide a model training method and apparatus, equipment, storage medium and product, aiming to improve the knowledge processing capability and reasoning efficiency of the student model.

[0005] The technical solution of the embodiment of the present application is implemented as follows:

[0006] In a first aspect, an embodiment of the present application provides a model training method, the method comprising:

[0007] Acquire the type of training text, where the type of training text includes factual reasoning text and counterfactual reasoning text;

[0008] Inputting the input questions of the training text into the student model to obtain the predicted answers of the student model; the student model is obtained by distillation based on the teacher model;

[0009] Based on the predicted answer of the student model and the standard answer of the training text, as well as the type of the training text, the student model is trained to obtain a trained student model;

[0010] The training text is obtained based on the information technology (IT) system operation and maintenance knowledge; the teacher model is a large language model, and the student model is a small operation and maintenance model.

[0011] In the above solution, the method further includes:

[0012] Inputting the input questions of the training text into the teacher model, and masking the input questions based on the set masking rules;

[0013] Based on the processed mask problem, the corresponding mask prediction answer is obtained;

[0014] Based on the masked predicted answer and the standard answer, updating the weights of each text feature of the input question;

[0015] Based on the updated weights of each text feature, the student model is obtained by distillation.

[0016] In the above solution, the masking process of the input question based on the set masking rule includes:

[0017] Based on different mask positions, mask a set number of text features in the input question to obtain a plurality of masked questions;

[0018] The set number is any number that is smaller than the number of text features in the input question.

[0019] In the above solution, updating the weights of each text feature of the input question based on the mask predicted answer and the standard answer includes:

[0020] Calculate the difference between the masked predicted answer and the standard answer to obtain a first difference result;

[0021] Based on the mask position of the mask prediction answer, using the corresponding first difference value result as the weight of the masked text feature;

[0022] The weight of the text feature is the corresponding maximum first difference value result.

[0023] In the above solution, the updating of the weights of the text features of the input question includes:

[0024] Based on the corresponding first difference value result, increasing the weight of the keyword of the input question;

[0025] The keywords are text features that characterize the resource-bearing relationship of the IT system.

[0026] In the above solution, calculating the difference between the mask prediction answer and the standard answer to obtain a first difference result includes:

[0027] Performing word vector processing on the masked predicted answer and the standard answer to obtain a masked predicted word vector and a standard word vector;

[0028] The cosine similarity between the masked prediction word vector and the standard word vector is calculated to obtain the first difference value result.

[0029] In the above scheme, the training of the student model based on the predicted answer of the student model and the standard answer of the training text, as well as the type of the training text, includes:

[0030] Calculating the difference between the predicted answer of the student model and the standard answer to obtain a second difference result;

[0031] Determining the type of the predicted answer of the student model based on the second difference value result and the type of the training text, where the type of the predicted answer of the student model includes a factual reasoning answer and a counterfactual reasoning answer;

[0032] Based on the type of the predicted answer of the student model and the second difference value result, obtaining a weighting coefficient in the loss function;

[0033] Based on the loss function, the student model is trained.

[0034] In the above solution, obtaining the weighting coefficient in the loss function for training the student model based on the type of the answer predicted by the student model and the second difference value result includes:

[0035] If it is determined that the predicted answer of the student model is the factual reasoning answer, then based on the second difference value result, determining the weighting coefficient within a first numerical range;

[0036] If it is determined that the predicted answer of the student model is the counterfactual reasoning answer, the weighting coefficient is determined within a second numerical range based on the second difference value result.

[0037] In a second aspect, an embodiment of the present application provides a model training device, the device comprising:

[0038] An acquisition module, used for acquiring the type of training text, wherein the type of training text includes factual reasoning text and counterfactual reasoning text;

[0039] A computing module, used for inputting the input questions of the training text into the student model to obtain the predicted answers of the student model; the student model is obtained based on the distillation of the teacher model;

[0040] A training module, used for training the student model based on the predicted answer of the student model and the standard answer of the training text, as well as the type of the training text, to obtain a trained student model;

[0041] Among them, the training text is obtained based on information technology IT system operation and maintenance knowledge; the teacher model is a large language model, and the student model is a small operation and maintenance model.

[0042] In a third aspect, an embodiment of the present application provides a network device, wherein the processor and the memory for storing a computer program that can be run on the processor,

[0043] Wherein, when the processor is used to run the computer program, it executes the steps of the method described in the first aspect.

[0044] In a fourth aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.

[0045] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the method described in the first aspect.

[0046] The model training method provided in the embodiment of the present application includes: obtaining the type of training text, the type of training text includes factual reasoning text and counterfactual reasoning text; inputting the input question of the training text into the student model to obtain the predicted answer of the student model; the student model is obtained by distillation based on the teacher model; based on the predicted answer of the student model and the standard answer of the training text, as well as the type of training text, the student model is trained to obtain a trained student model; wherein the training text is obtained based on IT system operation and maintenance knowledge; the teacher model is a large language model, and the student model is a small operation and maintenance model. The embodiment of the present application improves the reasoning and answering ability of the student model generated by distillation, reduces the probability of counterfactual reasoning answers, and improves the IT system operation and maintenance knowledge processing ability of the student model. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 A flow chart of the model training method according to an embodiment of the present application;

[0048] Figure 2 A schematic diagram of a logical topology of an IT system in an application example of this application;

[0049] Figure 3 This is a structural diagram of a teacher model according to an embodiment of the present application;

[0050] Figure 4 This is a schematic diagram of the structure of the model training device of the embodiment of the present application;

[0051] Figure 5 This is a schematic diagram of the structure of the network device according to an embodiment of the present application. DETAILED DESCRIPTION

[0052] The present application is further described in detail below in conjunction with the accompanying drawings and embodiments.

[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.

[0054] The present application embodiment provides a model training method, such as Figure 1 As shown, the method includes:

[0055] Step 101, obtaining the type of training text.

[0056] Here, the types of training texts include factual reasoning texts and counterfactual reasoning texts. The training texts include input questions and corresponding standard answers. In factual reasoning texts, the standard answers are obtained based on the thinking chain method of factual reasoning, and in counterfactual reasoning texts, the standard answers are obtained based on the thinking chain method of counterfactual reasoning.

[0057] Specifically, the training text of the embodiment of the present application is obtained based on IT system operation and maintenance knowledge.

[0058] Step 102, input the input question of the training text into the student model to obtain the predicted answer of the student model.

[0059] Here, the student model is obtained by distilling the teacher model. The teacher model is a large language model, and the student model is a small operation and maintenance model.

[0060] Step 103, based on the predicted answer of the student model and the standard answer of the training text, as well as the type of the training text, the student model is trained to obtain a trained student model.

[0061] Here, a large model is a type of machine learning model with large-scale parameters and complex computing structures, usually built with deep neural networks, capable of processing complex tasks and data, and widely used in natural language processing, computer vision, speech recognition and other fields. A large language model is a natural language processing model with a large number of parameters built using deep learning technology. By training on large-scale text data sets, it can understand and generate natural language, thereby performing a variety of language tasks such as text generation, translation, and question answering.

[0062] It should be noted that a large model is a type of machine learning model with large-scale parameters and complex computing structure, usually built by deep neural networks, capable of processing complex tasks and data, and widely used in many fields such as natural language processing, computer vision, and speech recognition. A large language model is a natural language processing model with a large number of parameters built using deep learning technology. By training on large-scale text data sets, it can understand and generate natural language, thereby performing a variety of language tasks such as text generation, translation, and question answering.

[0063] It can be understood that the teacher model of the embodiment of the present application utilizes the natural language processing ability, reasoning ability and coding ability of the large language model, combined with IT system operation and maintenance knowledge, to realize functions such as IT system alarm understanding, alarm combined with log for event detection and automatic generation of fault reports.

[0064] It should be noted that since large language models require more deployment resources, in the field of IT system operation and maintenance, local area networks are usually unable to provide sufficient deployment resources. Therefore, in related technologies, IT system operation and maintenance modules are usually connected to large operation and maintenance models deployed in the cloud through the Internet to achieve intelligent IT system operation and maintenance functions. However, for IT system operation and maintenance scenarios that require sensitive data protection, the IT system operation and maintenance module cannot be connected to the large operation and maintenance model through the Internet for data security reasons. For the above scenarios, in some related technologies, a solution is adopted to deploy a small operation and maintenance model and the IT system in a local area network.

[0065] Here, the small operation and maintenance model can significantly reduce the number of parameters by limiting the processing knowledge domain to the IT system operation and maintenance domain, so that the small operation and maintenance model can be deployed in a resource-constrained local area network. Specifically, the small operation and maintenance model can be obtained by distilling the large language model based on knowledge distillation technology, where knowledge distillation technology is a knowledge extraction method based on a deep neural network model. By training a student model with fewer parameters and shallower levels to imitate a teacher model with more parameters and deeper levels, the knowledge of the teacher model is transferred to the student model, achieving model resource compression.

[0066] Here, there are many methods for obtaining a student model based on knowledge distillation technology. In an embodiment of the present application, the teacher model can be distilled based on the low-rank adaptation (LoRA) method to obtain a student model for processing IT system operation and maintenance knowledge. The low-rank adaptation method is specifically to add a trainable low-rank decomposition matrix to the parameter weight matrix of the teacher model when transferring the knowledge of the teacher model to the student model, and fine-tune the low-rank decomposition matrix during the training process, and use fewer training parameters in the low-rank decomposition matrix to approximate the incremental parameters obtained by fine-tuning the full parameters of the teacher model.

[0067] It should be noted that when handling IT system operation and maintenance tasks, the IT system operation and maintenance knowledge involved includes not only common fault handling methods, but also resource information of the resource pool where the IT system is located. Figure 2 As shown, the resource information of the resource pool where the IT system is located includes but is not limited to the IP addresses of physical machines and virtual machines, the central processing unit (CPU) and memory configuration information, the hosting relationship between physical machines and virtual machines, the deployment relationship between databases and virtual machines, the calling relationship between microservices and databases, and the relationship between web services and microservices. The above complex resource information will cause the small operation and maintenance model obtained by distillation to be unable to play a role close to that of the large language model. When the small operation and maintenance model handles IT system operation and maintenance tasks, the output prediction answer always contains counterfactual reasoning. Among them, the counterfactual reasoning situation not only includes the situation where the reasoning logic of the predicted answer and the input question is opposite, but also includes the situation where the predicted answer and the input question have different time ranges, different topological ranges, different IP addresses of hosts or pods, and different dimensions.

[0068] Specifically, the output prediction answers contain counterfactual reasoning in the following cases: The input question is: What is the proportion of pod anomalies? The prediction answer output by the small operation and maintenance model is: The proportion of normal pods is 95%. Obviously, the prediction answer obtained by the small operation and maintenance model is based on the counterfactual reasoning thinking chain method.

[0069] Specifically, the output prediction answer contains counterfactual reasoning, and the following situations also include: the input question indicates a performance indicator query, and the prediction answer output by the operation and maintenance small model is the alarm content; the input question of the operation and maintenance small model indicates a resource data query, and the output prediction answer is the log statistics result.

[0070] Obviously, although "5% of pods are abnormal" and "95% of pods are normal" point to the same fact, the user asking the question expects the operation and maintenance model to directly answer the input question; in addition, if the predicted answer output by the operation and maintenance model has different time ranges, different topology ranges, different IP addresses of the host or pod, and different dimensions, the user asking the question cannot get the expected result based on the predicted answer, that is, there is a situation of "answering the wrong question".

[0071] Specifically, due to the complexity of IT system operation and maintenance knowledge, the performance of the small operation and maintenance model in handling IT system operation and maintenance tasks is insufficient, and it cannot play a role close to that of the large language model, making it difficult to realize intelligent IT system operation and maintenance functions.

[0072] Based on this, the model training method provided in the embodiment of the present application adopts the factual reasoning thinking chain method and low-rank adaptation technology to distill and obtain a small operation and maintenance model, and uses the factual reasoning text and counterfactual reasoning text of IT system operation and maintenance knowledge to jointly train the small operation and maintenance model to correct the problem of the operation and maintenance small operation and maintenance outputting predicted answers based on the counterfactual reasoning thinking chain method, and improve the knowledge processing capability and reasoning efficiency of the small operation and maintenance model deployed in the local area network to meet the needs of IT system operation and maintenance scenarios that require sensitive data protection.

[0073] Exemplarily, training a student model based on the predicted answer of the student model and the standard answer of the training text, as well as the type of the training text, includes: calculating the difference value between the predicted answer of the student model and the standard answer to obtain a second difference value result; determining the type of the predicted answer of the student model based on the second difference value result and the type of the training text, the type of the predicted answer of the student model including a factual reasoning answer and a counterfactual reasoning answer; obtaining a weighting coefficient in a loss function based on the type of the predicted answer of the student model and the second difference value result; and training the student model based on the loss function.

[0074] Here, since the number of parameters of the student model is greatly reduced compared to the teacher model, after the knowledge of the teacher model is transferred to the student model, the model is trained based on the loss function, so that the performance of the trained student model in processing tasks in specific fields is close to that of the teacher model.

[0075] Among them, the loss function of the student model in the training stage can be:

[0076] L p =-∑ j ∑ i ω i,j P(y j |s j ,θ)

[0077] Among them, L p is the loss function, x is the input question, y is the corresponding predicted answer, j is the number of training texts, θ is the neural network parameter, ω is the weight of the text feature of the input question, and i is the number of text features in the input question.

[0078] Here, the type of training text indicates the thinking chain method corresponding to the standard answer. Based on the second comparison value result and the type of training text, it can be determined whether the predicted answer of the student model is obtained based on the factual reasoning thinking chain method or the counterfactual reasoning thinking chain method, and a weighted coefficient representing the influence of the type of predicted answer of the student model on the loss function is generated. Here, the weighted coefficient α is added to the loss function of the student model, and the new loss function can be:

[0079] L p =-αΣj Σ i ω i,j P(y j |x j ,θ)

[0080] Exemplarily, based on the type of the answer predicted by the student model and the second difference value result, a weighting coefficient in the loss function for training the student model is obtained, including: if it is determined that the predicted answer of the student model is a factual reasoning answer, then based on the second difference value result, the weighting coefficient is determined within a first numerical range; if it is determined that the predicted answer of the student model is a counterfactual reasoning answer, then based on the second difference value result, the weighting coefficient is determined within a second numerical range.

[0081] Here, the value range of the weighting function α is [T1, T2], the first numerical interval is [T1, (T1+T2) / 2], and the second numerical interval is [(T1+T2) / 2, T2].

[0082] It can be understood that the embodiment of the present application adds a weighting coefficient to the loss function and assigns the weighting coefficient in different numerical ranges based on the type of predicted answer of the student model, so that the trained student model reduces the probability of answering counterfactual reasoning and improves the knowledge processing capability of IT system operation and maintenance. In an application example, the value range of the weighting function α is [0,1].

[0083] It should be noted that the embodiments of the present application do not specifically limit the method for calculating the difference value between the predicted answer of the student model and the standard answer and the method for determining the type of the predicted answer of the student model. In some application examples, based on comparing the second difference value result and the set difference value threshold, if it is determined that the second difference value result is less than the set difference value threshold, it is determined that the predicted answer of the student model and the standard answer of the training text are obtained based on the same thinking chain method; if it is determined that the second difference value result is greater than or equal to the set difference value threshold, it is determined that the predicted answer of the student model and the standard answer of the training text are obtained based on different thinking chain methods.

[0084] It should be noted that when a large language model processes natural language tasks in different fields, the same vocabulary in the input question may have different degrees of influence on the output predicted answer. Before distilling to generate a student model, the embodiment of the present application also trains a teacher model based on the training text of IT system operation and maintenance knowledge to identify the keywords of the input answers in the IT system operation and maintenance knowledge, and adjusts the weights of the keywords in the parameters of the teacher model to further improve the performance of the student model obtained by distillation in processing IT system operation and maintenance tasks.

[0085] Here, the text feature token is the basic unit for processing text in the large language model. When performing natural language processing tasks, the large language model divides the input question into multiple text feature tokens. The text feature token can be a corresponding string. The large language model obtains the corresponding text feature token of the predicted answer based on the machine learning algorithm, and converts the text feature token of the predicted answer into the corresponding predicted answer output. Among them, the weight of each text feature token represents the influence of each text feature token on the output predicted answer.

[0086] It is understandable that, since IT system operation and maintenance knowledge includes complex resource information, the keywords of the input answer at least include the text feature Token that characterizes the IT system resource carrying relationship.

[0087] Exemplarily, the method also includes: inputting the input questions of the training text into the teacher model, and masking the input questions based on the set masking rules; obtaining the corresponding masked predicted answers based on the processed masked questions; updating the weights of each text feature of the input questions based on the masked predicted answers and the standard answers; and obtaining the student model by distillation based on the updated weights of each text feature.

[0088] Exemplarily, masking the input question based on the set masking rule includes: masking a set number of text features in the input question based on different masking positions to obtain multiple masked questions, wherein the set number is any number less than the number of text features in the input question.

[0089] Here, if Figure 3 As shown, the teacher model is a Transformer neural network structure, including an embedding layer and a self-attention layer. The input question is converted into multiple text feature Tokens and then input into the teacher model. The embodiment of the present application masks the text feature Tokens processed by the embedding layer and the self-attention layer, and the teacher model outputs the corresponding predicted answer based on the input question after masking.

[0090] It is understandable that by masking text feature tokens at different positions and in different numbers, the predicted answer output by the teacher model will change; by calculating the difference between the corresponding predicted answer and the standard answer, the degree of influence of each text feature token on the output predicted answer can be determined, and then the keywords in the input question that have a significant impact on the output predicted answer can be identified, and the weights of the text feature tokens corresponding to the keywords in the input question can be increased, while the weights of the text feature tokens corresponding to non-keywords in the input question can be reduced.

[0091] Here, the masking rules are specifically set as follows: the initial set number is set to 1, and based on the current set number, the set number of text feature tokens in the input question are masked in turn with different mask combinations. After all masking processing of the input question is completed with different mask combinations based on the current set number, the current set number is accumulated and the next round of masking processing is performed.

[0092] In an application example, if the number of text feature tokens after conversion of the input question is 10, and the current set number is 1, then based on the set masking rules, 10 corresponding masked questions can be obtained; after obtaining 10 masked questions corresponding to the set number of 1, the set number is set to 2, and based on the set masking rules, 45 corresponding masked questions are obtained.

[0093] Exemplarily, based on the masked predicted answer and the standard answer, the weight of each text feature of the input question is updated, including: calculating the difference between the masked predicted answer and the standard answer to obtain a first difference value result; based on the mask position of the masked predicted answer, using the corresponding first difference value result as the weight of the masked text feature. The weight of the text feature is the corresponding maximum first difference value result.

[0094] Here, the text feature Token corresponding to the first difference value result includes the masked text feature Token in the masked question corresponding to the predicted answer used to generate the difference value result.

[0095] It is understandable that based on different set numbers and different mask combinations, the text feature token in the input question may be masked multiple times, that is, the text feature token corresponds to multiple first difference value results. Here, the weight of the text feature token is obtained based on the largest first difference value result corresponding to the text feature token to characterize the influence of the text feature token on the output prediction result.

[0096] In an application example, if the number of text feature Tokens after conversion of the input question is 4, and the set number is any natural number from 1 to 3, then the number of difference value results corresponding to each text feature Token of the input question is 7.

[0097] In an application example, after masking based on the current set number, the maximum difference value result obtained is the same as the maximum difference value result obtained based on the previous set number, which means that continuing to increase the set number will not affect the output prediction answer, so the set number will no longer be accumulated to save model training costs.

[0098] Exemplarily, updating the weight of each text feature of the input question includes: increasing the weight of a keyword of the input question based on the corresponding first difference value result.

[0099] It can be understood that the text feature tokens with updated weights only include text feature tokens related to IT system operation and maintenance knowledge, and the updated weights are used for distillation to generate a small operation and maintenance model. There is no need to consider the influence of the text feature tokens with updated weights on the predicted answers in other knowledge fields. In the embodiment of the present application, the training text obtained only based on IT system operation and maintenance knowledge is used as the sample for calculating the weights; since the first difference value result between the predicted answer and the standard answer obtained based on the masked problem of keyword masking is large, and since the keywords representing the resource carrying relationship have a significantly greater influence on the predicted answers in IT system operation and maintenance tasks than in natural language processing tasks in other fields, based on the weight calculation method of the embodiment of the present application, the updated weight of the keywords in the input question will increase relative to the original weight in the teacher model.

[0100] It is understandable that since the number of parameters of the student model is greatly reduced compared to the number of parameters of the teacher model, the update result of the weight of non-keywords in the teacher model that have little impact on the predicted answer will not directly affect the prediction result output by the student model.

[0101] Exemplarily, calculating the difference value between the masked predicted answer and the standard answer to obtain a first difference value result includes: performing word vector processing on the masked predicted answer and the standard answer to obtain the masked predicted word vector and the standard word vector; calculating the cosine similarity between the masked predicted word vector and the standard word vector to obtain the first difference value result.

[0102] Here, cosine similarity is a measurement method for measuring the angle between two non-zero vectors, which is usually used in fields such as text analysis, information retrieval and recommendation systems. The embodiment of the present application performs word2vec mode processing on the predicted answer to obtain the masked predicted word vector corresponding to the predicted answer, and calculates the cosine similarity between the masked predicted word vector and the standard word vector corresponding to the standard answer, and takes the difference between 1 and the cosine similarity as the first difference value result corresponding to the predicted answer and the standard answer.

[0103] It should be noted that the embodiment of the present application does not specifically limit the method for calculating the difference value between the predicted answer and the standard answer. The above-mentioned method for obtaining the first difference value result based on word vector processing and calculating cosine similarity is only a specific implementation example of the method for calculating the difference value between the predicted answer and the standard answer. The technical solution of the embodiment of the present application can also be implemented by using other methods to calculate the difference value between the predicted answer and the standard answer.

[0104] Here, if the first difference value result is obtained based on the calculation of cosine similarity, the weight of the text feature Token is the corresponding maximum first difference value result; if the first difference value result is calculated based on other methods, the activation function sigmoid function (y = 1 / (1+e -x ))The first difference value result is normalized, and the normalized result is used as the weight of the text feature Token.

[0105] It can be understood that the embodiment of the present application realizes the distillation of a large language model into a small operation and maintenance model through the factual reasoning thinking chain method and the low-rank adaptive distillation method, thereby improving the reasoning efficiency of the small operation and maintenance model; based on the masking processing of the input question, a weight calculation method for a text feature Token is provided, thereby improving the knowledge processing capability of the small operation and maintenance model.

[0106] In an application example of the present application, an example of factual reasoning text obtained based on IT operation and maintenance knowledge is as follows:

[0107] Factual reasoning text 1:

[0108] Input question: What are the abnormalities of business calls in system A in the past hour?

[0109] Standard answer: In the past hour, the number of times the web server call return code of system A was not 200 was 10.

[0110] Factual reasoning text 2:

[0111] Input question: How many pods in the microservice cluster are in abnormal status?

[0112] Standard answer: The number of pod abnormal states is 3.

[0113] Factual reasoning text three:

[0114] Input question: What is the proportion of pod exceptions?

[0115] Standard answer: Pod abnormalities account for 5%.

[0116] Factual Reasoning Text 4:

[0117] Input question: In the past hour, how was the business call status of system A?

[0118] Standard answer: In the past hour, the web server of system A was successfully called 100 times, with a success rate of 99%.

[0119] Factual Reasoning Text 5:

[0120] Input question: What is the status of the pods in the microservice cluster that are in normal state?

[0121] Standard answer: The number of pods in normal state is 20.

[0122] Factual Reasoning Text 6:

[0123] Input question: What is the normal percentage of pods?

[0124] Standard answer: The normal percentage of pods is 95%.

[0125] In an application example of the present application, an example of a counterfactual reasoning text obtained based on IT operation and maintenance knowledge is as follows:

[0126] Counterfactual reasoning text 1: Input question: What are the abnormalities of business calls in system A in the past hour?

[0127] Standard answer: In the past hour, the web server of system A was successfully called 100 times, with a success rate of 99%.

[0128] Counterfactual Reasoning Text 2:

[0129] Input question: How many pods in the microservice cluster are in abnormal status?

[0130] Standard answer: The number of pods in normal state is 20.

[0131] Counterfactual Reasoning Text 3:

[0132] Input question: What is the proportion of pod exceptions?

[0133] Standard answer: The normal percentage of pods is 95%.

[0134] Counterfactual Reasoning Text 4:

[0135] Input question: In the past hour, how was the business call status of system A?

[0136] Standard answer: In the past hour, the number of times the web server call return code of system A was not 200 was 10.

[0137] Counterfactual Reasoning Text 5:

[0138] Input question: What is the status of the pods in the microservice cluster that are in normal state?

[0139] Standard answer: The number of pod abnormal states is 3.

[0140] Counterfactual Reasoning Text 6:

[0141] Input question: What is the normal percentage of pods?

[0142] Standard answer: Pod abnormalities account for 5%.

[0143] It is understandable that based on different factual reasoning thinking chain methods, the standard answers corresponding to the same input question are completely different. The embodiments of the present application share the factual reasoning text and counterfactual reasoning text obtained based on IT operation and maintenance knowledge to train the small operation and maintenance model, so that the ability of the small operation and maintenance model to handle IT system operation and maintenance tasks is close to that of the large operation and maintenance model.

[0144] In order to implement the method of the embodiment of the present application, the embodiment of the present application also provides a model training device, which corresponds to the above-mentioned model training method, and each step in the above-mentioned model training method embodiment is also completely applicable to the embodiment of the present device. Figure 4 As shown, an embodiment of the present application provides a model training device, which includes: an acquisition module 401, a calculation module 402 and a training module 403. The acquisition module 401 is used to obtain the type of training text, and the type of training text includes factual reasoning text and counterfactual reasoning text. The calculation module 402 is used to input the input questions of the training text into the student model to obtain the predicted answers of the student model; the student model is obtained based on the distillation of the teacher model; the training module 403 is used to train the student model based on the predicted answers of the student model and the standard answers of the training text, as well as the type of training text, to obtain a trained student model. Among them, the training text is obtained based on the operation and maintenance knowledge of information technology IT systems; the teacher model is a large language model, and the student model is a small operation and maintenance model.

[0145] In some embodiments, the model training device further includes a processing module 404, which is used to input input questions of the training text into the teacher model and perform mask processing on the input questions based on set masking rules.

[0146] In some embodiments, the calculation module 402 is further used to: obtain a corresponding masked predicted answer based on the processed masked question; and update the weights of each text feature of the input question based on the masked predicted answer and the standard answer.

[0147] In some embodiments, the training module 403 is further used to distill a student model based on the updated weights of each text feature.

[0148] In some embodiments, the processing module 404 is specifically used to: based on different mask positions, perform mask processing on a set number of text features in the input question to obtain multiple masked questions, wherein the set number is any number less than the number of text features in the input question.

[0149] In some embodiments, the calculation module 402 is specifically used to: calculate the difference between the masked predicted answer and the standard answer to obtain a first difference value result; based on the mask position of the masked predicted answer, use the corresponding first difference value result as the weight of the masked text feature. The weight of the text feature is the corresponding maximum first difference value result.

[0150] In some embodiments, the calculation module 402 is specifically used to: increase the weight of the keyword of the input question based on the corresponding first difference value result, wherein the keyword is a text feature that characterizes the IT system resource carrying relationship.

[0151] In some embodiments, the processing module 404 is specifically used to: perform word vector processing on the masked predicted answer and the standard answer to obtain the masked predicted word vector and the standard word vector.

[0152] In some embodiments, the calculation module 402 is specifically used to calculate the cosine similarity between the mask prediction word vector and the standard word vector to obtain a first difference value result.

[0153] In some embodiments, the calculation module 402 is specifically used to: calculate the difference between the predicted answer of the student model and the standard answer to obtain a second difference value result; determine the type of the predicted answer of the student model based on the second difference value result and the type of training text, and the type of the predicted answer of the student model includes a factual reasoning answer and a counterfactual reasoning answer; based on the type of the predicted answer of the student model and the second difference value result, obtain the weighting coefficient in the loss function.

[0154] In some embodiments, the training module 403 is specifically used to: train the student model based on the loss function.

[0155] In some embodiments, the calculation module 402 is specifically used to: if it is determined that the predicted answer of the student model is a factual reasoning answer, then based on the second difference value result, determine the weighting coefficient within the first numerical interval; if it is determined that the predicted answer of the student model is a counterfactual reasoning answer, then based on the second difference value result, determine the weighting coefficient within the second numerical interval.

[0156] It should be noted that: the model training device provided in the above embodiment only uses the division of the above program modules as an example when performing model training. In actual applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the device is divided into different program modules to complete all or part of the processing described above. In addition, the model training device provided in the above embodiment belongs to the same concept as the model training method embodiment. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0157] In order to implement the method of the embodiment of the present application, the embodiment of the present application also provides a network device. Figure 5 Only an exemplary structure of the network device is shown, not all structures, and can be implemented as needed. Figure 5 Partial or complete structure shown.

[0158] like Figure 5 As shown, the network device 500 provided in the embodiment of the present application includes: at least one processor 501, a memory 502, a user interface 503 and at least one network interface 504. The various components in the network device 500 are coupled together through a bus system 505. It can be understood that the bus system 505 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 505 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, in Figure 5 Various buses are labeled as bus system 505 .

[0159] The user interface 503 may include a display, a keyboard, a mouse, a trackball, a click wheel, keys, buttons, a touch pad or a touch screen.

[0160] The memory 502 in the embodiment of the present application is used to store various types of data to support the operation of the network device 500. Examples of such data include: any computer program used to operate on the network device 500.

[0161] The model training method disclosed in the embodiment of the present application can be applied to the processor 501, or implemented by the processor 501. The processor 501 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the model training method can be completed by the hardware integrated logic circuit or software instructions in the processor 501. The above-mentioned processor 501 may be a general-purpose processor, a digital signal processor (DSP, Digital Signal Processor), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 501 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiment of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present application, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium, which is located in the memory 502, and the processor 501 reads the information in the memory 502, and completes the steps of the model training method provided in the embodiment of the present application in combination with its hardware.

[0162] In an exemplary embodiment, the network device 500 can be implemented by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers (MCUs), microprocessors, or other electronic components to execute the aforementioned model training method.

[0163] It can be understood that the memory 502 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM).The memories described in the embodiments of the present application are intended to include, but are not limited to, these and any other suitable types of memories.

[0164] In an exemplary embodiment, the present application also provides a storage medium, namely a computer storage medium, which may be a computer-readable storage medium, for example, a memory 502 storing a computer program, and the computer program may be executed by a processor 501 of a network device 500 to complete the steps described in the model training method of the present application embodiment. The computer-readable storage medium may be a memory such as a ROM, a PROM, an EPROM, an EEPROM, a Flash Memory, a magnetic surface memory, an optical disk, or a CD-ROM.

[0165] In an exemplary embodiment, the embodiment of the present application also provides a computer program product, including a computer program, which can be executed by the processor 501 of the network device 500 to complete the steps described in the model training method of the embodiment of the present application.

[0166] It should be noted that: "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0167] In addition, the technical solutions described in the embodiments of the present application can be combined arbitrarily without conflict.

[0168] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A model training method, characterized in that: The method comprises: Acquire the type of training text, where the type of training text includes factual reasoning text and counterfactual reasoning text; Inputting the input questions of the training text into the student model to obtain the predicted answers of the student model; the student model is obtained by distillation based on the teacher model; Based on the predicted answer of the student model and the standard answer of the training text, as well as the type of the training text, the student model is trained to obtain a trained student model; Among them, the training text is obtained based on information technology IT system operation and maintenance knowledge; the teacher model is a large language model, and the student model is a small operation and maintenance model.

2. The method according to claim 1, characterized in that: The method further comprises: Inputting the input questions of the training text into the teacher model, and masking the input questions based on the set masking rules; Based on the processed mask problem, the corresponding mask prediction answer is obtained; Based on the masked predicted answer and the standard answer, updating the weights of each text feature of the input question; Based on the updated weights of each text feature, the student model is obtained by distillation.

3. The method according to claim 2, characterized in that The masking process of the input question based on the set masking rule includes: Based on different mask positions, mask a set number of text features in the input question to obtain a plurality of masked questions; The set number is any number that is smaller than the number of text features in the input question.

4. The method according to claim 3, characterized in that: The updating of the weights of the text features of the input question based on the mask predicted answer and the standard answer includes: Calculate the difference between the masked predicted answer and the standard answer to obtain a first difference result; Based on the mask position of the mask prediction answer, using the corresponding first difference value result as the weight of the masked text feature; The weight of the text feature is the corresponding maximum first difference value result.

5. The method according to claim 4, characterized in that The updating of the weights of the text features of the input question includes: Based on the corresponding first difference value result, increasing the weight of the keyword of the input question; The keywords are text features that characterize the resource-bearing relationship of the IT system.

6. The method according to claim 4, characterized in that The calculating the difference between the mask prediction answer and the standard answer to obtain a first difference result includes: Performing word vector processing on the masked predicted answer and the standard answer to obtain a masked predicted word vector and a standard word vector; The cosine similarity between the masked prediction word vector and the standard word vector is calculated to obtain the first difference value result.

7. The method according to claim 1, characterized in that The step of training the student model based on the predicted answer of the student model and the standard answer of the training text, as well as the type of the training text, comprises: Calculating the difference between the predicted answer of the student model and the standard answer to obtain a second difference result; Determining the type of the predicted answer of the student model based on the second difference value result and the type of the training text, where the type of the predicted answer of the student model includes a factual reasoning answer and a counterfactual reasoning answer; Based on the type of the predicted answer of the student model and the second difference value result, obtaining a weighting coefficient in the loss function; Based on the loss function, the student model is trained.

8. The method according to claim 7, characterized in that The step of obtaining a weighting coefficient in a loss function for training the student model based on the type of the answer predicted by the student model and the second difference value result includes: If it is determined that the predicted answer of the student model is the factual reasoning answer, then based on the second difference value result, determining the weighting coefficient within a first numerical range; If it is determined that the predicted answer of the student model is the counterfactual reasoning answer, the weighting coefficient is determined within a second numerical range based on the second difference value result.

9. A model training device, characterized in that: The device comprises: An acquisition module, used for acquiring the type of training text, wherein the type of training text includes factual reasoning text and counterfactual reasoning text; A computing module, used for inputting the input questions of the training text into the student model to obtain the predicted answers of the student model; the student model is obtained based on the distillation of the teacher model; A training module, used for training the student model based on the predicted answer of the student model and the standard answer of the training text, as well as the type of the training text, to obtain a trained student model; Among them, the training text is obtained based on information technology IT system operation and maintenance knowledge; the teacher model is a large language model, and the student model is a small operation and maintenance model.

10. A network device, characterized in that: the processor and a memory for storing a computer program capable of running on the processor, Wherein, when the processor is used to run the computer program, it executes the steps of the method described in any one of claims 1 to 8.

11. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

Citation Information

Cited By

  • Large model knowledge distillation method based on anti-fact data enhancement and multi-view thinking chain

    CN119721182A

  • Large model knowledge distillation method based on counterfactual data augmentation and multi-perspective thinking chain

    CN119721182B

  • Large model training method and device, reasoning method and device, equipment and storage medium

    CN120430399A

  • Model training method and platform and text reasoning method and platform

    CN121119025A

  • Large model thinking chain knowledge distillation method and system based on anti-fact reasoning

    CN121365743A