Sample processing method, model training method, text processing method and device

By acquiring the instability index and single-sample loss of training samples, the model can accurately identify samples with high learning value and adjust the contribution of training samples. This solves the problem of model training being biased in the wrong direction in existing technologies and improves model training efficiency and learning effect.

CN122153468APending Publication Date: 2026-06-05BEIJING BAIDU NETCOM SCI & TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING BAIDU NETCOM SCI & TECH CO LTD
Filing Date
2026-04-15
Publication Date
2026-06-05

Smart Images

  • Figure CN122153468A_ABST
    Figure CN122153468A_ABST
Patent Text Reader

Abstract

The present disclosure provides a sample processing method, a model training method, a text processing method and device, relates to the technical field of computers, and particularly relates to the technical fields of artificial intelligence, machine learning, large models, natural language processing and the like. The specific implementation scheme comprises the following steps: obtaining a training sample; obtaining an instability index of the training sample, so as to represent the fluctuation size of the semantic representation consistency of the training sample by a to-be-trained model under N different pre-training nodes; wherein N is greater than or equal to 2 and is an integer; obtaining a single-sample loss corresponding to the training sample, so as to represent the loss value of the semantic representation result of the training sample based on the to-be-trained model relative to the semantic true value of the training sample; and based on the instability index and the single-sample loss, obtaining an application indication for the training sample, so as to adjust the contribution degree of the training sample when training the to-be-trained model. The present disclosure can accurately locate the training sample with high learning value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to the fields of artificial intelligence, machine learning, large models, and natural language processing. Specifically, it relates to a sample processing method, a model training method, a text processing method, and an apparatus. Background Technology

[0002] With the rapid development of artificial intelligence technology, neural network models have been widely deployed in many application fields. Their training is highly dependent on large-scale sample data, and the mining of sample data with high learning value is the fundamental prerequisite for ensuring the learning effect of neural network models. Summary of the Invention

[0003] This disclosure provides a sample processing method, a model training method, a text processing method, and an apparatus.

[0004] According to a first aspect of this disclosure, a sample processing method is provided, comprising: Obtain training samples; Obtain the instability index of the training samples; where the instability index is used to characterize the fluctuation of the consistency of the semantic representation of the training samples by the model to be trained under N different previous training nodes; N≥2 and N is an integer; Obtain the single-sample loss corresponding to the training sample; wherein, the single-sample loss is used to characterize the loss value of the semantic representation result of the training sample obtained based on the model to be trained relative to the semantic ground truth of the training sample. Based on the instability index and single-sample loss, an application indicator for the training samples is obtained; the application indicator is used to adjust the contribution of the training samples when training the model to be trained.

[0005] According to a second aspect of this disclosure, a model training method is provided, comprising: Multiple training samples are obtained; wherein, for each of the multiple training samples, the training sample has a corresponding application instruction, and the application instruction is obtained using the method provided in the first aspect; Following multiple application instructions that correspond one-to-one with multiple training samples, the model to be trained is trained using multiple training samples to obtain the first target model.

[0006] According to a third aspect of this disclosure, a text processing method is provided, comprising: Get the text to be processed; The target model is used to process the text to obtain the processing result; the target model is obtained using the method provided in the second aspect.

[0007] According to a fourth aspect of this disclosure, a sample processing apparatus is provided, comprising: The first sample acquisition unit is used to acquire training samples; The indicator acquisition unit is used to acquire the instability indicator of the training samples; wherein, the instability indicator is used to characterize the fluctuation of the consistency of the semantic representation of the training samples by the model to be trained under N different pre-training nodes; N≥2 and N is an integer; The loss acquisition unit is used to acquire the single-sample loss corresponding to the training sample; wherein, the single-sample loss is used to characterize the loss value of the semantic representation result of the training sample obtained based on the model to be trained relative to the semantic ground truth of the training sample. The application instruction acquisition unit is used to obtain application instructions for training samples based on instability indicators and single-sample loss; wherein, the application instructions are used to adjust the contribution of training samples when training the model to be trained.

[0008] According to a fifth aspect of this disclosure, a model training apparatus is provided, comprising: The second sample acquisition unit is used to acquire multiple training samples; wherein, for each of the multiple training samples, the training sample has a corresponding application instruction, and the application instruction is obtained using the device provided in the fourth aspect; The model training unit is used to train the model to be trained using multiple training samples according to multiple application instructions that correspond one-to-one with multiple training samples, so as to obtain the first target model.

[0009] According to a sixth aspect of this disclosure, a text processing apparatus is provided, comprising: The text acquisition unit is used to acquire the text to be processed. The text processing unit is used to process the text to be processed using a first target model to obtain a processing result for the text to be processed; wherein the first target model is obtained using the apparatus provided in the fifth aspect.

[0010] According to a seventh aspect of this disclosure, an electronic device is provided, comprising: At least one processor; Memory that is communicatively connected to at least one processor; The memory stores instructions executable by at least one processor, which are executed by at least one processor to enable the at least one processor to perform the methods provided in at least one of the first, second, and third aspects of this disclosure.

[0011] According to an eighth aspect of this disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided; wherein the computer instructions are used to cause a computer to perform the methods provided in at least one of the first, second, and third aspects of this disclosure.

[0012] According to a ninth aspect of this disclosure, a computer program product is provided, comprising a computer program; wherein, when executed by a processor, the computer program is capable of implementing the methods provided in at least one of the first, second, and third aspects of this disclosure.

[0013] This disclosure helps to overcome the limitations of traditional methods during the retraining phase of the model to be trained, accurately locate training samples with high learning value, guide the model to prioritize learning training samples with high learning value, and avoid model training biased in the wrong direction. This can not only significantly improve model training efficiency, but also improve model learning effect and generalization, thereby improving the performance of the first target model obtained by training and ensuring the robustness of the first target model in real noisy environments.

[0014] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0015] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein: Figure 1 A schematic flowchart of a sample processing method provided in an embodiment of this disclosure; Figure 2 A schematic flowchart of a model training method provided in an embodiment of this disclosure; Figure 3 This is a schematic diagram of the structure of a sample pre-selection model provided in an embodiment of the present disclosure; Figure 4 This is a schematic diagram of the structure of a sample selection model provided in an embodiment of the present disclosure; Figure 5 A schematic diagram illustrating a combined implementation process of a sample processing method and a model training method provided in this disclosure embodiment; Figure 6 A flowchart illustrating a text processing method provided in an embodiment of this disclosure; Figure 7 A schematic diagram illustrating an application scenario of a sample processing method, a model training method, and a text processing method provided in an embodiment of this disclosure; Figure 8 A schematic structural block diagram of a sample processing device provided in an embodiment of this disclosure; Figure 9 A schematic structural block diagram of a model training device provided in an embodiment of this disclosure; Figure 10 A schematic structural block diagram of a text processing apparatus provided in this disclosure embodiment; Figure 11 This is a schematic structural block diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation

[0016] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0017] In traditional approaches, sample data mining typically relies on the loss value corresponding to the sample data. That is, for a given sample, the loss value is used as a selection criterion to decide whether to retain that sample for training the model. However, in real-world corpora containing noise such as mislabeled text, garbled characters, and adversarial text, a high loss value does not necessarily indicate high learning value for the sample. Using this as the standard can easily lead to biased model training, reducing training efficiency, affecting model learning effectiveness and generalization, and ultimately harming model performance.

[0018] To address the above problems, this disclosure provides a sample processing method that can be applied to electronic devices. The electronic device can be a server, workbench, mainframe computer, conventional computer (e.g., desktop computer, laptop computer, tablet computer, etc.) or other similar computing devices. The following will be combined with... Figure 1 The flowchart shown illustrates a sample processing method provided in an embodiment of this disclosure. It should be noted that, although in Figure 1 The flowchart shown illustrates the logical order; however, in some cases, the steps shown or described in the flowchart may be performed in a different order.

[0019] Step S101: Obtain training samples.

[0020] The training samples are the sample data, such as text samples.

[0021] Step S102: Obtain the instability index of the training samples.

[0022] The instability index can be used to characterize the fluctuation of the consistency of the semantic representation of the training samples by the model to be trained under N different pre-training nodes; N≥2 and N is an integer.

[0023] In this embodiment, the model to be trained can be a neural network model with a Transformer architecture, and it has already completed pre-training. During the pre-training phase of the model to be trained, N different pre-training nodes are sequentially set (e.g., sampling points based on a fixed number of training steps or training rounds). Each pre-training node corresponds to a model snapshot (Checkpoint), that is, the model parameters saved at that pre-training node. Specifically, the model to be trained under the i-th pre-training node (corresponding to the i-th model snapshot) among the N different pre-training nodes is further trained to obtain the model to be trained under the (i+1)-th pre-training node (corresponding to the (i+1)-th model snapshot). Thus, the N different pre-training nodes have N corresponding model snapshots, each recording the model parameters of the model to be trained at different time points during the pre-training phase, for use in obtaining the instability index of the training samples. Where 1 ≤ i ≤ N-1, and i is an integer.

[0024] Furthermore, in this embodiment of the disclosure, the instability index can be a scalar, for example, a scalar with a value range of [0, 1]. A large instability index indicates that the consistency of the semantic representation of the training samples by the model to be trained fluctuates greatly under N different pre-training nodes, meaning that the training samples may contain noise such as garbled text or adversarial text, and are noisy samples with low credibility. Conversely, a small instability index indicates that the consistency of the semantic representation of the training samples by the model to be trained fluctuates little under N different pre-training nodes, meaning that the training samples have clear semantics and high credibility, and are non-noisy samples with high credibility.

[0025] Step S103: Obtain the single-sample loss corresponding to the training samples.

[0026] The single-sample loss can be used to characterize the loss value of the semantic representation result of the training sample obtained based on the model to be trained relative to the semantic ground truth of the training sample. Here, the semantic representation result can be the first semantic vector of the training sample obtained based on the model to be trained; the semantic ground truth can be the true semantic vector of the training sample, and it can be obtained through manual annotation or automatic annotation (e.g., automatic annotation based on knowledge base, rule engine, pre-trained large model, etc.). This disclosure does not limit this.

[0027] In this embodiment of the disclosure, the single-sample loss can be a scalar, for example, a scalar with a value range of [0, 1]. A large single-sample loss means that the training sample is outside the capability range of the model to be trained, and is a difficult sample that can promote the efficient evolution of the model to be trained; conversely, a small single-sample loss means that the training sample is at or within the capability range of the model to be trained, and cannot promote the efficient evolution of the model to be trained, but may still have a partial promoting effect on the evolution of the model to be trained, and is a non-difficult sample with low learning necessity.

[0028] Step S104: Based on the instability index and single-sample loss, obtain the application instructions for the training samples.

[0029] The application instruction can be used to adjust the contribution of training samples when training the model to be trained. Specifically, it can be used in the retraining stage after the pre-training stage to adjust the contribution of training samples when training the model to be trained.

[0030] In this embodiment of the disclosure, when training the model to be trained, the contribution of the training samples can be adjusted by weight parameters. That is, the application instruction can be a weight parameter, which is used to weight the current sample loss corresponding to the training sample when training the model to be trained, so as to adjust the contribution of the training sample in the total sample loss corresponding to itself.

[0031] In this embodiment of the disclosure, when training the model to be trained, the contribution of the training samples can also be controlled by a sampling strategy. That is, the application instruction can also be a sampling strategy to adjust the number of training samples when training the model to be trained, so as to adjust the contribution of the training samples in the total sample loss corresponding to themselves.

[0032] Furthermore, it should be noted that in this embodiment of the disclosure, "training the model to be trained" can be understood as updating the model parameters of the model to be trained, that is, modifying the current model parameters of the model to be trained to the new model parameters.

[0033] The sample processing method provided in this disclosure can acquire training samples and their instability indices to characterize the fluctuation in the consistency of the semantic representation of the training samples by the model to be trained under N different pre-training nodes. Then, the single-sample loss corresponding to the training sample is acquired to characterize the loss value of the semantic representation result of the training sample obtained based on the model to be trained relative to the semantic ground truth of the training sample. Finally, based on the instability index and the single-sample loss, an application indicator for the training sample is obtained to adjust the contribution of the training sample when training the model to be trained. In other words, the sample processing method provided in this disclosure can accurately locate training samples with high learning value. Its core lies in: evaluating training samples from the dimensions of credibility and learning necessity through the instability index and single-sample loss to determine whether the training sample has high learning value. Specifically: The instability index is generalized to measure the fluctuation of the consistency of the semantic representation of the training samples by the model under N different pre-training nodes. A large instability index indicates that the consistency of the semantic representation of the training samples by the model under N different pre-training nodes fluctuates greatly, which means that the training samples may contain noise such as garbled text or adversarial text, and are noisy samples with low credibility. In contrast, a small instability index indicates that the consistency of the semantic representation of the training samples by the model under N different pre-training nodes fluctuates little, which means that the training samples have clear semantics and high credibility, and are non-noisy samples with high credibility. The single-sample loss reflects the difficulty of the model fitting the training samples. A large single-sample loss means that the training samples are outside the capability range of the model and are difficult samples with high learning necessity that can promote the efficient evolution of the model. A small single-sample loss means that the training samples are at or within the capability range of the model and cannot promote the efficient evolution of the model, but may have some promoting effect on the evolution of the model. These are non-difficult samples with low learning necessity.

[0034] Therefore, by making a joint value judgment on training samples based on instability indicators and single-sample loss, it is possible to accurately locate training samples with high learning value. For example, training samples with low instability indicators and high single-sample loss possess both high credibility and high learning necessity, and can be used as training samples with high learning value. Training samples with high instability indicators and high single-sample loss, although possessing high learning necessity, lack high credibility and should be suppressed; that is, they should not be used as training samples with high learning value. Thus, the model training method provided by the embodiments of this disclosure can help overcome the one-sidedness of traditional schemes during the retraining stage of the model to be trained, accurately locate training samples with high learning value, guide the model to prioritize learning training samples with high learning value, and avoid model training biased in the wrong direction. This can not only significantly improve model training efficiency, but also improve model learning effect and generalization, thereby improving the performance of the first target model obtained by training and ensuring the robustness of the first target model in real noisy environments.

[0035] In some optional implementations, step S102, namely, "obtaining the instability index of the training samples", may include: Obtain M transformed samples from the training samples; For each of the N different pre-training nodes, the first semantic vector of the training sample and the M second semantic vectors corresponding one-to-one with the M transformed samples are obtained using the model to be trained under the pre-training node. Based on the first semantic vector and M second semantic vectors, an instability index for the training samples is obtained.

[0036] Where M≥2 and M is an integer.

[0037] In this embodiment of the disclosure, the M transformed samples can be obtained by transforming the training samples. When the training samples are text samples, the M transformed samples can also be text samples.

[0038] In one example, "obtaining M transformed samples of the training samples" can include: Determine at least one transformation strategy; For each of the at least one transformation strategy, the training samples are transformed multiple times according to the transformation strategy to obtain multiple different intermediate samples; Based on multiple different intermediate samples, M transformed samples of the training samples are obtained.

[0039] The at least one transformation strategy may include at least one of normalization transformation, cross-language back translation, interval reprojection, and sentence length transformation. That is, when determining at least one transformation strategy, at least one of normalization transformation, cross-language back translation, interval reprojection, and sentence length transformation may be determined as the transformation strategy.

[0040] For standardization transformations, it can include at least one of the following: spelling correction, misspelling correction, synonym replacement, and simplified / traditional character conversion. Spelling correction can be either correcting a correct spelling to an incorrect spelling or vice versa; misspelling correction can be either correcting a misspelled word to a correct word or vice versa.

[0041] For cross-language back-translation, there is no limit to the length of the back-translation path. For example, when the back-translation path length is 1, the source language A (e.g., Chinese) can be translated into the target language B (e.g., English), and then translated back from the target language B into the source language A; when the back-translation path length is 2, the source language A can be translated into the first target language B, then translated from the first target language B into the second target language C (e.g., Russian), and finally translated back from the second target language C into the source language A.

[0042] For interval reprojection, it can include at least one of random masking, long sentence segmentation, and short sentence recombination. Among them, random masking can be to randomly mask some words in the training samples.

[0043] Statement length transformations can include statement abbreviation and / or statement expansion.

[0044] When obtaining M transformed samples of the training samples, after determining at least one transformation strategy, the training samples can be transformed multiple times according to each of the at least one transformation strategy to obtain multiple different intermediate samples. Based on the multiple different intermediate samples, the M transformed samples of the training samples can be obtained. For example, at least some of the intermediate samples can be randomly selected from all the obtained intermediate samples as the M transformed samples of the training samples; or, for another example, all the obtained intermediate samples can be used as the M transformed samples of the training samples.

[0045] After obtaining M transformed samples of the training samples, for each of the N different preceding training nodes, the first semantic vector of the training samples and M second semantic vectors corresponding one-to-one with the M transformed samples can be obtained using the model to be trained under the preceding training node. In this embodiment of the disclosure, "obtaining the first semantic vector of the training samples using the model to be trained under the preceding training node" can be characterized as: in, Used to characterize training samples; Used to characterize the previous training node The model parameters of the model to be trained; Used to characterize the use of pre-training nodes The model to be trained, for training samples Perform semantic representation; Used to characterize the use of pre-training nodes The training samples obtained from the model to be trained The first semantic vector.

[0046] Similarly, in this embodiment of the disclosure, "using the model to be trained under the previous training node to obtain M second semantic vectors corresponding one-to-one with the M transformed samples" can be characterized as: in, Used to represent the j-th transformed sample among M transformed samples, 1≤j≤M, and j is an integer; Used to characterize the previous training node The model parameters of the model to be trained; Used to characterize the use of pre-training nodes The model to be trained under the given conditions, for the transformed samples Perform semantic representation; Used to characterize the use of pre-training nodes The transformed samples obtained from the model to be trained The second semantic vector.

[0047] For example, M=3, and the 3 transformed samples include transformed samples Transformed samples and transformed samples N=5, and the 5 distinct pre-training nodes include the pre-training nodes. Pre-training nodes Pre-training nodes Pre-training nodes and pre-training nodes Therefore, for each of the five different pre-training nodes, the training samples obtained using the model to be trained under that pre-training node are... The first semantic vector and the three second semantic vectors corresponding one-to-one with the three transformed samples can be shown in Table 1: After obtaining M transformed samples of the training samples, and for each of the N different pre-training nodes, using the model to be trained under the pre-training node to obtain the first semantic vector of the training samples and M second semantic vectors corresponding one-to-one with the M transformed samples, the instability index of the training samples can be obtained based on the first semantic vector and the M second semantic vectors. In one example, "obtaining the instability index of the training samples based on the first semantic vector and the M second semantic vectors" can include: Obtain the semantic similarity between the first semantic vector and M second semantic vectors respectively to obtain M semantic similarity scores; Based on the N×M semantic similarities corresponding to N different pre-training nodes, an instability index for the training samples is obtained.

[0048] Semantic similarity can be represented by cosine similarity. That is, "obtaining the semantic similarity between the first semantic vector and M second semantic vectors" can be: for each of the M second semantic vectors, obtain the cosine similarity between the first semantic vector and the second semantic vector as the semantic similarity corresponding to the second semantic vector, so as to obtain M semantic similarities that correspond one-to-one with the M second semantic vectors.

[0049] Furthermore, in this embodiment of the disclosure, "obtaining an instability index for training samples based on N×M semantic similarities corresponding to N different preceding training nodes" may include: Obtain the variance calculation results of N×M semantic similarities; Based on the variance calculation results, the instability index of the training samples is obtained.

[0050] In this embodiment of the disclosure, "obtaining the variance calculation results of N×M semantic similarities" can be characterized as follows: in, Used to characterize the use of pre-training nodes The training samples obtained from the model to be trained The first semantic vector; Used to characterize the use of pre-training nodes The transformed samples obtained from the model to be trained The second semantic vector; Used to represent and obtain the first semantic vector With the second semantic vector semantic similarity; Used to characterize a sample set comprising M transformed samples; Used to represent the first of N different preceding training nodes; Used to represent the Nth pre-training node among N different pre-training nodes; Used to characterize the variance calculation results of obtaining N×M semantic similarities; The variance calculation results are used to characterize N×M semantic similarities.

[0051] In this embodiment of the disclosure, after obtaining the variance calculation results of N×M semantic similarities, an instability index of the training samples can be obtained based on the variance calculation results. For example, the variance calculation results can be directly used as the instability index of the training samples; or, if it is determined that the training samples belong to sample data in a specific application domain, the variance calculation results can be reduced; if it is determined that the training samples do not belong to sample data in a specific application domain, the variance calculation results can be directly used as the instability index of the training samples. The specific application domain can be, but is not limited to, application domains with high security requirements such as medical question answering, financial risk control consulting, autonomous driving instruction understanding, and legal document analysis.

[0052] Furthermore, in this embodiment of the disclosure, when reducing the variance calculation result, the reduction factor and / or reduction method can be set according to application requirements, and this embodiment of the disclosure does not impose any restrictions on this.

[0053] Through the above methods, in this embodiment of the disclosure, M transformed samples of the training sample can be obtained. For each of the N different pre-training nodes, the first semantic vector of the training sample and M second semantic vectors corresponding one-to-one with the M transformed samples are obtained using the model to be trained under the pre-training node. Then, based on the first semantic vector and the M second semantic vectors, the instability index of the training sample is obtained. In other words, in this embodiment of the disclosure, the semantic representation differences of the model to be trained on the same training sample under different model states and different sample forms can be systematically captured by combining N different pre-training nodes and M transformed samples. This provides a direct, rich, and reliable data foundation for obtaining the instability index, which can effectively avoid the instability evaluation bias caused by a single model state or a single sample form, thereby improving the accuracy of the application indication for the training sample and further improving the positioning accuracy of training samples with high learning value.

[0054] Furthermore, when obtaining M transformed samples of the training samples, at least one transformation strategy can be determined (for example, at least one of normalization transformation, cross-language back-translation, interval reprojection, and sentence length transformation can be determined as the transformation strategy). For each of the at least one transformation strategy, the training samples are transformed multiple times according to the transformation strategy to obtain multiple different intermediate samples. Then, based on the multiple different intermediate samples, the M transformed samples of the training samples are obtained. In other words, in this embodiment of the disclosure, by introducing at least one transformation strategy (preferably multiple transformation strategies), the diverse noise and expression variations of the training samples in a real noisy environment can be simulated, so that the M transformed samples can cover a wider semantic perturbation space, avoid misjudging the value of the training samples due to a single transformation type, and thus improve the generalization and robustness of the instability index.

[0055] Furthermore, when obtaining the instability index of the training sample based on the first semantic vector and M second semantic vectors, the semantic similarity between the first semantic vector and the M second semantic vectors can be obtained to obtain M semantic similarities. Based on the N×M semantic similarities corresponding to N different pre-training nodes, the instability index of the training sample can be obtained. For example, the variance calculation result of the N×M semantic similarities can be obtained, and the instability index of the training sample can be obtained based on the variance calculation result. In other words, in this embodiment, semantic similarity can quantify the semantic representation consistency between training samples and transformed samples under the same pre-training node, and variance calculation can aggregate the fluctuation magnitude of the semantic representation consistency between all pre-training nodes and all transformed samples to obtain a unified and comparable scalar as an instability index. This index is used to intuitively reflect the semantic cognitive stability of the model to be trained on the training samples, thereby providing an accurate basis for obtaining application instructions for the training samples and improving the accuracy of application instructions for the training samples.

[0056] In some optional implementations, step S103, namely, "obtaining the single-sample loss corresponding to the training samples", may include: The first semantic vector of the training sample obtained by using the model to be trained under the target training node is determined as the semantic representation result of the training sample; Obtain the semantic truth of the training samples; Obtain the loss value of the semantic representation result relative to the semantic truth value, and use it as the single-sample loss corresponding to the training sample.

[0057] The target training node can be the last preceding training node in the time sequence among N different preceding training nodes.

[0058] Continuing the previous example, with N=5 and 5 distinct preceding training nodes, including the preceding training nodes... Pre-training nodes Pre-training nodes Pre-training nodes and pre-training nodes At that time, the target training node is one of the five different preceding training nodes. Therefore, the pre-training nodes can be utilized. The first semantic vector of the training samples obtained from the model to be trained The semantic representation results determined as training samples.

[0059] After determining the first semantic vector of the training sample obtained by using the model to be trained under the target training node as the semantic representation result of the training sample, the semantic ground truth of the training sample can be obtained, and the loss value of the semantic representation result relative to the semantic ground truth can be obtained as the single-sample loss corresponding to the training sample. As mentioned above, in this embodiment of the disclosure, the semantic ground truth can be the real semantic vector of the training sample, and it can be obtained by manual annotation or automatic annotation. This embodiment of the disclosure does not limit this. In addition, in this embodiment of the disclosure, the cross-entropy loss function can be used to obtain the loss value of the semantic representation result relative to the semantic ground truth as the single-sample loss corresponding to the training sample. This embodiment of the disclosure also does not limit this.

[0060] In this embodiment, the first semantic vector of the training sample obtained using the model to be trained under the target training node can be determined as the semantic representation result of the training sample (specifically, the target training node can be the last preceding training node in time among N different preceding training nodes), and the semantic ground truth of the training sample can be obtained. Then, the loss value of the semantic representation result relative to the semantic ground truth can be obtained as the single-sample loss corresponding to the training sample. In other words, in this embodiment, the semantic representation result of the training sample can be determined by selecting the last preceding training node in time, so as to ensure that the single-sample loss can truly reflect the degree of difficulty of the model to be trained in fitting the training sample, that is, the accuracy of the single-sample loss can be ensured.

[0061] For step S104, namely, "obtaining application instructions for training samples based on instability indicators and single-sample loss," as a first optional implementation, it may include: Based on the instability index and single-sample loss, the weight parameters of the training samples are obtained as application indicators.

[0062] As mentioned above, in this embodiment of the disclosure, the weighting parameter can be used to weight the current sample loss corresponding to the training sample when training the model to be trained, so as to adjust the contribution of the training sample to the total sample loss corresponding to itself.

[0063] Furthermore, in this embodiment of the disclosure, "obtaining the weight parameters of the training samples based on the instability index and the single-sample loss" can be: obtaining the weight parameters of the training samples based on the instability index and the single-sample loss according to a preset logic. The preset logic can satisfy one of the following conditions: When the instability index reflects that the training sample has high reliability and the single sample loss reflects that the training sample has high learning necessity, the training sample is assigned a weight parameter greater than the baseline weight. When the instability index reflects that the training sample has low reliability and the single sample loss reflects that the training sample has high learning necessity, the training sample is assigned a weight parameter that is smaller than the baseline weight. When the single-sample loss reflects that the training samples have low learning necessity, the training samples are assigned weight parameters equal to the baseline weights.

[0064] As mentioned above, in this embodiment of the disclosure, a small instability index reflects high reliability of the training samples; conversely, a large instability index reflects low reliability of the training samples. Here, a small instability index can mean that the instability index is less than or equal to an index threshold; a large instability index can mean that the instability index is greater than an index threshold. The index threshold can be set according to application requirements, for example, it can be set to 0.4, and this embodiment of the disclosure does not impose any limitations on this.

[0065] Similarly, as mentioned above, in this embodiment of the disclosure, a large single-sample loss reflects a high learning necessity for the training sample; conversely, a small single-sample loss reflects a low learning necessity for the training sample. Here, a large single-sample loss can mean that the single-sample loss is greater than a loss threshold; a small single-sample loss can mean that the single-sample loss is less than or equal to the loss threshold. The loss threshold can be set according to application requirements, for example, it can be set to 0.2, and this embodiment of the disclosure does not impose any limitations on this.

[0066] Based on the above, as shown in Table 2, in this embodiment of the disclosure, when the instability index is small and the single-sample loss is large, indicating that the training sample has both high credibility and high learning necessity, a weight parameter greater than the baseline weight can be assigned to the training sample to enable reinforcement learning. When the instability index is large and the single-sample loss is large, indicating that the training sample has high learning necessity but not high credibility, a weight parameter less than the baseline weight can be assigned to the training sample to suppress it. When the single-sample loss is small, indicating that the training sample has low learning necessity, a weight parameter equal to the baseline weight can be assigned to the training sample to enable normal learning. The baseline weight can be set according to application requirements; for example, it can be set to 1. This embodiment of the disclosure does not limit this setting.

[0067] Furthermore, in this embodiment of the disclosure, the preset logic can be fixed assignment logic. For example, if the instability index reflects that the training sample has high reliability and the single-sample loss reflects that the training sample has high learning necessity, a first candidate parameter greater than the benchmark weight can be used as the weight parameter of the training sample; or, if the instability index reflects that the training sample has low reliability and the single-sample loss reflects that the training sample has high learning necessity, a second candidate parameter less than the benchmark weight can be used as the weight parameter of the training sample; or, if the single-sample loss reflects that the training sample has low learning necessity, the benchmark weight can be used as the weight parameter of the training sample. The first and second candidate parameters can be set according to application requirements. For example, if the benchmark weight is set to 1, the first candidate parameter can be set to 1.5 and the second candidate parameter can be set to 0.5. This embodiment of the disclosure does not impose any limitations on this.

[0068] In this embodiment of the disclosure, the preset logic can also be implemented using an adaptive weight function. That is, "obtaining the weight parameters of the training samples based on the instability index and single-sample loss according to the preset logic" can be: using an adaptive weight function to process the instability index and single-sample loss to obtain the weight parameters of the training samples. This process can be characterized as follows: in, Used to characterize training samples Instability indicators; Used for characterizing and training samples The corresponding single-sample loss; Used to characterize the use of adaptive weighting functions For training samples Instability index and single-sample loss Process it; Used to characterize training samples The weight parameters.

[0069] In practical implementation, the adaptive weight function can specifically be: in, Used to characterize adjustable hyperparameters, which can be set according to application requirements, for example, can be set to 0.85, but the embodiments disclosed herein do not limit this; Used to characterize training samples Instability indicators; Used to characterize training samples The corresponding single-sample loss; The threshold used to characterize the indicator can be set according to application requirements. For example, it can be set to 0.4. This disclosure does not limit this. The threshold used to characterize the loss can be set according to application requirements. For example, it can be set to 0.2. This disclosure does not limit this. Used to characterize exponential functions; Weight parameters used to characterize training samples.

[0070] For example, there are 3 training samples, namely training samples Training samples and training samples Among them, training samples Training samples and training samples For text-based samples, specifically, training samples The instability index of "This movie is really great" =0.1, corresponding to a single-sample loss =0.8; training samples The instability index of "You're really good" =0.6, corresponding to a single-sample loss =0.9; training samples The instability index for "The weather is very nice today" =0.05, corresponding to a single-sample loss =0.2. Therefore, as shown in Table 3, the adjustable hyperparameter... =0.85, indicator threshold =0.4, loss threshold When the weight ratio is 0.2, an adaptive weight function is used to adjust the weights of the training samples. Instability index and single-sample loss After processing, training samples can be obtained. Weight parameters =1.5; Using an adaptive weighting function, the training samples are... Instability index and single-sample loss After processing, training samples can be obtained. Weight parameters =0.55; Using an adaptive weighting function, the training samples are... Instability index and single-sample loss After processing, training samples can be obtained. Weight parameters =1.

[0071] In this way, when training the model, more training samples can be used for learning. Less training samples Normal learning training samples .

[0072] In summary, in this embodiment of the disclosure, when obtaining application instructions for training samples based on instability indicators and single-sample loss, the weight parameters of the training samples can be obtained based on the instability indicators and single-sample loss as application instructions. Specifically, the weight parameters of the training samples can be obtained according to preset logic based on instability indicators and single-sample loss. Specifically, for "high-value difficult example samples" that are semantically clear, highly credible, and not yet mastered by the model to be trained, a weight parameter greater than the baseline weight is assigned to them, so that they account for a higher contribution in the total sample loss, thereby guiding the model to be trained to focus on learning these information-rich, non-capable samples and accelerating the performance improvement of the model to be trained; for "suspicious noise samples" that may contain noise such as garbled text or adversarial text and not yet mastered by the model to be trained, a weight parameter less than the baseline weight is assigned to them, effectively suppressing their negative impact on the model parameters of the model to be trained and avoiding the training of the model to be trained in the wrong direction; for samples that the model to be trained has basically mastered, a weight parameter is assigned to them. By maintaining the baseline weights on ordinary samples with low learning necessity, and allowing them to learn normally, the stability of the learned knowledge is ensured. This adaptive weighting mechanism not only achieves synergistic optimization of hard sample reinforcement and noisy sample suppression, significantly improving the training efficiency, generalization, and robustness of the model under training in real noisy environments, but also smoothly adjusts the contribution of each training sample to the total sample loss in each batch of training samples, avoiding information loss or training oscillations that may be caused by discrete sampling, thereby further improving the training efficiency, generalization, and robustness of the model under training in real noisy environments.

[0073] For step S104, namely, "obtaining application instructions for training samples based on instability indicators and single-sample loss," as a second optional implementation, it may include: Based on the instability index and single-sample loss, a sampling strategy for training samples is derived as an application guide.

[0074] As described above, in this embodiment of the disclosure, the sampling strategy can be used to adjust the number of training samples during the training of the model to be trained, thereby adjusting the contribution of the training samples to the total sample loss. The sampling strategy can include one of an upsampling strategy, a downsampling strategy, and a normal sampling strategy. Here, an upsampling strategy can be used to instruct an increase in the number of training samples (e.g., increasing the number of training samples based on a baseline sampling number) to increase the contribution of the training samples to the total sample loss corresponding to them; a downsampling strategy can be used to instruct a decrease in the number of training samples (e.g., decreasing the number of training samples based on a baseline sampling number) to decrease the contribution of the training samples to the total sample loss corresponding to them; a normal sampling strategy can be used to instruct the maintenance of the number of training samples (e.g., setting the number of training samples to the baseline sampling number) to maintain the contribution of the training samples to the total sample loss corresponding to them.

[0075] In this embodiment of the disclosure, the number of reference samples can be set according to application requirements, for example, it can be set to 100, and this embodiment of the disclosure does not limit this.

[0076] Furthermore, in this embodiment of the disclosure, "obtaining a sampling strategy for training samples based on instability metrics and single-sample loss" may include one of the following: When the instability index reflects that the training samples have high reliability and the single-sample loss reflects that the training samples have high learning necessity, the upsampling strategy is determined as the sampling strategy for the training samples. When the instability index reflects that the training samples have low reliability and the single-sample loss reflects that the training samples have high learning necessity, the downsampling strategy is determined as the sampling strategy for the training samples. When the single-sample loss indicates that the training samples have low learning necessity, the normal sampling strategy is determined as the sampling strategy for the training samples.

[0077] As mentioned above, in this embodiment of the disclosure, a small instability index reflects high reliability of the training samples; conversely, a large instability index reflects low reliability of the training samples. Here, a small instability index can mean that the instability index is less than or equal to an index threshold; a large instability index can mean that the instability index is greater than an index threshold. The index threshold can be set according to application requirements, for example, it can be set to 0.4, and this embodiment of the disclosure does not impose any limitations on this.

[0078] Similarly, as mentioned above, in this embodiment of the disclosure, a large single-sample loss reflects a high learning necessity for the training sample; conversely, a small single-sample loss reflects a low learning necessity for the training sample. Here, a large single-sample loss can mean that the single-sample loss is greater than a loss threshold; a small single-sample loss can mean that the single-sample loss is less than or equal to the loss threshold. The loss threshold can be set according to application requirements, for example, it can be set to 0.2, and this embodiment of the disclosure does not impose any limitations on this.

[0079] Based on the above, as shown in Table 4, in this embodiment of the disclosure, when the instability index is small and the single-sample loss is large, indicating that the training samples have both high credibility and high learning necessity, the upsampling strategy can be determined as the sampling strategy for the training samples to enable reinforcement learning of the training samples; when the instability index is large and the single-sample loss is large, indicating that the training samples have high learning necessity but not high credibility, the downsampling strategy can be determined as the sampling strategy for the training samples to suppress the training samples; when the single-sample loss is small, indicating that the training samples have low learning necessity, the normal sampling strategy can be determined as the sampling strategy for the training samples to enable normal learning of the training samples.

[0080] As described above, in this embodiment of the disclosure, the upsampling strategy can be to increase the number of training samples based on the baseline sampling number. For example, the baseline sampling number can be increased by amplifying the adjustment parameter to obtain the number of training samples. The downsampling strategy can be to decrease the number of training samples based on the baseline sampling number. For example, the baseline sampling number can be decreased by reducing the adjustment parameter to obtain the number of training samples. The normal sampling strategy can be to use the baseline sampling number as the number of training samples. This process can be characterized as follows: in, The amplification adjustment parameter can be a first fixed value set according to application requirements, such as 1.5, or it can be a first dynamic value obtained based on the instability index and single-sample loss. This disclosure does not limit this. The number of reference samples is used to characterize the number of samples. It can be set according to application requirements. For example, it can be set to 100. This disclosure does not limit this. Used to characterize training samples Instability indicators; Used for characterizing and training samples The corresponding single-sample loss; The threshold used to characterize the indicator can be set according to application requirements. For example, it can be set to 0.4. This disclosure does not limit this. The threshold used to characterize the loss can be set according to application requirements. For example, it can be set to 0.2. This disclosure does not limit this. The parameter used to characterize the reduction adjustment can be a second fixed value set according to application requirements, such as 0.5, or it can be a second dynamic value obtained based on the instability index and single-sample loss. This disclosure does not limit this. Used to characterize training samples The number of samples.

[0081] In this embodiment of the disclosure, when the amplification adjustment parameter is a first dynamic value obtained based on the instability index and the single-sample loss, and the reduction adjustment parameter is a second dynamic value obtained based on the instability index and the single-sample loss, the method for obtaining the amplification adjustment parameter can be the same as the method for obtaining the weight parameters of the training samples using an adaptive weight function when the training samples have both high credibility and high learning necessity, and this embodiment of the disclosure will not elaborate on this. The method for obtaining the reduction adjustment parameter can be the same as the method for obtaining the weight parameters of the training samples using an adaptive weight function when the training samples have high learning necessity but not high credibility, and this embodiment of the disclosure will also not elaborate on this.

[0082] For example, there are 3 training samples, namely training samples Training samples and training samples Among them, training samples Training samples and training samples For text-based samples, specifically, training samples The instability index of "This movie is really great" =0.1, corresponding to a single-sample loss =0.8; training samples The instability index of "You're really good" =0.6, corresponding to a single-sample loss =0.9; training samples The instability index for "The weather is very nice today" =0.05, corresponding to a single-sample loss =0.2. Therefore, as shown in Table 5, the adjustable hyperparameter... =0.85, indicator threshold =0.4, loss threshold When the weight ratio is 0.2, an adaptive weight function is used to adjust the weights of the training samples. Instability index and single-sample loss After processing, we can obtain samples that are similar to the training samples. Corresponding amplification adjustment parameters =1.5; Using an adaptive weighting function, the training samples are... Instability index and single-sample loss After processing, we can obtain samples that are similar to the training samples. Corresponding reduction adjustment parameters =0.55.

[0083] In this way, when training the model, more training samples can be used for learning. Less training samples Normal learning training samples .

[0084] In summary, in this embodiment of the disclosure, when obtaining application instructions for training samples based on instability indicators and single-sample loss, a sampling strategy for the training samples can be obtained based on the instability indicators and single-sample loss as the application instructions. Specifically, if the instability indicator reflects high reliability of the training samples and the single-sample loss reflects high learning necessity of the training samples, an upsampling strategy can be determined as the sampling strategy for the training samples; or, if the instability indicator reflects low reliability of the training samples and the single-sample loss reflects high learning necessity of the training samples, a downsampling strategy can be determined as the sampling strategy for the training samples; or, if the single-sample loss reflects low learning necessity of the training samples, a normal sampling strategy can be determined as the sampling strategy for the training samples. Accordingly, in this embodiment of the disclosure, during the training process of the model to be trained, a sampling quantity matching its true value can be dynamically set for each training sample. Specifically, for "high-value difficult example samples" that are semantically clear, highly credible, and not yet mastered by the training model, a sampling quantity greater than the baseline sampling quantity is set for them, allowing them to contribute more to the total sample loss. This guides the training model to focus on learning these information-rich, uncapable samples, accelerating the performance improvement of the training model. For "suspicious noise samples" that may contain garbled text, adversarial text, or other noise and are not yet mastered by the training model, a sampling quantity less than the baseline sampling quantity is set for them. This effectively suppresses their negative impact on the model parameters of the training model, preventing the training model from being biased towards the wrong direction. For ordinary samples that the model has basically mastered or that have low learning necessity, the baseline sampling quantity is used as the sampling quantity for normal learning to ensure the stability of the learned knowledge. This sampling quantity adjustment mechanism not only achieves the synergistic optimization of hard sample reinforcement and noisy sample suppression, but also significantly improves the training efficiency, generalization and robustness of the model in real noisy environments. Moreover, this sampling quantity adjustment mechanism is closer to the ideas of data augmentation and resampling, is easy to integrate with traditional training frameworks (e.g., data loaders, batch samplers), and has a more indirect and smoother impact on the model optimizer.

[0085] This disclosure provides a model training method, specifically a method for retraining a model to be trained, which can be applied to an electronic device. The electronic device can be a server, workbench, mainframe computer, conventional computer, or other similar computing device. The following will be combined with... Figure 2 The flowchart shown illustrates a model training method provided in an embodiment of this disclosure. It should be noted that, although in Figure 2 The flowchart shown illustrates the logical order; however, in some cases, the steps shown or described in the flowchart may be performed in a different order.

[0086] Step S201: Obtain multiple training samples.

[0087] The training samples are the sample data, such as text samples.

[0088] In this embodiment of the disclosure, multiple training samples can be obtained from multiple candidate samples through manual screening or machine screening, and this embodiment of the disclosure does not limit this.

[0089] Furthermore, in this embodiment of the disclosure, each training sample among multiple training samples has a corresponding application instruction, and the application instruction can be obtained using the aforementioned sample processing method, which will not be elaborated upon in this embodiment of the disclosure.

[0090] Step S202: According to multiple application instructions that correspond one-to-one with multiple training samples, the model to be trained is trained using multiple training samples to obtain the first target model.

[0091] The model to be trained can be the model to be trained under the aforementioned target training node, that is, the model to be trained under the latest preceding training node in the time sequence among the aforementioned N different preceding training nodes.

[0092] As previously stated, in this embodiment of the disclosure, for each of the plurality of training samples, the application instruction can be used to adjust the contribution of the training sample when training the model to be trained.

[0093] In this embodiment of the disclosure, for each training sample among multiple training samples, when training the model to be trained, the contribution of the training sample can be adjusted by a weight parameter. That is, the application instruction can be a weight parameter, which is used to weight the current sample loss corresponding to the training sample when training the model to be trained, so as to adjust the contribution of the training sample in the total sample loss corresponding to itself.

[0094] In this embodiment of the disclosure, for each of the multiple training samples, the contribution of the training sample can also be controlled by a sampling strategy when training the model to be trained. That is, the application instruction can also be a sampling strategy to adjust the number of training samples when training the model to be trained, so as to adjust the contribution of the training sample in the total sample loss corresponding to itself.

[0095] Furthermore, it should be noted that in this embodiment of the disclosure, "training the model to be trained" can be understood as updating the model parameters of the model to be trained, that is, modifying the current model parameters of the model to be trained to the new model parameters.

[0096] It should also be noted that in this embodiment, steps S201 and S202 can be executed cyclically. For example, step S201 can be executed first to obtain a first batch of multiple training samples, and step S202 can be executed using the first batch of multiple training samples, and the resulting first target model can be used as a new model to be trained. Subsequently, step S201 can be executed again to obtain a second batch of multiple training samples, and step S202 can be executed using the second batch of multiple training samples, and so on, until it is determined that the model to be trained meets the preset convergence condition, and it is used as the final first target model; or, until it is determined that the model to be trained does not meet the preset convergence condition, but the number of training rounds has reached N. The preset convergence condition can be set according to application requirements, and this embodiment does not limit it.

[0097] In this embodiment of the disclosure, if it is determined that the model to be trained has not met the preset convergence condition, but the number of training rounds has reached N, the sample processing method can be executed again in a loop to obtain new training materials, including application instructions corresponding to each new training sample in multiple new training samples in N batches. During this process, the models to be trained under N different previous training nodes include: After obtaining the first target model by executing step S202 using multiple training samples from the first batch, the first target model is used as the new model to be trained. After obtaining the first target model by executing step S202 using multiple training samples from the second batch, the first target model is used as the new model to be trained. ... After obtaining the first target model by executing step S202 using multiple training samples in the Nth batch, the first target model is used as the new model to be trained.

[0098] The model training method provided in this disclosure can acquire multiple training samples (each training sample has a corresponding application instruction, and the application instruction can be obtained using the aforementioned sample processing method), and train the model to be trained using the multiple training samples according to the multiple application instructions corresponding one-to-one with the multiple training samples, to obtain the first target model. In other words, the model training method provided in this disclosure can accurately locate training samples with high learning value. Its core lies in: evaluating training samples from two dimensions—reliability and learning necessity—using instability indicators and single-sample loss to determine whether a training sample has high learning value. Specifically: The instability index is generalized to measure the fluctuation of the consistency of the semantic representation of the training samples by the model under N different pre-training nodes. A large instability index indicates that the consistency of the semantic representation of the training samples by the model under N different pre-training nodes fluctuates greatly, which means that the training samples may contain noise such as garbled text or adversarial text, and are noisy samples with low credibility. In contrast, a small instability index indicates that the consistency of the semantic representation of the training samples by the model under N different pre-training nodes fluctuates little, which means that the training samples have clear semantics and high credibility, and are non-noisy samples with high credibility. The single-sample loss reflects the difficulty of the model fitting the training samples. A large single-sample loss means that the training samples are outside the capability range of the model and are difficult samples with high learning necessity that can promote the efficient evolution of the model. A small single-sample loss means that the training samples are at or within the capability range of the model and cannot promote the efficient evolution of the model, but may have some promoting effect on the evolution of the model. These are non-difficult samples with low learning necessity.

[0099] Therefore, by making a joint value judgment on training samples based on instability indicators and single-sample loss, it is possible to accurately locate training samples with high learning value. For example, training samples with low instability indicators and high single-sample loss have both high credibility and high learning necessity, and can be used as training samples with high learning value. Training samples with high instability indicators and high single-sample loss, although they have high learning necessity, do not have high credibility and should be suppressed, that is, they should not be used as training samples with high learning value. Thus, the sample processing method provided by the embodiments of this disclosure can help overcome the one-sidedness of traditional solutions in the retraining stage of the model to be trained, accurately locate training samples with high learning value, guide the model to prioritize learning training samples with high learning value, and avoid model training biased in the wrong direction. This can not only significantly improve the model training efficiency, but also improve the model learning effect and generalization, thereby improving the performance of the first target model obtained by training and ensuring the robustness of the first target model in real noisy environments.

[0100] As mentioned above, in this embodiment of the disclosure, multiple training samples can be obtained from multiple candidate samples through machine screening. Based on this, in this embodiment of the disclosure, step S201, i.e., "obtaining multiple training samples," may include: Obtain multiple candidate samples; For each candidate sample among multiple candidate samples, a sample pre-selection model is used to obtain multiple pre-selection classification results for the candidate sample. If the candidate sample is determined to be a usable sample based on the multiple pre-selection classification results, the candidate sample is determined as a training sample.

[0101] Candidate samples are sample data, such as text samples.

[0102] Please combine Figure 3 In this embodiment of the disclosure, the sample pre-selection model may include a first main model and multiple pre-selection classification heads connected in parallel to the output of the first main model. The first main model may be the model to be trained, or it may be a neural network model with a different converter architecture independent of the model to be trained; this embodiment of the disclosure does not limit this. The multiple pre-selection classification heads may be multiple lightweight networks with the same structure but independently updated parameters, specifically fully connected networks, multilayer perceptrons (MLPs), etc. Here, the multiple pre-selection classification heads can be used to output multiple pre-selection classification results in a one-to-one correspondence.

[0103] In this embodiment of the disclosure, the pre-classification result can be used to characterize whether the candidate sample meets the sample pre-selection conditions. For example, if the pre-classification result is "1", it indicates that the candidate sample meets the sample pre-selection conditions; if the pre-classification result is "0", it indicates that the candidate sample does not meet the sample pre-selection conditions. The sample pre-selection conditions can be set according to application requirements. For example, they can be set to indicate that the candidate sample does not have extremely low confidence, that is, the candidate sample has extremely high confidence, high confidence, medium confidence, or low confidence. This embodiment of the disclosure does not impose any limitations on this.

[0104] Furthermore, in this embodiment of the disclosure, "determining that a candidate sample belongs to an available sample based on multiple pre-selected classification results" may include: When multiple pre-selected classification results simultaneously indicate that the candidate sample meets the sample pre-selection conditions, the candidate sample is determined to be a usable sample.

[0105] In this embodiment of the present disclosure, after obtaining multiple candidate samples, a sample pre-selection model is used to obtain multiple pre-selection classification results for each candidate sample. If, based on these pre-selection classification results, the candidate sample is determined to be a usable sample, it is then designated as a training sample. For example, if multiple pre-selection classification results simultaneously indicate that the candidate sample meets the sample pre-selection conditions, it is determined to be a usable sample and designated as a training sample. In other words, this embodiment of the present disclosure utilizes multi-head cross-validation to quickly eliminate high-noise samples from multiple candidate samples, retaining only usable samples unanimously recognized by multiple pre-selection classification heads as training samples for training the model to be trained, thus obtaining the first target model. This effectively reduces the proportion of high-noise samples in the multiple training samples, minimizing invalid fitting of the model to be trained to high-noise samples during the training process to obtain the first target model, thereby further improving the training efficiency and generalization of the model to be trained.

[0106] Furthermore, it should be noted that in this embodiment of the disclosure, the sample pre-selection model can be obtained by training an initial pre-selection model. This process may include: Obtain the first data sample; Using the initial pre-selected model, multiple pre-selected classification result samples are obtained for the first data sample; For each of the multiple pre-selected classification result samples, the pre-selection loss is obtained based on the pre-selected classification result sample and the true value of the pre-selected classification result for the first data sample; The initial pre-selection model is trained using multiple pre-selection losses that correspond one-to-one with multiple pre-selection classification results to obtain the sample pre-selection model.

[0107] The initial pre-selected model can be the sample pre-selected model in its initial state, that is, it has the same structure as the sample pre-selected model, which will not be elaborated in this embodiment. The ground truth value of the pre-selected classification result can be the true semantic vector of the first data sample, and it can be obtained through manual annotation or automatic annotation, which is also not limited in this embodiment. Here, the annotation principle can be: for the first data sample that does not have extremely low confidence, its pre-selected classification result ground truth value is annotated as "1"; for the first data sample with extremely low confidence, its pre-selected classification result ground truth value is annotated as "0".

[0108] In this embodiment of the disclosure, the cross-entropy loss function can be used to obtain the pre-selection loss based on the pre-selection classification result samples and the true value of the pre-selection classification result for the first data sample. This embodiment of the disclosure does not limit this.

[0109] Furthermore, in this embodiment of the disclosure, when training the initial pre-selection model using multiple pre-selection losses that correspond one-to-one with multiple pre-selection classification results to obtain the sample pre-selection model, the model parameters of the first master model can be frozen, and for each of the multiple pre-selection losses, the parameters of the pre-selection classification head in the initial pre-selection model corresponding to that pre-selection loss can be adjusted using the pre-selection loss to obtain the sample pre-selection model; alternatively, the parameters of the first master model in the initial pre-selection model can be adjusted by combining multiple pre-selection losses, and at the same time, for each of the multiple pre-selection losses, the parameters of the pre-selection classification head in the initial pre-selection model corresponding to that pre-selection loss can be adjusted using the pre-selection loss to obtain the sample pre-selection model. This embodiment of the disclosure does not limit this approach.

[0110] As mentioned above, in this embodiment of the disclosure, for multiple training samples, the multiple application instructions corresponding to each of them can be multiple weight parameters (each application instruction is a weight parameter). Based on this, step S202, namely, "training the model to be trained using the multiple training samples according to the multiple application instructions corresponding to each of the multiple training samples to obtain the first target model," as a first optional implementation, may include: For each training sample among multiple training samples, obtain the first semantic representation result of the training sample obtained by using the model to be trained, so as to obtain multiple first semantic representation results corresponding one-to-one with multiple training samples. Obtain multiple first semantic truth values ​​that correspond one-to-one with multiple training samples; Based on multiple weight parameters, multiple first semantic representation results and multiple first semantic truth values, the first total sample loss corresponding to multiple training samples is obtained; Based on the first total sample loss, the model to be trained is trained to obtain the first target model.

[0111] In this embodiment, for each of the multiple training samples, the corresponding first semantic truth value can be the real semantic vector of the training sample, and it can be obtained by manual annotation or automatic annotation. This disclosure does not limit this.

[0112] In this embodiment of the disclosure, "obtaining the first total sample loss corresponding to multiple training samples based on multiple weight parameters, multiple first semantic representation results, and multiple first semantic truth values" can be characterized as follows: in, Used to characterize the total number of training samples ≥2, and It is an integer; Used for characterization The r1th training sample among the training samples (that is, the training sample) The weight parameters, 1≤r1≤ And r1 is an integer; Used to characterize training samples The first semantic representation result relative to the training samples The loss value of the first semantic truth, that is, the loss value compared with the training samples. The corresponding loss for the current sample; Used to characterize and The first total sample loss corresponding to each training sample.

[0113] Furthermore, in this embodiment of the disclosure, "training the model to be trained based on the first total sample loss to obtain the first target model" may include: Based on the model to be trained, determine the teacher model; For each training sample among multiple training samples, the teacher model is used to obtain the first reference semantic representation result of each of the M transformed samples of the training sample, and based on the first semantic representation result and the first reference semantic representation result of the training sample, the first transformation loss corresponding to the training sample is obtained. Based on the first total sample loss and multiple first transformation losses corresponding one-to-one with multiple training samples, the model to be trained is trained to obtain the first target model.

[0114] The teacher model can be a neural network model with the same structure as the model to be trained but with different parameter update methods. Specifically, the teacher model can be a "weighted average version" of the model to be trained, which represents the average model state of the model to be trained over a period of time.

[0115] In one example, the Exponential Moving Average (EMA) method can be used to determine the model parameters of the teacher model based on the current model parameters of the model to be trained, thus obtaining the teacher model. This process can be characterized as follows: in, The smoothing coefficient is used to characterize the smoothness and can be set according to application requirements. For example, it can be set to 0.99~0.999, but the embodiments disclosed herein do not limit this. Historical model parameters used to characterize the teacher model; The current model parameters used to characterize the model to be trained; Model parameters used to characterize the teacher model.

[0116] Furthermore, it should be noted that in this embodiment of the disclosure, after determining the model parameters of the teacher model based on the current model parameters of the model to be trained in order to obtain the teacher model, the model parameters of the teacher model can be used as its new historical model parameters.

[0117] Furthermore, in this embodiment of the disclosure, "using the teacher model to obtain the first reference semantic representation result of each of the M transformed samples of the training samples, and based on the first semantic representation result and the first reference semantic representation result of the training samples, obtaining the first transformation loss corresponding to the training samples" can be characterized as: in, Used to characterize training samples The total number of transformed samples, M≥2, and M is an integer; Used to characterize training samples The j-th transform sample among M transform samples The first reference semantic representation result, 1≤j≤M, and j is an integer; Used to characterize training samples The first semantic representation result; Used to characterize training samples The j-th transform sample among M transform samples First reference semantic representation results and training samples The relative entropy between the first semantic representation results (also known as Kullback-Leibler Divergence, KL divergence). Used for characterizing and training samples The corresponding first conversion loss.

[0118] Based on this, in this embodiment of the disclosure, when training the model to be trained based on the first total sample loss and the multiple first transformation losses corresponding one-to-one with the multiple training samples to obtain the first target model, the first total loss can be obtained based on the first total sample loss and the multiple first transformation losses corresponding one-to-one with the multiple training samples, and the model to be trained based on the first total loss to obtain the first target model. Wherein, "obtaining the first total loss based on the first total sample loss and the multiple first transformation losses corresponding one-to-one with the multiple training samples" can be characterized as: in, Used to characterize the total number of training samples ≥2, and It is an integer; Used to characterize and The first total sample loss corresponding to each training sample; The first balance coefficient is used to characterize the application and can be set according to the application requirements. For example, it can be set to 0.2. This disclosure does not limit this. Used for characterization The r1th training sample among the training samples (that is, the training sample) The weight parameters, 1≤r1≤ And r1 is an integer; Used for characterizing and training samples The corresponding first conversion loss; Used to characterize the first total loss.

[0119] In this embodiment of the present disclosure, for each training sample among multiple training samples, a first semantic representation result obtained using the model to be trained can be acquired to obtain multiple first semantic representation results corresponding one-to-one with the multiple training samples, and multiple first semantic ground values ​​corresponding one-to-one with the multiple training samples can be acquired. Then, based on multiple weight parameters, multiple first semantic representation results, and multiple first semantic ground values, a first total sample loss corresponding to the multiple training samples can be obtained. Finally, based on the first total sample loss, the model to be trained is trained to obtain a first target model. That is to say, in this embodiment of the present disclosure, weight parameters matching their true value can be dynamically assigned to each training sample during the training process of the model to be trained. Specifically, for "high-value difficult examples" that are semantically clear, highly credible, and not yet mastered by the training model, a weight parameter greater than the baseline weight is assigned, allowing them to contribute more to the total sample loss. This guides the training model to focus on learning these information-rich, extra-capability samples, accelerating the performance improvement of the training model. For "suspicious noise samples" that may contain garbled text, adversarial text, or other noise and are not yet mastered by the training model, a weight parameter less than the baseline weight is assigned, effectively suppressing their negative impact on the model parameters and preventing the training model from being biased in the wrong direction. For samples that the training model has basically mastered... By maintaining the baseline weights on ordinary samples with low learning necessity, and allowing them to learn normally, the stability of the learned knowledge is ensured. This adaptive weighting mechanism not only achieves synergistic optimization of hard sample reinforcement and noisy sample suppression, significantly improving the training efficiency, generalization, and robustness of the model under training in real noisy environments, but also smoothly adjusts the contribution of each training sample to the total sample loss in each batch of training samples, avoiding information loss or training oscillations that may be caused by discrete sampling, thereby further improving the training efficiency, generalization, and robustness of the model under training in real noisy environments.

[0120] Furthermore, when training the model to be trained based on the first total sample loss to obtain the first target model, a teacher model can be determined based on the model to be trained (for example, using the EMA method to determine the model parameters of the teacher model based on the current model parameters of the model to be trained, thus obtaining the teacher model). For each training sample among multiple training samples, the teacher model is used to obtain the first reference semantic representation result of each of the M transformed samples of the training sample. Based on the first semantic representation result and the first reference semantic representation result of the training sample, the first transformation loss corresponding to the training sample is obtained. Then, based on the first total sample loss and the multiple first transformation losses corresponding one-to-one with the multiple training samples, the model to be trained is trained to obtain the first target model. Thus, in this embodiment of the disclosure, a consistency regularization loss based on the teacher model, i.e., multiple first transformation losses, is further introduced on the basis of the first total sample loss. The teacher model is obtained through the EMA method based on the current model parameters of the model to be trained, and its semantic representation result is more stable and noise-resistant than that of the model to be trained. Therefore, by training the model to be trained based on the first total sample loss and the multiple first transformation losses corresponding one-to-one with multiple training samples, the first target model can be obtained, which can further improve the robustness of the first target model to real noisy environments.

[0121] As mentioned above, in this embodiment of the disclosure, for multiple training samples, the multiple application instructions corresponding to them can also be multiple sampling strategies (each application instruction is a sampling strategy). Based on this, step S202, namely, "training the model to be trained using the multiple training samples according to the multiple application instructions corresponding to the multiple training samples to obtain the first target model," as a second optional implementation, may include: Based on multiple sampling strategies, the number of at least some of the training samples in multiple training samples is adjusted to obtain multiple actual samples; For each of the multiple real samples, the second semantic representation result of the real sample is obtained using the model to be trained, so as to obtain multiple second semantic representation results that correspond one-to-one with the multiple real samples. Obtain multiple second semantic truth values ​​that correspond one-to-one with multiple actual samples; Based on multiple second semantic representation results and multiple second semantic truth values, a second total sample loss corresponding to multiple actual samples is obtained; Based on the second total sample loss, the model to be trained is trained to obtain the first target model.

[0122] In this embodiment, for each of the multiple actual samples, the corresponding second semantic truth value can be the real semantic vector of the actual sample, and it can be obtained through manual annotation or automatic annotation. This disclosure does not limit this.

[0123] In this embodiment of the disclosure, "obtaining the second total sample loss corresponding to multiple actual samples based on multiple second semantic representation results and multiple second semantic truth values" can be characterized as follows: in, Used to characterize the total number of actual samples ≥2, and It is an integer; Used for characterization The r2th actual sample among the actual samples (that is, the actual sample) The second semantic representation result relative to the actual sample The loss value of the second semantic truth, that is, the loss value compared with the actual sample. The corresponding current sample loss, 1≤r²≤ And r2 is an integer; Used to characterize and The second total sample loss corresponding to each actual sample.

[0124] Furthermore, in this embodiment of the disclosure, "training the model to be trained based on the second total sample loss to obtain the first target model" may include: Based on the model to be trained, determine the teacher model; For each of the multiple real samples, the teacher model is used to obtain the second reference semantic representation result of each of the M transformed samples of the real sample, and based on the second semantic representation result and the second reference semantic representation result of the real sample, the second transformation loss corresponding to the real sample is obtained. Based on the second total sample loss and multiple second transformation losses corresponding one-to-one with multiple actual samples, the model to be trained is trained to obtain the first target model.

[0125] The teacher model can be a neural network model with the same structure as the model to be trained but with different parameter update methods. Specifically, the teacher model can be a "weighted average version" of the model to be trained, which represents the average model state of the model to be trained over a period of time.

[0126] As previously described, in this embodiment of the disclosure, the EMA method can be used to determine the model parameters of the teacher model based on the current model parameters of the model to be trained, thereby obtaining the teacher model. This process can be characterized as follows: in, The smoothing coefficient is used to characterize the smoothness and can be set according to application requirements. For example, it can be set to 0.99~0.999, but the embodiments disclosed herein do not limit this. Historical model parameters used to characterize the teacher model; The current model parameters used to characterize the model to be trained; Model parameters used to characterize the teacher model.

[0127] Furthermore, it should be noted that in this embodiment of the disclosure, after determining the model parameters of the teacher model based on the current model parameters of the model to be trained in order to obtain the teacher model, the model parameters of the teacher model can be used as its new historical model parameters.

[0128] Furthermore, in this embodiment of the disclosure, "using the teacher model to obtain the second reference semantic representation result of each of the M transformed samples of the actual sample, and based on the second semantic representation result and the second reference semantic representation result of the actual sample, obtaining the second transformation loss corresponding to the actual sample" can be characterized as: in, Used to characterize actual samples The total number of transformed samples, M≥2, and M is an integer; Used to characterize actual samples The j-th transform sample among M transform samples The second reference semantic representation result, 1≤j≤M, and j is an integer; Used to characterize actual samples The second semantic representation result; Used to characterize actual samples The j-th transform sample among M transform samples The second reference semantic representation results and the actual samples The relative entropy between the second semantic representation results; Used to characterize actual samples The corresponding second conversion loss.

[0129] Based on this, in this embodiment of the disclosure, when training the model to be trained based on the second total sample loss and the multiple second transformation losses corresponding one-to-one with the multiple actual samples to obtain the first target model, a second total loss can be obtained based on the second total sample loss and the multiple second transformation losses corresponding one-to-one with the multiple actual samples, and the model to be trained based on the second total loss to obtain the first target model. Wherein, "obtaining the second total loss based on the second total sample loss and the multiple second transformation losses corresponding one-to-one with the multiple actual samples" can be characterized as: in, Used to characterize the total number of actual samples ≥2, and It is an integer; Used to characterize and The second total sample loss corresponding to each actual sample; The second balance coefficient is used to characterize the application and can be set according to the application requirements. For example, it can be set to 0.2. This disclosure does not limit this. Used to characterize and The r2th actual sample among the actual samples (that is, the actual sample) The corresponding second transformation loss, 1≤r²≤ And r2 is an integer; Used to characterize the second total loss.

[0130] In this embodiment of the present disclosure, for each of the multiple real samples, the second semantic representation result of the real sample can be obtained using the model to be trained, thereby obtaining multiple second semantic representation results corresponding one-to-one with the multiple real samples, and obtaining multiple second semantic ground values ​​corresponding one-to-one with the multiple real samples. Then, based on the multiple second semantic representation results and the multiple second semantic ground values, the second total sample loss corresponding to the multiple real samples is obtained. Finally, based on the second total sample loss, the model to be trained is trained to obtain the first target model. That is to say, in this embodiment of the present disclosure, during the training process of the model to be trained, the sampling quantity matching its true value for each training sample can be dynamically set. Specifically, for "high-value difficult example samples" that are semantically clear, highly credible, and not yet mastered by the training model, a sampling quantity greater than the baseline sampling quantity is set for them, allowing them to contribute more to the total sample loss. This guides the training model to focus on learning these information-rich, uncapable samples, accelerating the performance improvement of the training model. For "suspicious noise samples" that may contain garbled text, adversarial text, or other noise and are not yet mastered by the training model, a sampling quantity less than the baseline sampling quantity is set for them. This effectively suppresses their negative impact on the model parameters of the training model, preventing the training model from being biased towards the wrong direction. For ordinary samples that the model has basically mastered or that have low learning necessity, the baseline sampling quantity is used as the sampling quantity for normal learning to ensure the stability of the learned knowledge. This sampling quantity adjustment mechanism not only achieves the synergistic optimization of hard sample reinforcement and noisy sample suppression, but also significantly improves the training efficiency, generalization and robustness of the model in real noisy environments. Moreover, this sampling quantity adjustment mechanism is closer to the ideas of data augmentation and resampling, is easy to integrate with traditional training frameworks (e.g., data loaders, batch samplers), and has a more indirect and smoother impact on the model optimizer.

[0131] Furthermore, when training the model to be trained based on the second total sample loss to obtain the first target model, a teacher model can be determined based on the model to be trained. For each actual sample among multiple actual samples, the teacher model is used to obtain the second reference semantic representation result for each of the M transformed samples of the actual sample. Based on the second semantic representation result and the second reference semantic representation result of the actual sample, the second transformation loss corresponding to the actual sample is obtained. Then, based on the second total sample loss and the multiple second transformation losses corresponding one-to-one with the multiple actual samples, the model to be trained is trained to obtain the first target model. Thus, in this embodiment, a consistency regularization loss based on the teacher model, i.e., multiple second transformation losses, is further introduced on the basis of the second total sample loss. The teacher model is obtained using the EMA method based on the current model parameters of the model to be trained, and its semantic representation result is more stable and noise-resistant than that of the model to be trained. Therefore, training the model to be trained based on the second total sample loss and the multiple second transformation losses corresponding one-to-one with the multiple actual samples to obtain the first target model can further improve the robustness of the first target model to real noisy environments.

[0132] Furthermore, the model training method provided in this disclosure embodiment may further include: For each training sample among multiple training samples, the sample selection model is used to obtain multiple selection classification results for the training sample. If the training sample is determined to be a high-quality sample based on the multiple selection classification results, the training sample is identified as a reusable sample. Following the application instructions corresponding to the reusable samples, the first target model is trained using the reusable samples to obtain the second target model.

[0133] Please combine Figure 4 In this embodiment of the disclosure, the sample selection model may include a second main model and multiple selection classification heads connected in parallel to the output of the second main model. The second main model may be a first target model or a neural network model with a different converter architecture independent of the first target model; this embodiment of the disclosure does not limit this. The multiple selection classification heads may be multiple lightweight networks with the same structure but independently updated parameters, specifically fully connected networks, MLPs, etc. Here, the multiple selection classification heads can be used to output multiple selection classification results in a one-to-one correspondence.

[0134] In this embodiment of the disclosure, the classification result can be used to characterize whether the training sample meets the sample selection condition. For example, a classification result of "1" indicates that the training sample meets the sample selection condition; a classification result of "0" indicates that the training sample does not meet the sample selection condition. The sample selection condition can be set according to application requirements. For example, it can be set to allow the training sample to have high credibility and medium to low learning necessity. This embodiment of the disclosure does not limit this.

[0135] Furthermore, in this embodiment of the disclosure, "determining that the training sample belongs to a high-quality sample based on multiple selection classification results" may include: When multiple classification results simultaneously indicate that the training sample meets the sample selection criteria, the training sample is determined to be a high-quality sample.

[0136] The model training method provided in this disclosure, through the above methods, may further include: for each training sample among multiple training samples, using a sample selection model to obtain multiple selection classification results for the training sample; and, if the training sample is determined to be a high-quality sample based on the multiple selection classification results, identifying the training sample as a reusable sample (for example, if multiple selection classification results simultaneously indicate that the training sample meets the sample selection conditions, it can be determined that the training sample is a high-quality sample and identified as a reusable sample); then, according to the application instructions corresponding to the reusable sample, using the reusable sample, training the first target model to obtain the second target model. In other words, in this disclosure embodiment, after training the model to be trained to obtain the first target model, multi-head cross-validation can be used to quickly identify high-quality samples among the multiple training samples for consolidation training of the first target model, thereby effectively mitigating the forgetting phenomenon that may occur during training and further improving model stability and long-term performance.

[0137] Furthermore, it should be noted that in this embodiment of the disclosure, the sample selection model can be obtained by training an initial selection model. This process may include: Obtain the second data sample; Using the initial multiple-selection model, multiple multiple-selection classification result samples are obtained for the second data sample; For each of the multiple multiple classification result samples, the multiple classification loss is obtained based on the multiple classification result sample and the true value of the multiple classification result for the second data sample; The initial selection model is trained using multiple selection losses that correspond one-to-one with multiple selection classification results to obtain the sample selection model.

[0138] The initial selection model can be the initial sample selection model, that is, it has the same structure as the sample selection model, which will not be elaborated in this embodiment. The true value of the selection classification result can be the real semantic vector of the second data sample, and it can be obtained through manual annotation or automatic annotation, which is also not limited in this embodiment. Here, the annotation principle can be: for the second data sample with high credibility and medium to low learning necessity, its true value of the selection classification result is annotated as "1"; for the second data sample that does not have high credibility and medium to low learning necessity, its true value of the selection classification result is annotated as "0".

[0139] In this embodiment of the disclosure, the cross-entropy loss function can be used to obtain the multiple selection loss based on the multiple selection result samples and the true value of the multiple selection result for the second data sample. This embodiment of the disclosure does not limit this.

[0140] Furthermore, in this embodiment of the disclosure, when training the initial multiple selection model using multiple selection losses that correspond one-to-one with multiple multiple selection classification results to obtain the sample multiple selection model, the model parameters of the second master model can be frozen, and for each of the multiple selection losses, the parameters of the multiple selection classification head in the initial multiple selection model corresponding to that multiple selection loss can be adjusted using the multiple selection loss to obtain the sample multiple selection model; alternatively, the parameters of the second master model in the initial multiple selection model can be adjusted by combining multiple selection losses, and at the same time, for each of the multiple selection losses, the parameters of the multiple selection classification head in the initial multiple selection model corresponding to that multiple selection loss can be adjusted using the multiple selection loss to obtain the sample multiple selection model. This embodiment of the disclosure does not limit this approach.

[0141] The following will combine Figure 5 The present disclosure describes a combined implementation process of a sample processing method and a model training method.

[0142] Step S501: Obtain training samples.

[0143] Step S502: Obtain the instability index of the training samples.

[0144] The instability index can be used to characterize the fluctuation of the consistency of the semantic representation of the training samples by the model to be trained under N different pre-training nodes; N≥2 and N is an integer.

[0145] Step S503: Obtain the single-sample loss corresponding to the training samples.

[0146] Among them, single-sample loss can be used to characterize the loss value of the semantic representation result of the training sample obtained based on the model to be trained relative to the semantic truth value of the training sample.

[0147] Step S504: Based on the instability index and single-sample loss, obtain the application instructions for the training samples.

[0148] Among them, the application indicator can be used to adjust the contribution of training samples when training the model to be trained.

[0149] In this embodiment of the disclosure, steps S501 to S504 can be executed cyclically to obtain the application instruction corresponding to each training sample in multiple training samples of N batches.

[0150] Step S505: According to multiple application instructions that correspond one-to-one with multiple training samples, train the model to be trained using multiple training samples to obtain the first target model.

[0151] Step S505 can be executed cyclically. For example, step S505 can be executed first using multiple training samples from the first batch, and the resulting first target model can be used as the new model to be trained. Subsequently, step S505 can be executed using multiple training samples from the second batch, and so on, until it is determined that the model to be trained meets the preset convergence condition, and this model is used as the final first target model; or, until it is determined that the model to be trained does not meet the preset convergence condition, but the number of training rounds has reached N. The preset convergence condition can be set according to application requirements, and this embodiment does not limit it.

[0152] In this embodiment of the disclosure, if it is determined that the model to be trained has not met the preset convergence condition, but the number of training rounds has reached N, steps S501 to S504 can be executed again in a loop to obtain new training materials, including application instructions corresponding to each new training sample in multiple new training samples in N batches. During this process, the models to be trained under N different pre-training nodes include: After obtaining the first target model by executing step S505 using multiple training samples from the first batch, the first target model is used as the new model to be trained. After obtaining the first target model by executing step S505 using multiple training samples from the second batch, the first target model is used as the new model to be trained. ... After obtaining the first target model by executing step S505 using multiple training samples in the Nth batch, the first target model is used as the new model to be trained.

[0153] For the specific functions and examples of the above steps, please refer to the relevant descriptions of the corresponding steps in the aforementioned text processing method and model training method embodiments, which will not be repeated here.

[0154] This disclosure provides a text processing method that can be applied to an electronic device. The electronic device can be a server, workbench, mainframe computer, conventional computer, or other similar computing device. The following will be combined with… Figure 6 The flowchart shown illustrates a text processing method provided in an embodiment of this disclosure. It should be noted that, although in Figure 6 The flowchart shown illustrates the logical order; however, in some cases, the steps shown or described in the flowchart may be performed in a different order.

[0155] Step S601: Obtain the text to be processed.

[0156] The text to be processed can be text content with specific processing requirements. These specific processing requirements can include, but are not limited to, content security auditing, text classification, knowledge Q&A, information retrieval, and content understanding and analysis.

[0157] Step S602: Use the target model to process the text to be processed to obtain the processing result for the text to be processed.

[0158] The target model can be obtained using the aforementioned model training method, specifically the aforementioned first target model or second target model, and this disclosure does not limit this.

[0159] In this embodiment of the disclosure, when performing step S602, the target model can be used to perform semantic representation on the text to be processed, so as to obtain the target semantic representation result (i.e., the target semantic vector) of the text to be processed, which is used as the processing result for the text to be processed.

[0160] The text processing method provided in this disclosure can acquire the text to be processed and use a target model to process the text to obtain a processing result. The target model can be obtained using the aforementioned model training method, specifically either the first target model or the second target model. Since the target model is obtained using the aforementioned model training method, it has superior performance and high robustness in real-world noisy environments. Therefore, using the target model to process the text to obtain a processing result can improve the accuracy of the processing result.

[0161] Furthermore, the text processing method provided in this disclosure embodiment may also include: Using the target task header connected to the output of the target model, the task execution result is obtained based on the processing result of the text to be processed.

[0162] The target task header can be implemented through a lightweight network, including but not limited to a fully connected network and MLP.

[0163] Furthermore, in this embodiment of the disclosure, the target task head can be one of the following: classification task head, question answering task head, semantic matching task head, and content generation task head. Specifically, it can be obtained by training text samples with different processing requirements (e.g., content security review, text classification, knowledge question answering, information retrieval, or content understanding and analysis). This embodiment of the disclosure does not limit this. Specifically, when the specific processing requirement is content security review or text classification, the target task header can be a classification task header to obtain the category label of the text to be processed based on the processing result of the text to be processed, as the task execution result; when the specific processing requirement is knowledge question answering, the target task header can be a question answering task header to obtain the response content for the text to be processed based on the processing result of the text to be processed, as the task execution result; when the specific processing requirement is information retrieval, the target task header can be a semantic matching task header to obtain the retrieval result corresponding to the text to be processed based on the processing result of the text to be processed, as the task execution result; when the specific processing requirement is content understanding and analysis, the target task header can be a content generation task header to obtain the main description information of the text to be processed based on the processing result of the text to be processed, as the task execution result.

[0164] In this embodiment of the present disclosure, after acquiring the text to be processed and processing it using the target model to obtain the processing result, the target task head connected to the output of the target model can be used to obtain the task execution result based on the processing result of the text to be processed. That is, in this embodiment of the present disclosure, the processing result of the text to be processed output by the target model is converted into the task execution result required by the specific task via the target task head. Since the target model has been robustly trained as described above, its semantic representation ability has high stability and noise resistance. Therefore, the target task head only needs a small number of text samples for training to quickly adapt to downstream tasks. This can significantly reduce task migration costs while ensuring the accuracy and robustness of the task execution result.

[0165] As previously described, in this embodiment of the disclosure, the target task head is trained, for example, it can be obtained by training an initial task head. This process may include: Obtain text samples; The target model is used to process the text samples to obtain the processed result samples of the text samples; Using the initial task header connected to the output of the target model, and based on the processing result sample of the text sample, the task execution result sample is obtained; Based on the task execution result samples and the true values ​​of the task execution results corresponding to the text samples, the task execution loss is obtained; Based on the task execution loss, the initial task head is trained to obtain the target task head.

[0166] The initial task header can be the target task header in its initial state, that is, it has the same structure as the target task header. This embodiment of the present disclosure will not elaborate on this. The true value of the task execution result can be the real task execution result corresponding to the text sample, and it can be obtained through manual annotation or automatic annotation. This embodiment of the present disclosure will not limit this either.

[0167] In this embodiment of the disclosure, the cross-entropy loss function can be used to obtain the task execution loss based on the task execution result samples and the true values ​​of the task execution results corresponding to the text samples. This embodiment of the disclosure does not limit this.

[0168] Furthermore, in this embodiment of the present disclosure, when training the initial task head based on the task execution loss to obtain the target task head, the parameters of the initial task head can be adjusted based on the task execution loss to obtain the target task head.

[0169] Please see Figure 7 This diagram illustrates an application scenario of a sample processing method, a model training method, and a text processing method provided in this disclosure, which can be applied to electronic devices. The electronic device can be a server, workbench, mainframe computer, conventional computer, or other similar computing device.

[0170] In this embodiment of the disclosure, when the sample processing method is applied to an electronic device, the electronic device is used to: Obtain training samples; Obtain the instability index of the training samples; where the instability index is used to characterize the fluctuation of the consistency of the semantic representation of the training samples by the model to be trained under N different previous training nodes; N≥2 and N is an integer; Obtain the single-sample loss corresponding to the training sample; wherein, the single-sample loss is used to characterize the loss value of the semantic representation result of the training sample obtained based on the model to be trained relative to the semantic ground truth of the training sample. Based on the instability index and single-sample loss, an application indicator for the training samples is obtained; the application indicator is used to adjust the contribution of the training samples when training the model to be trained.

[0171] In this embodiment of the disclosure, when the model training method is applied to an electronic device, the electronic device is used to: Multiple training samples are obtained; for each of the multiple training samples, the training sample has a corresponding application instruction, and the application instruction is obtained using the sample processing method. The model training unit is used to train the model to be trained using multiple training samples according to multiple application instructions that correspond one-to-one with multiple training samples, so as to obtain the first target model.

[0172] In this embodiment of the disclosure, when the text processing method is applied to an electronic device, the electronic device is used to: Get the text to be processed; The text processing unit is used to process the text to be processed using the first target model to obtain the processing result for the text to be processed; wherein, the first target model is obtained using a model training method.

[0173] It should be noted that, in the embodiments disclosed herein, Figure 7 The application scenario diagrams shown are for illustrative purposes only and are not restrictive. Those skilled in the art can use them as a basis for their own interpretation. Figure 7 The examples may be modified in various obvious ways and / or substitutions, and the resulting technical solutions still fall within the scope of the disclosure of the embodiments of this disclosure.

[0174] To better implement the sample processing method, this disclosure also provides a sample processing apparatus that can be integrated into an electronic device. The electronic device can be a server, workbench, mainframe computer, conventional computer, or other similar computing device. The following will be combined with... Figure 8 The schematic block diagram shown illustrates a sample processing apparatus 800 provided in the disclosed embodiment.

[0175] Sample processing device 800, comprising: The first sample acquisition unit 801 is used to acquire training samples; The indicator acquisition unit 802 is used to acquire the instability indicator of the training samples; wherein, the instability indicator is used to characterize the fluctuation of the consistency of the semantic representation of the training samples by the model to be trained under N different pre-training nodes; N≥2 and N is an integer; The loss acquisition unit 803 is used to acquire the single-sample loss corresponding to the training sample; wherein, the single-sample loss is used to characterize the loss value of the semantic representation result of the training sample obtained based on the model to be trained relative to the semantic truth value of the training sample. The application instruction acquisition unit 804 is used to obtain an application instruction for the training sample based on the instability index and single sample loss; wherein the application instruction is used to adjust the contribution of the training sample when training the model to be trained.

[0176] In some alternative implementations, the indicator acquisition unit 802 is used for: Obtain M transformed samples from the training samples; where M≥2 and M is an integer; For each of the N different pre-training nodes, the first semantic vector of the training sample and the M second semantic vectors corresponding one-to-one with the M transformed samples are obtained using the model to be trained under the pre-training node. Based on the first semantic vector and M second semantic vectors, an instability index for the training samples is obtained.

[0177] In some alternative implementations, the indicator acquisition unit 802 is used for: Determine at least one transformation strategy; For each of the at least one transformation strategy, the training samples are transformed multiple times according to the transformation strategy to obtain multiple different intermediate samples; Based on multiple different intermediate samples, M transformed samples of the training samples are obtained.

[0178] In some alternative implementations, the indicator acquisition unit 802 is used for: At least one of the following transformation strategies is determined: normalization transformation, cross-language back-translation, interval reprojection, and sentence length transformation.

[0179] In some alternative implementations, the indicator acquisition unit 802 is used for: Obtain the semantic similarity between the first semantic vector and M second semantic vectors respectively to obtain M semantic similarity scores; Based on the N×M semantic similarities corresponding to N different pre-training nodes, an instability index for the training samples is obtained.

[0180] In some alternative implementations, the indicator acquisition unit 802 is used for: Obtain the variance calculation results of N×M semantic similarities; Based on the variance calculation results, the instability index of the training samples is obtained.

[0181] In some alternative implementations, the loss acquisition unit 803 is used for: The first semantic vector of the training sample obtained by using the model to be trained under the target training node is determined as the semantic representation result of the training sample; where the target training node is the last preceding training node in time order among N different preceding training nodes. Obtain the semantic truth of the training samples; Obtain the loss value of the semantic representation result relative to the semantic truth value, and use it as the single-sample loss corresponding to the training sample.

[0182] In some optional implementations, the application instruction acquisition unit 804 is used for: Based on the instability index and single-sample loss, the weight parameters of the training samples are obtained as application indicators. The weight parameters are used to weight the total sample loss corresponding to the training samples when training the model to be trained, so as to adjust the contribution of the training samples in the total sample loss. Alternatively, based on the instability index and single-sample loss, a sampling strategy for the training samples can be obtained as an application instruction; wherein, the sampling strategy includes one of an upsampling strategy, a downsampling strategy, and a normal sampling strategy; the upsampling strategy is used to indicate increasing the number of training samples to increase the contribution of training samples to the total sample loss; the downsampling strategy is used to indicate decreasing the number of training samples to decrease the contribution of training samples to the total sample loss; the normal sampling strategy is used to indicate maintaining the number of training samples to maintain the contribution of training samples to the total sample loss.

[0183] In some optional implementations, the application instruction acquisition unit 804 is used for: According to the preset logic, the weight parameters of the training samples are obtained based on the instability index and single-sample loss; wherein the preset logic satisfies one of the following conditions: When the instability index reflects that the training sample has high reliability and the single sample loss reflects that the training sample has high learning necessity, the training sample is assigned a weight parameter greater than the baseline weight. When the instability index reflects that the training sample has low reliability and the single sample loss reflects that the training sample has high learning necessity, the training sample is assigned a weight parameter that is smaller than the baseline weight. When the single-sample loss reflects that the training samples have low learning necessity, the training samples are assigned weight parameters equal to the baseline weights.

[0184] In some alternative implementations, the application instruction acquisition unit 804 is used for one of the following: When the instability index reflects that the training samples have high reliability and the single-sample loss reflects that the training samples have high learning necessity, the upsampling strategy is determined as the sampling strategy for the training samples. When the instability index reflects that the training samples have low reliability and the single-sample loss reflects that the training samples have high learning necessity, the downsampling strategy is determined as the sampling strategy for the training samples. When the single-sample loss indicates that the training samples have low learning necessity, the normal sampling strategy is determined as the sampling strategy for the training samples.

[0185] In this embodiment of the present disclosure, the specific functions and examples of each unit in the sample processing device 800 can be found in the relevant descriptions of the corresponding steps in the foregoing sample processing method embodiments, and will not be repeated here.

[0186] To better implement the model training method, this disclosure also provides a model training apparatus that can be integrated into an electronic device. The electronic device can be a server, workbench, mainframe computer, conventional computer, or other similar computing device. The following will be combined with... Figure 9 The schematic block diagram shown illustrates a model training device 900 provided in the disclosed embodiment.

[0187] Model training device 900, including: The second sample acquisition unit 901 is used to acquire multiple training samples; wherein, for each training sample among the multiple training samples, the training sample has a corresponding application instruction, and the application instruction is obtained using the sample processing device. The model training unit 902 is used to train the model to be trained using multiple training samples according to multiple application instructions that correspond one-to-one with multiple training samples, so as to obtain the first target model.

[0188] In some alternative implementations, the model training unit 902 is used for: When multiple applications indicate multiple weight parameters, for each training sample among multiple training samples, the first semantic representation result of the training sample obtained by using the model to be trained is obtained, so as to obtain multiple first semantic representation results corresponding one-to-one with multiple training samples. Obtain multiple first semantic truth values ​​that correspond one-to-one with multiple training samples; Based on multiple weight parameters, multiple first semantic representation results and multiple first semantic truth values, the first total sample loss corresponding to multiple training samples is obtained; Based on the first total sample loss, the model to be trained is trained to obtain the first target model.

[0189] In some alternative implementations, the model training unit 902 is used for: Based on the model to be trained, determine the teacher model; For each training sample among multiple training samples, the teacher model is used to obtain the first reference semantic representation result of each of the M transformed samples of the training sample; based on the first semantic representation result and the first reference semantic representation result of the training sample, the first transformation loss corresponding to the training sample is obtained. Based on the first total sample loss and multiple first transformation losses corresponding one-to-one with multiple training samples, the model to be trained is trained to obtain the first target model.

[0190] In some alternative implementations, the model training unit 902 is used for: In the case of multiple applications indicating multiple sampling strategies, at least a portion of the training samples in multiple training samples are adjusted based on the multiple sampling strategies to obtain multiple actual samples; For each of the multiple real samples, the second semantic representation result of the real sample is obtained using the model to be trained, so as to obtain multiple second semantic representation results that correspond one-to-one with the multiple real samples. Obtain multiple second semantic truth values ​​that correspond one-to-one with multiple actual samples; Based on multiple second semantic representation results and multiple second semantic truth values, a second total sample loss corresponding to multiple actual samples is obtained; Based on the second total sample loss, the model to be trained is trained to obtain the first target model.

[0191] In some alternative implementations, the model training unit 902 is used for: Based on the model to be trained, determine the teacher model; For each of the multiple real samples, the teacher model is used to obtain the second reference semantic representation result of each of the M transformed samples of the real sample; based on the second semantic representation result and the second reference semantic representation result of the real sample, the second transformation loss corresponding to the real sample is obtained. Based on the second total sample loss and multiple second transformation losses corresponding one-to-one with multiple actual samples, the model to be trained is trained to obtain the first target model.

[0192] In some alternative implementations, the model training unit 902 is used for: Using the exponential moving average method, the model parameters of the teacher model are determined based on the current model parameters of the model to be trained, so as to obtain the teacher model.

[0193] In some optional implementations, the second sample acquisition unit 901 is used for: Obtain multiple candidate samples; For each candidate sample among multiple candidate samples, a sample pre-selection model is used to obtain multiple pre-selection classification results for the candidate sample. If the candidate sample is determined to be a usable sample based on the multiple pre-selection classification results, the candidate sample is determined as a training sample. The sample pre-selection model includes a first main model and multiple pre-selection classification heads connected in parallel to the output of the first main model; the multiple pre-selection classification heads are used to output multiple pre-selection classification results in a one-to-one correspondence.

[0194] In some optional implementations, the second sample acquisition unit 901 is used for: When multiple pre-selected classification results simultaneously indicate that the candidate sample meets the sample pre-selection conditions, the candidate sample is determined to be a usable sample.

[0195] In some optional implementations, model training further includes a model retraining unit for: For each training sample among multiple training samples, the sample selection model is used to obtain multiple selection classification results for the training sample. If the training sample is determined to be a high-quality sample based on the multiple selection classification results, the training sample is identified as a reusable sample. According to the application instructions corresponding to the reusable samples, the first target model is trained using the reusable samples to obtain the second target model; The sample selection model includes a second main model and multiple selection classification heads connected in parallel to the output of the second main model; the multiple selection classification heads are used to output multiple selection classification results in a one-to-one correspondence.

[0196] In some alternative implementations, the model retraining unit is used for: When multiple classification results simultaneously indicate that the training sample meets the sample selection criteria, the training sample is determined to be a high-quality sample.

[0197] The specific functions and examples of each unit in the model training device 900 in this embodiment can be found in the relevant descriptions of the corresponding steps in the model training method embodiment, and will not be repeated here.

[0198] To better implement the sample processing method, this disclosure also provides a text processing apparatus that can be integrated into an electronic device. The electronic device can be a server, workbench, mainframe computer, conventional computer, or other similar computing device. The following will be combined with... Figure 10 The schematic block diagram shown illustrates a text processing apparatus 1000 provided in the disclosed embodiments.

[0199] Text processing device 1000, including: The text acquisition unit 1001 is used to acquire the text to be processed. The text processing unit 1002 is used to process the text to be processed using a first target model to obtain a processing result for the text to be processed; wherein the first target model is obtained using a model training device.

[0200] In some alternative embodiments, the text processing apparatus 1000 further includes a result output unit for: Using the target task header connected to the output of the target model, the task execution result is obtained based on the processing result of the text to be processed.

[0201] In this embodiment of the disclosure, the specific functions and examples of each unit in the text processing device 1000 can be found in the relevant descriptions of the corresponding steps in the foregoing text processing method embodiments, and will not be repeated here.

[0202] In this disclosed embodiment, the acquisition, storage, and application of user personal information are all known to the user and have been agreed to by the user, and all comply with the provisions of relevant laws and regulations, and do not violate public order and good morals.

[0203] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0204] Figure 11 A schematic structural block diagram of an example electronic device 1100 that can be used to implement embodiments of the present disclosure is shown. Electronic device 1100 is intended to represent various forms of digital computers, such as in-vehicle computing devices, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic device 1100 may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0205] like Figure 11 As shown, the electronic device 1100 includes a computing unit 1101, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 1102 or a computer program loaded from a storage unit 1108 into a random access memory (RAM) 1103. The RAM 1103 may also store various programs and data required for the operation of the electronic device 1100. The computing unit 1101, ROM 1102, and RAM 1103 are interconnected via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.

[0206] Multiple components in electronic device 1100 are connected to I / O interface 1105, including: input unit 1106, such as keyboard, mouse, etc.; output unit 1107, such as various types of renderers, speakers, etc.; storage unit 1108, such as disk, optical disk, etc.; and communication unit 1109, such as network card, modem, wireless transceiver, etc. Communication unit 1109 allows electronic device 1100 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0207] The computing unit 1101 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1101 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. The computing unit 1101 performs the various methods and processes described above, such as at least one of sample processing methods, model training methods, and text processing methods. For example, in some embodiments, at least one of the sample processing methods, model training methods, and text processing methods can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1108. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 1100 via ROM 1102 and / or communication unit 1109. When the computer program is loaded into RAM 1103 and executed by computing unit 1101, it can perform one or more steps of at least one of the sample processing method, model training method, and text processing method described above. Alternatively, in other embodiments, computing unit 1101 can be configured to perform at least one of the sample processing method, model training method, and text processing method by any other suitable means (e.g., by means of firmware).

[0208] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transferring data and instructions to the storage system, the at least one input device, and the at least one output device.

[0209] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data optimization device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0210] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, erasable programmable read-only memory (EPROM) or flash memory, optical fibers, compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0211] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a rendering device (e.g., a cathode ray tube (CRT) renderer or a liquid crystal display (LCD)) for rendering information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices are also used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0212] The systems and technologies described herein can be implemented in computing systems that include back-end components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0213] A computer system can include client and server components. Clients and servers are generally located far apart and typically interact via a communication network. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, a server in a distributed system, or a server incorporating blockchain technology.

[0214] This disclosure also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to perform at least one of a sample processing method, a model training method, and a text processing method.

[0215] This disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements at least one of a sample processing method, a model training method, and a text processing method.

[0216] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure is achieved, and this is not limited herein. Furthermore, in this disclosure, relational terms such as "first," "second," and "third" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Additionally, "multiple" in this disclosure can be understood as at least two.

[0217] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A sample processing method, comprising: Obtain training samples; Obtain the instability index of the training samples; wherein, the instability index is used to characterize the fluctuation of the semantic representation consistency of the training samples by the model to be trained under N different pre-training nodes; N≥2 and N is an integer; Obtain the single-sample loss corresponding to the training sample; wherein, the single-sample loss is used to characterize the loss value of the semantic representation result of the training sample obtained based on the model to be trained relative to the semantic ground truth of the training sample; Based on the instability index and the single-sample loss, an application instruction for the training sample is obtained; wherein the application instruction is used to adjust the contribution of the training sample when training the model to be trained.

2. The method according to claim 1, wherein, The process of obtaining the instability index of the training samples includes: Obtain M transformed samples of the training samples; where M≥2 and M is an integer; For each of the N different pre-training nodes, the training model under the pre-training node is used to obtain the first semantic vector of the training sample and the M second semantic vectors corresponding one-to-one with the M transformed samples. Based on the first semantic vector and the M second semantic vectors, the instability index of the training sample is obtained.

3. The method according to claim 2, wherein, The process of obtaining M transformed samples of the training samples includes: Determine at least one transformation strategy; For each of the at least one transformation strategy, the training samples are transformed multiple times according to the transformation strategy to obtain multiple different intermediate samples; Based on the multiple different intermediate samples, M transformed samples of the training samples are obtained.

4. The method according to claim 3, wherein, Determining at least one transformation strategy includes: The transformation strategy is defined as at least one of the following: normalization transformation, cross-language back-translation, interval reprojection, and sentence length transformation.

5. The method according to claim 2, wherein, The process of obtaining the instability index of the training samples based on the first semantic vector and the M second semantic vectors includes: The semantic similarity between the first semantic vector and the M second semantic vectors is obtained respectively to obtain M semantic similarity values; Based on the N×M semantic similarities corresponding to the N different pre-training nodes, the instability index of the training samples is obtained.

6. The method according to claim 5, wherein, The instability index of the training samples, obtained based on N×M semantic similarities corresponding to the N different pre-training nodes, includes: Obtain the variance calculation results of the N×M semantic similarities; Based on the variance calculation results, the instability index of the training samples is obtained.

7. The method according to claim 2, wherein, The step of obtaining the single-sample loss corresponding to the training samples includes: The first semantic vector of the training sample obtained by the model to be trained under the target training node is determined as the semantic representation result of the training sample; wherein, the target training node is the last preceding training node in time order among the N different preceding training nodes; Obtain the semantic truth value of the training samples; Obtain the loss value of the semantic representation result relative to the semantic truth value, and use it as the single-sample loss corresponding to the training sample.

8. The method according to any one of claims 1 to 7, wherein, The process of obtaining application instructions for the training samples based on the instability index and the single-sample loss includes: Based on the instability index and the single-sample loss, the weight parameters of the training samples are obtained as the application indicator; wherein, the weight parameters are used to weight the current sample loss corresponding to the training sample when training the model to be trained, so as to adjust the contribution of the training sample in the total sample loss corresponding to itself. Alternatively, based on the instability index and the single-sample loss, a sampling strategy for the training samples is obtained as the application instruction; wherein, the sampling strategy includes one of an upsampling strategy, a downsampling strategy, and a normal sampling strategy; the upsampling strategy is used to indicate increasing the number of training samples to increase the contribution of the training samples to the total sample loss corresponding to themselves; the downsampling strategy is used to indicate decreasing the number of training samples to decrease the contribution of the training samples to the total sample loss corresponding to themselves; the normal sampling strategy is used to indicate maintaining the number of training samples to maintain the contribution of the training samples to the total sample loss corresponding to themselves.

9. The method according to claim 8, wherein, The weight parameters of the training samples are obtained based on the instability index and the single-sample loss, including: According to preset logic, the weight parameters of the training samples are obtained based on the instability index and the single-sample loss; wherein the preset logic satisfies one of the following conditions: When the instability index reflects that the training sample has high reliability and the single-sample loss reflects that the training sample has high learning necessity, the training sample is assigned a weight parameter greater than the baseline weight. When the instability index reflects that the training sample has low reliability and the single-sample loss reflects that the training sample has high learning necessity, the training sample is assigned a weight parameter that is less than the baseline weight. When the single-sample loss reflects that the training sample has low learning necessity, the training sample is assigned a weight parameter equal to the baseline weight.

10. The method according to claim 8, wherein, The sampling strategy for the training samples, based on the instability index and the single-sample loss, includes one of the following: When the instability index reflects that the training sample has high reliability and the single-sample loss reflects that the training sample has high learning necessity, the upsampling strategy is determined as the sampling strategy for the training sample. When the instability index reflects that the training sample has low reliability and the single-sample loss reflects that the training sample has high learning necessity, the downsampling strategy is determined as the sampling strategy for the training sample. When the single-sample loss reflects that the training sample has low learning necessity, the normal sampling strategy is determined as the sampling strategy for the training sample.

11. A model training method, comprising: A plurality of training samples are obtained; wherein, for each of the plurality of training samples, the training sample has a corresponding application instruction, and the application instruction is obtained using the method of any one of claims 1 to 10; According to the multiple application instructions that correspond one-to-one with the multiple training samples, the training model is trained using the multiple training samples to obtain the first target model.

12. The method according to claim 11, wherein, The step of training the model to be trained using the multiple training samples according to multiple application instructions that correspond one-to-one with the multiple training samples to obtain the first target model includes: When the multiple application indicators are multiple weight parameters, for each of the multiple training samples, the first semantic representation result of the training sample obtained by the model to be trained is obtained, so as to obtain multiple first semantic representation results corresponding one-to-one with the multiple training samples. Obtain multiple first semantic truth values ​​that correspond one-to-one with the multiple training samples; Based on the multiple weight parameters, the multiple first semantic representation results, and the multiple first semantic truth values, the first total sample loss corresponding to the multiple training samples is obtained; Based on the first total sample loss, the model to be trained is trained to obtain the first target model.

13. The method according to claim 12, wherein, The step of training the model to be trained based on the first total sample loss to obtain the first target model includes: Based on the model to be trained, determine the teacher model; For each of the plurality of training samples, the teacher model is used to obtain the first reference semantic representation result of each of the M transformed samples of the training sample; based on the first semantic representation result of the training sample and the first reference semantic representation result, the first transformation loss corresponding to the training sample is obtained; Based on the first total sample loss and the multiple first transformation losses corresponding one-to-one with the multiple training samples, the model to be trained is trained to obtain the first target model.

14. The method according to claim 11, wherein, The step of training the model to be trained using at least a portion of the training samples according to multiple application instructions corresponding one-to-one with the multiple training samples to obtain a first target model includes: When the multiple applications indicate multiple sampling strategies, at least a portion of the training samples among the multiple training samples are adjusted in number based on the multiple sampling strategies to obtain multiple actual samples; For each of the plurality of actual samples, the model to be trained is used to obtain the second semantic representation result of the actual sample, so as to obtain a plurality of second semantic representation results corresponding one-to-one with the plurality of actual samples; Obtain multiple second semantic truth values ​​that correspond one-to-one with the multiple actual samples; Based on the multiple second semantic representation results and the multiple second semantic truth values, a second total sample loss corresponding to the multiple actual samples is obtained; Based on the second total sample loss, the model to be trained is trained to obtain the first target model.

15. The method according to claim 14, wherein, The step of training the model to be trained based on the second total sample loss to obtain the first target model includes: Based on the model to be trained, determine the teacher model; For each of the plurality of actual samples, the teacher model is used to obtain the second reference semantic representation result of each of the M transformed samples of the actual sample; based on the second semantic representation result of the actual sample and the second reference semantic representation result, the second transformation loss corresponding to the actual sample is obtained; Based on the second total sample loss and the multiple second transformation losses corresponding one-to-one with the multiple actual samples, the model to be trained is trained to obtain the first target model.

16. The method according to claim 13 or 15, wherein, The process of determining the teacher model based on the model to be trained includes: Using the exponential moving average method, the model parameters of the teacher model are determined based on the current model parameters of the model to be trained, so as to obtain the teacher model.

17. The method according to claim 11, wherein, The acquisition of multiple training samples includes: Obtain multiple candidate samples; For each of the multiple candidate samples, a sample pre-selection model is used to obtain multiple pre-selection classification results for the candidate sample; if the candidate sample is determined to be an available sample based on the multiple pre-selection classification results, the candidate sample is determined as the training sample. The sample pre-selection model includes a first main model and multiple pre-selection classification heads connected in parallel to the output of the first main model; the multiple pre-selection classification heads are used to output the multiple pre-selection classification results one by one.

18. The method according to claim 17, wherein, The step of determining that the candidate sample belongs to the usable sample based on the multiple pre-selected classification results includes: If the multiple pre-selected classification results simultaneously indicate that the candidate sample meets the sample pre-selection conditions, then the candidate sample is determined to be an available sample.

19. The method of claim 11, further comprising: For each of the multiple training samples, a sample selection model is used to obtain multiple selection classification results for the training sample; If, based on the multiple selection classification results, the training sample is determined to be a high-quality sample, then the training sample is identified as a reusable sample. According to the application instructions corresponding to the reusable sample, the first target model is trained using the reusable sample to obtain the second target model; The sample selection model includes a second main model and multiple selection classification heads connected in parallel to the output of the second main model; the multiple selection classification heads are used to output the multiple selection classification results in a one-to-one correspondence.

20. The method according to claim 19, wherein, The step of determining that the training samples belong to high-quality samples based on the multiple selection classification results includes: If the multiple classification results simultaneously indicate that the training sample meets the sample selection criteria, the training sample is determined to be a high-quality sample.

21. A text processing method, comprising: Get the text to be processed; The target model is used to process the text to be processed to obtain the processing result for the text to be processed; wherein the target model is obtained using the method of any one of claims 11 to 20.

22. The method of claim 21, further comprising: Using the target task header connected to the output of the target model, the task execution result is obtained based on the processing result of the text to be processed.

23. A sample processing apparatus, comprising: The first sample acquisition unit is used to acquire training samples; The indicator acquisition unit is used to acquire the instability indicator of the training sample; wherein the instability indicator is used to characterize the fluctuation of the semantic representation consistency of the training sample by the model to be trained under N different pre-training nodes; N≥2 and N is an integer; The loss acquisition unit is used to acquire the single-sample loss corresponding to the training sample; wherein, the single-sample loss is used to characterize the loss value of the semantic representation result of the training sample obtained based on the model to be trained relative to the semantic ground truth of the training sample. An application instruction acquisition unit is used to obtain an application instruction for the training sample based on the instability index and the single-sample loss; wherein the application instruction is used to adjust the contribution of the training sample when training the model to be trained.

24. A model training device, comprising: The second sample acquisition unit is used to acquire multiple training samples; wherein, for each of the multiple training samples, the training sample has a corresponding application instruction, and the application instruction is obtained using the device of claim 23; The model training unit is used to train the model to be trained using the multiple training samples according to multiple application instructions that correspond one-to-one with the multiple training samples, so as to obtain the first target model.

25. A text processing apparatus, comprising: The text acquisition unit is used to acquire the text to be processed. A text processing unit is configured to process the text to be processed using a first target model to obtain a processing result for the text to be processed; wherein the first target model is obtained using the apparatus of claim 24.

26. An electronic device, comprising: At least one processor; A memory that is communicatively connected to the at least one processor; The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the method according to any one of claims 1 to 22.

27. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 22.

28. A computer program product comprising a computer program; wherein, When the computer program is executed by a processor, it can implement the method of any one of claims 1 to 22.