Text analysis model training method and text matching method

By using unsupervised learning and supervised fine-tuning methods of loss mask and contrast loss function in the intelligent work order system, the training of the text analysis model is optimized, the problem of low recognition accuracy of the text analysis model is solved, and the efficiency of work order processing is improved. Customer satisfaction.

CN118798159APending Publication Date: 2024-10-18CHINA MOBILE COMM CORP TIANJIN +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410611680.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-16
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

When the intelligent work order system processes work order data, due to the low recognition accuracy of the text analysis model, it cannot accurately match the solution text, resulting in slow response speed, low processing efficiency, and low customer satisfaction.

Method used

An unsupervised learning method based on loss masks and contrastive loss functions is used, combined with supervised fine-tuning of annotated data, to optimize the training process of the text analysis model, generate high-quality sentence embedding vectors, and adapt to new data through incremental learning.

Benefits of technology

The generalization ability and recognition accuracy of the text analysis model have been improved, allowing it to perform better on unseen data and match solution text more accurately, improving work order processing efficiency and customer satisfaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118798159A_ABST
    Figure CN118798159A_ABST
Patent Text Reader

Abstract

According to the text analysis model training method and the text matching method provided by the invention, compared with the prior art, the loss mask and the first loss function are used for comparison loss calculation, and unsupervised learning can be carried out on unlabeled data, so that features and expressions of text data are learned; the understanding and generalization ability of the text analysis model on the data can be improved; the sentences in the labeled data set are used for supervised fine tuning, so that the performance of the model on a specific task can be further optimized, the supervised fine tuning can help the model better adapt to task requirements, and the accuracy and generalization ability are improved. The generalization ability of the model can be improved by combining unsupervised learning and supervised fine tuning methods, so that the text analysis model has better performance on unseen data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a training method for a text analysis model and a text matching method. Background Art

[0002] With the rapid development of information technology and the deepening of enterprise digital transformation, the work order system, as an important part of enterprise internal service management, has become one of the key indicators for measuring enterprise service quality through its intelligence level. Although the traditional work order system has improved work efficiency to a certain extent, it still relies on manual operation and experience judgment when handling customer issues or requests, resulting in slow response, low processing efficiency, and low customer satisfaction.

[0003] In the development process of the intelligent work order system, the text analysis model processes texts related to user needs, deeply understands and identifies various user needs, and is an important processing link of the intelligent work order system. However, the existing text analysis models, especially in the text preprocessing and vector encoding stages, still have some limitations. First, the imperfection of the word segmentation system makes it impossible to accurately process ambiguous words, recognize new words, and process special texts. These problems directly affect the accuracy of text information extraction and subsequent processing. Secondly, the problems in the vector encoding stage are mainly reflected in the inability of models such as word2vec to effectively learn sentence information and lack sufficient corpus support, resulting in the inability of the encoding vector to accurately express the text semantics. In addition, in the process of manual data annotation, due to the different professional qualities of the annotation personnel, this will lead to limited recognition accuracy of the model. Therefore, when the current intelligent work order system processes work order data, especially the work order data with strong professionalism, the recognition accuracy of the text analysis model of the intelligent work order system is low, resulting in the inability to match accurate and effective solution text. Summary of the invention

[0004] The present disclosure provides a text analysis model training method and a text matching method, the main purpose of which is to solve the problem that when the intelligent work order system retrieves and matches the solution text, it is unable to match the accurate and effective solution text due to the low recognition accuracy of the text analysis model.

[0005] According to a first aspect of the present disclosure, a method for training a text analysis model is provided, comprising:

[0006] Based on the loss mask, the unlabeled training set is input into the text analysis model for training to obtain positive and negative samples;

[0007] Using a first loss function, performing contrast loss calculation on the positive sample and the negative sample, and performing back propagation optimization on the text analysis model according to the calculation result of the first loss function to obtain an unsupervised text analysis model;

[0008] Inputting sentence pairs in the labeled training set into the unsupervised text analysis model for training to obtain an embedding vector for each sentence in the sentence pair;

[0009] The second loss function is used to calculate the contrast loss of the embedding vector of the sentence pair, and the unsupervised text analysis model is back-propagated and optimized according to the calculation result of the second loss function to obtain the trained text analysis model.

[0010] In some embodiments, the method further comprises:

[0011] Based on the calculation result of the second loss function, the sentence pairs whose loss values ​​in the labeled training set exceed the loss threshold are selected to generate a difficult sample data set;

[0012] The difficult sample data set is input into the unsupervised text analysis model for training to obtain the trained text analysis model.

[0013] In some embodiments, the step of inputting the unlabeled training set into the text analysis model for training based on the loss mask to obtain positive samples and negative samples includes:

[0014] Based on the first number of loss masks, input each sentence in the unlabeled training set into the text analysis model for training to obtain the positive sample;

[0015] Sentence embeddings obtained by training other sentences in the same batch of the unlabeled training set are obtained, and the sentence embeddings are marked as the negative samples.

[0016] In some embodiments, the method further comprises:

[0017] Based on the attention mask, a pooling operation is performed on the encoding vector of each sentence so as to map the embedding vector to the same dimension;

[0018] The pooling operation is performed on the encoding vector of each sentence based on the attention mask, including:

[0019] Obtain the encoding vector and assign it to the tag embedding vector; expand the input attention mask into the same shape as the encoding vector to obtain an expanded input mask;

[0020] Performing a weighted summation process on the tag embedding vector and the extended input mask to obtain a weighted summed embedding vector;

[0021] Summing all elements in a first dimension of the summed embedding vector to obtain a first scalar value; summing all elements in a first dimension of the extended input mask to obtain a second scalar value;

[0022] The first scalar value and the second scalar value are divided to obtain a coding vector after the pooling operation.

[0023] In some embodiments, after obtaining the trained text analysis model, the method further includes:

[0024] Based on the collected incremental learning data set, incremental learning training is performed on the trained text analysis model.

[0025] In some embodiments, the method further comprises:

[0026] Based on a preset evaluation method and a preset test data set, the trained text analysis model is evaluated to obtain a model evaluation result.

[0027] According to a second aspect of the present disclosure, a text matching method is provided, comprising:

[0028] Acquire work order data to be processed, and preprocess the work order data to be processed to obtain text analysis data;

[0029] Inputting the text analysis data into a text analysis model for prediction to obtain a text expression vector corresponding to the text analysis data;

[0030] Based on the text expression vector, the solution text corresponding to the to-be-processed work order data in the historical work order database is retrieved.

[0031] In some embodiments, inputting the text analysis data into a text analysis model for prediction to obtain a text expression vector corresponding to the text analysis data includes:

[0032] Encoding the text analysis data to obtain vocabulary encoding vectors, and padding the encoding vectors so that the lengths of the encoding vectors are consistent;

[0033] Inputting the vocabulary encoding vector and the attention mask into the text analysis model for prediction to obtain a text embedding vector corresponding to the text analysis data;

[0034] The text embedding vector is normalized to obtain a text expression vector corresponding to the text analysis data.

[0035] In some embodiments, the method further comprises:

[0036] Perform data analysis on the work orders to be processed to generate an incremental learning data set for the text analysis model.

[0037] According to a third aspect of the present disclosure, a training device for a text analysis model is provided, comprising:

[0038] The first training unit is used to input the unlabeled training set into the text analysis model for training based on the loss mask to obtain positive samples and negative samples;

[0039] A first optimization unit is used to perform contrast loss calculation on the positive sample and the negative sample using a first loss function, and perform back propagation optimization on the text analysis model according to the calculation result of the first loss function to obtain an unsupervised text analysis model;

[0040] A second training unit is used to input the sentence pairs in the labeled training set into the unsupervised text analysis model for training to obtain an embedding vector for each sentence in the sentence pair;

[0041] The second optimization unit is used to use a second loss function to perform contrast loss calculation on the embedding vector of the sentence pair, and perform back propagation optimization on the unsupervised text analysis model according to the calculation result of the second loss function to obtain the trained text analysis model.

[0042] In some embodiments, the apparatus further comprises:

[0043] A generating unit, configured to generate a difficult sample data set by selecting sentence pairs whose loss values ​​in the labeled training set exceed a loss threshold based on the calculation result of the second loss function;

[0044] The third training unit is used to input the difficult sample data set into the unsupervised text analysis model for training to obtain the trained text analysis model.

[0045] In some embodiments, the first training unit includes:

[0046] A training module, configured to input each sentence in the unlabeled training set into the text analysis model for training based on the first number of loss masks to obtain the positive samples;

[0047] The acquisition module is used to acquire sentence embeddings obtained by training other sentences in the same batch in the unlabeled training set, and mark the sentence embeddings as the negative samples.

[0048] In some embodiments, the apparatus further comprises:

[0049] A pooling unit, configured to perform a pooling operation on the encoding vector of each sentence based on the attention mask so as to map the embedding vector to the same dimension;

[0050] The pooling unit comprises:

[0051] An expansion module is used to obtain the encoding vector and assign it to the tag embedding vector; expand the input attention mask into the same shape as the encoding vector to obtain an expanded input mask;

[0052] A first calculation module is used to perform weighted sum processing on the tag embedding vector and the extended input mask to obtain a weighted summed embedding vector;

[0053] A second calculation module, configured to sum all elements in a first dimension of the summed embedding vector to obtain a first scalar value; and sum all elements in a first dimension of the extended input mask to obtain a second scalar value;

[0054] The third calculation module is used to divide the first scalar value and the second scalar value to obtain the encoding vector after the pooling operation.

[0055] In some embodiments, after obtaining the trained text analysis model, the apparatus further includes:

[0056] The fourth training unit is used to perform incremental learning training on the trained text analysis model based on the collected incremental learning data set.

[0057] In some embodiments, the apparatus further comprises:

[0058] The evaluation unit is used to evaluate the trained text analysis model based on a preset evaluation device and a preset test data set to obtain a model evaluation result.

[0059] According to a fourth aspect of the present disclosure, a text matching device is provided, comprising:

[0060] A preprocessing unit, used to obtain the work order data to be processed, and preprocess the work order data to be processed to obtain text analysis data;

[0061] A prediction unit, used for inputting the text analysis data into a text analysis model for prediction, and obtaining a text expression vector corresponding to the text analysis data;

[0062] The retrieval unit is used to retrieve the solution text corresponding to the to-be-processed work order data in the historical work order database based on the text expression vector.

[0063] In some embodiments, the prediction unit includes:

[0064] An encoding module, used for encoding the text analysis data to obtain a vocabulary encoding vector, and padding the encoding vector so that the length of the encoding vector is consistent;

[0065] A prediction module, used for inputting the vocabulary encoding vector and the attention mask into the text analysis model for prediction, and obtaining a text embedding vector corresponding to the text analysis data;

[0066] The processing module is used to perform a normalization operation on the text embedding vector to obtain a text expression vector corresponding to the text analysis data.

[0067] In some embodiments, the apparatus further comprises:

[0068] The analysis unit is used to perform data analysis on the work order to be processed and generate an incremental learning data set for the text analysis model.

[0069] According to a fifth aspect of the present disclosure, there is provided an electronic device, including:

[0070] at least one processor; and

[0071] a memory communicatively connected to the at least one processor; wherein,

[0072] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect or the second aspect.

[0073] According to a sixth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the first aspect or the second aspect.

[0074] According to a seventh aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method as described in the first aspect or the second aspect.

[0075] The present disclosure provides a training method for a text analysis model and a text matching method. Based on a loss mask, an unlabeled training set is input into a text analysis model for training to obtain positive samples and negative samples; a first loss function is used to perform contrast loss calculation on the positive samples and the negative samples, and according to the calculation result of the first loss function, the text analysis model is back-propagated and optimized to obtain an unsupervised text analysis model; sentence pairs in a labeled training set are input into the unsupervised text analysis model for training to obtain an embedding vector of each sentence in the sentence pair; a second loss function is used to perform contrast loss calculation on the embedding vector of the sentence pair, and according to the calculation result of the second loss function, the unsupervised text analysis model is back-propagated and optimized to obtain the trained text analysis model. Compared with the related art, the embodiment of the present disclosure can perform unsupervised learning on unlabeled data by using loss mask and the first loss function to perform contrastive loss calculation, thereby learning the characteristics and representation of text data, which helps to improve the understanding and generalization ability of the text analysis model for data; by using sentence pairs in the labeled data set for supervised fine-tuning, the performance of the model on specific tasks can be further optimized. Supervised fine-tuning can help the model better adapt to task requirements and improve accuracy and generalization ability. The method of combining unsupervised learning and supervised fine-tuning can improve the generalization ability of the model and make the text analysis model perform better on unseen data.

[0076] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0077] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0078] Figure 1 A flowchart of a method for training a text analysis model provided in an embodiment of the present disclosure;

[0079] Figure 2 A schematic diagram of the sentence-bert model architecture;

[0080] Figure 3 A flowchart of a text matching method provided in an embodiment of the present disclosure;

[0081] Figure 4 An architecture diagram of an intelligent work order system provided in an embodiment of the present disclosure;

[0082] Figure 5 A structural schematic diagram of a text analysis model training device provided in an embodiment of the present disclosure;

[0083] Figure 6 A schematic diagram of the structure of another text analysis model training device provided in an embodiment of the present disclosure;

[0084] Figure 7 A schematic diagram of the structure of a text matching device provided in an embodiment of the present disclosure;

[0085] Figure 8 A schematic block diagram of an exemplary electronic device provided for an embodiment of the present disclosure. DETAILED DESCRIPTION

[0086] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0087] The following describes a text analysis model training method and a text matching method according to an embodiment of the present disclosure with reference to the accompanying drawings.

[0088] Figure 1 A flowchart of a method for training a text analysis model provided in an embodiment of the present disclosure.

[0089] like Figure 1 As shown, the method comprises the following steps:

[0090] Step 101: Based on the loss mask, the unlabeled training set is input into the text analysis model for training to obtain positive samples and negative samples.

[0091] In an embodiment of the present disclosure, a pre-trained Transformer model (such as BERT) and a dropout mechanism in natural language processing are used to enhance the representation of text data. Dropout is not only a regularization technique, but also used to generate different embeddings of text as a means of "data enhancement".

[0092] Specifically, when training a text analysis model using an unlabeled training set, the text data is input into a pre-trained text analysis model. In this process, the model encodes the text and generates its corresponding embedding representation. Dropout is a regularization technique commonly used in training neural networks. It prevents the model from over-relying on specific neurons or combinations of neurons during training by randomly "turning off" some neurons in the network (that is, their outputs are set to 0). This positive sample generated by the dropout mechanism is actually a simple data augmentation method that can increase the generalization ability and robustness of the model without introducing additional data or knowledge sources.

[0093] The labeled training set is input into the text analysis model for training, and the obtained negative samples are used together with the positive samples to train a contrastive loss function to learn the similarities and differences between sentences. In this way, a text analysis model with high-quality sentence vector representation can be effectively trained without the need for complex data enhancement or external knowledge sources.

[0094] For example, there is a batch of unlabeled data, such as "Your mobile phone number is currently in arrears", "The broadband service is currently in the process of upgrading, please forgive me for the inconvenience caused to you"... These sentences do not have similar sentences with good labels. During the training process, all data are sliced ​​to form batches, each batch contains a certain number of sentences. A batch of data is sent to the encoding model text2vec twice. After the text2vec model, a pooling layer (dropout) is added, so that the same sentence is obtained with different vector encodings. The two inputs of the same sentence are used as positive samples, and the others are used as negative samples.

[0095] Step 102: Using a first loss function, perform contrast loss calculation on the positive sample and the negative sample, and perform back propagation optimization on the text analysis model according to the calculation result of the first loss function to obtain an unsupervised text analysis model.

[0096] In the embodiments of the present disclosure, after obtaining the positive samples generated by the dropout mechanism (i.e., two different embeddings obtained based on the same sentence but with different dropout masks applied) and the randomly selected negative samples (i.e., embeddings from different sentences), the next key step is to use a specific loss function to calculate the contrast loss between these samples. This loss function, called the "first loss function", is intended to measure the similarity between positive sample pairs and the difference between negative sample pairs.

[0097] Specifically, the first loss function usually uses contrastive loss or its variants. The design principle of contrastive loss is that for positive sample pairs (that is, two embeddings come from the same sentence), we hope that their representations are as close as possible, and for negative sample pairs (that is, two embeddings come from different sentences), we hope that their representations are as far apart as possible.

[0098] When calculating the contrastive loss, the positive and negative samples are input into the loss function. For each pair of positive samples, the loss function calculates the similarity between their embeddings (such as cosine similarity) and hopes that this similarity is as high as possible. For each pair of negative samples, the loss function hopes that the similarity between their embeddings is as low as possible. To achieve this goal, the loss function outputs a loss value based on the difference in similarity between the positive and negative sample pairs. After obtaining this loss value, the backpropagation algorithm can be used to optimize the parameters of the text analysis model.

[0099] After this process, we finally get an unsupervised text analysis model. This model has learned how to use the dropout mechanism to generate positive sample pairs and distinguish between positive sample pairs and negative sample pairs through the contrast loss function. This process does not rely on any labeled data. This unsupervised text analysis model can serve as the basis for subsequent supervised learning tasks. The following first loss function is used to calculate the contrast loss of positive and negative samples:

[0100] The first loss function is:

[0101]

[0102] Among them, u, v are the embedding vectors of the positive sample pair; sim refers to the similarity of the two vectors, and cosine similarity is used here; τ is the temperature parameter used to control the similarity score scaling; N is the number of samples in the batch; vk is the other embeddings in the batch, used as negative samples.

[0103] After training with a large-scale unlabeled training set, a small-scale high-quality labeled training set is used for fine-tuning.

[0104] Step 103: Input the sentence pairs in the labeled training set into the unsupervised text analysis model for training to obtain the embedding vector of each sentence in the sentence pair.

[0105] In the embodiment of the present disclosure, the text analysis model is a text2vec model, which is a model developed based on multiple BERT models, such as sentence-bert, macbert and other bert variants. In the embodiment of the present disclosure, the sentence-bert model is specifically used. The structural principle of the sentence-bert model is as follows: Figure 2 As shown in Figure 2, the unsupervised text analysis model is a text analysis model trained using a large-scale unlabeled training set.

[0106] After an unsupervised text analysis model (also called an unsupervised text analysis model) is trained using a large-scale unlabeled dataset through unsupervised learning, the sentence pairs in the labeled training set are input into the model to obtain the embedding vector of each sentence in these sentence pairs. Before supervised training, a labeled training set needs to be prepared. This training set contains a series of sentence pairs, each of which is clearly marked as similar or dissimilar. These sentence pairs are usually extracted from a specific field or corpus and have been manually or automatically labeled.

[0107] These annotated sentence pairs are input into the unsupervised text analysis model one by one. Before inputting into the model, the sentence pairs need to be properly preprocessed, such as word segmentation, stop word removal, conversion to lowercase, etc., to ensure that the model can accurately understand the meaning of the sentence. Figure 2 , the sentence pairs in the labeled training set are input into BERT in the sentence-bert model. Once the sentence pairs are input into the text analysis model, the model will use the knowledge it has learned in the unsupervised training phase to encode each sentence and generate its corresponding embedding vector. These embedding vectors are the model's abstract representation of the sentence semantics, which captures the key information and contextual relationships in the sentence. Sentences with similar semantics will have a closer vector distance, which can be used to calculate similarity.

[0108] Since the model has been trained unsupervised, it can handle a variety of different types of sentences and generate discriminative embedding vectors. For similar sentence pairs, the embedding vectors generated by the model should have high similarity; while for dissimilar sentence pairs, the similarity between the embedding vectors should be low.

[0109] Step 104: Use the second loss function to calculate the contrast loss of the embedding vector of the sentence pair, and perform back propagation optimization on the unsupervised text analysis model according to the calculation result of the second loss function to obtain the trained text analysis model.

[0110] In the embodiments of the present disclosure, the embedding vectors obtained by training the unsupervised text analysis model with the labeled training set can be further used to optimize the performance of the model. This is usually achieved by introducing a contrastive loss function (also called a second loss function), which can measure the similarity or difference between the embedding vectors of the sentence pairs.

[0111] The main purpose of the contrastive loss function is to enable the model to learn better sentence representations so that similar sentence pairs have a closer distance in the embedding space, while dissimilar sentence pairs have a farther distance. To achieve this, the contrastive loss function calculates some distance or similarity measure between the embedding vectors of the sentence pairs and generates a loss value based on this measure.

[0112] During the training process, annotated sentence pairs are taken as input and their embedding vectors are obtained through the unsupervised text analysis model. Then, these embedding vectors are input into the contrastive loss function to calculate the loss value between the sentence pairs. The size of the loss value reflects the ability of the model in distinguishing similar and dissimilar sentence pairs. Next, the back-propagation algorithm is used to optimize the model parameters to minimize the output of the contrastive loss function. The back-propagation algorithm calculates the gradient of the loss function with respect to the model parameters and updates the parameter values ​​in the opposite direction of the gradient, thereby gradually reducing the loss value and improving the performance of the model. By continuously iterating this process, the performance of the unsupervised text analysis model can be gradually optimized so that it can better adapt to the sentence pairs in the annotated training set. Finally, a trained text analysis model will be obtained, which can accurately represent the semantic information of the sentence and show excellent performance in various text processing tasks.

[0113] It should be noted that the selection and design of the contrastive loss function has an important impact on the performance of the model. Different contrastive loss functions may be suitable for different tasks and datasets, so they need to be selected and adjusted according to the specific situation in practical applications. In addition, the backpropagation optimization process also needs to be adjusted according to factors such as the complexity of the model and the size of the dataset to ensure the efficiency and stability of the training process.

[0114] In the disclosed embodiment, cosine similarity is often used to calculate the similarity between two sentences, so optimizing the cosine value can better improve the model performance. CoSENT is a loss function that takes the cosine value into consideration. The loss function hopes that the similarity of the positive sample pair is greater than the similarity of the negative sample pair. The loss function form is:

[0115]

[0116] Among them, uk,ul are positive sample pairs, ui,uj are negative sample pairs; cos is cosine calculation; is a hyperparameter for adjusting the size of the loss function; sim is the cosine similarity calculation.

[0117] The present disclosure provides a training method for a text analysis model. Based on a loss mask, an unlabeled training set is input into a text analysis model for training to obtain positive samples and negative samples; a first loss function is used to perform contrast loss calculation on the positive samples and the negative samples, and according to the calculation result of the first loss function, the text analysis model is back-propagated and optimized to obtain an unsupervised text analysis model; sentence pairs in a labeled training set are input into the unsupervised text analysis model for training to obtain an embedding vector of each sentence in the sentence pair; a second loss function is used to perform contrast loss calculation on the embedding vector of the sentence pair, and according to the calculation result of the second loss function, the unsupervised text analysis model is back-propagated and optimized to obtain the trained text analysis model. Compared with the related art, the embodiment of the present disclosure can perform unsupervised learning on unlabeled data by using loss mask and the first loss function to perform contrastive loss calculation, thereby learning the characteristics and representation of text data, which helps to improve the understanding and generalization ability of the text analysis model for data; by using sentence pairs in the labeled data set for supervised fine-tuning, the performance of the model on specific tasks can be further optimized. Supervised fine-tuning can help the model better adapt to task requirements and improve accuracy and generalization ability. The method of combining unsupervised learning and supervised fine-tuning can improve the generalization ability of the model and make the text analysis model perform better on unseen data.

[0118] Further, as a refinement of the above embodiment, based on the loss mask, the unlabeled training set is input into the text analysis model for training to obtain positive samples and negative samples, including: based on the first number of loss masks, each sentence in the unlabeled training set is input into the text analysis model for training to obtain the positive sample; sentence embeddings are obtained by training other sentences in the same batch of the unlabeled training set, and the sentence embeddings are marked as the negative samples.

[0119] Specifically in the disclosed embodiments, dropout is used as a method of "data enhancement". For the same sentence, a preset number of forward propagations are performed, which is the same as the first number of dropout masks, and a different dropout mask is applied each time. This means that in the forward propagation, although the input sentence is the same, due to the randomness of dropout, the model will generate different embedding representations. Since the embedding representations are generated based on the same sentence, they are regarded as positive samples. As for the generation of negative samples, different sentences are usually randomly selected from the training set to constitute negative samples.

[0120] During the training process of the text analysis model, deviations may occur, making it easy for the model to misjudge negative samples as positive samples, thereby generating false positive errors. Some samples may be very close to the target category, making it difficult for the model to classify correctly. These negative samples that are difficult to classify are called difficult samples. Therefore, in an embodiment of the present disclosure, a method for mining difficult-to-classify samples from negative samples is provided, so that the text analysis model can find those difficult-to-classify negative samples and add them to the training set to improve the performance of the model. The method includes but is not limited to the following: In some embodiments, the method further includes: based on the calculation result of the second loss function, the sentence pairs whose loss values ​​in the labeled training set exceed the loss threshold, and a difficult sample data set is generated; the difficult sample data set is input into the unsupervised text analysis model for training to obtain the trained text analysis model.

[0121] Specifically, in the embodiment of the present disclosure, in the training process of optimizing the text analysis model, the hard negative mining training method is used to improve the model's ability to distinguish the semantics of sentences. This method is mainly aimed at samples with large loss values ​​during the training process, that is, samples that are difficult for the model to correctly classify, especially those sentence pairs with similar sentence structures but different semantics.

[0122] Specifically, based on the calculation results of the second loss function, sentence pairs whose loss values ​​exceed the preset loss threshold can be identified. These sentence pairs are "difficult" for the model because, although they may be similar in sentence structure, they have obvious differences in semantics. These samples provide valuable information that helps the model better learn how to distinguish sentences with different semantics. In order to make full use of these difficult samples, these difficult samples are collected and a difficult sample dataset is generated. This dataset contains all sentence pairs whose loss values ​​exceed the threshold, which are selected for further training of the model. This difficult sample dataset is merged into the original annotated training set to form a richer and more challenging dataset. This new dataset not only contains the original sentence pairs, but also adds those difficult samples that challenge the model, which helps the model learn more subtle and complex semantic differences during training. This merged dataset is input into the text analysis model again for training. During the training process, the model adjusts its parameters based on these new samples to better adapt to the distribution and characteristics of the data. Through multiple rounds of iteration and optimization, the model will gradually improve its ability to distinguish the semantics of sentences, especially for those similar but semantically different sentence pairs.

[0123] Further, as an implementable method of the embodiment of the present disclosure, when the text analysis model is subjected to supervised training, the length of the input sentences varies. The uniform length of the encoding vector of each sentence output by the text analysis model is more conducive to the subsequent retrieval and matching process. By performing a pooling operation on the encoding vector of each sentence, the method can be adopted but not limited to the following method: Based on the attention mask, the encoding vector of each sentence is pooled so as to map the embedding vector to the same dimension.

[0124] Further, as a refinement of the above embodiment, the pooling operation is performed on the encoding vector of each sentence based on the attention mask, including:

[0125] Obtain the encoding vector and assign it to the tag embedding vector; expand the input attention mask into the same shape as the encoding vector to obtain an expanded input mask;

[0126] Performing a weighted summation process on the tag embedding vector and the extended input mask to obtain a weighted summed embedding vector;

[0127] Summing all elements in a first dimension of the summed embedding vector to obtain a first scalar value; summing all elements in a first dimension of the extended input mask to obtain a second scalar value;

[0128] The first scalar value and the second scalar value are divided to obtain a coding vector after the pooling operation.

[0129] Specifically in the disclosed embodiment, since the lengths of the input sentences vary, in order to obtain embeddings of uniform length, we perform a pooling operation after each BERT output in the sentence-bert model, which means that regardless of the length of the input sentence, the output is a vector of a fixed size. For the task of semantic matching, after testing common pooling schemes, we choose to use an average pooling operation combined with an attention mask. Please refer to Table 1 for the specific process.

[0130] Table 1

[0131]

[0132] First, the data is inferred by the text analysis model to obtain the last_hidden_state, which is the encoding vector output by the model, and assigned to the token embedding vector (token_embeddings). Then the input attention mask (attention_mask) is expanded into a tensor of the same shape as the encoding vector (last_hidden_state) to obtain an expanded input mask (input_mask_expanded). The expanded input mask (input_mask_expanded) is summed with the token embedding vector (token_embeddings) to obtain the summed embedding vector (um_weighted_embeddings), and then all elements are summed on its first dimension (axis=1), and the input_mask_expanded is summed on the first dimension. The two are divided to obtain the encoding vector after the pooling operation.

[0133] Further, as an implementable manner of the embodiment of the present disclosure, after obtaining the trained text analysis model, the method further includes:

[0134] Based on the collected incremental learning data set, incremental learning training is performed on the trained text analysis model.

[0135] Specifically in the disclosed embodiments, incremental learning is an efficient and practical machine learning strategy that allows the model to continuously learn and update itself when receiving new data while maintaining memory of old knowledge. In real-world applications, especially those scenarios where data sets are constantly expanding, such as the monthly accumulation of work order data (which may add thousands to tens of thousands of new data each month), incremental learning is particularly critical.

[0136] As time goes by and the system runs, new work order data is continuously collected. This data contains new patterns, new information, and new challenges. In order to maintain the performance of the model and enable it to process this new data, it is necessary to perform incremental learning on the text analysis model. Collect and organize these newly collected incremental learning data sets. These data sets contain work order data collected in real time after the system goes online. Each piece of data may contain new information or patterns, which helps to improve the generalization ability of the model. Combine these new data sets with old training data, or directly use the new data sets to train the model.

[0137] Specifically, in incremental learning, incremental learning is performed based on Elastic Weight Consol idation (EWC). Since there is a "catastrophic forgetting" problem in learning new tasks in incremental learning, this forgetting is reduced by imposing specific constraints on the network weights. First, the Fisher information matrix is ​​calculated on the old task, and then the parameters of the old task are stored. After that, a new elastic weight loss is determined, which combines the loss of the new task and the regularization term. The latter (the loss of the new task) penalizes the deviation between the parameters of the old task and the new parameters. Finally, a new text analysis model is trained. Its loss function is as follows:

[0138]

[0139] Where Lold is the loss function of the original model, λ is a hyperparameter used to control the weight information matrix, F is the second-order derivative, and θ is the model weight.

[0140] When the system collects a batch of new data, we first save the parameters of the current model. The new data is divided into training set, validation set, and test set in a ratio of 8:1:1, and then the model is trained on the new data and optimized using the EWC function. This ensures the rapid iteration of the model. At the same time, a data replay solution is introduced. After multiple incremental learning, "forgetting" is inevitable. All the data is recombined, that is, the old data + new data form a new data set, and retraining is completed to complete a model iteration.

[0141] Furthermore, as an achievable manner of the embodiment of the present disclosure, the method further includes:

[0142] Based on a preset evaluation method and a preset test data set, the trained text analysis model is evaluated to obtain a model evaluation result.

[0143] Specifically in the embodiment of the present disclosure, the model evaluation adopts three evaluation indicators, Pearson coefficient, Spearman coefficient, and Powell adaptive threshold calculation.

[0144] First, given two sample sets, X = {x1, x2, x3, ...}, Y = {y1, y2, y3, ...}, X stores the label value and Y stores the similarity calculated by the model.

[0145] Pearson coefficient: A statistical method to measure the strength and direction of the linear relationship between two variables. Its value is between -1 and +1, where +1 indicates a perfect positive correlation, -1 indicates a perfect negative correlation, and 0 indicates no linear correlation. The calculation formula is:

[0146]

[0147] in is the sample mean.

[0148] Spearman coefficient: Spearman rank correlation coefficient is a non-parametric statistic that measures the correlation between two sets of data. Unlike the Pearson correlation coefficient, the Spearman coefficient is not based on the original data value, but on the ranking of the data value. Therefore, when the data does not satisfy the normal distribution or is ordinal data, it is more appropriate to use the Spearman coefficient. The calculation formula is:

[0149]

[0150] The calculation process is to first sort X and Y in ascending order, calculate the rank, the rank is the index position after sorting + 1, if the two values ​​are the same, the rank value is the average of their index values ​​+ 1, and then calculate the rank difference di, that is, subtract the rank values ​​corresponding to X and Y. n is the sample size.

[0151] Powell adaptive threshold algorithm: The output of semantic matching is similarity. During the evaluation process, the manually set similarity threshold is difficult to reflect the actual accuracy. For example, if the cosine similarity is set to be greater than 0.9, the model accuracy will be very low, which is inconsistent with the actual situation. Therefore, we introduced the Powell adaptive threshold algorithm.

[0152] This is an optimization algorithm that does not require derivatives and is mainly used to solve multi-dimensional unconstrained optimization problems. Define the objective function f(x), where x is a vector and set a series of direction sets Search for each direction d and find The minimum value α, and update the initial value x, and use To replace the direction set with a minimum descent direction. Repeat the above process until the optimal point is found.

[0153] In this scheme, the objective function we set is:

[0154]

[0155]

[0156] f(t)=-mean(∑Y)

[0157] Among them, t is the adaptive threshold, which is also the optimization object of the algorithm, ypred is the result predicted by the model, and ytrue is the true label value.

[0158] Figure 3 A flowchart of a text matching method provided in an embodiment of the present disclosure.

[0159] like Figure 3 As shown, the method comprises the following steps:

[0160] Step 201: Acquire work order data to be processed, and pre-process the work order data to be processed to obtain text analysis data.

[0161] In an embodiment of the present disclosure, the work order data to be processed is data in a business process or customer service system, containing various information such as customer requests, problem reports, service requirements, etc. Preprocessing the acquired work order data to be processed is an essential step. The main purpose of preprocessing is to clean the data, remove noise, and convert it into a form suitable for text analysis. Data preprocessing may include but is not limited to data cleaning, including deduplication, removal of irrelevant information, abbreviated text, clearing privacy information, checking for typos, etc. The original semantic information is retained to the greatest extent, the impact of irrelevant information on the model is removed, and the model is prevented from learning privacy information. After the above preprocessing steps, structured text analysis data can be obtained. These data not only contain the original information of the work order, but also have been cleaned and converted to make them more suitable for subsequent text matching tasks.

[0162] Step 202: input the text analysis data into a text analysis model for prediction to obtain a text expression vector corresponding to the text analysis data.

[0163] In the embodiment of the present disclosure, text2vec is used to replace the word2vec module, and a new text matching method for intelligent work orders based on text2vec is proposed. The text expression vector is also the encoding vector of the sentence output by sentence-bert.

[0164] In the intelligent work order system, in order to achieve fast and accurate matching of work order content, a text analysis model based on Sentence-BERT (SBERT) is adopted. The SBERT model is an advanced text embedding technology that uses the deep semantic understanding ability of the BERT model to convert text into vector representation in a high-dimensional space, thereby capturing the semantic similarity between texts.

[0165] The preprocessed text analysis data is used as input. These data have been cleaned, segmented, and stop words are removed to ensure the quality and consistency of the data. Then, these data are input into the trained Sentence-BERT model. The Sentence-BERT model encodes the input text through its internal neural network structure and generates the corresponding text expression vector. In the Sentence-BERT model, the text expression vector is obtained after the model deeply understands and encodes the text. These vectors not only contain the surface information of the text, such as vocabulary, phrases, etc., but also contain the deep semantic information of the text, such as the meaning, emotion, theme, etc. of the sentence. Therefore, by comparing the vector representations of different texts, the semantic similarity between them can be evaluated, thereby achieving rapid matching of texts.

[0166] In the intelligent work order system, the text expression vector generated by the sentence-BERT model can be used to match the work order content at the semantic level. For example, when a new work order is created, its content can be converted into a text expression vector and compared with the vectors in the existing work order library. By calculating the similarity score between the vectors, the existing work order that is most similar to the new work order content can be found, thereby providing relevant historical processing experience, solutions or reference information to help staff process new work orders more quickly and accurately.

[0167] In some embodiments of the present disclosure, a schematic diagram of the architecture of an intelligent work order processing system is provided, such as Figure 4 As shown in the figure. The system includes basic data layer, data preprocessing layer, semantic understanding layer, vector retrieval layer and capability output layer. The basic data layer stores the data from customer service conversations, work orders created by customers, work orders created by customer service, and work order data created by internal personnel. The data preprocessing layer preprocesses the data, first desensitizes the text, removes privacy information, and then removes invalid information, such as work order numbers, etc., constructs sentence pairs, and uses a word segmenter to segment the text. The semantic understanding layer mainly analyzes long texts and contexts, extracts the actual problems of users and analyzes the problems, so as to understand customer intentions and provide corresponding work order solutions. The semantic understanding layer mainly trains the text analysis model, predicts the model (inference) and evaluates the model. The vector retrieval layer retrieves the corresponding solution in the historical work order database (vector library) based on the text expression vector output by the text analysis model. The capability output layer uniformly encapsulates the capabilities of the model, provides a unified interface service for application scenarios, and supports external nesting through URL.

[0168] Step 203: Based on the text expression vector, the solution text corresponding to the to-be-processed work order data in the historical work order database is retrieved.

[0169] In an embodiment of the present disclosure, after obtaining the text expression vectors generated based on the sentence-BERT model, these vectors can be further used to retrieve solution texts similar to or matching the work order data to be processed in the historical work order database (vector library).

[0170] Once the work order data to be processed has been preprocessed and processed by the text analysis model, the corresponding text expression vectors can be obtained, and then these vectors can be used to retrieve relevant solution texts from the historical work order database. The historical work order database usually contains a large number of processed work order records, including key information such as problem description, processing steps, and solutions.

[0171] The text expression vector of the work order to be processed is used as the query condition and compared with the vector representation of the work order text stored in the historical work order database. This process involves calculating the similarity between the query vector and each work order text vector in the database. The similarity can be calculated using metrics such as cosine similarity and Euclidean distance, and the appropriate algorithm can be selected according to the specific application scenario and requirements. By calculating the similarity, historical work order records with high similarity to the text expression vector of the work order to be processed can be found. These records with high similarity are likely to contain problem descriptions and solutions that are similar or related to the work order to be processed. Therefore, these records can be used as candidate matching results for further screening and evaluation.

[0172] During the screening and evaluation process, you can sort and filter based on factors such as similarity scores, the processing status of work orders, and the effectiveness of solutions. For example, you can select the first few work order records with high similarity scores, or only consider work order records that have been successfully resolved and whose solutions have been verified to be effective. Finally, the screened matching results are presented to the staff for their reference and reference. The solutions in these matching results can provide valuable experience and guidance for the staff, helping them to process pending work orders more quickly and accurately. At the same time, the staff can also further adjust and optimize the matching results according to actual needs to meet specific business needs.

[0173] In some embodiments, inputting the text analysis data into a text analysis model for prediction to obtain a text expression vector corresponding to the text analysis data includes:

[0174] Encoding the text analysis data to obtain vocabulary encoding vectors, and padding the encoding vectors so that the lengths of the encoding vectors are consistent;

[0175] Inputting the vocabulary encoding vector and the attention mask into the text analysis model for prediction to obtain a text embedding vector corresponding to the text analysis data;

[0176] The text embedding vector is normalized to obtain a text expression vector corresponding to the text analysis data.

[0177] Specifically, in the disclosed embodiment, the incoming text analysis data is sent to the tokenizer module for encoding processing, and the text is converted into a token code (lexical encoding vector). For example, "I want to go to the business hall" can be converted into a string of digital codes such as "101, 2769, 6206, 1343, 5852, 689, 1324, 102". Since the text analysis model input needs to be consistent in length (128 bits are used in the disclosed embodiment), it is padded with 0 to become the specified length. At the same time, an attention mask (attention_mask) is generated, and its size is the same as the token code. For example, the attention_mask of this example is "1, 1, 1, 1, 1, 1, 0, 0, 0...", where 1 represents that there is text at this position and 0 represents that there is no text. All the obtained data, including the encoding vector, attention_mask, etc., are passed into the sentence-bert model. The model will output various states. Only the value of last_hidden_state is taken, which is the encoding vector of the sentence, and a vector of size 1024 is obtained. Then the vector is NormalizedL2 operated, that is, the L2 norm is calculated first, and then all elements are divided by this L2 norm to obtain the vectorized expression of the work order text.

[0178] In some embodiments, the method further comprises:

[0179] Perform data analysis on the work orders to be processed to generate an incremental learning data set for the text analysis model.

[0180] Specifically, in the embodiments of the present disclosure, when performing data analysis on pending work orders, an important goal is to generate an incremental learning dataset for the text analysis model. The incremental learning dataset is crucial for the continuous improvement of the model and its adaptation to new environments, because it allows the model to learn new knowledge and patterns while retaining previous learning.

[0181] Extract relevant text data from pending work orders. This data may include the problem description of the work order, user feedback, processing steps, etc., which provide rich contextual information for the model. The extracted text data will serve as the basis for the incremental learning dataset. Preprocess these text data. Preprocessing steps may include text cleaning (removing irrelevant information, special characters, etc.), text segmentation (dividing text into words or subword units), and removing stop words (filtering out common words that do not contribute to model training). These steps help reduce data noise, improve data quality, and lay a good foundation for subsequent data analysis.

[0182] After preprocessing, the text data can be further analyzed. This may involve tasks such as text classification (classifying work orders by type, priority, etc.), sentiment analysis (identifying sentiment in work orders), and entity recognition (extracting key entities in work orders, such as product names, fault types, etc.). These analysis tasks aim to extract valuable information from text data in order to provide effective learning signals for the model.

[0183] Based on the above analysis, an incremental learning dataset can be generated. An incremental learning dataset usually consists of two parts: new training samples and labels. Training samples are text data extracted from work orders to be processed, while labels are categories or attributes assigned to these text data based on the analysis results. For example, in a text classification task, we can divide work orders into different categories according to their types and assign a unique label to each category. The generated incremental learning dataset will be used to update and train the text analysis model. By continuously introducing new data and knowledge, the model can gradually adapt to new environments and requirements, improving its performance and accuracy in real application scenarios. At the same time, incremental learning also helps to avoid catastrophic forgetting, which is the situation where the model forgets old knowledge when learning new knowledge.

[0184] It should be noted that the embodiments of the present disclosure may include multiple steps. For the convenience of description, these steps are numbered, but these numbers do not limit the execution time slots or execution order between the steps; these steps can be implemented in any order, and the embodiments of the present disclosure do not limit this.

[0185] Corresponding to the above-mentioned text analysis model training method and text matching method, the present invention also proposes a text analysis model training device and a text matching device. Since the device embodiment of the present invention corresponds to the above-mentioned method embodiment, the details not disclosed in the device embodiment can be referred to the above-mentioned method embodiment, and will not be repeated in the present invention.

[0186] Figure 5 A structural diagram of a training device for a text analysis model provided in an embodiment of the present disclosure, such as Figure 5 As shown, including:

[0187] A first training unit 31 is used to input the unlabeled training set into the text analysis model for training based on the loss mask to obtain positive samples and negative samples;

[0188] A first optimization unit 32 is used to perform contrast loss calculation on the positive sample and the negative sample using a first loss function, and perform back propagation optimization on the text analysis model according to the calculation result of the first loss function to obtain an unsupervised text analysis model;

[0189] A second training unit 33 is used to input the sentence pairs in the labeled training set into the unsupervised text analysis model for training to obtain an embedding vector for each sentence in the sentence pair;

[0190] The second optimization unit 34 is used to use a second loss function to perform contrast loss calculation on the embedding vector of the sentence pair, and perform back propagation optimization on the unsupervised text analysis model according to the calculation result of the second loss function to obtain the trained text analysis model.

[0191] The present disclosure provides a training device for a text analysis model. Based on a loss mask, an unlabeled training set is input into a text analysis model for training to obtain positive samples and negative samples; a first loss function is used to calculate contrast loss for the positive samples and the negative samples, and according to the calculation result of the first loss function, the text analysis model is back-propagated and optimized to obtain an unsupervised text analysis model; sentence pairs in a labeled training set are input into the unsupervised text analysis model for training to obtain an embedding vector of each sentence in the sentence pair; a second loss function is used to calculate contrast loss for the embedding vector of the sentence pair, and according to the calculation result of the second loss function, the unsupervised text analysis model is back-propagated and optimized to obtain the trained text analysis model. Compared with the related art, the embodiment of the present disclosure can perform unsupervised learning on unlabeled data by using loss mask and the first loss function to perform contrastive loss calculation, thereby learning the characteristics and representation of text data, which helps to improve the understanding and generalization ability of the text analysis model for data; by using sentence pairs in the labeled data set for supervised fine-tuning, the performance of the model on specific tasks can be further optimized. Supervised fine-tuning can help the model better adapt to task requirements and improve accuracy and generalization ability. The method of combining unsupervised learning and supervised fine-tuning can improve the generalization ability of the model and make the text analysis model perform better on unseen data.

[0192] Furthermore, in a possible implementation of this embodiment, as Figure 6 As shown, the device also includes:

[0193] A generating unit 35 is used to generate a difficult sample data set based on the calculation result of the second loss function by selecting sentence pairs whose loss values ​​in the labeled training set exceed a loss threshold;

[0194] The third training unit 36 ​​is used to input the difficult sample data set into the unsupervised text analysis model for training to obtain the trained text analysis model.

[0195] Furthermore, in a possible implementation of this embodiment, as Figure 6As shown, the first training unit 31 includes:

[0196] A training module 311 is used to input each sentence in the unlabeled training set into the text analysis model for training based on the first number of loss masks to obtain the positive samples;

[0197] The acquisition module 312 is used to obtain sentence embeddings obtained by training other sentences in the same batch in the unlabeled training set, and mark the sentence embeddings as the negative samples.

[0198] Furthermore, in a possible implementation of this embodiment, as Figure 6 As shown, the device also includes:

[0199] A pooling unit 37, configured to perform a pooling operation on the encoding vector of each sentence based on the attention mask so as to map the embedding vector to the same dimension;

[0200] The pooling unit 37 comprises:

[0201] An expansion module 371 is used to obtain the encoding vector and assign it to the tag embedding vector; expand the input attention mask into the same shape as the encoding vector to obtain an expanded input mask;

[0202] A first calculation module 372 is used to perform a weighted summation process on the tag embedding vector and the extended input mask to obtain a weighted summed embedding vector;

[0203] A second calculation module 373 is used to sum all elements in the first dimension of the summed embedding vector to obtain a first scalar value; and sum all elements in the first dimension of the extended input mask to obtain a second scalar value;

[0204] The third calculation module 374 is used to divide the first scalar value and the second scalar value to obtain the encoding vector after the pooling operation.

[0205] Furthermore, in a possible implementation of this embodiment, as Figure 6 As shown, after obtaining the trained text analysis model, the device further includes:

[0206] The fourth training unit 38 is used to perform incremental learning training on the trained text analysis model based on the collected incremental learning data set.

[0207] Furthermore, in a possible implementation of this embodiment, as Figure 6 As shown, the device also includes:

[0208] The evaluation unit 39 is used to evaluate the trained text analysis model based on a preset evaluation device and a preset test data set to obtain a model evaluation result.

[0209] Figure 7 A structural diagram of a text matching device provided in an embodiment of the present disclosure is shown in FIG. Figure 7 As shown, including:

[0210] A preprocessing unit 41 is used to obtain the work order data to be processed, and preprocess the work order data to be processed to obtain text analysis data;

[0211] A prediction unit 42, configured to input the text analysis data into a text analysis model for prediction, and obtain a text expression vector corresponding to the text analysis data;

[0212] The retrieval unit 43 is used to retrieve the solution text corresponding to the to-be-processed work order data in the historical work order database based on the text expression vector.

[0213] Furthermore, in a possible implementation of this embodiment, as Figure 7 As shown, the prediction unit 42 includes:

[0214] The encoding module 421 is used to encode the text analysis data to obtain a vocabulary encoding vector, and fill the encoding vector so that the length of the encoding vector is consistent;

[0215] A prediction module 422, configured to input the vocabulary encoding vector and the attention mask into the text analysis model for prediction, and obtain a text embedding vector corresponding to the text analysis data;

[0216] The processing module 423 is used to perform a normalization operation on the text embedding vector to obtain a text expression vector corresponding to the text analysis data.

[0217] Furthermore, in a possible implementation of this embodiment, as Figure 7 As shown, the device also includes:

[0218] The analysis unit 44 is used to perform data analysis on the work order to be processed and generate an incremental learning data set for the text analysis model.

[0219] It should be noted that the above explanation of the method embodiment is also applicable to the device of this embodiment, and the principle is the same, which is not limited in this embodiment.

[0220] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0221] Figure 8 A schematic block diagram of an example electronic device 500 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0222] like Figure 8 As shown, the device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 502 or a computer program loaded from a storage unit 508 to a RAM (Random Access Memory) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An I / O (Input / Output) interface 505 is also connected to the bus 504.

[0223] A number of components in the device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0224] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as a training method for a text analysis model or a method for text matching. For example, in some embodiments, the training method for a text analysis model or a method for text matching may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to execute the aforementioned text analysis model training method or text matching method in any other appropriate manner (for example, by means of firmware).

[0225] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a dedicated or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0226] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0227] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a RAM, a ROM, an EPROM (Electrically Programmable Read-Only-Memory) or a flash memory, an optical fiber, a CD-ROM (Compact Dis sc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0228] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the 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 acoustic input, voice input, or tactile input).

[0229] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.

[0230] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.

[0231] It should be noted that artificial intelligence is a discipline that studies how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.), and includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.

[0232] The various numerical numbers such as first and second involved in the present disclosure are only for the convenience of description and are not used to limit the scope of the embodiments of the present disclosure, but also indicate the order of precedence.

[0233] At least one in the present disclosure may also be described as one or more, and a plurality may be two, three, four or more, which is not limited in the present disclosure. In the embodiments of the present disclosure, for a technical feature, the technical features in the technical feature are distinguished by "first", "second", "third", "A", "B", "C" and "D", etc., and there is no order of precedence or size between the technical features described by the "first", "second", "third", "A", "B", "C" and "D".

[0234] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0235] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A training method for a text analysis model, characterized in that: include: Based on the loss mask, the unlabeled training set is input into the text analysis model for training to obtain positive and negative samples; Using a first loss function, performing contrast loss calculation on the positive sample and the negative sample, and performing back propagation optimization on the text analysis model according to the calculation result of the first loss function to obtain an unsupervised text analysis model; Inputting sentence pairs in the labeled training set into the unsupervised text analysis model for training to obtain an embedding vector for each sentence in the sentence pair; The second loss function is used to calculate the contrast loss of the embedding vector of the sentence pair, and the unsupervised text analysis model is back-propagated and optimized according to the calculation result of the second loss function to obtain the trained text analysis model.

2. The method according to claim 1, characterized in that The method further comprises: Based on the calculation result of the second loss function, the sentence pairs whose loss values ​​in the labeled training set exceed the loss threshold are selected to generate a difficult sample data set; The difficult sample data set is input into the unsupervised text analysis model for training to obtain the trained text analysis model.

3. The method according to claim 1, characterized in that The method further comprises: Based on the attention mask, a pooling operation is performed on the encoding vector of each sentence so as to map the embedding vector to the same dimension; The pooling operation is performed on the encoding vector of each sentence based on the attention mask, including: Obtain the encoding vector and assign it to the tag embedding vector; expand the input attention mask into the same shape as the encoding vector to obtain an expanded input mask; Performing a weighted summation process on the tag embedding vector and the extended input mask to obtain a weighted summed embedding vector; Summing all elements in a first dimension of the summed embedding vector to obtain a first scalar value; summing all elements in a first dimension of the extended input mask to obtain a second scalar value; The first scalar value and the second scalar value are divided to obtain a coding vector after the pooling operation.

4. The method according to claim 1, characterized in that The method further comprises: Based on a preset evaluation method and a preset test data set, the trained text analysis model is evaluated to obtain a model evaluation result.

5. A text matching method, characterized in that: The method comprises: Acquire work order data to be processed, and preprocess the work order data to be processed to obtain text analysis data; Inputting the text analysis data into a text analysis model for prediction to obtain a text expression vector corresponding to the text analysis data; Based on the text expression vector, the solution text corresponding to the to-be-processed work order data in the historical work order database is retrieved.

6. The method according to claim 5, characterized in that The step of inputting the text analysis data into a text analysis model for prediction to obtain a text expression vector corresponding to the text analysis data includes: Encoding the text analysis data to obtain vocabulary encoding vectors, and padding the encoding vectors so that the lengths of the encoding vectors are consistent; Inputting the vocabulary encoding vector and the attention mask into the text analysis model for prediction to obtain a text embedding vector corresponding to the text analysis data; The text embedding vector is normalized to obtain a text expression vector corresponding to the text analysis data.

7. The method according to claim 5, characterized in that The method further comprises: Perform data analysis on the work orders to be processed to generate an incremental learning data set for the text analysis model.

8. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.

9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-7.

10. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 7.