A processing method and device for optimizing MLP weight update model knowledge
By optimizing the MLP weights of the Transformer model and utilizing positive and counterfactual question-answer text pairs for knowledge updates in a large language model, the problem of high computational complexity in existing technologies is solved, achieving efficient and flexible knowledge updates.
Patent Information
- Application Number
- CN202510337895.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-21
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2045-03-21
AI Technical Summary
Existing knowledge update schemes for large language models have high computational complexity, large computational load, and long training cycles, making it difficult to achieve efficient and flexible knowledge updates for small batches or individuals.
By optimizing the MLP weights in the Transformer model and using positive and counterfactual question-answer text pairs for model knowledge updates, optimization is performed only on the MLP layer weights, reducing computational complexity and computational cost, and shortening the training cycle.
This achieves reduced computational complexity and computational load, shortened training cycle, improved update efficiency and flexibility, and reduced update cost.
Smart Images

Figure CN120218209B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a processing method and apparatus for updating model knowledge by optimizing MLP weights. Background Technology
[0002] Large Language Models (LLMs) can memorize massive amounts of knowledge and perform various Natural Language Processing (NLP) tasks, such as text generation, machine translation, intelligent question answering, and text classification. Knowledge updates for pre-trained LLMs are generally achieved through model fine-tuning. A typical fine-tuning approach involves collecting the knowledge information to be updated, constructing a fine-tuning corpus, and then optimizing the overall model parameters based on this corpus until convergence. This conventional approach is relatively conservative, focusing on optimizing the overall model parameters. While it theoretically maximizes optimization, it has significant drawbacks in practice. Given the massive number of parameters in any given LLM, fine-tuning using the conventional full-model parameter optimization method results in high computational complexity and cost, making it difficult to shorten the training cycle or reduce training costs. Such update costs are unacceptable for small-batch or even individual knowledge updates.
[0003] Most common large language models (such as GPT, BERT, LLaMA, T5, etc.) are based on the Transformer model, whose internal components include multi-layer MLP networks (also called MLP layers), each with a set of weight parameters. Many studies have shown that large language models learn from massive amounts of knowledge corpora during the pre-training phase and primarily achieve knowledge memorization by optimizing the weight parameters of each MLP layer. This implies that optimizing only the MLP weights can also achieve the goal of updating knowledge, and can significantly reduce computational complexity and volume, thereby shortening the training cycle, improving update efficiency and flexibility, and reducing update costs. How to achieve the desired knowledge updating effect through MLP weight optimization is precisely the technical problem that this invention aims to solve. Summary of the Invention
[0004] The purpose of this invention is to address the shortcomings of existing technologies by providing a method, apparatus, electronic device, and computer-readable storage medium for updating model knowledge through optimized MLP weights. This invention uses a batch of user-specified knowledge items as the updated knowledge set; it calculates the total number of knowledge items in the updated knowledge set as N1; it uses the currently specified large language model (a large language model based on the Transformer model structure that has completed pre-training and NLP task fine-tuning) as the target model; it creates a first data record consisting of positive question-answer text pairs and a second data record consisting of counterfactual question-answer text pairs for each knowledge item in the updated knowledge set; it extracts pre-trained knowledge corpus unrelated to all knowledge items from the target model's pre-trained knowledge corpus to form a third data record set; it optimizes the weight parameters of all MLP layers of the target model based on all the first data records; it performs counterfactual question evaluation on the updated target model based on all the second data records to obtain a first evaluation result; it performs irrelevant knowledge question evaluation on the updated target model based on the third data record set to obtain a second evaluation result; and it provides feedback to the user that the model knowledge update is complete when both the first and second evaluation results are passed. This invention optimizes only the weights of MLP. By using this invention, computational complexity and computational load can be reduced, training cycle can be shortened, update efficiency and update flexibility can be improved, and update cost can be reduced.
[0005] To achieve the above objectives, a first aspect of the present invention provides a method for updating model knowledge by optimizing MLP weights, the method comprising:
[0006] The user-specified batch of knowledge items is used as the updated knowledge set; the total number of knowledge items in the updated knowledge set is counted to obtain a total number N1; and the user-specified large language model is used as the target model; the user-specified large language model is a large language model based on the Transformer model structure that has completed pre-training and NLP task fine-tuning, and the NLP task includes at least text generation, machine translation, intelligent question answering, and text classification; the total number N1 is a positive integer with a minimum of 1; the updated knowledge set consists of N1 knowledge items (s i ,r i ,o i Composed of ) knowledge index i ≤ N1, s i r i o i These are the knowledge topic, topic-object relationship, and knowledge object of the knowledge triple;
[0007] For each of the knowledge entries (s) in the updated knowledge set i ,r i ,oi Create a question-answer text pair to form the corresponding first data record; and for each of the knowledge entries (s) i ,r i ,o i Create a counterfactual question-answer text pair to form the corresponding second data record; and extract the corresponding knowledge entries (s) from the pre-trained knowledge corpus of the target model. i ,r i ,o i A corresponding third data record set is formed by combining unrelated pre-trained knowledge corpora.
[0008] Based on N1 of the first data records, the weight parameters of all MLP layers of the target model are optimized;
[0009] The updated target model is evaluated using counterfactual questions based on N1 of the second data records to obtain a first evaluation result; and the updated target model is evaluated using irrelevant knowledge questions based on the third data record set to obtain a second evaluation result; both the first and second evaluation results include pass and fail.
[0010] The system identifies whether both the first and second evaluation results are passed; if not, it continues to optimize until both the latest first and second evaluation results are passed; if so, it informs the current user that the model knowledge update is complete.
[0011] Preferably, all internal modules of the target model are divided into two main sections: a preprocessing section and a forward inference section. Specifically, the internal modules used for word segmentation of the input text and the internal modules used for embedding and encoding the segmented sequence are both included in the preprocessing section. All internal modules involved in the forward inference process of the NLP task based on the initial vector output by the preprocessing section are included in the forward inference section.
[0012] The preprocessing module is used to segment the input text of the model to obtain the corresponding segmented sequence; and to perform embedding encoding processing on the segmented sequence according to the embedding encoding rules of the target model, and to send the obtained embedding encoding vector as the initial vector H0 to the forward inference module; the segmented sequence is composed of multiple segments; the initial vector H0 is composed of multiple initial segmentation vectors h0; the initial segmentation vector h0 corresponds one-to-one with the segmented words;
[0013] The forward reasoning module is used to perform forward reasoning based on the input initial vector H0 to obtain the corresponding generated text and output it; the total number of MLP layers in the forward reasoning module is denoted as the total number N2, and each MLP layer is labeled as the corresponding M. jLayers; the total number N2 is a positive integer; 1 ≤ layer index j ≤ N2; each of the M j The input and output vectors of a layer during the inference process are denoted as the corresponding process vector H. in,j Process vector H out,j The process vector H in,j Consists of multiple word segmentation process vectors h in,j Composition; the process vector H out,j Consists of multiple word segmentation process vectors h out,j Composition; the word segmentation process vector h in,j h out,j Each word segmentation vector or the initial word segmentation vector h0 corresponds one-to-one with the word segmentation vector.
[0014] Each of the M j The reasoning process of the layer is as follows:
[0015] H out,j =W out,j σ(W in,j γ(H in,j )),
[0016] Where σ is the preset activation function, γ is the preset normalization function, and W in,j W out,j M respectively j The input and output weights of the layer;
[0017] The first data record and the knowledge item (s) i ,r i ,o i One-to-one correspondence; the first data record includes a first question text and a first answer tag; the first question text is a tag containing the corresponding knowledge topic s i and the topic-object relationship r i The natural language question text; the first answer tag and the corresponding knowledge object o i match;
[0018] The second data record and the knowledge entry (s) i ,r i ,o i One-to-one correspondence; the second data record includes the second question text and the second answer tag; the second question text is a knowledge item (s) corresponding to the knowledge item (s) i ,r i ,o i The second answer label is the answer text corresponding to the second question text, and its answer content includes two categories: yes and no.
[0019] The pre-trained knowledge corpus includes multiple pre-trained knowledge corpora (s) tr ,r tr ,o tr );s tr r tr o tr These are the knowledge topic, topic-object relationship, and knowledge object of the knowledge triple;
[0020] The third data record set includes multiple third data records; each third data record includes a third question text and a third answer tag; each third data record corresponds to one of all the knowledge entries (s) i ,r i ,o i The pre-trained knowledge corpus (s) is irrelevant to all of them. tr ,r tr ,o tr The third question text is a document containing the corresponding knowledge topic (s). tr and the topic-object relationship r tr The natural language question text; the third answer tag and the corresponding knowledge object o tr match.
[0021] Preferably, the knowledge entries (s) of the updated knowledge set are... i ,r i ,o i Create a question-answer text pair to form the first data record, specifically including:
[0022] A question text generation instruction template is configured for the target model, denoted as the first instruction template; the configurable parameters of the first instruction template include topic configuration parameters, topic-object relationship configuration parameters, and object configuration parameters; the first instruction template is a formatted instruction text template; the first instruction template is used to instruct the target model to generate a question text with the object configuration parameters as the expected answer, using the topic configuration parameters and the topic-object relationship configuration parameters as question text elements;
[0023] Each of the knowledge entries (s) in the updated knowledge set i ,r i ,o i Each of these is treated as a corresponding current knowledge entry; and the knowledge topic s of the current knowledge entry is... i The topic-object relationship r i and the knowledge object o iAs the corresponding current knowledge topic, current topic-object relationship, and current knowledge object; and setting the topic configuration parameters, topic-object relationship configuration parameters, and object configuration parameters of the first instruction template to the corresponding current knowledge topic, current topic-object relationship, and current knowledge object; and inputting the first instruction template with completed parameter settings as the corresponding first instruction text into the target model for question text generation processing, and using the question text obtained in this processing as the corresponding first question text; and using the current knowledge object as the corresponding first answer tag; and forming a corresponding first data record by the first question text and the first answer tag corresponding to the current knowledge item.
[0024] Preferably, the knowledge entries (s) are each of the aforementioned knowledge items. i ,r i ,o i Create a counterfactual question-answer text pair to form the corresponding second data record, specifically including:
[0025] Configure another question text generation instruction template for the target model, denoted as the second instruction template; the configurable parameters of the second instruction template include topic configuration parameters, topic-object relationship configuration parameters, and object configuration parameters; the second instruction template is a formatted instruction text template; the second instruction template is used to require the target model to form a current fact triple from the topic configuration parameters, the topic-object relationship configuration parameters, and the object configuration parameters, and generate a classification question text that has a counterfactual relationship with the current fact triple, and generate a corresponding binary answer text for the classification question text, requiring that the binary answer text can only be either yes or no;
[0026] Each of the knowledge entries (s) in the updated knowledge set i ,r i ,o i Each of these is treated as a corresponding current knowledge entry; and the knowledge topic s of the current knowledge entry is... i The topic-object relationship r i and the knowledge object o iAs the corresponding current knowledge topic, current topic-object relationship, and current knowledge object; and setting the topic configuration parameters, topic-object relationship configuration parameters, and object configuration parameters of the second instruction template to the corresponding current knowledge topic, current topic-object relationship, and current knowledge object; and inputting the second instruction template with completed parameter settings as the corresponding second instruction text into the target model for question and answer text generation processing, and using the categorized question text and binary answer text obtained in this processing as the corresponding second question text and second answer tag; and forming a corresponding second data record by the second question text and second answer tag corresponding to the current knowledge item.
[0027] Preferably, the step of extracting all the knowledge items (s) from the pre-trained knowledge corpus corresponding to the target model is... i ,r i ,o i A third data record set is formed by combining unrelated pre-trained knowledge corpora, specifically including:
[0028] Each knowledge topic s in the pre-trained knowledge corpus tr With all the knowledge entries (s) i ,r i ,o i The knowledge topic s i The pre-trained knowledge corpus (s) that are irrelevant tr ,r tr ,o tr ) are recorded as irrelevant data;
[0029] Each of the aforementioned irrelevant corpora is then treated as a corresponding current knowledge entry; and the knowledge topic s of the current knowledge entry is... tr The topic-object relationship r tr and the knowledge object o tr As the corresponding current knowledge topic, current topic-object relationship, and current knowledge object; and setting the topic configuration parameters, topic-object relationship configuration parameters, and object configuration parameters of the first instruction template to the corresponding current knowledge topic, current topic-object relationship, and current knowledge object; and inputting the first instruction template with the completed parameter settings as the corresponding first instruction text into the target model for question text generation processing, and using the question text obtained from this processing as the corresponding third question text; and using the current knowledge object as the corresponding third answer tag; and using the third question text and the third answer tag corresponding to the current knowledge item to form a corresponding third data record;
[0030] The obtained third data records form the corresponding third data record set.
[0031] Preferably, the step of optimizing the weight parameters of all MLP layers of the target model based on N1 first data records specifically includes:
[0032] Step 601: Denote the current overall model parameters of the target model as parameter θ;
[0033] Step 602: Input the first question text of each of the first data records into the target model as the current model input text for processing, and denote the word segmentation sequence and the initial vector H0 output by the preprocessing module during this processing as the corresponding word segmentation sequence U. i and initial vector H 0,i And each of the M mentioned in this process j The process vector H of layer input and output in,j H out,j Let H be the corresponding process vector. in,j,i H out,j,i And for all the process vectors H in this processing process in,j,i H out,j,i Cache;
[0034] Wherein, the word segmentation sequence U i With the knowledge item (s) i ,r i ,o i One-to-one correspondence, consisting of multiple word segments u i Composition, one of which is related to the knowledge topic s i Corresponding to; the initial vector H 0,i With the knowledge item (s) i ,r i ,o i One-to-one correspondence, consisting of multiple initial word segmentation vectors h 0,i Composition, the initial word segmentation vector h 0,i With the segmented word u i One-to-one correspondence; the process vector H in,j,i H out,j,i With the knowledge item (s) i ,r i ,o i One-to-one correspondence; the process vector H in,j,i Consists of multiple word segmentation process vectors h in,j,i Composition; the H out,j,i Consists of multiple word segmentation process vectors h out,j,i composition;
[0035] Step 603, assign each of the knowledge entries (s)i ,r i ,o i The process vector H corresponding to the last layer. out,j=N2,i The last segmentation process vector Extracted as the corresponding final-level word vector And for each of the aforementioned final-layer word vectors Set a vector whose length and feature dimension are both the same as the current last-layer word vector. Maintaining a consistent global increment δ i ; and all the aforementioned global increments δ i All are initialized to a vector of zeros;
[0036] Step 604, based on the negative log-likelihood loss function and the N1 sets of final layer word vectors. The global increment δ i and the knowledge object o i Set a corresponding optimization objective function; and adjust each of the global increments δ in the direction that minimizes the optimization objective function. i The optimal solution is obtained and the result is used as the corresponding optimal global increment. And based on the last-layer word vectors of each of the aforementioned layers and the corresponding optimal global increment Calculate the corresponding target end-word vector e tag,i ;
[0037] The optimization objective function is:
[0038]
[0039] L NLL It is the negative log-likelihood loss function. To achieve the desired overall model parameter θ, using each of the global increments δ i The corresponding last-layer word vector was adjusted. Subsequently, the generated text of the target model is the corresponding knowledge object o. i The conditional probability;
[0040] The target end-word vector e tag,i The calculation method is as follows:
[0041]
[0042] Step 605: Set a counter C initialized to 1;
[0043] Step 606, assign each of the knowledge entries (s) i ,r i,o i The first question text corresponding to the current model is input into the target model for processing, and each of the M values in this processing is processed. j The process vector H of layer input and output in,j,i H out,j,i Cache again;
[0044] Step 607, match the layer index j with the counter C of the M j The layer serves as the current MLP layer;
[0045] Step 608, assign each of the knowledge entries (s) i ,r i ,o i The process vector H corresponding to the N2 latest caches. in,j,i In, with the knowledge topic s i And the word segmentation process vector h corresponding to the current MLP layer in,j=C,i Let h be the corresponding topic vector. subject,C,i ; and according to each of the aforementioned topic vectors h subject,C,i and the corresponding input layer weights W in,j=C Calculate the latest single-layer key vector k j=C,i Make an estimate;
[0046] Wherein, the single-layer key vector k j=C,i The estimation method is as follows:
[0047] k j=C,i =σ(W in,j=C γ(h subject,C,i ));
[0048] σ is the preset activation function, and γ is the preset normalization function;
[0049] Step 609, assign each of the knowledge entries (s) i ,r i ,o i The process vector H corresponding to the N2 latest caches. out,j,i In the process vector H corresponding to the current MLP layer out,j=C,i The last segmentation process vector h out,j=C,i Let e be a single-layer end-word vector C,i ; and based on the target end-word vector e tag,i and the single-layer tail word vector e C,i Estimate the corresponding single-layer local increment Δδ j,i ;
[0050] Wherein, the single-layer local increment Δδ j,i The estimation method is as follows:
[0051]
[0052] Step 610, consisting of N1 single-layer key vectors k j=C,i Form a corresponding key vector matrix K j=C ; and consisting of N1 local increments Δδ of the single layer j=C,i Form a corresponding local increment matrix R j=C ; and based on the key vector matrix K j=C and the local increment matrix R j=C Estimate the corresponding single-layer incremental weight ΔW out,j=C ;
[0053] Among them, the single-layer incremental weight △W out,j=C The estimation method is as follows:
[0054]
[0055] Among them, X j=C The parameters are the pre-defined covariance matrix parameters for the j=C level.
[0056] Step 611, based on the single-layer incremental weight ΔW out,j=C The output layer weights W of the current MLP layer out,j=C Update; and based on the new output layer weights W out,j=C Update the parameter θ of the target model;
[0057] The new W out,j=C = old W out,j=C +ΔW out,j=C ;
[0058] Step 612: Increment the counter C by 1; and identify whether the counter C after incrementing by 1 exceeds the total number N2; if it does not exceed the total number N2, return to step 606; if it exceeds the total number N2, confirm that the optimization is complete.
[0059] Preferably, the step of performing a counterfactual problem evaluation on the updated target model based on N1 of the second data records to obtain the corresponding first evaluation result specifically includes:
[0060] Each of the second data records is successively used as the corresponding current record; the second question text of the current record is used as the current model input text and input into the target model for processing, and the generated text obtained from this model processing is used as the corresponding current answer; it is then identified whether the current answer matches the second answer label of the current record. If they do not match, the corresponding first question and answer result is set to "not matched"; if they match, the corresponding first question and answer result is set to "matched"; it is then identified whether all N1 first question and answer results are matches. If they are, the corresponding first evaluation result is set to "passed"; otherwise, the corresponding first evaluation result is set to "failed".
[0061] Preferably, the step of evaluating the updated target model based on the third data record set to obtain the corresponding second evaluation result includes:
[0062] Step 81: Perform a traversal of all the third data records in the third data record set; during this traversal, take the currently traversed third data record as the corresponding current record; input the third question text of the current record into the target model as the current model input text for processing, and take the generated text obtained from this model processing as the corresponding first predicted answer; and form a corresponding first prediction-label pair by the first predicted answer and the third answer label of the current record; and at the end of this traversal, input all the obtained first prediction-label pairs into a preset first model loss function to calculate the corresponding first loss value;
[0063] The first model loss function is implemented based on the cross-entropy loss function or the negative log-likelihood loss function.
[0064] Step 82, and identify whether the first loss value meets the preset first loss value range; if it does, set the corresponding second evaluation result as passed; if it does not, set the corresponding second evaluation result as failed.
[0065] A second aspect of the present invention provides an apparatus for implementing the processing method of updating model knowledge by optimizing MLP weights as described in the first aspect above. The apparatus includes: a data receiving module, a preprocessing module, an MLP optimization module, an optimization evaluation module, and an update feedback module.
[0066] The data receiving module is used to receive a batch of knowledge items specified by the user as an updated knowledge set; and to count the total number of knowledge items in the updated knowledge set to obtain a total number N1; and to use the large language model specified by the user as the target model; the large language model specified by the user is a large language model based on the Transformer model structure that has been pre-trained and fine-tuned for NLP tasks, and the NLP tasks include at least text generation, machine translation, intelligent question answering, and text classification; the total number N1 is a positive integer with a minimum of 1; the updated knowledge set consists of N1 knowledge items (s i ,r i ,o i Composed of ) knowledge index i ≤ N1, s i r i o i These are the knowledge topic, topic-object relationship, and knowledge object of the knowledge triple;
[0067] The preprocessing module is used to preprocess each of the knowledge entries (s) in the updated knowledge set. i ,r i ,o i Create a question-answer text pair to form the corresponding first data record; and for each of the knowledge entries (s) i ,r i ,o i Create a counterfactual question-answer text pair to form the corresponding second data record; and extract the corresponding knowledge entries (s) from the pre-trained knowledge corpus of the target model. i ,r i ,o i A corresponding third data record set is formed by combining unrelated pre-trained knowledge corpora.
[0068] The MLP optimization module is used to optimize the weight parameters of all MLP layers of the target model based on N1 first data records;
[0069] The optimization evaluation module is used to perform a counterfactual problem evaluation on the updated target model based on N1 second data records to obtain a corresponding first evaluation result; and to perform an irrelevant knowledge problem evaluation on the updated target model based on the third data record set to obtain a corresponding second evaluation result; both the first and second evaluation results include pass and fail;
[0070] The update feedback module is used to identify whether both the first and second evaluation results are passed; if not, it continues to optimize until the latest first and second evaluation results are both passed; if so, it feeds back to the current user that the model knowledge update is complete.
[0071] A third aspect of the present invention provides an electronic device, including: a memory, a processor, and a transceiver;
[0072] The processor is used to couple with the memory, read and execute instructions in the memory to implement the steps of the method described in the first aspect above;
[0073] The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.
[0074] A fourth aspect of the present invention provides a computer-readable storage medium storing computer instructions that, when executed by a computer, cause the computer to perform the instructions described in the first aspect.
[0075] This invention provides a method, apparatus, electronic device, and computer-readable storage medium for updating model knowledge by optimizing MLP weights. As described above, this invention uses a batch of user-specified knowledge items as the updated knowledge set; the total number of knowledge items in the updated knowledge set is statistically analyzed to obtain a total number N1; the currently user-specified large language model (a large language model based on the Transformer model structure that has completed pre-training and NLP task fine-tuning) is used as the target model; a first data record consisting of positive question-answer text pairs and a second data record consisting of counterfactual question-answer text pairs are created for each knowledge item in the updated knowledge set; a third data record set is formed by extracting pre-trained knowledge corpus unrelated to all knowledge items from the target model's pre-trained knowledge corpus; the weight parameters of all MLP layers of the target model are optimized based on all the first data records; a counterfactual question evaluation is performed on the updated target model based on all the second data records to obtain a first evaluation result; an irrelevant knowledge question evaluation is performed on the updated target model based on the third data record set to obtain a second evaluation result; and feedback is given to the user that the model knowledge update is complete when both the first and second evaluation results are passed. The embodiments of the present invention only optimize the weights of MLP. Through the embodiments of the present invention, not only is the computational complexity and amount of computation reduced, the training cycle shortened, and the update cost reduced, but the update efficiency and update flexibility are also improved. Attached Figure Description
[0076] Figure 1 This is a schematic diagram of a method for updating model knowledge by optimizing MLP weights, provided in Embodiment 1 of the present invention.
[0077] Figure 2 This is a module structure diagram of a processing device for updating model knowledge by optimizing MLP weights, provided in Embodiment 2 of the present invention.
[0078] Figure 3 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. Detailed Implementation
[0079] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0080] Embodiment 1 of the present invention provides a method for updating model knowledge by optimizing MLP weights, such as... Figure 1 The schematic diagram illustrates a method for updating model knowledge by optimizing MLP weights, as provided in Embodiment 1 of the present invention. This method mainly includes the following steps:
[0081] Step 1: Use the batch of knowledge items specified by the user as the updated knowledge set; calculate the total number of knowledge items in the updated knowledge set to obtain the total number N1; and use the large language model specified by the user as the target model.
[0082] Here, the large language model in this embodiment of the invention is a large language model implemented based on the Transformer model structure, which has completed pre-training and NLP task fine-tuning. The NLP tasks of the large language model include at least text generation, machine translation, intelligent question answering, and text classification. The total number N1 is a positive integer, with a minimum of 1; the updated knowledge set consists of N1 knowledge items (s...). i ,r i ,o i Composed of ) knowledge index i ≤ N1, s i r i o i These are the knowledge topic, topic-object relationship, and knowledge object of the knowledge triple.
[0083] It should be noted that all internal modules of the target model in this embodiment of the invention are divided into two main sections: the preprocessing section and the forward inference section; specifically: 1) Within the target model, the internal modules used for word segmentation of the input text and the internal modules used for embedding and encoding the segmented sequence are both included in the preprocessing section; 2) Within the target model, all internal modules involved in the forward inference process of the NLP task based on the initial vector output by the preprocessing section are included in the forward inference section.
[0084] The preprocessing module of this embodiment of the invention is used to perform word segmentation on the input text of the model to obtain the corresponding word segmentation sequence; and to perform embedding encoding on the word segmentation sequence according to the embedding encoding rules of the target model and send the obtained embedding encoding vector as the initial vector H0 to the forward inference module; wherein, the word segmentation sequence is composed of multiple words; the initial vector H0 is composed of multiple initial word segmentation vectors h0; and the initial word segmentation vector h0 corresponds one-to-one with the word segmentation.
[0085] The forward inference module of this invention is used to perform forward inference based on the input initial vector H0 to obtain the corresponding generated text and output it. The total number of MLP layers in the forward inference module is denoted as N2, and each MLP layer is labeled as its corresponding M. j Layers; the total number of layers N2 is a positive integer; 1 ≤ layer index j ≤ N2.
[0086] Each M in the embodiments of the present invention j The input and output vectors of a layer during the inference process are denoted as the corresponding process vector H. in,j Process vector H out,j Among them, the process vector H in,j Consists of multiple word segmentation process vectors h in,j Composition; Process vector H out,j Consists of multiple word segmentation process vectors h out,j Composition; word segmentation process vector h in,j h out,j It corresponds one-to-one with the word segmentation or the initial word segmentation vector h0.
[0087] Each M in the embodiments of the present invention j The reasoning process of the layer is as follows:
[0088] H out,j =W out,j σ(W in,j γ(H in,j ));
[0089] Where σ is the preset activation function, γ is the preset normalization function, and W in,j W out,j M respectively j The input and output weights of the layer.
[0090] Step 2, update each knowledge item (s) in the knowledge set. i ,r i ,o i Create a question-answer text pair to form the first data record; and create a question-answer text pair for each knowledge item (s i ,r i ,o iCreate a counterfactual question-answer text pair to form the corresponding second data record; and extract the corresponding knowledge entries from the pre-trained knowledge corpus of the target model. i ,r i ,o i A corresponding third data record set is formed by combining unrelated pre-trained knowledge corpora.
[0091] Specifically, this includes: Step 21, updating each knowledge item (s) in the knowledge set. i ,r i ,o i Create a question-answer text pair to form the first data record;
[0092] Among them, the first data record and knowledge item (s i ,r i ,o i One-to-one correspondence; the first data record includes the first question text and the first answer tag; the first question text is a tag containing the corresponding knowledge topic s i Subject-object relationship r i Natural language question text; first answer label and corresponding knowledge object. i match;
[0093] Specifically, this includes: Step 211, configuring a question text generation instruction template for the target model, denoted as the first instruction template;
[0094] Here, the configurable parameters of the first instruction template in this embodiment of the invention include topic configuration parameters, topic-object relationship configuration parameters, and object configuration parameters; the first instruction template is a formatted instruction text template; the first instruction template is used to require the target model to generate a question text with the object configuration parameters as the expected answer, using the topic configuration parameters and topic-object relationship configuration parameters as question text elements;
[0095] Step 212 involves updating each knowledge entry (s) in the knowledge set. i ,r i ,o i Each of these is treated as a corresponding current knowledge entry; and the knowledge topic s of the current knowledge entry is... i Subject-object relationship r i and knowledge objects o iThis serves as the corresponding current knowledge topic, current topic-object relationship, and current knowledge object; the topic configuration parameters, topic-object relationship configuration parameters, and object configuration parameters of the first instruction template are set to the corresponding current knowledge topic, current topic-object relationship, and current knowledge object; the first instruction template with completed parameter settings is input into the target model as the corresponding first instruction text for question text generation processing, and the question text obtained in this processing is used as the corresponding first question text; the current knowledge object is used as the corresponding first answer tag; and the first question text and first answer tag corresponding to the current knowledge item form a corresponding first data record;
[0096] Step 22, and for each knowledge item (s) i ,r i ,o i Create a counterfactual question-answer text pair to form the corresponding second data record;
[0097] Among them, the second data record and knowledge item (s i ,r i ,o i One-to-one correspondence; the second data record includes the second question text and the second answer label; the second question text is a corresponding knowledge item (s) i ,r i ,o i The second answer label is the answer text corresponding to the second question text, and its answer content includes two categories: yes and no.
[0098] Specifically, this includes: Step 221, configuring another question text generation instruction template for the target model, denoted as the second instruction template;
[0099] Here, the configurable parameters of the second instruction template in this embodiment of the invention include topic configuration parameters, topic-object relationship configuration parameters, and object configuration parameters; the second instruction template is a formatted instruction text template; the second instruction template is used to require the target model to form a current fact triplet composed of topic configuration parameters, topic-object relationship configuration parameters, and object configuration parameters, and to generate a classification question text that has a counterfactual relationship with the current fact triplet, and to generate a corresponding binary answer text for the classification question text, and require that the binary answer text can only be yes or no;
[0100] Step 222 involves updating each knowledge entry (s) in the knowledge set. i ,r i ,o i Each of these is treated as a corresponding current knowledge entry; and the knowledge topic s of the current knowledge entry is... i Subject-object relationship r iand knowledge objects o i As the corresponding current knowledge topic, current topic-object relationship, and current knowledge object; the topic configuration parameters, topic-object relationship configuration parameters, and object configuration parameters of the second instruction template are set to the corresponding current knowledge topic, current topic-object relationship, and current knowledge object; the second instruction template with completed parameter settings is used as the corresponding second instruction text input to the target model for question and answer text generation processing; the classification question text and binary answer text obtained in this processing are used as the corresponding second question text and second answer label; and the second question text and second answer label corresponding to the current knowledge item form a corresponding second data record;
[0101] For example, the second instruction text is: "Given the topic configuration parameter = "cat", topic-object relationship configuration parameter = "loves to eat", and object configuration parameter = "canned food", please form a current fact triple from the topic configuration parameter, topic-object relationship configuration parameter and object configuration parameter, generate a classification question text that has a counterfactual relationship with the current fact triple, generate a corresponding binary answer text for the classification question text, and require that the binary answer text can only be either yes or no".
[0102] After the second instruction text is input into the target model, the target model gives the classification question text that has a counterfactual relationship with the current fact triplet as "Does the cat not like to eat canned food?", and the corresponding binary classification answer text is "No".
[0103] Step 23, and extract all knowledge items (s) from the pre-trained knowledge corpus corresponding to the target model. i ,r i ,o i A corresponding third data record set is formed by combining unrelated pre-trained knowledge corpora.
[0104] Among them, the pre-trained knowledge corpus includes multiple pre-trained knowledge corpora (s tr ,r tr ,o tr );s tr r tr o tr These are the knowledge topic, topic-object relationship, and knowledge object of the knowledge triple;
[0105] The third data record set includes multiple third data records; each third data record includes a third question text and a third answer tag; each third data record corresponds to one of all knowledge entries (s) i ,r i ,o i Pre-trained knowledge corpus (s) that is irrelevant to all tr ,r tr ,otr The third question text is a document containing the corresponding knowledge topic (s). tr Subject-object relationship r tr Natural language question text; third answer label and corresponding knowledge object. tr match;
[0106] Specifically, this includes: Step 231, which involves processing each knowledge topic s in the pre-trained knowledge corpus. tr With all knowledge entries (s i ,r i ,o i ) knowledge topics i Unrelated pre-trained knowledge corpus (s tr ,r tr ,o tr ) are recorded as irrelevant data;
[0107] Step 232, and treat each irrelevant corpus as a corresponding current knowledge entry; and set the knowledge topic s of the current knowledge entry. tr Subject-object relationship r tr and knowledge objects o tr This serves as the corresponding current knowledge topic, current topic-object relationship, and current knowledge object; the topic configuration parameters, topic-object relationship configuration parameters, and object configuration parameters of the first instruction template are set to the corresponding current knowledge topic, current topic-object relationship, and current knowledge object; the first instruction template with completed parameter settings is used as the corresponding first instruction text input into the target model for question text generation processing, and the question text obtained in this processing is used as the corresponding third question text; the current knowledge object is used as the corresponding third answer tag; and the third question text and third answer tag corresponding to the current knowledge item form a corresponding third data record;
[0108] Step 233, and the obtained third data records form the corresponding third data record set.
[0109] Step 3: Optimize the weight parameters of all MLP layers of the target model based on N1 first data records;
[0110] Specifically, this includes: Step 3-1, denoting the current overall model parameters of the target model as parameter θ;
[0111] Step 3-2: Input the first question text of each first data record into the target model as the current model input text for processing, and denote the word segmentation sequence and initial vector H0 output by the preprocessing module during this processing as the corresponding word segmentation sequence U. i and initial vector H 0,i And each M in this processing process jLayer input and output process vector H in,j H out,j Let H be the corresponding process vector. in,j,i H out,j,i And for all process vectors H in this processing process in,j,i H out,j,i Cache;
[0112] Here, the word segmentation sequence U in this embodiment of the invention i With knowledge items (s) i ,r i ,o i One-to-one correspondence, consisting of multiple word segments u i Composition, one of which is related to knowledge topics i Corresponding; initial vector H 0,i With knowledge items (s) i ,r i ,o i One-to-one correspondence, consisting of multiple initial word segmentation vectors h 0,i Composition, initial vector h for word segmentation 0,i With the participle u i One-to-one correspondence; process vector H in,j,i H out,j,i With knowledge items (s) i ,r i ,o i One-to-one correspondence; process vector H in,j,i Consists of multiple word segmentation process vectors h in,j,i Composition; H out,j,i Consists of multiple word segmentation process vectors h out,j,i composition;
[0113] Step 3-3, sort each knowledge item (s) i ,r i ,o i The last process vector corresponding to ) The last word segmentation process vector Extracted as the corresponding final-level word vector And generate vectors for each final-level word. Set a vector whose length and feature dimension are the same as the current last-layer word vector. Maintaining a consistent global increment δ i ; and all global increments δ i All are initialized to a vector of zeros;
[0114] Here, the reason for including the last layer process vector The last word segmentation process vector Extracted as the corresponding final word vector e iThis is because the last MLP layer of a large language model based on the Transformer model structure is usually the penultimate or third-to-last processing layer before the model output. The next layer of the network after the last MLP layer usually performs specific text generation or classification operations based on the last word segmentation vector of the output vector of the last MLP layer. In other words, if the expected output of the model changes, the change in output can be synchronously reflected in the last word vector e of this final layer. i In terms of the amount of change;
[0115] Steps 3-4, based on the negative log-likelihood loss function and N1 sets of final layer word vectors. Global increment δ i and knowledge objects o i Set a corresponding optimization objective function; and adjust each global increment δ in the direction that minimizes the optimization objective function. i The optimal solution is obtained and the result is used as the corresponding optimal global increment. And based on the end-word vectors of each layer and its corresponding optimal global increment Calculate the corresponding target end-word vector e tag,i ;
[0116] Here, the optimization objective function of this embodiment of the invention is:
[0117]
[0118] Among them, L NLL It is the negative log-likelihood loss function. To achieve the desired overall model parameter θ, using various global increments δ i The corresponding last-level word vectors were adjusted. Subsequently, the generated text of the target model is the corresponding knowledge object o. i The conditional probability;
[0119] The target word vector e in this embodiment of the invention tag,i The calculation method is as follows:
[0120]
[0121] It should be noted that steps 3-4 involve solving the objective function to obtain the knowledge items (s). i ,r i ,o i In the corresponding final-level word vector The overall change generated above is the optimal global increment. And from the vectors of the last word in each layer and its corresponding optimal global increment Calculate each knowledge item (s) i ,r i ,o i The corresponding knowledge update needs to achieve a target output quantity in the model output, namely the target end-word vector e. tag,i ;
[0122] It should also be noted that the embodiments of the present invention apply to N2 M... j The layer optimization method is an iterative approach that optimizes one layer at a time. Specifically, it involves first optimizing M with the overall model parameters being the original parameters θ. j=1 The output layer weights W of the layer out,j=1 Optimize and update the overall model parameters of the target model based on the optimization results; then, based on the previously updated target model, refine M. j=2 The output layer weights W of the layer out,j=2 Optimize and update the overall model parameters of the target model again based on the optimization results; repeat this process N2 times to complete the optimization of N2 M models. j The N2 output layer weights W of the layer out,j All optimizations are performed; steps 3-5 to 3-12 below are the specific implementation process of this iterative loop method;
[0123] It should also be noted that, in the embodiments of the present invention, for each M j In simple terms, the single-layer optimization process involves first optimizing each knowledge item (s) based on the current model parameters of the target model. i ,r i ,o i The first question text is processed once to obtain a batch of cached parameters in this processing: process vector H. in,j,i Process vector H out,j,i Then, with the current M j The N1 process vectors H of the layer in,j,i There are N1 knowledge topics s i The corresponding N1 word segmentation process vectors h in,j,i Based on this, calculate N1 single-layer bond vectors k C,i C represents the current M j The layer index; then the current M j Layer N1 process vectors H out,j,i The last word segmentation process vector h out,j,i Extract these vectors and use them as corresponding end-word vectors to obtain N1 single-layer end-word vectors e. C,i And based on the target end-word vector e tag,i and N1 single-layer tail word vectors e C,i Calculate the N1 single-layer local increments Δδ j,i ; and with the current Mj The N1 single-layer bond vectors k of the layer C,i and N1 single-layer local increments Δδ j,i Based on this, calculate the current M. j The output layer weight increment of a layer is the single-layer incremental weight ΔW. out,j ; and based on the current M j Single-layer incremental weight △W out,j For the current M j The parameters of the layer and the target model are updated once; steps 3-5 to 3-12 below will describe the single-layer optimization process of this embodiment of the invention in detail;
[0124] Steps 3-5: Set a counter C initialized to 1;
[0125] Steps 3-6: Organize each knowledge item (s) i ,r i ,o i The first question text corresponding to the current model is used as the input text to the target model for processing, and each M in this processing is processed. j Layer input and output process vector H in,j,i H out,j,i Cache again;
[0126] Steps 3-7: Match layer index j with counter C for M j The layer serves as the current MLP layer;
[0127] Steps 3-8: Organize each knowledge item (s) i ,r i ,o i The corresponding N2 latest cached process vectors H in,j,i In the middle, with knowledge topic s i and the word segmentation process vector h corresponding to the current MLP layer in,j=C,i Let h be the corresponding topic vector. subject,C,i ; and based on each topic vector h subject,C,i and the corresponding input layer weights W in,j=C Calculate the latest single-layer key vector k j=C,i Make an estimate;
[0128] Among them, the single-layer key vector k j=C,i The estimation method is as follows:
[0129] k j=C,i =σ(W in,j=c γ(h subject,C,i ));
[0130] σ is the preset activation function, and γ is the preset normalization function;
[0131] Steps 3-9: Organize each knowledge item (s) i ,r i ,o i The corresponding N2 latest cached process vectors H out,j,i In the process vector H corresponding to the current MLP layer out,j=C,i The last word segmentation process vector h out,j=C,i Let e be a single-layer end-word vector C,i ; and based on the target word vector e tag,i and single-layer end-word vector e C,i Estimate the corresponding single-layer local increment Δδ j,i ;
[0132] Among them, the local increment Δδ of a single layer j,i The estimation method is as follows:
[0133]
[0134] Here, in the embodiment of the present invention, the calculation of the local increment Δδ of a single layer is performed. j,i At that time, first through (e) tag,i -e C,i Calculate a difference component, and then set a weight based on the layer index j of the current MLP layer according to a weighting method that prioritizes distant components over nearby ones. Then, the local increment Δδ of the current MLP layer is obtained by weighting the current difference component using this weight. j,i The weighting method mentioned here, which prioritizes closer layers over distant ones, actually means that the closer a layer is to the last MLP layer, the greater its weight, and vice versa.
[0135] Steps 3-10 consist of N1 single-layer bond vectors k j=C,i Form a corresponding key vector matrix K j=C ; and consists of N1 single-layer local increments Δδ j=C,i Form a corresponding local increment matrix R j=C ; and based on the key vector matrix K j=C and the local increment matrix R j=C Estimate the corresponding single-layer incremental weight ΔW out,j=C ;
[0136] Here, the single-layer incremental weight △W implemented in this invention out,j=C The estimation method is as follows:
[0137]
[0138] Among them, X j=C The parameters are the pre-defined covariance matrix parameters for the j=C layer;
[0139] To fully understand the estimation method in step 3-10, the derivation process of this estimation method is briefly explained below:
[0140] (Step 1) First, for the optimization of each layer, we expect the optimized output layer weights to be able to handle the N1 knowledge items (s) updated in this time. i ,r i ,o i This invention takes into account both pre-trained knowledge corpora unrelated to the current knowledge set update (hereinafter referred to as irrelevant corpora) in the pre-trained knowledge corpus. Therefore, this embodiment of the invention sets a single-layer optimization objective function as follows:
[0141]
[0142] in, For M j The optimized output layer weights; x is the corpus index of irrelevant corpus, N x k represents the total number of irrelevant corpora. j,x For each irrelevant corpus, save each M at the end of pre-training j The single-layer bond vector of the layer, e j,x For each irrelevant corpus, save each M at the end of pre-training j Single-layer tail word vectors; and This refers to the latest cached single-layer end-word vectors e. j,i Based on this, a single-layer local increment Δδ was added. j,i The resulting end-word vector, single-layer end-word vector It can be regarded as the target vector for optimization at each layer;
[0143] Here, in this embodiment of the invention, the non-linear relationship between knowledge topics and knowledge objects is actually determined by each M. j Layer output weight W out,j It is implemented using a mapping relationship similar to key-value pairs; the pair is composed of N x k historical key-value pairs j,x ,e j,x ) and N1 latest key-value pairs (k j,I ,e j,i Solving the single-layer optimization objective function constructed by ) yields It can satisfy the N1 knowledge topics s of this study. i -Knowledge Objects i The mapping relationship can also guarantee N x The mapping relationship between knowledge topics and knowledge objects in irrelevant corpora remains unchanged;
[0144] (Step 2) From N x A single-layer key vector kj,x Form the corresponding key vector Composed of N1 single-layer bond vectors k j,i Form the corresponding key vector K j , by N x A single-layer tail word vector e stored in history j,x Form the corresponding value vector Similarly, N1 of the latest single-layer tail word vectors Form the corresponding value vector V j And by solving the above single-layer optimization objective function using a normal equation, we can obtain:
[0145]
[0146] Calculating the above formula, we get:
[0147]
[0148] (Step 3) M j The output layer weights before optimization are denoted as weight W. out-old,j The output layer weight increments before and after optimization are denoted as single-layer incremental weights ΔW. out,j We can obtain:
[0149]
[0150] Therefore, the expression output in the second step can be further expressed as:
[0151]
[0152] Expanding the above equation, we get:
[0153]
[0154] (Step 4) Because Therefore, the expansion of the output in the third step can be further expressed as:
[0155]
[0156] Subtract both sides of the above equation We can obtain:
[0157]
[0158] Right now:
[0159] That is:
[0160] (Step 5) By M jThe N1 most recently cached single-layer tail word vectors e j,i Form the corresponding value vector V' j , by M j N1 local increments Δδ of a single layer j,i The corresponding change R j Then the value vector Value vector V' j and change R j The relation is: V j =V j ′+R j Substituting this relation into the expression output in step four yields:
[0161]
[0162] (Step 6) Because V j ′=W out-old,j K j Therefore, the expression output in step five can be further transformed into:
[0163]
[0164] Right now:
[0165] (Step 7) Each key vector All of these are historically known quantities. In this embodiment of the invention, the key vectors are pre-defined based on N² known key vectors. For N2 M j The layer is configured with N2 corresponding covariance matrix parameters. This allows us to obtain the single-layer incremental weight ΔW given in step 3-10. out,j The estimation expression:
[0166] ΔW out,j =R j K j T (X j +K j K j T ) -1 ;
[0167] Step 3-11, based on single-layer incremental weight △W out,j=C The output layer weights W of the current MLP layer out,j=C Update the output layer based on the new output layer weights W. out,j=C Update the parameters θ of the target model;
[0168] The new W out,j=C = old W out,j=C +ΔWout,j=C ;
[0169] Step 3-12: Increment counter C by 1; and check whether the incremented counter C exceeds the total number N2; if it does not exceed the total number N2, return to step 3-6; if it does exceed the total number N2, confirm that the optimization is complete.
[0170] Step 4: Based on N1 second data records, perform a counterfactual problem evaluation on the updated target model to obtain the corresponding first evaluation result; and based on the third data record set, perform an irrelevant knowledge problem evaluation on the updated target model to obtain the corresponding second evaluation result.
[0171] Specifically, it includes: Step 41, performing a counterfactual problem evaluation on the updated target model based on N1 second data records to obtain the corresponding first evaluation result;
[0172] The first assessment result includes pass and fail;
[0173] Specifically, this includes: sequentially using each second data record as the corresponding current record; inputting the second question text of the current record into the target model as the current model input text for processing, and using the generated text obtained from this model processing as the corresponding current answer; identifying whether the current answer matches the second answer label of the current record, and if they do not match, setting the corresponding first question and answer result as mismatched, and if they match, setting the corresponding first question and answer result as matched; and identifying whether all N1 obtained first question and answer results are matches, and if so, setting the corresponding first evaluation result as passed, and otherwise setting the corresponding first evaluation result as failed.
[0174] Step 42, and based on the third data record set, evaluate the updated target model for irrelevant knowledge issues to obtain the corresponding second evaluation result;
[0175] The second evaluation result includes pass and fail;
[0176] Specifically, this includes: Step 421, performing a round of traversal on all third data records in the third data record set; during this round of traversal, taking the currently traversed third data record as the corresponding current record; and taking the third question text of the current record as the current model input text to the target model for processing, and taking the generated text obtained from this model processing as the corresponding first predicted answer; and forming a corresponding first prediction-label pair by the first predicted answer and the third answer label of the current record; and at the end of this round of traversal, taking all the obtained first prediction-label pairs into the preset first model loss function to calculate the corresponding first loss value;
[0177] Here, the first model loss function in this embodiment of the invention is implemented based on the cross-entropy loss function or the negative log-likelihood loss function;
[0178] Step 422, and identify whether the first loss value meets the preset first loss value range; if it does, set the corresponding second evaluation result as passed; if it does not, set the corresponding second evaluation result as failed.
[0179] Here, the first loss value range in this embodiment of the invention is a pre-set loss value range.
[0180] Step 5: Identify whether both the first and second evaluation results are passed; if not, continue optimization until both the latest first and second evaluation results are passed; if so, inform the current user that the model knowledge update is complete.
[0181] Here, if the first and second evaluation results are not both passed, optimization needs to continue until the latest first and second evaluation results are both passed. This continued optimization actually means returning to step 3 for further optimization, then going through step 4 for further evaluation, and finally going through step 5 to re-identify whether the latest first and second evaluation results are both passed.
[0182] It should also be noted that, by default, the embodiments of the present invention optimize all MLP layers of the target model to achieve the purpose of updating knowledge. In addition, the embodiments of the present invention can also identify the key MLP layers in the target model that affect knowledge editing in advance, and then optimize only the key MLP layers to achieve the purpose of updating knowledge. This method has lower computational complexity and amount, shorter training cycle, lower update cost, and higher update efficiency and flexibility.
[0183] Figure 2 This is a module structure diagram of a processing device for updating model knowledge by optimizing MLP weights, provided in Embodiment 2 of the present invention. This device can be a terminal device or server implementing the aforementioned method embodiment, or it can be a device that enables the aforementioned terminal device or server to implement the aforementioned method embodiment. For example, the device can be a device or chip system of the aforementioned terminal device or server. Figure 2 As shown, the device includes: a data receiving module 201, a preprocessing module 202, an MLP optimization module 203, an optimization evaluation module 204, and an update feedback module 205.
[0184] The data receiving module 201 is used to receive a batch of knowledge items specified by the user as the updated knowledge set; and to count the total number of knowledge items in the updated knowledge set to obtain the total number N1; and to use the large language model specified by the user as the target model; the large language model specified by the user is a large language model based on the Transformer model structure that has been pre-trained and fine-tuned for NLP tasks. The NLP tasks include at least text generation, machine translation, intelligent question answering, and text classification tasks; the total number N1 is a positive integer with a minimum of 1; the updated knowledge set consists of N1 knowledge items (s i ,r i ,o i Composed of ) knowledge index i ≤ N1, s i r i o i These are the knowledge topic, topic-object relationship, and knowledge object of the knowledge triple.
[0185] Preprocessing module 202 is used to update the individual knowledge entries (s) of the knowledge set. i ,r i ,o i Create a question-answer text pair to form the first data record; and create a question-answer text pair for each knowledge item (s i ,r i ,o i Create a counterfactual question-answer text pair to form the corresponding second data record; and extract the corresponding knowledge entries from the pre-trained knowledge corpus of the target model. i ,r i ,o i A corresponding third data record set is formed by combining unrelated pre-trained knowledge corpora.
[0186] MLP optimization module 203 is used to optimize the weight parameters of all MLP layers of the target model based on N1 first data records.
[0187] The optimization evaluation module 204 is used to perform counterfactual problem evaluation on the updated target model based on N1 second data records to obtain the corresponding first evaluation result; and to perform irrelevant knowledge problem evaluation on the updated target model based on the third data record set to obtain the corresponding second evaluation result; both the first and second evaluation results include pass and fail.
[0188] The update feedback module 205 is used to identify whether both the first and second evaluation results are passed; if not, it continues to optimize until the latest first and second evaluation results are both passed; if so, it provides feedback to the current user that the model knowledge update is complete.
[0189] The present invention provides a processing device for updating model knowledge by optimizing MLP weights, which can execute the method steps in the above method embodiments. Its implementation principle and technical effect are similar, and will not be repeated here.
[0190] It should be noted that the division of the various modules in the above device is merely a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical entity, or they can be physically separated. Furthermore, these modules can be implemented entirely in software via processing element calls; they can be fully implemented in hardware; or some modules can be implemented in software via processing element calls, while others are implemented in hardware. For example, the data receiving module can be a separate processing element, or it can be integrated into a chip in the above device. Alternatively, it can be stored as program code in the memory of the above device, and called and executed by a processing element of the device. The implementation of other modules is similar. Moreover, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each of the above modules can be completed through integrated logic circuits in the hardware of the processor element or through software instructions.
[0191] For example, these modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more Digital Signal Processors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs). As another example, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a System-on-a-Chip (SOC).
[0192] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. This computer program product includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the foregoing method embodiments are generated. The computer described above can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The aforementioned computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the aforementioned computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, Bluetooth, microwave, etc.) means. The aforementioned computer-readable storage medium can be any available medium that a computer can access, or a data storage device such as a server or data center that integrates one or more available media. The aforementioned available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state disks (SSDs)).
[0193] Figure 3 This is a schematic diagram of an electronic device provided in Embodiment 3 of the present invention. This electronic device can be a terminal device or server implementing the methods of the aforementioned embodiments, or it can be a terminal device or server connected to the aforementioned terminal device or server implementing the methods of the aforementioned embodiments. Figure 3 As shown, the electronic device may include: a processor 301 (e.g., CPU), a memory 302, and a transceiver 303; the transceiver 303 is coupled to the processor 301, and the processor 301 controls the transmission and reception operations of the transceiver 303. The memory 302 may store various instructions for performing various processing functions and implementing the processing steps described in the foregoing embodiments. Preferably, the electronic device involved in the embodiments of the present invention further includes: a power supply 304, a system bus 305, and a communication port 306. The system bus 305 is used to realize communication connections between components. The communication port 306 is used for communication between the electronic device and other peripherals.
[0194] exist Figure 3The system bus 305 mentioned can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This system bus can be divided into address bus, data bus, control bus, etc. For ease of representation, it is represented by only one thick line in the figure, but this does not indicate that there is only one bus or one type of bus. The communication interface is used to enable communication between the database access device and other devices (e.g., clients, read-write libraries, and read-only libraries). Memory may include Random Access Memory (RAM) and may also include non-volatile memory, such as at least one disk storage device.
[0195] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), graphics processing units (GPUs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0196] It should be noted that the embodiments of the present invention also provide a computer-readable storage medium storing instructions that, when run on a computer, cause the computer to perform the methods and processes provided in the above embodiments.
[0197] This invention provides a method, apparatus, electronic device, and computer-readable storage medium for updating model knowledge by optimizing MLP weights. As described above, this invention uses a batch of user-specified knowledge items as the updated knowledge set; the total number of knowledge items in the updated knowledge set is statistically analyzed to obtain a total number N1; the currently user-specified large language model (a large language model based on the Transformer model structure that has completed pre-training and NLP task fine-tuning) is used as the target model; a first data record consisting of positive question-answer text pairs and a second data record consisting of counterfactual question-answer text pairs are created for each knowledge item in the updated knowledge set; a third data record set is formed by extracting pre-trained knowledge corpus unrelated to all knowledge items from the target model's pre-trained knowledge corpus; the weight parameters of all MLP layers of the target model are optimized based on all the first data records; a counterfactual question evaluation is performed on the updated target model based on all the second data records to obtain a first evaluation result; an irrelevant knowledge question evaluation is performed on the updated target model based on the third data record set to obtain a second evaluation result; and feedback is given to the user that the model knowledge update is complete when both the first and second evaluation results are passed. The embodiments of the present invention only optimize the weights of MLP. Through the embodiments of the present invention, not only is the computational complexity and amount of computation reduced, the training cycle shortened, and the update cost reduced, but the update efficiency and update flexibility are also improved.
[0198] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented in hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0199] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for updating model knowledge by optimizing MLP weights, characterized in that, The method includes: The user-specified batch of knowledge items is used as the updated knowledge set; the total number of knowledge items in the updated knowledge set is counted to obtain a total number N1; and the user-specified large language model is used as the target model; the user-specified large language model is a large language model based on the Transformer model structure that has completed pre-training and NLP task fine-tuning, and the NLP task includes at least text generation, machine translation, intelligent question answering, and text classification; the total number N1 is a positive integer with a minimum of 1; the updated knowledge set consists of N1 knowledge items (s i ,r i ,o i Composed of ) knowledge index i ≤ N1, s i r i o i These are the knowledge topic, topic-object relationship, and knowledge object of the knowledge triple; For each of the knowledge entries (s) in the updated knowledge set i ,r i ,o i Create a question-answer text pair to form the corresponding first data record; and for each of the knowledge entries (s) i ,r i ,o i Create a counterfactual question-answer text pair to form the corresponding second data record; and extract the corresponding knowledge entries (s) from the pre-trained knowledge corpus of the target model. i ,r i ,o i A corresponding third data record set is formed by combining unrelated pre-trained knowledge corpora. Based on N1 of the first data records, the weight parameters of all MLP layers of the target model are optimized; The updated target model is evaluated using counterfactual questions based on N1 of the second data records to obtain a first evaluation result; and the updated target model is evaluated using irrelevant knowledge questions based on the third data record set to obtain a second evaluation result; both the first and second evaluation results include pass and fail. The system identifies whether both the first and second evaluation results are passed; if not, it continues to optimize until both the latest first and second evaluation results are passed; if so, it informs the current user that the model knowledge update is complete.
2. The method for updating model knowledge by optimizing MLP weights according to claim 1, characterized in that, All internal modules of the target model are divided into two main sections: the preprocessing section and the forward inference section. Specifically, the internal modules used for word segmentation of the input text and the internal modules used for embedding and encoding the segmented sequence are included in the preprocessing section. All internal modules involved in the forward inference process of the NLP task based on the initial vector output by the preprocessing section are included in the forward inference section. The preprocessing module is used to segment the input text of the model to obtain the corresponding segmented sequence; and to perform embedding encoding processing on the segmented sequence according to the embedding encoding rules of the target model, and to send the obtained embedding encoding vector as the initial vector H0 to the forward inference module; the segmented sequence is composed of multiple segments; the initial vector H0 is composed of multiple initial segmentation vectors h0; the initial segmentation vector h0 corresponds one-to-one with the segmented words; The forward reasoning module is used to perform forward reasoning based on the input initial vector H0 to obtain the corresponding generated text and output it; the total number of MLP layers in the forward reasoning module is denoted as the total number N2, and each MLP layer is labeled as the corresponding M. j Layers; the total number N2 is a positive integer; 1 ≤ layer index j ≤ N2; each of the M j The input and output vectors of a layer during the inference process are denoted as the corresponding process vector H. in,j Process vector H out,j The process vector H in,j Consists of multiple word segmentation process vectors h in,j Composition; the process vector H out,j Consists of multiple word segmentation process vectors h out,j Composition; the word segmentation process vector h in,j h out,j Each word segmentation vector or the initial word segmentation vector h0 corresponds one-to-one with the word segmentation vector. Each of the M j The reasoning process of the layer is as follows: H out,j =W out,j σ(W in,j c(H in,j )), Where σ is the preset activation function, γ is the preset normalization function, and W in,j W out,j M respectively j The input and output weights of the layer; The first data record and the knowledge item (s) i ,r i ,o i One-to-one correspondence; the first data record includes a first question text and a first answer tag; the first question text is a tag containing the corresponding knowledge topic s i and the topic-object relationship r i The natural language question text; the first answer tag and the corresponding knowledge object o i match; The second data record and the knowledge entry (s) i ,r i ,o i One-to-one correspondence; the second data record includes the second question text and the second answer tag; the second question text is a knowledge item (s) corresponding to the knowledge item (s) i ,r i ,o i The second answer label is the answer text corresponding to the second question text, and its answer content includes two categories: yes and no. The pre-trained knowledge corpus includes multiple pre-trained knowledge corpora (s) tr ,r tr ,o tr );s tr r tr o tr These are the knowledge topic, topic-object relationship, and knowledge object of the knowledge triple; The third data record set includes multiple third data records; each third data record includes a third question text and a third answer tag; each third data record corresponds to one of all the knowledge entries (s) i ,r i ,o i The pre-trained knowledge corpus (s) is irrelevant to all of them. tr ,r tr ,o tr The third question text is a document containing the corresponding knowledge topic (s). tr and the topic-object relationship r tr The natural language question text; the third answer tag and the corresponding knowledge object o tr match.
3. The method for updating model knowledge by optimizing MLP weights according to claim 2, characterized in that, The above refers to each of the knowledge entries (s) in the updated knowledge set. i ,r i ,o i Create a question-answer text pair to form the first data record, specifically including: A question text generation instruction template is configured for the target model, denoted as the first instruction template; the configurable parameters of the first instruction template include topic configuration parameters, topic-object relationship configuration parameters, and object configuration parameters; the first instruction template is a formatted instruction text template; the first instruction template is used to instruct the target model to generate a question text with the object configuration parameters as the expected answer, using the topic configuration parameters and the topic-object relationship configuration parameters as question text elements; Each of the knowledge entries (s) in the updated knowledge set i ,r i ,o i Each of these is treated as a corresponding current knowledge entry; and the knowledge topic s of the current knowledge entry is... i The topic-object relationship r i and the knowledge object o i As the corresponding current knowledge topic, current topic-object relationship, and current knowledge object; and setting the topic configuration parameters, topic-object relationship configuration parameters, and object configuration parameters of the first instruction template to the corresponding current knowledge topic, current topic-object relationship, and current knowledge object; and inputting the first instruction template with completed parameter settings as the corresponding first instruction text into the target model for question text generation processing, and using the question text obtained in this processing as the corresponding first question text; and using the current knowledge object as the corresponding first answer tag; and forming a corresponding first data record by the first question text and the first answer tag corresponding to the current knowledge item.
4. The method for updating model knowledge by optimizing MLP weights according to claim 2, characterized in that, The above refers to each of the knowledge entries (s) i ,r i ,o i Create a counterfactual question-answer text pair to form the corresponding second data record, specifically including: Configure another question text generation instruction template for the target model, denoted as the second instruction template; the configurable parameters of the second instruction template include topic configuration parameters, topic-object relationship configuration parameters, and object configuration parameters; the second instruction template is a formatted instruction text template; the second instruction template is used to require the target model to form a current fact triple from the topic configuration parameters, the topic-object relationship configuration parameters, and the object configuration parameters, and generate a classification question text that has a counterfactual relationship with the current fact triple, and generate a corresponding binary answer text for the classification question text, requiring that the binary answer text can only be either yes or no; Each of the knowledge entries (s) in the updated knowledge set i ,r i ,o i Each of these is treated as a corresponding current knowledge entry; and the knowledge topic s of the current knowledge entry is... i The topic-object relationship r i and the knowledge object o i As the corresponding current knowledge topic, current topic-object relationship, and current knowledge object; and setting the topic configuration parameters, topic-object relationship configuration parameters, and object configuration parameters of the second instruction template to the corresponding current knowledge topic, current topic-object relationship, and current knowledge object; and inputting the second instruction template with completed parameter settings as the corresponding second instruction text into the target model for question and answer text generation processing, and using the categorized question text and binary answer text obtained in this processing as the corresponding second question text and second answer tag; and forming a corresponding second data record by the second question text and second answer tag corresponding to the current knowledge item.
5. The method for updating model knowledge by optimizing MLP weights according to claim 2, characterized in that, The step involves extracting all knowledge entries (s) from the pre-trained knowledge corpus corresponding to the target model. i ,r i ,o i A third data record set is formed by combining unrelated pre-trained knowledge corpora, specifically including: Each knowledge topic s in the pre-trained knowledge corpus tr With all the knowledge entries (s) i ,r i ,o i The knowledge topic s i The pre-trained knowledge corpus (s) that are irrelevant tr ,r tr ,o tr ) are recorded as irrelevant data; Each of the aforementioned irrelevant corpora is then treated as a corresponding current knowledge entry; and the knowledge topic s of the current knowledge entry is... tr The topic-object relationship r tr and the knowledge object o tr As the corresponding current knowledge topic, current topic-object relationship, and current knowledge object; and setting the topic configuration parameters, topic-object relationship configuration parameters, and object configuration parameters of the first instruction template to the corresponding current knowledge topic, current topic-object relationship, and current knowledge object; and inputting the first instruction template with the completed parameter settings as the corresponding first instruction text into the target model for question text generation processing, and using the question text obtained from this processing as the corresponding third question text; and using the current knowledge object as the corresponding third answer tag; and using the third question text and the third answer tag corresponding to the current knowledge item to form a corresponding third data record; The obtained third data records form the corresponding third data record set.
6. The method for updating model knowledge by optimizing MLP weights according to claim 2, characterized in that, The step of optimizing the weight parameters of all MLP layers of the target model based on N1 of the first data records specifically includes: Step 601: Denote the current overall model parameters of the target model as parameter θ; Step 602: Input the first question text of each of the first data records into the target model as the current model input text for processing, and denote the word segmentation sequence and the initial vector H0 output by the preprocessing module during this processing as the corresponding word segmentation sequence U. i and initial vector H 0,i And each of the M mentioned in this process j The process vector H of layer input and output in,j H out,j Let H be the corresponding process vector. in,j,i H out,j,i And for all the process vectors H in this processing process in,j,i H out,j,i Cache; Wherein, the word segmentation sequence U i With the knowledge item (s) i ,r i ,o i One-to-one correspondence, consisting of multiple word segments u i Composition, one of which is related to the knowledge topic s i Corresponding to; the initial vector H 0,i With the knowledge item (s) i ,r i ,o i One-to-one correspondence, consisting of multiple initial word segmentation vectors h 0,i Composition, the initial word segmentation vector h 0,i With the segmented word u i One-to-one correspondence; the process vector H in,j,i H out,j,i With the knowledge item (s) i ,r i ,o i One-to-one correspondence; the process vector H in,j,i Consists of multiple word segmentation process vectors h in,j,i Composition; the H out,j,i Consists of multiple word segmentation process vectors h out,j,i composition; Step 603, assign each of the knowledge entries (s) i ,r i ,o i The process vector corresponding to the last layer The last segmentation process vector Extracted as the corresponding final-level word vector And for each of the aforementioned final-layer word vectors Set a vector whose length and feature dimension are both the same as the current last-layer word vector. Maintaining a consistent global increment δ i ; and all the aforementioned global increments δ i All are initialized to a vector of zeros; Step 604, based on the negative log-likelihood loss function and the N1 sets of final layer word vectors. The global increment δ i and the knowledge object o i Set a corresponding optimization objective function; and adjust each of the global increments δ in the direction that minimizes the optimization objective function. i The optimal solution is obtained and the result is used as the corresponding optimal global increment. And based on the last-layer word vectors of each of the aforementioned layers and the corresponding optimal global increment Calculate the corresponding target end-word vector e tag,i ; The optimization objective function is: L NLL It is the negative log-likelihood loss function. To achieve the desired overall model parameter θ, using each of the global increments δ i The corresponding last-layer word vector was adjusted. Subsequently, the generated text of the target model is the corresponding knowledge object o. i The conditional probability; The target end-word vector e tag,i The calculation method is as follows: Step 605: Set a counter C initialized to 1; Step 606, assign each of the knowledge entries (s) i ,r i ,o i The first question text corresponding to the current model is input into the target model for processing, and each of the M values in this processing is processed. j The process vector H of layer input and output in,j,i H out,j,i Cache again; Step 607, match the layer index j with the counter C of the M j The layer serves as the current MLP layer; Step 608, assign each of the knowledge entries (s) i ,r i ,o i The process vector H corresponding to the N2 latest caches. in,j,i In, with the knowledge topic s i And the word segmentation process vector h corresponding to the current MLP layer in,j=C,i Let h be the corresponding topic vector. subject,C,i ; and according to each of the aforementioned topic vectors h subject,C,i and the corresponding input layer weights W in,j=C Calculate the latest single-layer key vector k j=C,i Make an estimate; Wherein, the single-layer key vector k j=C,i The estimation method is as follows: k j=C,i =σ(W in,j=C c(h subject,C,i )); σ is the preset activation function, and γ is the preset normalization function; Step 609, assign each of the knowledge entries (s) i ,r i ,o i The process vector H corresponding to the N2 latest caches. out,j,i In the process vector H corresponding to the current MLP layer out,j=C,i The last segmentation process vector h out,j=C,i Let e be a single-layer end-word vector C,i ; and based on the target end-word vector e tag,i and the single-layer tail word vector e C,i Estimate the corresponding single-layer local increment Δδ j,i ; Wherein, the single-layer local increment Δδ j,i The estimation method is as follows: Step 610, consisting of N1 single-layer key vectors k j=C,i Form a corresponding key vector matrix K j=C ; and consisting of N1 local increments Δδ of the single layer j=C,i Form a corresponding local increment matrix R j=C ; and based on the key vector matrix K j=C and the local increment matrix R j=C Estimate the corresponding single-layer incremental weight ΔW out,j=C ; Among them, the single-layer incremental weight △W out,j=C The estimation method is as follows: Among them, X j=C The parameters are the pre-defined covariance matrix parameters for the j=C level. Step 611, based on the single-layer incremental weight ΔW out,j=C The output layer weights W of the current MLP layer out,j=C Update; and based on the new output layer weights W out,j=C Update the parameter θ of the target model; The new W out,j=C = old W out,j=C +ΔW out,j=C ; Step 612: Increment the counter C by 1; and identify whether the counter C after incrementing by 1 exceeds the total number N2; if it does not exceed the total number N2, return to step 606; if it exceeds the total number N2, confirm that the optimization is complete.
7. The method for updating model knowledge by optimizing MLP weights according to claim 2, characterized in that, The step of performing a counterfactual problem evaluation on the updated target model based on N1 of the second data records to obtain the corresponding first evaluation result specifically includes: Each of the second data records is successively used as the corresponding current record; the second question text of the current record is used as the current model input text and input into the target model for processing, and the generated text obtained from this model processing is used as the corresponding current answer; it is then identified whether the current answer matches the second answer label of the current record. If they do not match, the corresponding first question and answer result is set to "not matched"; if they match, the corresponding first question and answer result is set to "matched"; it is then identified whether all N1 first question and answer results are matches. If they are, the corresponding first evaluation result is set to "passed"; otherwise, the corresponding first evaluation result is set to "failed".
8. The method for updating model knowledge by optimizing MLP weights according to claim 2, characterized in that, The step of evaluating the updated target model based on the third data record set to obtain the corresponding second evaluation result includes: Step 81: Perform a traversal of all the third data records in the third data record set; during this traversal, take the currently traversed third data record as the corresponding current record; input the third question text of the current record into the target model as the current model input text for processing, and take the generated text obtained from this model processing as the corresponding first predicted answer; and form a corresponding first prediction-label pair by the first predicted answer and the third answer label of the current record; and at the end of this traversal, input all the obtained first prediction-label pairs into a preset first model loss function to calculate the corresponding first loss value; The first model loss function is implemented based on the cross-entropy loss function or the negative log-likelihood loss function. Step 82, and identify whether the first loss value meets the preset first loss value range; if it does, set the corresponding second evaluation result as passed; if it does not, set the corresponding second evaluation result as failed.
9. An apparatus for performing the processing method of updating model knowledge by optimizing MLP weights as described in any one of claims 1-8, characterized in that, The device includes: a data receiving module, a preprocessing module, an MLP optimization module, an optimization evaluation module, and an update feedback module; The data receiving module is used to receive a batch of knowledge items specified by the user as an updated knowledge set; and to count the total number of knowledge items in the updated knowledge set to obtain a total number N1; and to use the large language model specified by the user as the target model; the large language model specified by the user is a large language model based on the Transformer model structure that has been pre-trained and fine-tuned for NLP tasks, and the NLP tasks include at least text generation, machine translation, intelligent question answering, and text classification; the total number N1 is a positive integer with a minimum of 1; the updated knowledge set consists of N1 knowledge items (s i ,r i ,o i Composed of ) knowledge index i ≤ N1, s i r i o i These are the knowledge topic, topic-object relationship, and knowledge object of the knowledge triple; The preprocessing module is used to preprocess each of the knowledge entries (s) in the updated knowledge set. i ,r i ,o i Create a question-answer text pair to form the corresponding first data record; and for each of the knowledge entries (s) i ,r i ,o i Create a counterfactual question-answer text pair to form the corresponding second data record; and extract the corresponding knowledge entries (s) from the pre-trained knowledge corpus of the target model. i ,r i ,o i A corresponding third data record set is formed by combining unrelated pre-trained knowledge corpora. The MLP optimization module is used to optimize the weight parameters of all MLP layers of the target model based on N1 first data records; The optimization evaluation module is used to perform a counterfactual problem evaluation on the updated target model based on N1 second data records to obtain a corresponding first evaluation result; and to perform an irrelevant knowledge problem evaluation on the updated target model based on the third data record set to obtain a corresponding second evaluation result; both the first and second evaluation results include pass and fail; The update feedback module is used to identify whether both the first and second evaluation results are passed; if not, it continues to optimize until the latest first and second evaluation results are both passed; if so, it feeds back to the current user that the model knowledge update is complete.
10. An electronic device, characterized in that, include: Memory, processor, and transceiver; The processor is configured to be coupled to the memory, read and execute instructions in the memory to implement the method according to any one of claims 1-8; The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a computer, cause the computer to perform the method described in any one of claims 1-8.
Citation Information
Patent Citations
Method and device for processing question and answer tasks in combination with knowledge graph
CN119357405A
Information processing apparatus, information processing method, and computer-readable recording medium
US20210064825A1