Model-based training processing method, device and equipment and readable storage medium
By acquiring the local focus word sets and their probability distribution differences between the teacher and student models for joint distillation training, the problem of low training efficiency of the student model in traditional distillation schemes is solved, and a more efficient training effect is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2026-02-11
- Publication Date
- 2026-04-17
AI Technical Summary
In traditional model distillation schemes, student models perform poorly at critical decision boundaries, requiring manual screening of difficult samples and repeated adjustments to data ratios, resulting in low training efficiency and poor performance.
By acquiring the differences in the local focus word sets and probability distributions between the teacher model and the student model, global and local joint distillation training is performed to automatically determine the keyword set, thereby improving training efficiency and effectiveness.
It enables the student model to learn keywords accurately, reduces the cost of manual intervention, and improves training efficiency and effectiveness.
Smart Images

Figure CN121882162A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a model-based training processing method, apparatus, device, and readable storage medium. Background Technology
[0002] Large-scale language models (LLMs) have made groundbreaking progress in tasks such as intelligent dialogue, content creation, and code generation thanks to their powerful natural language understanding and generation capabilities. However, the scale of these models, with hundreds of billions or even trillions of parameters, results in high inference latency and enormous computational resource consumption, making them difficult to apply directly to online service scenarios with strict real-time requirements (such as intelligent customer service and real-time translation). To balance performance and efficiency, knowledge distillation technology has been widely adopted. Its core lies in transferring the knowledge and capabilities of a large model (teacher model) to a smaller model (student model) with fewer parameters and faster inference.
[0003] Traditional model distillation schemes primarily involve minimizing the difference in output layer probability distributions between the teacher and student models (e.g., Kullback-Leibler divergence) to achieve knowledge transfer, offering advantages such as simplicity and versatility. However, this method has significant limitations: the output layer probability distribution is calculated over a vocabulary of tens to hundreds of thousands of words, and most lexical units (such as common function words and high-frequency general words) contribute very little to task discrimination. This results in the student model, while "aligning" with the teacher model in overall distribution, still performing poorly at key decision boundaries. This distillation scheme merely allows the student model to learn from the answers provided by the teacher model, failing to guarantee the student model's understanding of the task or its ability to learn from difficult samples. It often requires manual selection of difficult samples and repeated adjustments to data ratios to improve the student model's output performance, leading to low automation and high iteration costs in model training. Therefore, traditional model distillation schemes are inefficient and produce poor training results for student models. Summary of the Invention
[0004] This application provides a model-based training processing method, apparatus, device, and readable storage medium, which can improve the training efficiency and training effect of student models in model distillation training tasks.
[0005] This application provides a model-based training method, including: Obtain training data for the Kth round of distillation training of the student model, where K is a positive integer. The training data includes the input text and the standard response content of the input text. The standard response content of the input text is determined based on the first probability distribution obtained after the teacher model processes the input text. The first probability distribution includes the first prediction probability of the teacher model for each candidate word in the vocabulary. The student model is invoked to respond to the input text, resulting in a second probability distribution. The second probability distribution includes the student model's second prediction probability for each candidate word in the vocabulary. Based on the first probability distribution and the second probability distribution, the local focus word sets of the teacher model and the student model are determined from each candidate word in the vocabulary, and the local probability distributions of the teacher model and the student model on the local focus word sets are obtained respectively. Based on the difference between the first probability distribution and the second probability distribution, as well as the difference between the local probability distributions of the teacher model and the student model on the local focus word set, the student model is distilled to obtain the target student model, which is used to process the response task.
[0006] One embodiment of this application provides a model-based training processing apparatus, comprising: The acquisition module is used to acquire training data for the Kth round of distillation training of the student model, where K is a positive integer. The training data includes the input text and the standard response content of the input text. The standard response content of the input text is determined based on the first probability distribution obtained after the teacher model processes the response to the input text. The first probability distribution includes the first prediction probability of the teacher model for each candidate word in the vocabulary. The calling module is used to call the student model to process the input text and obtain the second probability distribution, which includes the student model's second prediction probability for each candidate word in the vocabulary. The word set determination module is used to determine the local focus word set of the teacher model and the student model from each candidate word in the vocabulary based on the first probability distribution and the second probability distribution, and to obtain the local probability distribution of the teacher model and the student model on the local focus word set respectively. The training module is used to distill the student model based on the difference between the first probability distribution and the second probability distribution, as well as the difference between the local probability distributions of the teacher model and the student model on the local focus word set, to obtain the target student model, which is used to process the response task.
[0007] In one embodiment, K is 1; The acquisition module retrieves the training data for the Kth round of distillation training of the student model, including the following implementation process: Obtain at least one initial input text; Based on each initial input text, the teacher model and student model are called to process the responses, and the responses of the teacher model and student model to the initial input text are obtained respectively. Based on the teacher model and student model, the response content for each initial input text is compared using the response comparison model to obtain the response comparison results for each initial input text. Based on the comparison results of the responses to at least one initial input text, sample sampling is performed on at least one initial input text to obtain a sample corresponding to at least one initial input text. At least one initial input text is used as the sampled text for the Kth round of distillation training of the student model, and the teacher model's response to the sampled text is used as the standard response to the input text. The input text is combined with the standard response to the input text to obtain the training data for the Kth round of distillation training of the student model.
[0008] In one embodiment, the sample sampling process includes positive sample sampling, wherein the sampled samples include representative positive samples; The acquisition module performs sample sampling on at least one initial input text based on the comparison results of responses to at least one initial input text, and obtains the sampled samples corresponding to at least one initial input text. The specific implementation methods include: Each initial input text whose response comparison result is the same in at least one initial input text is identified as a positive sample. Each positive sample is clustered according to the first quantity to obtain one or more first-class clusters, and the number of one or more first-class clusters is the first quantity; Obtain the cluster center of each first cluster, and determine the representative positive samples of the first cluster from the positive samples contained in the first cluster based on the distance between the positive samples contained in the first cluster and the cluster center of the first cluster. One or more representative positive samples of the first category are determined as representative positive samples corresponding to at least one initial input text.
[0009] In one embodiment, the sample sampling process includes negative sample sampling process, wherein the sampled samples include representative negative samples. The acquisition module performs sample sampling on at least one initial input text based on the comparison results of responses to at least one initial input text, and obtains the sampled samples corresponding to at least one initial input text. The specific implementation methods include: Each initial input text in which the response comparison results are different is identified as a negative sample. Clustering is performed on each negative sample according to the second quantity to obtain one or more second clusters, and the number of one or more second clusters is the second quantity; Obtain the cluster center of each second cluster, and determine the representative negative samples of the second cluster from the negative samples contained in the second cluster based on the distance between the negative samples contained in the second cluster and the cluster center of the second cluster; One or more representative negative samples of the second type cluster are determined as representative negative samples corresponding to at least one initial input text.
[0010] In one embodiment, the sample sampling process includes positive sample sampling, wherein the sampled samples include a group of positive samples. The acquisition module performs sample sampling on at least one initial input text based on the comparison results of responses to at least one initial input text, and obtains the sampled samples corresponding to at least one initial input text. The specific implementation methods include: Each initial input text whose response comparison result is the same is identified as a positive sample, and each initial input text whose response comparison result is different is identified as a negative sample. Calculate the sample distance between each negative sample and each positive sample, and based on the sample distances corresponding to each negative sample, determine the nearest positive sample corresponding to the negative sample from each positive sample; Based on the sample distance between each negative sample and its nearest positive sample, the negative samples are sorted to obtain a sample sequence. According to the sample selection rules, positive samples are determined from the sample sequence, and the positive samples are combined with the nearest positive samples corresponding to the positive samples to obtain at least one group of positive samples corresponding to the initial input text.
[0011] In one embodiment, the acquisition module determines positive class samples from the sample sequence according to sample selection rules, including: Obtain the sample selection ratio indicated by the sample selection rules, and count the number of negative samples included in the sample sequence. The sample selection ratio is multiplied by the sample size to obtain the sample selection value; The sequence position indicated by the sample selection value in the sample sequence is determined as the target sequence position, and the negative sample in the sample sequence that is at the target sequence position is determined as the target negative sample; Negative samples in the sample sequence that precede the target negative sample are identified as positive samples.
[0012] In one embodiment, K is an integer greater than 1; The specific implementation of the acquisition module for obtaining training data for the Kth round of distillation training of the student model includes: Obtain the training data for the K-1th round of distillation training of the student model, and determine the training data for the K-1th round of distillation training as the predecessor training data; Obtain representative negative samples and positive samples from the predecessor training data, and determine the representative negative samples from the predecessor training data as the predecessor representative negative samples, and determine the positive samples from the predecessor training data as the predecessor positive samples. Obtain the standard response content of the representative negative samples of the predecessor and the standard response content of the positive samples of the predecessor class; Based on the standard responses of the predecessor representative negative samples, the predecessor class positive samples, the predecessor representative negative samples, and the predecessor class positive samples, the predecessor training data is scaled up to obtain the training data for the Kth round of distillation training of the student model.
[0013] In one embodiment, the first probability distribution includes the first word position probability distribution of the teacher model on N word positions, where N is a positive integer, and the second probability distribution includes the second word position probability distribution of the student model on N word positions. The first word position probability distribution includes the first prediction probability of the teacher model for each candidate word in the vocabulary, and the second word position probability distribution includes the second prediction probability of the student model for each candidate word in the vocabulary. The word set determination module, based on the first and second probability distributions, determines the specific implementation of the locally focused word sets for the teacher and student models from among the candidate words in the vocabulary, including: Based on the probability distribution of the first and second word positions at each word position, determine the word focus set for that word position; By aggregating the word focus sets of N word positions, we obtain the local focus sets of the teacher model and the student model.
[0014] In one embodiment, the N word positions include word position i; The word set determination module determines the word set for word position i based on the probability distributions of the first and second word positions at word position i, including: Sort the first predicted probabilities contained in the first probability distribution of the first word position i in descending order to obtain the first probability sequence of word position i. The second predicted probabilities contained in the second probability distribution of word position i are sorted in descending order to obtain the second probability sequence of word position i. The candidate words corresponding to the first predicted probabilities of the first probability sequence of word position i are determined as the focus word set of the teacher model for word position i, where L is a positive integer; The candidate words corresponding to the first L second predicted probabilities in the second probability sequence of word position i are determined as the focus word set of the student model for word position i; The word set of the teacher model for word position i is combined with the word set of the student model for word position i to obtain the word set of the word position i.
[0015] In one embodiment, the training module performs distillation training on the student model based on the difference between the first probability distribution and the second probability distribution, and the difference between the local probability distributions of the teacher model and the student model on the local focus word set, respectively, to obtain a specific implementation of the target student model, including: The global distillation loss is determined based on the difference between the first probability distribution and the second probability distribution; The local distillation loss is determined based on the difference between the local probability distributions of the teacher model and the student model on the local focus word set. The student model is optimized based on global distillation loss and local distillation loss to obtain the target student model.
[0016] In one embodiment, the local probability distributions of the teacher model and the student model on the local focus word set include the word position local probability distributions of the teacher model and the student model on the word position focus word set for each word position. The training module determines the specific implementation of the local distillation loss based on the differences in local probability distributions between the teacher model and the student model on the locally focused word set, including: Based on the difference in the local probability distribution of the word position on the word position focus set of each word position between the teacher model and the student model, the local distillation loss of the word position corresponding to that word position is determined. The local distillation loss is obtained by summing the local distillation losses corresponding to the N word positions.
[0017] In one embodiment, the N word positions include word position i; The training module determines the local distillation loss for word position i based on the difference in the local probability distribution of word position i between the teacher model and the student model on the word position focus set. This process includes: Based on the first word position probability distribution of the teacher model at word position i, obtain the first prediction probability of the teacher model for each focused word in the word position focused word set at word position i; Based on the second word position probability distribution of the student model at word position i, obtain the second prediction probability of the student model for each focused word in the word position focused word set at word position i; The local distillation loss function is used to calculate the loss of the first prediction probability and the second prediction probability of each focal word in the focal word set of word position i, so as to obtain the word local distillation loss of each focal word in the focal word set of word position i. The word local distillation loss corresponding to each focal word in the focal set of word position i is summed to obtain the word local distillation loss corresponding to word position i.
[0018] In one embodiment, the training module optimizes the student model based on global distillation loss and local distillation loss to obtain a specific implementation of the target student model, including: The response classification loss is determined based on the standard response content of the input text and the second probability distribution; Obtain the classification weights, global distillation weights, and local distillation weights; Based on classification weights, global distillation weights, and local distillation weights, the classification loss, global distillation loss, and local distillation loss are weighted and calculated to obtain the total distillation loss. The student model is optimized based on the total distillation loss to obtain the target student model.
[0019] In one embodiment, the training module optimizes the student model according to the total distillation loss to obtain a specific implementation of the target student model, including: The student model is optimized based on the total distillation loss to obtain the student model trained in the Kth round. If the student model trained in the Kth round satisfies the model convergence condition, then the student model trained in the Kth round is determined as the target student model; If the student model trained in the Kth round does not meet the model convergence condition, then the training data of the (K+1)th round of distillation training is obtained, and the student model trained in the Kth round is distilled based on the training data of the (K+1)th round of distillation training to obtain the target student model.
[0020] One embodiment of this application provides a computer device, including: a processor and a memory; The memory stores a computer program, which, when executed by a processor, causes the processor to perform the methods described in the embodiments of this application.
[0021] One aspect of this application provides a computer-readable storage medium storing a computer program, which includes program instructions. When executed by a processor, the program instructions perform the methods described in this application.
[0022] One aspect of this application provides a computer program product comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the method provided in one aspect of the embodiments of this application.
[0023] In this embodiment, a distillation training scheme for a student model is provided. During the Kth round of distillation training of the student model, training data for the Kth round can be obtained. This training data includes the input text and the standard response content provided by the teacher model to this input text (this standard response content is determined based on the first probability distribution obtained after the teacher model processes the input text, which includes the teacher model's first prediction probability for each candidate word in the vocabulary). Based on this input text, the student model can be invoked to process the response, thereby obtaining the student model's second probability distribution (including the second prediction probability for each candidate word). Subsequently, based on the first and second probability distributions, this application filters out the local focus word sets of the teacher model and the student model from the candidate words in the vocabulary, and obtains the local probability distributions of the teacher model and the student model on these local focus word sets. Finally, based on the difference between the first and second probability distributions, and the difference between the local probability distributions of the teacher model and the student model on these local focus word sets, the student model is jointly distilled to obtain the final target student model for processing the response task. It should be understood that this application abandons the traditional distillation scheme's coarse alignment mode that treats all lexical units in the vocabulary equally. Instead, it uses two probability distributions output by the teacher and student models to filter out key lexical units that are locally focused by both models, dynamically constructing a locally focused word set. Based on the local probability distributions of the two models on this locally focused word set, local alignment of these local keywords can be achieved. The difference between the two probability distributions enables global alignment for the student model, while the difference between the local probability distributions of the two models on the locally focused word set allows for local alignment. Through joint global and local distillation training, the student model, while aligning with the overall understanding of the teacher model, can deeply understand and internalize the teacher model's judgment logic at semantic nuances, effectively improving the training effect of the student model. Moreover, in this process, this application automatically determines the locally focused word set, eliminating the need for any manual annotation or predefined difficult samples to identify the focused word set that requires special attention. This also reduces manual costs and saves model training time, thereby improving model training efficiency. In summary, this application can improve the training efficiency and training effect of the student model. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 This is a schematic diagram of the architecture of a model distillation training system provided in an exemplary embodiment of this application; Figure 2 This is a schematic diagram of a scenario provided in an embodiment of this application; Figure 3 This is a schematic flowchart of a model-based training processing method provided in an embodiment of this application; Figure 4 This is a schematic flowchart illustrating a process for determining training data for the first round of distillation training, provided in an embodiment of this application. Figure 5 This is a schematic diagram of a logical architecture for determining the training data for the first round, provided in an embodiment of this application. Figure 6 This is a schematic diagram of the logical architecture for model replacement training provided in an embodiment of this application; Figure 7 This is a schematic diagram of the structure of a model-based training processing device provided in an embodiment of this application; Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0026] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0027] For ease of understanding, the relevant technical terms used in the embodiments of this application will be introduced first below.
[0028] Large Language Model (LLM): Large language models are artificial intelligence models trained on massive amounts of text data using deep learning. They consist of artificial neural networks with many parameters (typically billions or more weights) and are capable of understanding, generating, and reasoning about natural language. At their core, they learn the statistical patterns of language through a Transformer architecture (or a similar structure), thereby enabling them to perform various tasks such as text generation, question answering, translation, and code writing.
[0029] Prompt: The instructions, questions, or text input into a large language model guide it to generate specific outputs. It is a key medium for human-computer interaction, determining the model's response direction, style, and content quality.
[0030] Knowledge Distillation (KD): Knowledge distillation is a model compression technique designed to transfer knowledge from a complex, high-performance "Teacher Model" to a lightweight "Student Model," thereby reducing computational and storage overhead while maintaining high performance.
[0031] The design concept of this application will be introduced below.
[0032] Large language models, with their powerful natural language understanding and generation capabilities, have demonstrated outstanding performance in various natural language processing tasks. For example, they are widely used in intelligent dialogue, content creation, and code generation. However, large language models suffer from drawbacks such as large user base, high computational demands, and long inference times (typically 2 seconds or more per line), which significantly limit their commercial deployment. To balance performance and efficiency, knowledge distillation is widely adopted. Its core principle is to transfer the knowledge and capabilities of a large model (teacher model) to a smaller model (student model) with fewer parameters and faster inference. However, choosing the appropriate parameter size for the smaller model and conducting the distillation process effectively to train a smaller model that meets the specific needs of the application remains a challenge.
[0033] In traditional approaches, the distillation of the student model mainly employs two methods: (1) Response-based distillation. In this approach, knowledge transfer is typically achieved by minimizing the difference in output layer probability distributions between the teacher and student models (e.g., Kullback-Leibler divergence). Typical implementations include selecting representative samples, using KL divergence as the loss function, and measuring the difference between the output distributions of the student and teacher models. This approach is simple to implement and highly versatile. (2) Feature-based distillation. In this approach, deeper semantic knowledge is conveyed by aligning the hidden states of the intermediate layers between the teacher and student models. By extracting the feature representations of the intermediate layers of the teacher model, the student model is guided to learn deeper semantic information. This method typically designs a specific loss function to make the intermediate layer features of the student model as close as possible to the corresponding features of the teacher model.
[0034] For the distillation method (1) mentioned above, the probability distribution of the output layer is calculated on a vocabulary of tens of thousands to hundreds of thousands. Most of the word units in the vocabulary (such as common function words and high-frequency general words) contribute very little to the task discrimination, while the truly key and easily confused word units (such as words like "subscribe" and "renew" in intent classification) account for too small a proportion in the overall loss and cannot be fully learned. This will cause the student model to "align" with the teacher model in the overall distribution, but it will still perform poorly at the key decision boundary. It often requires manual screening of difficult samples and repeated adjustment of data ratios to improve the effect, resulting in low automation and high iteration costs. As for the distillation method (2) mentioned above, since the large and small models in actual applications have significant differences in the number of layers, dimensions and structure, if feature distillation is adopted, it is necessary to manually determine which layer of the large model the features of each layer of the small model come from, how to align these different numbers of features, etc., that is, it is necessary to manually design complex feature mapping and alignment strategies, such as layer-by-layer matching, adaptive pooling, etc. The process is cumbersome, highly customized, and has weak generalization ability, making it very difficult to operate and difficult to achieve a standardized and automated distillation process.
[0035] In summary, traditional distillation schemes for large language models suffer from several drawbacks. The student model struggles to learn difficult samples and key words, requiring frequent manual intervention in data sampling for model distillation. This results in low training efficiency and poor training outcomes. Therefore, to improve the training efficiency and effectiveness of the student model in large language model distillation training scenarios, this application proposes a distillation training scheme for the student model. The distillation training scheme provided in this application generally includes five consecutive steps: 1. Obtain training data for the Kth round of distillation training of the student model.
[0036] The distillation training of the student model typically involves multiple iterative rounds. Each round of training refines the model from the previous round. In any round of model training, the scheme provided in this application can be followed, where K can be any positive integer. During the Kth round of distillation training of the student model, training data for that round is required. This training data includes training text (or input text), which can be any text used for model training. For each training text, a cue word can be generated. This cue word instructs the teacher model to perform intent understanding processing on the training text, fully comprehending its intent and responding accordingly. In other words, the cue word instructs the teacher model to respond to the training text, obtaining its response content. The response content generated by the teacher model serves as the standard response content for this training text. The training text and its standard response content together constitute training data. The teacher model can refer to a model that performs well on natural language processing tasks (or response tasks). It can also be called a reference model. This application uses the output of the teacher model after processing the training text as the standard response content for the training text. During the teacher model's response processing of the training text, the teacher model uses a pre-set vocabulary (containing millions or tens of millions of words; this vocabulary can be understood as a dictionary used by the model for response; each word in the vocabulary is called a candidate word; this vocabulary can be pre-deployed in both the teacher and student models, and the response processing of both models must be based on this vocabulary) to calculate the prediction probability of all candidate words in the vocabulary for each word position, starting from the first word position. Based on the prediction probability of each candidate word at each word position, the one with the highest prediction probability is selected as the text word predicted by the teacher model at that word position. When calculating the prediction probability of each candidate word at a certain word position, the model uses the text word predicted at the previous word position for prediction calculation. Ultimately, the teacher model can predict text words at multiple consecutive positions. The text content composed of these text words at multiple positions can serve as the teacher model's response to the training text, and can be used as the standard response. For any given position, the predicted probabilities of each candidate word calculated by the teacher model for that position can form a probability distribution for that position (called the first position probability distribution). The first position probability distributions of all positions can form the overall probability distribution output by the teacher model, which can be called the teacher model's first probability distribution.In other words, the training data for the Kth round of this application will include the input text and the standard response content of the input text, and the standard response content of the input text is determined based on the first probability distribution output by the teacher model.
[0037] 2. Call the student model to process the input text and obtain the second probability distribution.
[0038] After obtaining the training data for the Kth round of distillation training, a cue word can be generated for the input text in this training data. This cue word instructs the student model to perform intent understanding processing on the input text, so as to fully understand the intent of the input text and respond to it based on the understood intent. In other words, the cue word instructs the student model to respond to the input text to obtain the response content. The response content generated by the student model can be used as the predicted response content for this input text. Here, the student model can refer to a small model used to handle natural language processing tasks (or response tasks), whose parameter scale is much smaller than that of the teacher model. Similarly, during the student model's response to the input text, the student model determines the word positions included in the standard response content based on the standard response content output by the teacher model. Assuming the standard response content includes N word positions, the student model needs to start from the first word position and sequentially calculate the prediction probability for all candidate words in the vocabulary at each position (for clarity, the prediction probability determined by the teacher model can be called the first prediction probability, and the prediction probability determined by the student model can be called the second prediction probability). Based on the second prediction probability of each candidate word at each word position, the one with the highest second prediction probability can be selected as the text word predicted by the student model at that word position. When calculating the second prediction probability of each candidate word at a certain word position, the model will perform the prediction calculation based on the text word predicted at the previous word position. Ultimately, the student model can predict text words at multiple consecutive word positions. The text content composed of these multiple word positions can be used as the student model's response to the input text, and can be considered as the predicted response content. The purpose of model training in this application is to make this predicted response content continuously approach the standard response content. For any given word position, the second predicted probability of each candidate word calculated by the student model for that word position can form a probability distribution for that word position (called the second word position probability distribution). The second word position probability distribution of each word position can form the overall probability distribution output by the student model, which can be called the second probability distribution of the student model.
[0039] 3. Based on the first probability distribution and the second probability distribution, determine the local focus word set for the teacher model and the student model from each candidate word in the vocabulary.
[0040] The local focus word set here refers to a subset selected from all candidate words included in the entire vocabulary. Each word in this subset can be called a focus word, and each focus word refers to the word that the teacher model and the student model focus on in the current input (i.e., the input text). Specifically, these focus words can be words that the models assign a higher prediction probability to. The purpose of selecting the local focus word set is to concentrate the attention of subsequent distillation training on this local focus word set, thereby focusing the attention of distillation learning on keywords that both models focus on or that have prediction discrepancies, rather than performing an average alignment across the entire vocabulary.
[0041] 4. Obtain the local probability distributions of the teacher model and the student model on the local focus word set.
[0042] After determining the local focal word set, the teacher model's first prediction probability for each focal word in the local focal word set can be obtained from the first probability distribution. The probability distribution formed by these first prediction probabilities can be used as the local probability distribution of the teacher model for this local focal word set. Similarly, the student model's second prediction probability for each focal word in the local focal word set can be obtained from the second probability distribution. The probability distribution formed by these second prediction probabilities can be used as the local probability distribution of the student model for this local focal word set.
[0043] 5. Based on the difference between the first probability distribution and the second probability distribution, and the difference between the local probability distributions of the teacher model and the student model on the local focus word set, the student model is distilled to obtain the target student model.
[0044] Based on the difference between the first and second probability distributions, a global distillation loss can be determined for the student model. This global distillation loss is used to optimize the student model's parameters, aiming to drive the student model to learn the overall output distribution of the teacher model across the entire vocabulary, achieving an average alignment effect across the entire vocabulary. Conversely, based on the difference between the local probability distributions of the teacher and student models on their respective local focus sets, a local distillation loss can be determined for the student model. This local distillation loss is used to optimize the student model's parameters, aiming to drive the student model to more accurately mimic the teacher model's prediction preferences for local keywords highly relevant to task performance. The final distillation training loss consists of both the global and local distillation losses. This allows the student model to learn not only the overall output distribution of the teacher model but also its understanding and prediction capabilities for local keywords, resulting in a better-performing student model.
[0045] Therefore, this application, in the process of distillation training the student model, abandons the traditional distillation scheme's coarse alignment mode of treating all word elements in the vocabulary equally. Instead, it uses two probability distributions output by the teacher and student models to filter out key words that are locally focused by both models, dynamically constructing a local focused word set. Based on the local probability distributions of the two models on this local focused word set, local alignment of these local keywords can be achieved. Based on the difference between the two probability distributions, global alignment of the student model can be achieved, while based on the difference between the local probability distributions of the two models on the local focused word set, local alignment of the student model can be achieved. Through joint global and local distillation training, the student model can, on the basis of aligning with the overall understanding ability of the teacher model, deeply understand and internalize the judgment logic of the teacher model at semantic subtle differences, which can effectively improve the training effect of the student model. Moreover, in this process, by automatically determining the local focused word set, no manual annotation or predefined difficult samples are needed to find the focused word set that needs to be focused on, which can also reduce manual costs and save model training time, thereby achieving the goal of improving model training efficiency.
[0046] The model distillation training scheme provided in this application can be applied to any scenario with natural language processing task requirements (or response processing requirements), including but not limited to: intelligent dialogue scenarios, video companionship scenarios, etc. Wherein: Intelligent dialogue scenarios refer to scenarios where humans and computer devices engage in dialogue using voice or text. This includes, but is not limited to, dialogue scenarios in fields such as intelligent transportation, intelligent vehicles (e.g., in-vehicle intelligent assistants), and intelligent robots (e.g., physical robots, or robots in conversational applications (text robots, voice robots, multimodal digital humans, intelligent quality inspection, agent assistance, etc.)). For example, a dialogue scenario where an intelligent robot in a hotel (or other service scenarios such as customer service) converses with a human; another example is a dialogue scenario where a robot in an in-vehicle application converses with a human; and so on. It is worth noting that in intelligent dialogue scenarios, the dialogue between a human and a computer device (such as an intelligent robot with dialogue capabilities) can be a single conversation or multiple conversations; this application embodiment does not limit this. In intelligent dialogue scenarios, the computer device can use the distillation training method provided in this application to train a student model (e.g., a dialogue model) to obtain a dialogue model, and then deploy this dialogue model on the computer device. Thus, after receiving a question text input by the user, the computer device can call the dialogue model to perform intent recognition processing on the question text, and perform content retrieval based on the recognized intent to obtain a response content that meets the user's needs.
[0047] The video-accompanied viewing scenario refers to a situation where a video-accompanied robot accompanies a user while watching videos. Users can input their questions about the videos into the video-accompanied robot (e.g., in the TV series *AA*, in which episode does the protagonist V discover the bad guys?), and the video-accompanied robot can search for relevant videos and series based on the user's question to return an answer to the user. In this video-accompanied viewing scenario, the distillation training method provided in this application can be used to train a student model (such as a response model) to obtain a response model. This response model is then deployed into the video-accompanied robot, allowing the robot to call upon this response model to understand the user's input question text and, based on the identified intent, search for relevant videos and series, ultimately obtaining the user's answer.
[0048] In summary, the model distillation training scheme provided in this application can improve the training efficiency and effect of the student model, making the trained model perform better in handling response tasks (or natural language processing tasks, such as the aforementioned video retrieval task, dialogue task, etc.), and can effectively improve business coverage to a certain extent (such as expanding applicable scenarios).
[0049] It should be noted that the above-mentioned application scenarios are merely examples and do not limit the application scenarios applicable to the text correction scheme provided in this application embodiment.
[0050] Furthermore, the model distillation training scheme provided in this application embodiment can be executed by a computer device, which may include a terminal or a server, and may also include both a terminal and a server. To facilitate understanding of the model distillation training scheme provided in this application embodiment, the following is combined with... Figure 1 The model distillation training system shown illustrates the application scenarios involved in the embodiments of this application; wherein, Figure 1 This is a schematic diagram of the architecture of a model distillation training system provided in an exemplary embodiment of this application, such as... Figure 1 As shown, the model distillation training system includes a terminal 101 and a server 102; wherein: 1) Terminal 101 may include the terminal device used by the user. Of course, depending on the application scenario and field in which the model distillation training scheme is applied, the terminal providing the model distillation training scheme in this application embodiment may vary. Terminal devices may include, but are not limited to: smartphones (such as smartphones running Android, smartphones running Internetworking Operating System (IOS), or smartphones running HarmonyOS), tablet computers, portable personal computers, mobile Internet devices (MID), in-vehicle devices, head-mounted devices, desktop computers, intelligent robots, arcade devices, smart home devices, and intelligent voice interaction devices, etc. This application embodiment does not limit the type of terminal device, as stated here.
[0051] For example, in the context of intelligent robots, the terminal device can be an intelligent robot. That is, in this implementation, the model distillation training scheme provided in this application can be deployed on the intelligent robot. The intelligent robot, according to the model distillation training scheme provided in this application, performs distillation training on a task model used as a student model to obtain an optimized task model. This optimized task model can be deployed in the intelligent robot, which can then call the optimized task model to handle relevant response tasks. For instance, when a user converses with the intelligent robot, the intelligent robot calls the task model to perform intent recognition processing on the user's input text to correctly identify the user's true intent. Afterward, the intelligent robot can provide corresponding services to the user based on their true intent (such as intelligent robots in hotels providing directions or food pickup services). As another example, in the context of intelligent vehicles, the application deploying the model distillation training scheme provided in this application is an in-vehicle application. The type of this in-vehicle application can include, but is not limited to, music, video, or games.
[0052] An application can refer to a computer program designed to perform one or more specific tasks. Classifying applications according to different dimensions (such as how they run and their functions) can yield different types of the same application. For example, based on how they run, applications can include, but are not limited to: clients installed on a terminal, small programs that can be used without downloading and installation (as subroutines of the client), and World Wide Web (Web) applications opened through a browser. Another example is based on their functional type, which can include, but is not limited to: instant messaging (IM) applications, interactive content applications, audio applications, or video applications. Instant messaging applications refer to applications that facilitate instant communication and social interaction over the internet, and can include, but are not limited to: applications with communication functions, map applications with interactive functions, and game applications. Interactive content applications are applications capable of content interaction, such as sharing platforms, personal spaces, and news applications. Audio applications are applications that implement audio functions over the internet, and can include, but are not limited to: music applications with music playback and editing capabilities, radio applications with radio playback capabilities, or live streaming applications with live streaming capabilities. A video application is an application that can play videos. Video applications can include, but are not limited to, applications that play short videos (videos are often short, such as a few seconds or a few minutes), applications that play long videos (such as movies or TV series, which are often longer), and so on.
[0053] Of course, the model distillation training scheme provided in this application embodiment can be deployed directly on a device (such as an intelligent robot) or outside of an application, as described above, or it can be deployed in the form of a plug-in on a device or application. This application embodiment does not limit the carrier for deploying the model distillation training scheme.
[0054] 2) Server 102 can be a server corresponding to the terminal, used to interact with the terminal to provide computing and application service support. Specifically, this server is the backend server corresponding to the application deployed in the terminal, used to interact with the terminal to provide computing and application services for the application. Server 102 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0055] For example, in a video-watching scenario, the computer device can be a server. That is, in this implementation, the model distillation training scheme provided in this application can be deployed on this server. The server can pre-train and optimize a task model (serving as a student model) according to the model distillation training method provided in this application. After obtaining the optimized task model, it can be deployed on the server. The terminal can receive the user's question text about the video and send it to the server. The server can call this task model to perform intent recognition processing. After obtaining the user's true intent, the server can perform relevant searches of the video content based on the user's true intent to generate a response to the user's question and return it to the terminal. The terminal can then display the response returned by the server.
[0056] The terminal 101 and the server 102 can be directly or indirectly connected via wired or wireless communication, and this application does not impose any limitations on this. Furthermore, this application does not limit the number of terminals and servers; Figure 1 The number of terminals 101 and servers 102 is only a single example. In actual applications, multiple servers may be distributed in a distributed manner. This is just a brief explanation.
[0057] Based on the model distillation training scheme and system architecture described above, the following points should also be noted: (1) The embodiments of this application mentioned above Figure 1The system shown is intended to more clearly illustrate the technical solutions of the embodiments of this application and does not constitute a limitation on the technical solutions provided in the embodiments of this application. Those skilled in the art will understand that, with the evolution of system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems. For example, the above description uses the example of the execution subject "computer device" of this application including a terminal and a server, that is, the model distillation training scheme provided in the embodiments of this application being jointly executed by the terminal and the server, to introduce one application scenario of the model distillation training scheme; it should be understood that, in practical applications, the computer device can also be a terminal or a server, that is, it supports the terminal or server to execute the model distillation training scheme provided in the embodiments of this application independently.
[0058] (2) The data collection and processing in this application embodiment should strictly comply with the requirements of relevant laws and regulations. The acquisition of personal information must be based on the knowledge or consent of the individual (or have a legal basis for information acquisition), and subsequent data use and processing should be carried out within the scope of laws and regulations and the authorization of the personal information subject. For example, when this application embodiment is applied to specific products or technologies, such as when acquiring the user's text data, the user's permission or consent is required, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant regions.
[0059] Based on the solution described above, please refer to [link / reference needed] for a better understanding of its application scenarios. Figure 2 , Figure 2 This is a schematic diagram of a scenario provided in an embodiment of this application. Wherein, as... Figure 2 The scenario shown is an example of an intelligent question-and-answer scenario.
[0060] In such Figure 2In the illustrated scenario, it is assumed that user a's terminal device is running a smart assistant application. User a can use this smart assistant application to query information they want to know. After user a runs the smart assistant application on their terminal device, the terminal device can display the smart assistant application's dialogue page 2001. User a can input their relevant questions on this dialogue page 2001 and view the smart assistant application's answers to their questions on this dialogue page 2001. In this embodiment, the smart assistant application can correspond to a server. This server can provide related computing services for the smart assistant application. Specifically, this server can deploy a response model. This response model can perform intent recognition on the user's input question text to identify the user's query intent and process the question response based on the identified query intent, generating corresponding response content. The response model deployed on the server can be trained using the model distillation training method provided in this solution, exhibiting good response performance.
[0061] like Figure 2 As shown, assuming user a enters the question text "What is the simplest way to cook sauerkraut fish" in the dialogue page 2001, the terminal device can generate a response request based on the received question text and send the response request to the server. After receiving the response request, the server can first input the question text into the response model, which will then perform intent recognition processing on the question text, perform response processing based on the identified query intent, and output the response content.
[0062] Furthermore, the server can return the response content output by the model as a response result to the terminal device. The terminal device can then generate a final response based on the server's response and display it on dialog page 2001. Taking an example where the server's response includes the simplest steps for making sauerkraut fish, the response displayed on dialog page 2001 could be: "The following are the simplest steps for making sauerkraut fish: 1. xxxxxx; 2. xxxxxxx; ...." Through the response displayed on the terminal device, user A can learn the simplest process for making sauerkraut fish.
[0063] As can be seen, the model distillation training scheme provided in this application embodiment can improve the training efficiency and training effect of the response model in the intelligent question answering scenario. The trained response model can more accurately identify the user's query intent, thereby providing the user with more accurate and reliable response content, thus improving the user experience.
[0064] Based on the model distillation training scheme and application scenarios described above, this application provides a more detailed model-based training processing method. The model-based training processing method proposed in this application will be described in detail below with reference to the accompanying drawings.
[0065] Please see Figure 3 , Figure 3 This is a flowchart illustrating a model-based training method provided in an embodiment of this application. The flowchart may refer to the model distillation training scheme provided in this embodiment. The model-based training method can be executed by a computer device in the aforementioned system, such as a terminal and / or a server. The model-based training method may include at least the following steps S301-S304: Step S301: Obtain training data for the Kth round of distillation training of the student model, where K is a positive integer. The training data includes the input text and the standard response content of the input text. The standard response content of the input text is determined based on the first probability distribution obtained after the teacher model processes the input text. The first probability distribution includes the first prediction probability of the teacher model for each candidate word in the vocabulary.
[0066] In this application, the distillation training of the student model typically involves a multi-round iterative training process. Each round of training further optimizes the model trained in the previous round. In any round of model training, the scheme provided in this application can be followed, where K can be any positive integer. During the Kth round of distillation training of the student model, training data for the Kth round of distillation training needs to be obtained. This training data includes training text (or input text), which can be any text used for model training.
[0067] Based on the above, the teacher model can be invoked to process the input text (first performing intent recognition to identify the text intent, and then providing a corresponding response based on the text intent). The teacher model starts from the first word position and predicts the text words at multiple positions sequentially until the predictions are complete. The final text words at these multiple positions form the teacher model's response to the input text, which serves as the standard response to the input text. For a given word position, the teacher model calculates the predicted probability of all candidate words in the vocabulary at that position (called the first prediction probability). The candidate word with the highest first prediction probability is selected as the text word at that position. For any given word position, the probability distribution formed by the teacher model's first prediction probabilities for each candidate word in the vocabulary serves as the teacher model's first word position probability distribution for that word position. The teacher model's first word position probability distributions for all word positions can form a larger probability distribution, which serves as the final first probability distribution determined by the teacher model.
[0068] Step S302: Call the student model to respond to the input text and obtain the second probability distribution. The second probability distribution includes the student model's second prediction probability for each candidate word in the vocabulary.
[0069] In this application, based on the above, the student model can be called to process the input text. Similarly, during the process of the student model processing the input text, the student model will determine the word positions included in the standard response content based on the standard response content output by the teacher model. Here, assuming that the standard response content includes N (N is a positive integer, usually an integer greater than 1) word positions, the student model needs to start from the first word position and calculate the prediction probability of all candidate words in the vocabulary for each word position in turn (for ease of distinction, the prediction probability determined by the teacher model can be called the first prediction probability, and the prediction probability determined by the student model can be called the second prediction probability). Based on the second prediction probability of each candidate word in each word position, the one with the largest second prediction probability can be selected as the text word predicted by the student model in this word position. When the model calculates the second prediction probability of each candidate word in a certain word position, it will perform the prediction calculation based on the text word predicted in the previous word position. Ultimately, the student model can predict text words at multiple consecutive word positions. The text content composed of these multiple word positions can serve as the student model's response to the input text, and can be used as the predicted response. The purpose of training the model in this application is to make this predicted response continuously approach the standard response. For any word position, the second predicted probability of each candidate word determined by the student model for that word position can form a probability distribution for that word position (called the second word position probability distribution). The second word position probability distributions of each word position can form the overall probability distribution output by the student model, which can be called the second probability distribution of the student model.
[0070] Step S303: Based on the first probability distribution and the second probability distribution, determine the local focus word set of the teacher model and the student model from each candidate word in the vocabulary, and obtain the local probability distribution of the teacher model and the student model on the local focus word set respectively.
[0071] In this application, the local focus word set refers to a subset selected from all candidate words included in the entire vocabulary. Each word in this subset can be called a focus word, and each focus word refers to the word that the teacher model and the student model focus on under the current input (i.e., the input text). Specifically, the focus words can be words that the model assigns a higher prediction probability to. The purpose of selecting the local focus word set is to concentrate the attention of subsequent distillation training on this local focus word set, thereby focusing the attention of distillation learning on keywords that both models focus on or that have prediction discrepancies, rather than performing an average alignment across the entire vocabulary.
[0072] The specific implementation process of determining the local focus word set of the teacher model and the student model from each candidate word in the vocabulary based on the first probability distribution and the second probability distribution can include at least the following: First, for any given word position, the focus word set of that word position can be determined according to the first word position probability distribution and the second word position probability distribution of that word position. That is, for any given word position, the focus word set of the teacher model and the student model at that word position can be determined according to the first word position probability distribution of the teacher model and the second word position probability distribution of the student model at that word position. This focus word set is called the focus word set of that word position. Here, we will take word position i among N word positions as an example to explain the detailed process of determining the focus word set of word position i. The process of determining the word focus set of word position i based on the first word position probability distribution and the second word position probability distribution of word position i can include at least the following: First, the first predicted probabilities contained in the first word position probability distribution of word position i can be sorted in descending order, and the resulting sequence can be used as the first probability sequence of word position i; Alternatively, the second predicted probabilities contained in the second word position probability distribution of word position i can be sorted in descending order, and the resulting sequence can be used as the second probability sequence of word position i.
[0073] Furthermore, the candidate words indicated by the first L (L is a positive integer, which can be set according to actual business needs) first predicted probabilities in the first probability sequence of word position i can be determined as the focus word set of the teacher model for word position i. That is, the first L first predicted probabilities in the first probability sequence can be obtained. These L first predicted probabilities are the probabilities with larger values that rank higher in the teacher model's prediction of word position i. The candidate words indicated by these L first predicted probabilities can all be used as the focus words of the teacher model for word position i. The set of these focus words can be used as the teacher model's focus word set for word position i. The student model focuses on the word set for word position i. Similarly, the candidate words corresponding to the first L second predicted probabilities in the second probability sequence of word position i can be determined as the student model's focus word set for word position i. That is, the first L second predicted probabilities in the second probability sequence can be obtained. These L second predicted probabilities are the probabilities of the student model predicting the word position i with the largest values. The candidate words indicated by these L second predicted probabilities can be used as the student model's focus words for word position i. The set of these focus words can be used as the student model's focus word set for word position i.
[0074] After determining the focus word sets for word position i for both the teacher and student models, we can perform a union operation on these two sets (i.e., find the union of the two focus word sets). This union serves as the focus word set for word position i, containing all focus words for word position i from both the teacher and student models. Following the method for determining the focus word set for word position i, we can determine the focus word sets for all word positions. Then, we aggregate the focus word sets of N word positions (which can be understood as forming a large set) to obtain the local focus word sets for both the teacher and student models. This local focus word set will include the focus word sets for each word position.
[0075] After determining the word focus set for each word position, this application can select the first prediction probability of each focused word in the word focus set for the teacher model from the first word position probability distribution for each word position. The probability distribution formed by these first prediction probabilities can be understood as the word position focusing probability distribution of the word position focusing set for the teacher model for that word position (also called the word position local probability distribution). Similarly, the second prediction probability of each focused word in the word position focusing set for the student model can be selected from the second word position probability distribution for that word position. The probability distribution formed by these second prediction probabilities can be understood as the word position focusing probability distribution of the word position focusing set for the student model for that word position (also called the word position local probability distribution). The word position focusing probability distribution of the teacher model for each word position can form a large local distribution, which can be used as the local probability distribution of the teacher model for the entire local word focus set; similarly, the word position focusing probability distribution of the student model for each word position can also form a large local distribution, which can be used as the local probability distribution of the student model for the entire local word focus set.
[0076] Step S304: Based on the difference between the first probability distribution and the second probability distribution, and the difference between the local probability distributions of the teacher model and the student model on the local focus word set, the student model is distilled to obtain the target student model, which is used to process the response task.
[0077] In this application, a global distillation loss can be determined based on the difference between the first probability distribution and the second probability distribution; and a local distillation loss can be determined based on the difference between the local probability distributions of the teacher model and the student model on the local focused word set. Based on the global distillation loss and the local distillation loss, the model parameters of the student model can be optimized in the Kth round to obtain the final target student model.
[0078] The method for determining the global distillation loss in this application can be implemented by introducing the KL loss function. Using this KL loss function, the loss can be calculated for the first probability distribution and the second probability distribution, thereby obtaining the global distillation loss value. The method for calculating the global distillation loss is as shown in formula (1): L_KL_global = ∑(y_true log(y_true / y_pred)) formula (1) Wherein, L_KL_global can be used to characterize the global distillation loss; y_true can be used to characterize the first prediction probability of the teacher model for a text word (the text word predicted by the teacher model) at a certain word position in the first probability distribution; y_pred can be used to characterize the second prediction probability of the student model for a text word (the text word predicted by the teacher model) at the same word position in the second probability distribution. The global distillation loss can be calculated using the method shown in formula (1).
[0079] The method used in this application to determine the local distillation loss can be implemented by introducing a local KL loss function. The specific implementation process of determining the local distillation loss based on the difference between the local probability distributions of the teacher model and the student model on the local focused word set can at least include: First, based on the difference in the local probability distributions of the teacher model and the student model on the focused word set for each word position, the local distillation loss corresponding to that word position can be determined. Here, we still take N word positions, including word position i, as an example to illustrate the specific process of determining the local distillation loss corresponding to word position i. The process of determining the local distillation loss corresponding to word position i based on the difference in the local probability distributions of the teacher model and the student model on the focused word set for word position i can at least include: Based on the first word position probability distribution of the teacher model on word position i, the first prediction probability of the teacher model for each focused word in the focused word set for word position i can be obtained; similarly, based on the second word position probability distribution of the student model on word position i, the prediction probability of the student model for each focused word in the focused word set for word position i can be obtained. The second prediction probability; further, for any focal word in the focal word set of word position i, the local distillation loss function can be used to calculate the loss of the first prediction probability (i.e., the prediction probability of the teacher model) and the second prediction probability (i.e., the prediction probability of the student model) corresponding to the focal word, so as to obtain the word local distillation loss corresponding to the focal word. Using this method, the word local distillation loss corresponding to each focal word in the focal word set of word position i can be obtained. By summing the word local distillation losses corresponding to each focal word in the focal word set of word position i, the word local distillation loss corresponding to word position i can be obtained. According to the method of determining the word local distillation loss corresponding to word position i, the word local distillation loss of N word positions can be determined, and then the word local distillation loss corresponding to N word positions can be summed to obtain the local distillation loss. The specific method for calculating the local distillation loss is as shown in formula (2): L_KL_local = ∑(y_true_S log(y_true_S / y_pred_S)) formula (2) Among them, L_KL_local can be used to characterize the local distillation loss; y_true_S can be used to characterize the first prediction probability of a focal word at a certain word position; y_pred_S can be used to characterize the second prediction probability of a focal word at the same word position; the word position local distillation loss can be calculated based on the first prediction probability and the second prediction probability of all focal words at a word position, and the local distillation loss can be obtained by summing the word position local distillation losses of all word positions.
[0080] Optionally, in a feasible embodiment, this application may also introduce a classification loss during the optimization of the student model to ensure that the student model does not deviate from the basic requirements of the task while imitating the teacher model. This classification loss can be calculated based on the cross-entropy loss function. Optimizing the student model through this cross-entropy loss can provide basic supervision signals, guarantee basic task performance, and combat knowledge bias or additional noise during the distillation process. In general, the cross-entropy loss (classification loss) provides a clear, stable, and correct optimization target. Based on this, the specific implementation process of optimizing the student model based on the global distillation loss and local distillation loss to obtain the target student model may include at least the following: First, the response classification loss can be determined based on the standard response content and the second probability distribution of the input text. In this process, for any standard response content in the input text, for any word position, the classification loss of that word position can be determined based on the text word at that word position in the standard response content and the text word at that word position in the predicted response content of the student model; the sum of the classification losses of each word position yields the response classification loss of the input text. The specific implementation method for determining the response classification loss for an input text can be shown in formula (3): Formula (3) Among them, as shown in formula (3) The response classification loss is used to characterize an input text i; The classification label used to characterize a word position j is 1 when the text word predicted by the student model for that word position is the same as the text word predicted by the teacher model for that word position, and 0 when the text word predicted by the student model for that word position is different from the text word predicted by the teacher model for that word position. The term is used to represent the probability of the student model predicting a text word at word j, given the prediction made by the teacher model; N represents the total number of word positions.
[0081] After determining the response classification loss, we can obtain the classification weights, global distillation weights, and local distillation weights. The classification weights can be the pre-set weights for the response classification loss, the global distillation weights can be the pre-set weights for the global distillation loss, and the local distillation weights can be the pre-set weights for the local distillation loss. The values of these three weights have a significant impact on the distillation effect and can be dynamically adjusted using a dynamic weight adjustment strategy. Specifically, in the first few training rounds of the student model's distillation training (these values can be set according to actual business needs, for example, the first 3 rounds, etc.), the classification weights can be set to 0.5, the global distillation weights to 0.5, and the local distillation weights to 0, so that the model focuses on global alignment rather than local alignment. As the model iterates through the training rounds, when the required number of rounds is reached, the classification weights can be set to 0.5, the global distillation weights to 0.25, and the local distillation weights to 0.25, so that the model begins to focus on local alignment. Of course, starting from the first round, the local distillation weight can be set to a very small value, and then gradually increased with each training round until it reaches 0.25. By setting classification weights, global distillation weights, and local distillation weights, the student model can first focus on global alignment, and then emphasize local alignment. In other words, the specific values of classification weights, global distillation weights, and local distillation weights in this application will be determined based on the value of K. When K is less than or equal to the round number condition value (set based on actual business needs, for example, set to 3), the classification weight can be set to 0.5, the global distillation weight to 0.5, and the local distillation weight to 0; when K is greater than the round number condition value (set based on actual business needs, for example, set to 3), the classification weight can be set to 0.5, the global distillation weight to 0.25, and the local distillation weight to 0.25.
[0082] Furthermore, based on classification weights, global distillation weights, and local distillation weights, the classification loss, global distillation loss, and local distillation loss can be calculated using weighted averages. Specifically, the classification weights can be multiplied by the response classification loss, the global distillation loss by the global distillation weights, and the local distillation loss by the local distillation weights. The sum of these multiplication results yields the total distillation loss. This total distillation loss can then be used to optimize the model parameters of the student model to obtain the target student model.
[0083] In practical applications, after optimizing the student model according to the total distillation loss, the student model trained in the Kth round can be obtained. This student model trained in the Kth round can be tested to see if it meets the model convergence condition (the model convergence condition in this application is, for example, the number of training rounds reaching a threshold). If the student model trained in the Kth round meets the model convergence condition, it can be determined as the target student model. If the student model trained in the Kth round does not meet the model convergence condition, the training data of the K+1th round of distillation training can be obtained. Based on the training data of the K+1th round of distillation training, the model distillation training method provided in this application is used to distill the student model obtained in the Kth round of training. After obtaining the student model trained in the K+1th round of distillation, it can be tested again to see if it meets the model convergence condition... and so on, until a student model that meets the model convergence condition is obtained through iterative training. This model can then be used as the target student model.
[0084] It is worth noting that this application provides an automatic evaluation scheme for the target student model obtained through distillation training. A third-party evaluation model is introduced to assess the response performance of the target student model obtained through distillation, in order to measure whether the output of the target student model is aligned with the output of the teacher model. Specifically, this application can generate a prompt word for the input text, the standard response content of the teacher model, and the predicted response content output by the target student model. This prompt word is used to instruct a third-party evaluation model to compare whether the two outputs are consistent. The evaluation model needs to generate an accuracy rate for the output of the target student model based on its own comparison results. If this accuracy rate reaches the accuracy rate threshold (e.g., 95%), it can be said that the output of the target student model is basically consistent with the output of the teacher model, and this target student model can be deployed to the application scenario to perform real-time response tasks. However, if this accuracy rate does not reach the accuracy rate threshold (e.g., 95%), it can be said that even through distillation training, the output of the target student model is still significantly different from the output of the teacher model. At this time, the target student model can be abandoned, and a model with a larger parameter scale than the current target student model can be used as a new student model. The model distillation training method provided in this application can be used to conduct a new distillation training. Since the new student model has a larger parameter scale, its processing performance can be better, so the response effect after distillation training is likely to meet the standard.
[0085] In this embodiment, the traditional distillation scheme abandons the coarse alignment mode of treating all lexical units in the vocabulary equally. Instead, it uses two probability distributions output by the teacher and student models to filter out key lexical units that are locally focused by both models, dynamically constructing a locally focused word set. Based on the local probability distributions of the two models on this locally focused word set, local alignment of these local keywords can be achieved. The difference between the two probability distributions enables global alignment of the student model, while the difference between the local probability distributions of the two models on the locally focused word set allows for local alignment. Through joint global and local distillation training, the student model, while aligning with the overall understanding of the teacher model, can deeply understand and internalize the judgment logic of the teacher model at semantic nuances, effectively improving the training effect of the student model. Moreover, in this process, this application automatically determines the locally focused word set, eliminating the need for any manual annotation or predefined difficult samples to identify the focused word set that requires special attention, thus reducing manual costs and saving model training time, thereby improving model training efficiency. In summary, this application can improve the training efficiency and training effect of the student model.
[0086] Furthermore, in this application, the training data for each round of distillation training is different, and the training data for any round of distillation training is determined based on the training data of the previous round. That is, this application first determines the training data for the first round of distillation training; based on the training data of the first round of distillation training, the training data for the second round of distillation training is determined; based on the training data of the second round of distillation training, the training data for the third round of distillation training is determined, and so on. The process of obtaining the training data for each round of distillation training will be described in detail below with reference to the accompanying drawings. Please refer to the accompanying drawings. Figure 4 , Figure 4 This is a schematic flowchart illustrating the process of determining training data for the first round of distillation training, provided in an embodiment of this application. Specifically, this process refers to the procedure for obtaining training data for the first round of distillation training on the student model when K is 1. Figure 4 As shown, the process may include at least the following steps S401-S406: Step S401: Obtain at least one initial input text.
[0087] In this application, the initial input text can be collected texts such as question texts, search texts, or query texts actually entered by different users, or it can be a series of texts pre-configured by relevant objects (such as users responsible for model training) for model training. Since these texts will be sampled later to select some texts for training the student model, the collected texts that have not yet been sampled can be referred to as the initial input text.
[0088] Step S402: Based on each initial input text, call the teacher model and student model to perform response processing respectively, and obtain the response content of the teacher model and student model for the initial input text respectively.
[0089] In this application, for any initial input text, the teacher model can be invoked to process its response, and the response content of the teacher model to this initial input text can be obtained through the response processing; alternatively, the student model can be invoked to process its response, and the response content of the student model to this initial input text can also be obtained through the response processing of the student model.
[0090] Step S403: Based on the teacher model and student model, the response comparison model is called to perform response comparison processing on the response content of each initial input text, so as to obtain the response comparison result of each initial input text.
[0091] In this application, after obtaining the responses from the teacher model and the student model to each initial input text, for any given initial input text, a response comparison model can be invoked to compare the responses of the two models to the same initial input text (referred to as response comparison processing) to obtain the response comparison results of the two models for this initial input text. Here, the response comparison model can be the same model as the third-party evaluation model mentioned above. Thus, this response comparison model can compare whether the response output by the student model is consistent with the response output by the teacher model. For example, after response comparison processing, the response comparison model can output the accuracy rate for each initial input text. For any given initial input text, if the accuracy rate output by the response comparison model is high (e.g., above an accuracy threshold), then the response output by the student model can be considered consistent with the response output by the teacher model, and the response comparison result for this initial input text can be determined as the same result (i.e., the response content output by the two models is the same). If the accuracy rate output by the response comparison model is low (e.g., below the accuracy rate threshold), it can be considered that the response output by the student model is inconsistent with the response output by the teacher model. The response comparison result of this initial input text can be determined as a different result (i.e., the response content output by the two models is different).
[0092] Step S404: Based on the response comparison results of at least one initial input text, perform sample sampling processing on at least one initial input text to obtain a sample corresponding to at least one initial input text.
[0093] In this application, based on the comparison results of responses to at least one initial input text, sample sampling can be performed on at least one initial input text to obtain sampled samples corresponding to at least one initial input text. Specifically, the sample sampling process in this application can include positive sample sampling, negative sample sampling, and positive-like sample sampling. Positive sample sampling can extract representative positive samples from at least one initial input text; negative sample sampling can extract representative negative samples from at least one initial input text; and positive-like sample sampling can extract a group of positive-like samples from at least one initial input text. Representative positive samples, representative negative samples, and the group of positive-like samples can collectively constitute the sampled samples corresponding to at least one initial input text.
[0094] The process of sampling at least one initial input text for positive samples based on the response comparison results of at least one initial input text to obtain representative positive samples corresponding to at least one initial input text may include at least the following steps: First, obtain each initial input text whose response comparison results are the same. For these initial input texts, the response content of the student model is consistent with the response content of the teacher model, so they can be identified as positive samples. Subsequently, representative positive samples can be selected from these positive samples as the final representative positive samples. Specifically, for each positive sample, clustering can be performed on each positive sample in advance according to a first number (e.g., using the K-means clustering algorithm to cluster them), thereby obtaining one or more clusters (which can be called the first cluster), and the number of one or more first clusters is the first number. This first number can be set according to actual business needs, and is usually set to a value around 20.
[0095] After identifying each first-class cluster, the cluster center of each first-class cluster can be obtained. For any first-class cluster, after determining its cluster center, the distance between each positive sample contained in that first-class cluster and its cluster center can be determined. The positive sample with the smallest distance can be used as the representative positive sample of that first-class cluster. In this way, the representative positive samples of each first-class cluster can be determined. By combining the representative positive samples of each first-class cluster (forming a set), at least one representative positive sample corresponding to the initial input text can be obtained. In other words, at least one representative positive sample corresponding to the initial input text is composed of the representative positive samples of each first-class cluster.
[0096] The process of negative sample sampling of at least one initial input text to obtain representative negative samples corresponding to at least one initial input text, based on the comparison results of responses to at least one initial input text, may include at least the following steps: First, each initial input text in the at least one initial input text whose response comparison results are different can be obtained. For these initial input texts, the response content of the student model is inconsistent with the response content of the teacher model, so they can be identified as negative samples. Subsequently, representative negative samples can be selected from these negative samples as the final representative negative samples. Specifically, for each negative sample, each negative sample can be pre-clustered according to a second quantity, thereby obtaining one or more clusters (referred to as second clusters for easy distinction). The number of one or more second clusters is the second quantity. This second quantity can also be set according to actual business needs. Since the response content output by the student model is mostly inconsistent with the teacher model before it has been trained, the number of negative samples is usually large. Therefore, in general, the value of the second quantity will be much larger than the value of the first quantity. For example, the second quantity can be set to around 200. It is worth noting that, since there are a large number of negative samples, in order to improve the accuracy of the clustering results, during the clustering process of each negative sample, a second number of cluster centers can be randomly selected in advance to perform multiple rounds of clustering. The clustering result with the smallest clustering loss can be selected as the final clustering result.
[0097] After obtaining one or more second-class clusters through clustering, the cluster center of each second-class cluster can be obtained. Then, for any second-class cluster, the distance between each negative sample contained in that second-class cluster and the cluster center of that second-class cluster can be obtained. The negative sample with the smallest distance can be used as the representative negative sample of that second-class cluster. Combining the representative negative samples of each second-class cluster (forming a set) yields at least one representative negative sample corresponding to the initial input text. In other words, at least one representative negative sample corresponding to the initial input text is composed of representative negative samples from each second-class cluster.
[0098] The process of sampling at least one initial input text for positive samples based on the response comparison results of at least one initial input text to obtain a group of positive samples corresponding to at least one initial input text may include at least the following steps: First, each initial input text with the same response comparison result can be identified as a positive sample, and each initial input text with a different response comparison result can be identified as a negative sample. Then, for any negative sample, the sample distance between the negative sample and each positive sample can be calculated, thus obtaining multiple sample distances. Based on each sample distance corresponding to the negative sample, the positive sample with the smallest sample distance can be taken as the nearest positive sample corresponding to the negative sample (i.e., the closest positive sample). In this way, the nearest positive samples corresponding to all negative samples can be determined. Further, the sample distance between each negative sample and its corresponding nearest positive sample can be obtained. According to the order of these sample distances from smallest to largest, the negative samples can be sorted, and the resulting sequence can be called the sample sequence. After obtaining the sorted sample sequence, positive samples can be determined from the sample sequence according to sample selection rules.
[0099] Specifically, the sample selection ratio indicated by the sample selection rules can be obtained (this ratio can be set according to actual business needs; in practice, the product of the sample selection ratio and the total number of negative samples can be controlled to be around 50), and the number of negative samples included in the sample sequence can be counted. Then, the sample selection ratio and the number of samples can be multiplied to obtain the sample selection value. After that, the sequence position indicated by this sample selection value can be obtained from the sample sequence. The sequence position indicated by the sample selection value in this sample sequence can be determined as the target sequence position, and the negative samples in the sample sequence that are at the target sequence position can be determined as target negative samples. Then, the negative samples in the sample sequence that are before the target negative samples can be determined as positive samples.
[0100] As can be seen, the "class positive sample" in this application refers to a negative sample whose sample distance is very close to that of a positive sample, and the sample selection rule refers to the rule for selecting class positive samples from various negative samples. According to this sample selection rule, class positive samples can be selected from various negative samples, and each class positive sample will have a nearest positive sample. In this application, each class positive sample can be combined with its nearest positive sample (which can mean that the class positive sample and its nearest positive sample are used as two elements to form a tuple). The resulting tuple can be used as a class positive sample group, and each class positive sample group is at least one class positive sample group corresponding to the initial input text.
[0101] It should be understood that positive samples can be understood as samples that the student model has already understood and can answer accurately. The student model can output relatively accurate answers to these positive samples. Therefore, this application can select a small number of representative positive samples to participate in model training to consolidate the student model's memory of these positive samples and prevent the model from forgetting. On the other hand, negative samples can be understood as samples that the student model has not understood at all and cannot answer accurately. The student model cannot accurately answer these negative samples, and the answers obtained do not meet the standards. Therefore, this application can extract a large number of representative negative samples to participate in model training to help the student model focus on mastering new knowledge points and learn how to handle these negative samples. As for positive-like samples, they can be understood as difficult samples. For the student model, these positive samples are like questions that "seem easy to do but always get wrong." These positive samples are semantically very similar to the positive samples that the student model has already mastered, but the model still makes mistakes. These represent the most ambiguous and challenging core difficulties in decision-making boundaries. Using these positive samples to specifically train the model can significantly improve the model's training performance.
[0102] In summary, the sample sampling process in this application is actually to find out which data the student model fails in and for what reasons (such as confusion with positive samples). It is equivalent to the sample sampling process finding difficult samples for the student model. It can automatically and accurately determine more suitable samples for model training without human intervention. The model distillation training no longer uses massive amounts of data for training, nor does it use a lot of useless data for training, which can greatly improve the training efficiency of the model.
[0103] Step S405: Use at least one sample corresponding to the initial input text as the input text for the Kth round of distillation training of the student model, and use the teacher model's response to the sample as the standard response content of the input text.
[0104] In this application, after determining at least one initial input text corresponding to a sampling sample, each sampling sample (such as a representative positive sample, a representative negative sample, or a group of positive samples) can be used as an input text for the Kth round of distillation training of the student model. Then, the teacher model can process the response to each input text to obtain the standard response content of the input text.
[0105] Step S406: Combine the input text with the standard response content of the input text to obtain the training data for the Kth round of distillation training of the student model.
[0106] In this application, training data for the Kth round of distillation training of the student model can be obtained by combining an input text with its standard response (e.g., treating the input text and its standard response as two separate elements to form a tuple). Multiple input texts can yield multiple training data sets, which can then be combined to form the training data for the Kth round of distillation training of the student model.
[0107] It should be noted that after determining the input text for the first round (including multiple representative positive samples, multiple representative negative samples, and multiple groups of positive samples), the input text for each subsequent round can be determined based on the input text of the previous round. After determining the input text for any round, the input text for this round and its corresponding standard response content can be used as the training data for that round. Specifically, when K is an integer greater than 1, the specific implementation process for obtaining the training data for the Kth round of distillation training of the student model can include at least the following: First, the training data for the (K-1)th round of distillation training of the student model can be obtained, and the training data for the (K-1)th round of distillation training can be determined as the predecessor training data; then, representative negative samples and positive samples in the predecessor training data can be obtained, and the representative negative samples in the predecessor training data can be determined as the predecessor representative negative samples, and the positive samples in the predecessor training data can be determined as the predecessor positive samples; then, the standard response content of the predecessor representative negative samples and the standard response content of the predecessor positive samples can be obtained; based on the predecessor representative negative samples, the predecessor positive samples, the standard response content of the predecessor representative negative samples, and the standard response content of the predecessor positive samples, the predecessor training data can be scaled up, thereby obtaining the training data for the Kth round of distillation training of the student model.
[0108] Here, scale overlay processing refers to the process of overlaying representative negative samples, positive samples, and their corresponding standard responses from the previous round onto the training data from the previous round. This overlay process results in a larger training data set, which can then be used as the training data for the current round. For example, suppose the first round of training data has a total of 320 input texts: 20 representative positive samples, 200 representative negative samples, and 50 positive sample groups (i.e., 50 positive samples and 50 nearest positive samples corresponding to these positive samples; each positive sample group includes two samples, so there are a total of 100 samples). Then the second round of training data may include 620 input texts: based on the 320 input texts in the first round, 200 representative negative samples and 50 positive sample groups (i.e., 50 positive samples and 50 nearest positive samples corresponding to these positive samples) are added. The third round of training data may include 920 input texts: based on the 620 input texts in the second round, 200 representative negative samples and 50 positive sample groups (i.e., 50 positive samples and 50 nearest positive samples corresponding to these positive samples) are added, and so on.
[0109] In practical applications, since the performance of the model improves with each training round, the scale of each round of training data accumulation can be reduced based on the scale of the previous round. For example, suppose the first round of training data has a total of 320 input texts: 20 representative positive samples, 200 representative negative samples, and 50 positive sample groups (i.e., 50 positive samples and 50 nearest positive samples corresponding to these positive samples); the second round of training data may include 470 input texts: based on the 320 input texts in the first round, add 100 representative negative samples and 25 positive sample groups (i.e., 25 positive samples and 25 nearest positive samples corresponding to these positive samples, for a total of 50 samples); the third round of training data may include 546 input texts: based on the 470 input texts in the second round, add 50 representative negative samples and 13 positive sample groups (i.e., 13 positive samples and 13 nearest positive samples corresponding to these positive samples, for a total of 26 samples)... and so on. In other words, the number of representative negative samples and positive samples in each round of superposition is less than the number of representative negative samples and positive samples in the previous round of superposition (the specific number can be set according to actual business needs, and this application does not limit it).
[0110] For a better understanding, please refer to the following: Figure 5 , Figure 5 This is a schematic diagram of a logical architecture for determining the training data for the first round, provided in an embodiment of this application. Figure 5As shown, this logical architecture may include at least the following components: data collection component 51, teacher model 52, student model 53, evaluation model 54, first sampling component 55, second sampling component 56, third sampling component 57, and data merging component 58. The specific implementation methods of each component will be briefly described below: Data collection component 51: The data collection component 51 is mainly used to collect at least one initial input text for data sampling.
[0111] Teacher Model 52: Teacher Model 52 is mainly used to process responses to each initial input text in order to obtain the standard response content for each initial input text.
[0112] Student Model 53: Student Model 53 is mainly used to process responses to each initial input text in order to obtain the predicted response content for each initial input text.
[0113] Evaluation Model 54: Evaluation Model 54 refers to a third-party evaluation model, which is mainly used to evaluate whether the responses of Teacher Model 52 and Student Model 53 to the same initial input text are consistent.
[0114] First sampling component 55: For the initial input text whose output content is consistent with the response content of the teacher model 52 and the student model 53, this application can input it as a positive sample into the first sampling component 55, and the first sampling component 55 will sample it to obtain a representative positive sample.
[0115] Second sampling component 56: For initial input texts where the responses output by teacher model 52 and student model 53 are inconsistent, this application can input them as negative samples into the second sampling component 56, which will then sample them to obtain representative negative samples.
[0116] Third sampling component 57: All the above positive and negative samples will be input into the third sampling component 57, which will sample them to obtain a positive sample group (a positive sample group will include a positive sample and its corresponding nearest positive sample).
[0117] Data merging component 58: Data merging component 58 is used to merge the representative positive samples sampled by the first sampling component 55, the representative negative samples sampled by the second sampling component 56, and the group of similar positive samples sampled by the third sampling component 57 to form the training data for the first round.
[0118] For the specific implementation details of each of the above components, please refer to the above. Figure 4 The descriptions of each step in the corresponding embodiments will not be repeated here.
[0119] In the embodiments of this application, in addition to introducing local distillation loss during the distillation training of the student model, this application will also automatically identify difficult samples suitable for model training, so that the model can further perform distillation learning on difficult samples. The whole process does not require manual intervention and can achieve efficient model distillation, which can greatly improve the training efficiency and performance of the model.
[0120] Furthermore, based on the above, after obtaining a target student model that meets the model convergence condition (such as the number of training iterations reaching a threshold) through distillation training, this application can use an evaluation model to assess the accuracy of the target student model to detect whether the response output by the target student model is highly consistent with the teacher model. If the detection determines that the accuracy of the target student model meets the standard, it can be put into use; if the detection determines that the accuracy of the target student model does not meet the standard, a language understanding model with a larger parameter scale can be replaced as a new student model based on the parameter scale of the current target student model, and a new distillation training can be performed on this new student model according to the distillation training scheme provided in this application. For a better presentation of the logic of model replacement, please refer to [link to relevant documentation]. Figure 6 , Figure 6 This is a schematic diagram of the logical architecture for model replacement training provided in an embodiment of this application. For example... Figure 6 The logical architecture described above may include at least the following components: a trained student model 61 (i.e., the target student model), a teacher model 62, an evaluation model 63, a pass / fail detection component 64, a model application component 65, and a model replacement component 66. The functions implemented by each component will be briefly described below: Trained student model 61: Trained student model 61 refers to a student model that meets the model convergence condition after distillation training.
[0121] Teacher Model 62: Teacher Model 62 is mainly used to process responses to inputs (such as input text) to obtain the response content to the input.
[0122] Evaluation Model 63: Evaluation Model 63 is mainly used to compare the responses of the trained student model 61 and the teacher model 62 to the same input (such as input text) in order to determine the accuracy of the trained student model 61 relative to the teacher model 62.
[0123] Standard Detection Component 64: Standard Detection Component 64 is mainly used to determine whether the accuracy of the trained student model 61 meets the standard based on the comparison results of the evaluation model 63.
[0124] Model application component 65: If the accuracy of the trained student model 61 is determined by the standard detection component 64, the model application component 65 can put the trained student model 61 into use.
[0125] Model replacement component 66: If the accuracy of the trained student model 61 is determined by the compliance detection component 64 to be below the standard, the model replacement component 66 can use a model with a larger parameter scale as the new student model, and perform distillation training on the new student model according to the distillation training scheme provided in this application. For the model obtained after distillation training, its accuracy can also be checked to see if it meets the standard. The entire process can be repeated until a student model with the standard accuracy is determined.
[0126] In this embodiment, by performing distillation training on a student model with a small parameter size, the trained student model can replace the teacher model, thereby reducing the computational cost and resource consumption of the teacher model during application. In the process of distillation training the student model, this application can greatly improve the training efficiency and training effect of the model by sampling samples and introducing local distillation loss. The trained student model has good generalization ability and can be applied to most natural language processing tasks.
[0127] Further, please see Figure 7 , Figure 7 This is a schematic diagram of the structure of a model-based training processing device provided in an embodiment of this application. The model-based training processing device can be a computer program running on a computer device; for example, the model-based training processing device is an application software. The model-based training processing device can be used to execute... Figure 3 The method shown. (As illustrated) Figure 7 As shown, the model-based training processing device 1 may include: an acquisition module 11, a calling module 12, a word set determination module 13, and a training module 14.
[0128] The acquisition module 11 is used to acquire training data for the Kth round of distillation training of the student model, where K is a positive integer. The training data includes the input text and the standard response content of the input text. The standard response content of the input text is determined based on the first probability distribution obtained after the teacher model processes the response to the input text. The first probability distribution includes the first prediction probability of each candidate word in the vocabulary by the teacher model. Module 12 is invoked to call the student model to process the input text and obtain the second probability distribution, which includes the student model’s second prediction probability for each candidate word in the vocabulary. The word set determination module 13 is used to determine the local focus word set of the teacher model and the student model from each candidate word in the word list based on the first probability distribution and the second probability distribution, and to obtain the local probability distribution of the teacher model and the student model on the local focus word set respectively. Training module 14 is used to distill the student model based on the difference between the first probability distribution and the second probability distribution, as well as the difference between the local probability distributions of the teacher model and the student model on the local focus word set, to obtain the target student model, which is used to process the response task.
[0129] The specific implementation methods of the acquisition module 11, the calling module 12, the word set determination module 13, and the training module 14 can be found in the above description. Figure 3 The descriptions of steps S301-S304 in the corresponding embodiments will not be repeated here.
[0130] In one embodiment, K is 1; The specific implementation process of module 11 for acquiring training data for the Kth round of distillation training of the student model includes: Obtain at least one initial input text; Based on each initial input text, the teacher model and student model are called to process the responses, and the responses of the teacher model and student model to the initial input text are obtained respectively. Based on the teacher model and student model, the response content for each initial input text is compared using the response comparison model to obtain the response comparison results for each initial input text. Based on the comparison results of the responses to at least one initial input text, sample sampling is performed on at least one initial input text to obtain a sample corresponding to at least one initial input text. At least one initial input text is used as the sampled text for the Kth round of distillation training of the student model, and the teacher model's response to the sampled text is used as the standard response to the input text. The input text is combined with the standard response to the input text to obtain the training data for the Kth round of distillation training of the student model.
[0131] In one embodiment, the sample sampling process includes positive sample sampling, wherein the sampled samples include representative positive samples; The process by which the acquisition module 11 performs sample sampling on at least one initial input text based on the response comparison results of at least one initial input text, and obtains a sample corresponding to at least one initial input text, includes: Each initial input text whose response comparison result is the same in at least one initial input text is identified as a positive sample. Each positive sample is clustered according to the first quantity to obtain one or more first-class clusters, and the number of one or more first-class clusters is the first quantity; Obtain the cluster center of each first cluster, and determine the representative positive samples of the first cluster from the positive samples contained in the first cluster based on the distance between the positive samples contained in the first cluster and the cluster center of the first cluster. One or more representative positive samples of the first category are determined as representative positive samples corresponding to at least one initial input text.
[0132] In one embodiment, the sample sampling process includes negative sample sampling process, wherein the sampled samples include representative negative samples. The process by which the acquisition module 11 performs sample sampling on at least one initial input text based on the response comparison results of at least one initial input text, and obtains a sample corresponding to at least one initial input text, includes: Each initial input text in which the response comparison results are different is identified as a negative sample. Clustering is performed on each negative sample according to the second quantity to obtain one or more second clusters, and the number of one or more second clusters is the second quantity; Obtain the cluster center of each second cluster, and determine the representative negative samples of the second cluster from the negative samples contained in the second cluster based on the distance between the negative samples contained in the second cluster and the cluster center of the second cluster; One or more representative negative samples of the second type cluster are determined as representative negative samples corresponding to at least one initial input text.
[0133] In one embodiment, the sample sampling process includes positive sample sampling, wherein the sampled samples include a group of positive samples. The process by which the acquisition module 11 performs sample sampling on at least one initial input text based on the response comparison results of at least one initial input text, and obtains a sample corresponding to at least one initial input text, includes: Each initial input text whose response comparison result is the same is identified as a positive sample, and each initial input text whose response comparison result is different is identified as a negative sample. Calculate the sample distance between each negative sample and each positive sample, and based on the sample distances corresponding to each negative sample, determine the nearest positive sample corresponding to the negative sample from each positive sample; Based on the sample distance between each negative sample and its nearest positive sample, the negative samples are sorted to obtain a sample sequence. According to the sample selection rules, positive samples are determined from the sample sequence, and the positive samples are combined with the nearest positive samples corresponding to the positive samples to obtain at least one group of positive samples corresponding to the initial input text.
[0134] In one embodiment, the acquisition module 11 determines positive samples from the sample sequence according to sample selection rules, including: Obtain the sample selection ratio indicated by the sample selection rules, and count the number of negative samples included in the sample sequence. The sample selection ratio is multiplied by the sample size to obtain the sample selection value; The sequence position indicated by the sample selection value in the sample sequence is determined as the target sequence position, and the negative sample in the sample sequence that is at the target sequence position is determined as the target negative sample; Negative samples in the sample sequence that precede the target negative sample are identified as positive samples.
[0135] In one embodiment, K is an integer greater than 1; The specific implementation of module 11 for obtaining training data for the Kth round of distillation training of the student model includes: Obtain the training data for the K-1th round of distillation training of the student model, and determine the training data for the K-1th round of distillation training as the predecessor training data; Obtain representative negative samples and positive samples from the predecessor training data, and determine the representative negative samples from the predecessor training data as the predecessor representative negative samples, and determine the positive samples from the predecessor training data as the predecessor positive samples. Obtain the standard response content of the representative negative samples of the predecessor and the standard response content of the positive samples of the predecessor class; Based on the standard responses of the predecessor representative negative samples, the predecessor class positive samples, the predecessor representative negative samples, and the predecessor class positive samples, the predecessor training data is scaled up to obtain the training data for the Kth round of distillation training of the student model.
[0136] In one embodiment, the first probability distribution includes the first word position probability distribution of the teacher model on N word positions, where N is a positive integer, and the second probability distribution includes the second word position probability distribution of the student model on N word positions. The first word position probability distribution includes the first prediction probability of the teacher model for each candidate word in the vocabulary, and the second word position probability distribution includes the second prediction probability of the student model for each candidate word in the vocabulary. The word set determination module 13, based on the first probability distribution and the second probability distribution, determines the specific implementation of the locally focused word set for the teacher model and the student model from the candidate words in the vocabulary, including: Based on the probability distribution of the first and second word positions at each word position, determine the word focus set for that word position; By aggregating the word focus sets of N word positions, we obtain the local focus sets of the teacher model and the student model.
[0137] In one embodiment, the N word positions include word position i; The word set determination module 13 determines the word set for word position i based on the probability distributions of the first and second word positions at word position i, including: Sort the first predicted probabilities contained in the first probability distribution of the first word position i in descending order to obtain the first probability sequence of word position i. The second predicted probabilities contained in the second probability distribution of word position i are sorted in descending order to obtain the second probability sequence of word position i. The candidate words corresponding to the first predicted probabilities of the first probability sequence of word position i are determined as the focus word set of the teacher model for word position i, where L is a positive integer; The candidate words corresponding to the first L second predicted probabilities in the second probability sequence of word position i are determined as the focus word set of the student model for word position i; The word set of the teacher model for word position i is combined with the word set of the student model for word position i to obtain the word set of the word position i.
[0138] In one embodiment, the training module 14 performs distillation training on the student model based on the difference between the first probability distribution and the second probability distribution, and the difference between the local probability distributions of the teacher model and the student model on the local focus word set, to obtain a specific implementation of the target student model, including: The global distillation loss is determined based on the difference between the first probability distribution and the second probability distribution; The local distillation loss is determined based on the difference between the local probability distributions of the teacher model and the student model on the local focus word set. The student model is optimized based on global distillation loss and local distillation loss to obtain the target student model.
[0139] In one embodiment, the local probability distributions of the teacher model and the student model on the local focus word set include the word position local probability distributions of the teacher model and the student model on the word position focus word set for each word position. Training module 14 determines the specific implementation of local distillation loss based on the differences in local probability distributions between the teacher model and the student model on the locally focused word set, including: Based on the difference in the local probability distribution of the word position on the word position focus set of each word position between the teacher model and the student model, the local distillation loss of the word position corresponding to that word position is determined. The local distillation loss is obtained by summing the local distillation losses corresponding to the N word positions.
[0140] In one embodiment, the N word positions include word position i; Training module 14 determines the local distillation loss for word position i based on the difference in the local probability distribution of word position i between the teacher model and the student model on the word position focusing set. This process includes: Based on the first word position probability distribution of the teacher model at word position i, obtain the first prediction probability of the teacher model for each focused word in the word position focused word set at word position i; Based on the second word position probability distribution of the student model at word position i, obtain the second prediction probability of the student model for each focused word in the word position focused word set at word position i; The local distillation loss function is used to calculate the loss of the first prediction probability and the second prediction probability of each focal word in the focal word set of word position i, so as to obtain the word local distillation loss of each focal word in the focal word set of word position i. The word local distillation loss corresponding to each focal word in the focal set of word position i is summed to obtain the word local distillation loss corresponding to word position i.
[0141] In one embodiment, the training module 14 optimizes the student model based on global distillation loss and local distillation loss to obtain a specific implementation of the target student model, including: The response classification loss is determined based on the standard response content of the input text and the second probability distribution; Obtain the classification weights, global distillation weights, and local distillation weights; Based on classification weights, global distillation weights, and local distillation weights, the classification loss, global distillation loss, and local distillation loss are weighted and calculated to obtain the total distillation loss. The student model is optimized based on the total distillation loss to obtain the target student model.
[0142] In one embodiment, the training module 14 optimizes the student model according to the total distillation loss to obtain a specific implementation of the target student model, including: The student model is optimized based on the total distillation loss to obtain the student model trained in the Kth round. If the student model trained in the Kth round satisfies the model convergence condition, then the student model trained in the Kth round is determined as the target student model; If the student model trained in the Kth round does not meet the model convergence condition, then the training data of the (K+1)th round of distillation training is obtained, and the student model trained in the Kth round is distilled based on the training data of the (K+1)th round of distillation training to obtain the target student model.
[0143] In this embodiment, the traditional distillation scheme abandons the coarse alignment mode of treating all lexical units in the vocabulary equally. Instead, it uses two probability distributions output by the teacher and student models to filter out key lexical units that are locally focused by both models, dynamically constructing a locally focused word set. Based on the local probability distributions of the two models on this locally focused word set, local alignment of these local keywords can be achieved. The difference between the two probability distributions enables global alignment of the student model, while the difference between the local probability distributions of the two models on the locally focused word set allows for local alignment. Through joint global and local distillation training, the student model, while aligning with the overall understanding of the teacher model, can deeply understand and internalize the judgment logic of the teacher model at semantic nuances, effectively improving the training effect of the student model. Moreover, in this process, this application automatically determines the locally focused word set, eliminating the need for any manual annotation or predefined difficult samples to identify the focused word set that requires special attention, thus reducing manual costs and saving model training time, thereby improving model training efficiency. In summary, this application can improve the training efficiency and training effect of the student model.
[0144] Further, please see Figure 8 , Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 8 As shown, the aforementioned computer device 8000 may include: a processor 8001, a network interface 8004, and a memory 8005. Furthermore, the computer device 8000 also includes: a user interface 8003, and at least one communication bus 8002. The communication bus 8002 is used to enable communication between these components. The user interface 8003 may include a display screen and a keyboard; optionally, the user interface 8003 may also include a standard wired interface or a wireless interface. The network interface 8004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 8005 may be high-speed RAM or non-volatile memory, such as at least one disk storage device. Optionally, the memory 8005 may also be at least one storage device located remotely from the aforementioned processor 8001. Figure 8As shown, the memory 8005, which is a computer-readable storage medium, may include an operating system, a network communication module, a user interface module, and a device control application program.
[0145] exist Figure 8 In the computer device 8000 shown, the network interface 8004 provides network communication functionality; the user interface 8003 is mainly used to provide an input interface for the user; and the processor 8001 can be used to call the device control application program stored in the memory 8005 to achieve: Obtain training data for the Kth round of distillation training of the student model, where K is a positive integer. The training data includes the input text and the standard response content of the input text. The standard response content of the input text is determined based on the first probability distribution obtained after the teacher model processes the input text. The first probability distribution includes the first prediction probability of the teacher model for each candidate word in the vocabulary. The student model is invoked to respond to the input text, resulting in a second probability distribution. The second probability distribution includes the student model's second prediction probability for each candidate word in the vocabulary. Based on the first probability distribution and the second probability distribution, the local focus word sets of the teacher model and the student model are determined from each candidate word in the vocabulary, and the local probability distributions of the teacher model and the student model on the local focus word sets are obtained respectively. Based on the difference between the first probability distribution and the second probability distribution, as well as the difference between the local probability distributions of the teacher model and the student model on the local focus word set, the student model is distilled to obtain the target student model, which is used to process the response task.
[0146] It should be understood that the computer device 8000 described in the embodiments of this application can execute the foregoing text. Figures 3 to 4 The description of the model-based training method in the corresponding embodiments can also be performed as described above. Figure 7 The description of the model-based training processing device 1 in the corresponding embodiments will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated.
[0147] Furthermore, it should be noted that this application embodiment also provides a computer-readable storage medium, which stores a computer program executed by the aforementioned data processing computer device 8000. The computer program includes program instructions, and when the processor executes the program instructions, it can execute the aforementioned... Figures 3 to 4The description of the model-based training processing method in the corresponding embodiments is already provided and will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the computer-readable storage medium embodiments related to this application, please refer to the description of the method embodiments of this application.
[0148] The aforementioned computer-readable storage medium can be the model-based training processing apparatus provided in any of the foregoing embodiments or the internal storage unit of the aforementioned computer device, such as the hard disk or memory of the computer device. The computer-readable storage medium can also be an external storage device of the computer device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., provided on the computer device. Furthermore, the computer-readable storage medium can include both internal storage units and external storage devices of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.
[0149] One aspect of this application provides a computer program product comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the method provided in one aspect of the embodiments of this application.
[0150] The terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the term "comprising," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product, or device that includes a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other step units inherent to these processes, methods, apparatuses, products, or devices.
[0151] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0152] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.
[0153] The methods and related apparatuses provided in this application are described with reference to the method flowcharts and / or structural diagrams provided in this application. Specifically, each block of the method flowchart and / or structural diagram, as well as combinations of blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to create a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing device, generate instructions for implementing the process. Figure 1 A schematic diagram of one or more processes and / or structures. Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 A schematic diagram of one or more processes and / or structures. Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 A process or multiple processes and / or structures illustrate the steps of the functions specified in one or more boxes.
[0154] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.
Claims
1. A model-based training processing method, characterized in that, The method includes: Obtain training data for the Kth round of distillation training of the student model, where K is a positive integer. The training data includes the input text and the standard response content of the input text. The standard response content of the input text is determined based on the first probability distribution obtained after the teacher model processes the response to the input text. The first probability distribution includes the first prediction probability of the teacher model for each candidate word in the vocabulary. The student model is invoked to respond to the input text, resulting in a second probability distribution. The second probability distribution includes the student model's second prediction probability for each candidate word in the vocabulary. Based on the first probability distribution and the second probability distribution, the local focus word sets of the teacher model and the student model are determined from each candidate word in the vocabulary, and the local probability distributions of the teacher model and the student model on the local focus word sets are obtained respectively. Based on the difference between the first probability distribution and the second probability distribution, and the difference between the local probability distributions of the teacher model and the student model on the local focus word set, the student model is distilled to obtain a target student model, which is used to process the response task.
2. The method according to claim 1, characterized in that, K is 1; The acquisition of training data for the Kth round of distillation training of the student model includes: Obtain at least one initial input text; Based on each initial input text, the teacher model and the student model are invoked to perform response processing respectively, so as to obtain the response content of the teacher model and the student model to the initial input text respectively; Based on the teacher model and the student model respectively, the response comparison model is invoked to perform response comparison processing on the response content of each initial input text, so as to obtain the response comparison result of each initial input text; Based on the response comparison results of the at least one initial input text, sample sampling is performed on the at least one initial input text to obtain the sampled sample corresponding to the at least one initial input text; The sampled sample corresponding to the at least one initial input text is used as the input text for the Kth round of distillation training of the student model, and the response content of the teacher model to the sampled sample is used as the standard response content of the input text. The input text is combined with the standard response content of the input text to obtain the training data for the Kth round of distillation training of the student model.
3. The method according to claim 2, characterized in that, The sample sampling process includes positive sample sampling process, and the sampled samples include representative positive samples; The step of performing sample sampling on the at least one initial input text based on the response comparison result of the at least one initial input text to obtain a sample corresponding to the at least one initial input text includes: Each initial input text whose response comparison result is the same in the at least one initial input text is determined as a positive sample; Each positive sample is clustered according to a first quantity to obtain one or more first clusters, wherein the number of the one or more first clusters is the first quantity. Obtain the cluster center of each first cluster, and determine the representative positive samples of the first cluster from the positive samples contained in the first cluster based on the distance between the positive samples contained in each first cluster and the cluster center of the first cluster; The representative positive samples of the one or more first clusters are all determined as the representative positive samples corresponding to the at least one initial input text.
4. The method according to claim 2, characterized in that, The sample sampling process includes negative sample sampling process, and the sampled samples include representative negative samples. The step of performing sample sampling on the at least one initial input text based on the response comparison result of the at least one initial input text to obtain a sample corresponding to the at least one initial input text includes: Each initial input text in the at least one initial input text whose response comparison result is different is identified as a negative sample; Clustering is performed on each negative sample according to the second quantity to obtain one or more second clusters, wherein the number of the one or more second clusters is the second quantity; Obtain the cluster center of each second cluster, and determine the representative negative sample of the second cluster from the negative samples contained in the second cluster based on the distance between the negative sample contained in the second cluster and the cluster center of the second cluster; The representative negative samples of the one or more second-class clusters are all determined as the representative negative samples corresponding to the at least one initial input text.
5. The method according to claim 2, characterized in that, The sample sampling process includes positive sample sampling process, and the sampled samples include positive sample groups; The step of performing sample sampling on the at least one initial input text based on the response comparison result of the at least one initial input text to obtain a sample corresponding to the at least one initial input text includes: Each initial input text in the at least one initial input text whose response comparison result is the same is determined as a positive sample, and each initial input text in the at least one initial input text whose response comparison result is different is determined as a negative sample; Calculate the sample distance between each negative sample and each positive sample, and based on the sample distances corresponding to each negative sample, determine the nearest positive sample corresponding to the negative sample from the positive samples; Based on the sample distance between each negative sample and its nearest positive sample, the negative samples are sorted to obtain a sample sequence. According to the sample selection rules, positive samples are determined from the sample sequence, and the positive samples are combined with the nearest positive samples corresponding to the positive samples to obtain the positive sample group corresponding to the at least one initial input text.
6. The method according to claim 5, characterized in that, The step of determining positive samples from the sample sequence according to the sample selection rules includes: Obtain the sample selection ratio indicated by the sample selection rule, and count the number of negative samples included in the sample sequence; The sample selection ratio is multiplied by the sample quantity to obtain the sample selection value; The sequence position indicated by the sample selection value in the sample sequence is determined as the target sequence position, and the negative sample in the sample sequence that is at the target sequence position is determined as the target negative sample; Negative samples in the sample sequence that precede the target negative sample are identified as positive-like samples.
7. The method according to claim 1, characterized in that, K is an integer greater than 1; The step of obtaining training data for the Kth round of distillation training of the student model includes: Obtain the training data for the K-1th round of distillation training of the student model, and determine the training data for the K-1th round of distillation training as the predecessor training data; Obtain representative negative samples and positive samples from the predecessor training data, and determine the representative negative samples from the predecessor training data as predecessor representative negative samples, and determine the positive samples from the predecessor training data as predecessor positive samples. Obtain the standard response content of the representative negative sample of the predecessor and the standard response content of the positive sample of the predecessor class; Based on the representative negative samples of the predecessors, the positive samples of the predecessors, the standard responses of the representative negative samples of the predecessors, and the standard responses of the positive samples of the predecessors, the preceding training data is subjected to scale stacking to obtain the training data for the Kth round of distillation training of the student model.
8. The method according to claim 1, characterized in that, The first probability distribution includes the first word position probability distribution of the teacher model on N word positions, where N is a positive integer; the second probability distribution includes the second word position probability distribution of the student model on the N word positions; the first word position probability distribution includes the first prediction probability of the teacher model for each candidate word in the word list; and the second word position probability distribution includes the second prediction probability of the student model for each candidate word in the word list. The step of determining the local focus word set for the teacher model and the student model from each candidate word in the vocabulary based on the first probability distribution and the second probability distribution includes: Based on the probability distribution of the first word position and the probability distribution of the second word position at each of the aforementioned word positions, determine the word position focus set for that word position; The word focus sets of the N word positions are aggregated to obtain the local focus sets of the teacher model and the student model.
9. The method according to claim 8, characterized in that, The N word positions include word position i; The process of determining the word focus set for word position i based on the first word position probability distribution and the second word position probability distribution for word position i includes: The first predicted probabilities contained in the first probability distribution of the first word position i are sorted in descending order to obtain the first probability sequence of the word position i. The second predicted probabilities contained in the second probability distribution of the word position i are sorted in descending order to obtain the second probability sequence of the word position i. The candidate words corresponding to the first L first predicted probabilities in the first probability sequence of word position i are determined as the focus word set of the teacher model for word position i, where L is a positive integer; The candidate words corresponding to the first L second predicted probabilities in the second probability sequence of word position i are determined as the focus word set of the student model for word position i; The teacher model's focus word set for word position i and the student model's focus word set for word position i are combined to obtain the word position focus word set for word position i.
10. The method according to claim 8, characterized in that, The step of distilling the student model to obtain the target student model based on the difference between the first probability distribution and the second probability distribution, and the difference between the local probability distributions of the teacher model and the student model on the local focus word set, includes: The global distillation loss is determined based on the difference between the first probability distribution and the second probability distribution; The local distillation loss is determined based on the difference between the local probability distributions of the teacher model and the student model on the local focus word set, respectively. The student model is optimized based on the global distillation loss and the local distillation loss to obtain the target student model.
11. The method according to claim 10, characterized in that, The local probability distributions of the teacher model and the student model on the local focused word set respectively include the word position local probability distributions of the teacher model and the student model on the word position focused word set for each word position respectively; The step of determining the local distillation loss based on the difference between the local probability distributions of the teacher model and the student model on the local focus word set includes: Based on the difference between the local probability distribution of the word position in the word position focus set of the teacher model and the student model at each word position, the local distillation loss of the word position corresponding to that word position is determined; The local distillation loss is obtained by summing the local distillation losses corresponding to the N word positions.
12. The method according to claim 11, characterized in that, The N word positions include word position i; The process of determining the local distillation loss of word position i based on the difference between the local probability distribution of word position i in the word position focus set of the teacher model and the student model includes: Based on the first word position probability distribution of the teacher model at word position i, obtain the first prediction probability of the teacher model for each focused word in the word position focused word set of word position i; Based on the second word position probability distribution of the student model at word position i, obtain the second prediction probability of the student model for each focused word in the word position focused word set of word position i; Using the local distillation loss function, the loss is calculated on the first prediction probability and the second prediction probability corresponding to each focused word in the word focus set of word position i, so as to obtain the word local distillation loss corresponding to each focused word in the word focus set of word position i; The word local distillation loss corresponding to each focal word in the word focal set of word position i is summed to obtain the word local distillation loss corresponding to word position i.
13. The method according to claim 10, characterized in that, The optimization of the student model based on the global distillation loss and the local distillation loss to obtain the target student model includes: Based on the standard response content of the input text and the second probability distribution, determine the response classification loss; Obtain the classification weights, global distillation weights, and local distillation weights; Based on the classification weight, the global distillation weight, and the local distillation weight, the classification loss, the global distillation loss, and the local distillation loss are weighted and calculated to obtain the total distillation loss; The student model is optimized according to the total distillation loss to obtain the target student model.
14. The method according to claim 13, characterized in that, The optimization of the student model according to the total distillation loss to obtain the target student model includes: The student model is optimized based on the total distillation loss to obtain the student model trained in the Kth round. If the student model trained in the Kth round satisfies the model convergence condition, then the student model trained in the Kth round is determined as the target student model; If the student model trained in the Kth round does not meet the model convergence condition, then the training data of the (K+1)th round of distillation training is obtained, and the student model trained in the Kth round is distilled based on the training data of the (K+1)th round of distillation training to obtain the target student model.
15. A model-based training processing device, characterized in that, The device includes: The acquisition module is used to acquire training data for the Kth round of distillation training of the student model, where K is a positive integer. The training data includes the input text and the standard response content of the input text. The standard response content of the input text is determined based on the first probability distribution obtained after the teacher model processes the response to the input text. The first probability distribution includes the first prediction probability of the teacher model for each candidate word in the vocabulary. The calling module is used to call the student model to process the response to the input text and obtain a second probability distribution, the second probability distribution including the second prediction probability of the student model for each candidate word in the vocabulary; The word set determination module is used to determine the local focus word set of the teacher model and the student model from each candidate word in the word list based on the first probability distribution and the second probability distribution, and to obtain the local probability distribution of the teacher model and the student model on the local focus word set respectively; The training module is used to perform distillation training on the student model based on the difference between the first probability distribution and the second probability distribution, and the difference between the local probability distributions of the teacher model and the student model on the local focus word set, respectively, to obtain a target student model, which is used to process the response task.
16. A computer device, characterized in that, include: Processor, memory, and network interface; The processor is connected to the memory and the network interface, wherein the network interface is used to provide network communication functions, the memory is used to store computer programs, and the processor is used to call the computer programs to cause the computer device to execute the method according to any one of claims 1-14.
17. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted to be loaded by a processor and to execute the method of any one of claims 1-14.
18. A computer program product, characterized in that, The computer program product includes a computer program stored in a computer-readable storage medium, the computer program being adapted to be read and executed by a processor to cause a computer device having the processor to perform the method of any one of claims 1-14.