Text processing methods, devices, equipment, media, and products based on advertising review

By adjusting the Sentence-BERT model by calculating the total error of similarity prediction for sample text pairs, the problem of inconsistency between the training and prediction processes is solved, improving the accuracy of text pair similarity prediction and the training effect of the model, making it suitable for text matching tasks.

CN117057337BActive Publication Date: 2026-11-17TENCENT TECH SHANGHAI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210995746.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-17
Publication Date
2026-11-17
Estimated Expiration
2042-08-17

AI Technical Summary

Technical Problem

Sentence-BERT suffers from inconsistencies between the training and prediction processes in sentence vector representation and text matching tasks, resulting in low accuracy in predicting text similarity.

Method used

By obtaining the labeled similarity and predicted similarity of sample text pairs, the total similarity prediction error is calculated, and the initial text similarity recognition model is adjusted based on this error. The model is then optimized to obtain the target similarity recognition model, ensuring the consistency of the training and prediction processes, and ranking features are introduced into the training process.

Benefits of technology

It improves the accuracy of text similarity prediction, enhances the convergence speed and performance of the model during the training phase, and is suitable for text matching tasks such as search and recall tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117057337B_ABST
    Figure CN117057337B_ABST
Patent Text Reader

Abstract

This application provides a text processing method, apparatus, device, medium, and product for advertising review, applied in the field of advertising review. The method includes: acquiring M sample text pairs and the labeled text similarity corresponding to each of the M sample text pairs; performing similarity recognition on the M sample text pairs using an initial text similarity recognition model, and outputting M predicted text similarities; acquiring a discrimination parameter between the M predicted text similarities; determining the total similarity prediction error of the initial text similarity recognition model based on the discrimination parameter, the labeled text similarities corresponding to each of the M sample text pairs, and the M predicted text similarities; and adjusting the initial text similarity recognition model based on the total similarity prediction error to obtain a target text similarity recognition model. Using the method described in this application, the accuracy of text pair similarity recognition can be improved based on artificial intelligence technology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural language processing technology, and in particular to a text processing method, apparatus, device, medium and product based on advertising review. Background Technology

[0002] The supervised sentence representation model Sentence-BERT demonstrates state-of-the-art (SOTA) performance on sentence vector representation and text matching tasks, proving its effectiveness. The training process of Sentence-BERT involves concatenating (u,v,|uv|) and then performing a classification softmax layer. However, the training and prediction processes of Sentence-BERT are inconsistent, with a certain probability of overfitting or even "training collapse." This manifests as a decrease in training loss and an increase in training accuracy, but a significant decrease in the cosine-based Spearman coefficient, affecting both the training and test sets. This training and prediction method of Sentence-BERT leads to lower accuracy in predicting the similarity of text pairs. Summary of the Invention

[0003] This application provides a text processing method, apparatus, device, medium, and product based on advertising review, which can improve the accuracy of predicting the similarity of text pairs.

[0004] In a first aspect, embodiments of this application provide a text processing method based on advertisement review, the method comprising:

[0005] Obtain M sample text pairs and the labeled text similarity corresponding to the M sample text pairs respectively; M is an integer greater than or equal to 2, and a sample text pair includes two sample texts;

[0006] The M sample texts are input into the initial text similarity recognition model, and the initial text similarity recognition model is used to perform similarity recognition on the M sample text pairs respectively, and outputs M predicted text similarities;

[0007] Obtain the discrimination parameters among the M predicted text similarities, and determine the total similarity prediction error of the initial text similarity recognition model based on the discrimination parameters, the labeled text similarities corresponding to the M sample text pairs, and the M predicted text similarities.

[0008] Based on the total error of the similarity prediction, the initial text similarity recognition model is adjusted to obtain a target text similarity recognition model for recognizing the target similarity of target text pairs.

[0009] Secondly, embodiments of this application provide a text processing apparatus based on advertisement review, the apparatus comprising:

[0010] The acquisition module is used to acquire M sample text pairs and the labeled text similarity corresponding to the M sample text pairs respectively; M is an integer greater than or equal to 2, and a sample text pair includes two sample texts;

[0011] The recognition module is used to input the M sample texts into the initial text similarity recognition model, and to perform similarity recognition on the M sample text pairs through the initial text similarity recognition model, and output M predicted text similarities;

[0012] The determination module is used to obtain the discrimination parameters between the M predicted text similarities through the acquisition module, and determine the total similarity prediction error of the initial text similarity recognition model based on the discrimination parameters, the labeled text similarities corresponding to the M sample text pairs, and the M predicted text similarities.

[0013] The adjustment module is used to adjust the initial text similarity recognition model based on the total error of the similarity prediction, so as to obtain a target text similarity recognition model for recognizing the target similarity of target text pairs.

[0014] Thirdly, embodiments of this application provide a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method described in the first aspect.

[0015] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method described in the first aspect.

[0016] Fifthly, embodiments of this application provide a computer program product, including a computer program, characterized in that, when the computer program is executed by a processor, it implements the steps of the method described in the first aspect.

[0017] In summary, the computer device can acquire M sample text pairs and the corresponding labeled text similarities for each of the M sample text pairs. It then uses an initial text similarity recognition model to identify the similarity of each of the M sample text pairs, outputting M predicted text similarities. Furthermore, the computer device can determine the total similarity prediction error of the initial text similarity recognition model based on the discrimination parameters between the M predicted text similarities, the labeled text similarities for each of the M sample text pairs, and the M predicted text similarities. Based on this total similarity prediction error, the initial text similarity recognition model is adjusted to obtain a target text similarity recognition model for identifying the target text pairs. This method introduces similarity calculation into the model training process, ensuring consistency between the model's training and prediction methods. This leads to more accurate similarity recognition by the target text similarity recognition model. Moreover, the introduction of ranking features into the training process allows the similarity generated by the target similarity recognition model to be used for ranking, recall, and other scenarios. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a schematic diagram of the network architecture of a text processing system provided in an embodiment of this application;

[0020] Figure 2A This is a flowchart illustrating a text processing method based on advertising review provided in an embodiment of this application;

[0021] Figure 2B This is a schematic diagram of a text similarity calculation process provided in an embodiment of this application;

[0022] Figure 3 This is a flowchart illustrating another text processing method based on advertising review provided in an embodiment of this application;

[0023] Figure 4 This is a schematic diagram of the structure of a text processing device based on advertising review provided in an embodiment of this application;

[0024] Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0025] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.

[0026] Artificial intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.

[0027] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.

[0028] Natural Language Processing (NLP) is an important field within computer science and artificial intelligence. It studies the theories and methods for enabling effective communication between humans and computers using natural language. NLP is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language people use in daily life—and thus it has a close relationship with linguistic research. NLP techniques typically include text processing, semantic understanding, machine translation, question answering, and knowledge graphs.

[0029] This application implements a text processing scheme, which involves technologies such as artificial intelligence natural speech processing technology.

[0030] The text processing scheme implemented in this application ensures consistency between model training and prediction processes. Compared to existing technologies where inconsistencies in model training and prediction lead to inaccurate predictions of similarity between text pairs, this application achieves both training and prediction by calculating the similarity of text pairs. This results in a target text similarity recognition model with higher accuracy in predicting the similarity of text pairs. Furthermore, because the model training and prediction processes on supervised corpora are consistent, the convergence speed and performance of the model during the training phase are significantly better than neural network models such as the Sentence-BERT model used for calculating text similarity. In addition, the text processing scheme adopted in this application proposes a new loss function for the model training process, referencing the supervised method of the SimCSE model. This loss function can calculate the total similarity prediction error, which is used in the model optimization process. During model optimization, it can directly optimize the predicted text similarity of two sample text pairs compared among multiple sample text pairs. Furthermore, the text processing scheme adopted in this application, due to its supervised training method, can enhance the distinguishability between highly similar and relatively low-similar sample text pairs based on the similarity of the labeled text corresponding to each sample text pair. This improves the effectiveness of the model in representing text features. Specifically, this effectiveness is reflected in the fact that the similarity calculated by the model after representing the features of each text in multiple text pairs can effectively reflect the true similarity difference between multiple text pairs, rather than simply reflecting whether the individual texts in each text pair are similar or dissimilar. Therefore, the similarity calculated by the aforementioned text processing scheme in the model prediction stage is more suitable for text matching tasks, such as search tasks and recall tasks.

[0031] Here, "higher" and "lower" similarity are relative concepts. For example, the similarity of the labeled text of sample text pair 1 (sample 1, sample 2) is greater than that of sample text pair 2 (sample 1, sample 3), and the similarity of sample text pair 2 is greater than that of sample text pair 3 (sample 1, sample 4). From the perspective of sample text pair 2, sample text pair 1 is considered to have higher similarity than sample text pair 2, while sample text pair 2 is considered to have lower similarity than sample text pair 1. Similarly, from the perspective of sample text pair 3, sample text pair 2 can be considered to have higher similarity than sample text pair 3, while sample text pair 3 is considered to have lower similarity than sample text pair 2. During training, this application can enhance the discriminative power between sample text pair 1 and sample text pair 2 based on the annotation similarity corresponding to sample text pair 1 and sample text pair 2, and enhance the discriminative power between sample text pair 2 and sample text pair 3 based on the annotation similarity corresponding to sample text pair 2 and sample text pair 3. Overall, it enhances the discriminative power among sample text pair 1, sample text pair 2, and sample text pair 3 based on the annotation similarity corresponding to sample text pair 1, sample text pair 2, and sample text pair 3.

[0032] The text processing scheme generally proceeds as follows: M sample text pairs are obtained, along with their corresponding labeled text similarities; the M sample texts are input into an initial text similarity recognition model, which then performs similarity recognition on each of the M sample text pairs, outputting M predicted text similarities; based on the labeled text similarities and the M predicted text similarities for each of the M sample text pairs, the total similarity prediction error of the initial text similarity recognition model is determined; and based on the total similarity prediction error, the initial text similarity recognition model is adjusted to obtain a target text similarity recognition model used to identify the target similarity of target text pairs. Further, the text processing scheme proceeds as follows: M sample text pairs and their corresponding labeled text similarities are obtained; the M sample texts are input into an initial text similarity recognition model, which then performs similarity recognition on each of the M sample text pairs, outputting M predicted text similarities; based on the discrimination parameters between the M predicted text similarities, the labeled text similarities corresponding to the M sample text pairs, and the M predicted text similarities, the total similarity prediction error of the initial text similarity recognition model is determined; based on the total similarity prediction error, the initial text similarity recognition model is adjusted to obtain a target text similarity recognition model used to identify the target similarity of target text pairs.

[0033] To facilitate a clearer understanding of this application, we will first introduce the text processing system that implements the text processing method based on advertising review, such as... Figure 1 As shown, Figure 1 As shown, this text processing system includes a server 10 and a terminal cluster. The terminal cluster can include one or more terminals; the number of terminals is not limited here. Figure 1 As shown, the terminal cluster may specifically include terminal 1, terminal 2, ..., terminal n; it can be understood that terminal 1, terminal 2, terminal 3, ..., terminal n can all connect to server 10 via the network so that each terminal can interact with server 10 via the network connection.

[0034] In one application scenario, the terminal is equipped with a search platform for users. This search platform can refer to web pages, mini-programs, and search applications. The terminal can automatically generate the similarity between input text pairs through the target text similarity recognition model in the search platform, and then perform business processing based on the similarity between the input text pairs.

[0035] For example, the terminal can obtain keywords input by the user based on the search platform, and then use the keywords to form multiple text pairs with multiple texts included in the specified database. The similarity recognition model in the search platform can automatically generate the similarity of each text pair in the input multiple text pairs. Then, the multiple texts are sorted based on the similarity, thereby determining the top preset number of texts with the highest similarity to provide to the user, so as to provide the user with accurate search content and improve search accuracy.

[0036] For example, the terminal can obtain the advertising keywords entered by the advertiser based on the search platform, and then use the advertising keywords to form multiple keyword pairs with multiple advertising keywords included in the specified database. The similarity recognition model in the search platform can automatically generate the similarity of each keyword pair in the multiple input keyword pairs. Then, based on the similarity, the terminal can filter out the top preset number of advertising keywords with the highest similarity from the multiple keywords and provide them to the advertiser, thereby providing the advertiser with effective advertising keywords and improving the advertising effect.

[0037] It should be noted that the text processing scheme described above can be used not only for search platforms, but also for other platforms that need to perform the text matching task, such as recommendation platforms. This application embodiment does not limit this.

[0038] Understandably, server 10 can refer to a device used to provide backend services for the search platform. For example, server 10 can train an initial text similarity recognition model to obtain a target text similarity recognition model for recognizing the similarity of input text pairs. The input text pairs generated by the target text similarity recognition model are then processed for business purposes, and the processed data is sent to the terminal to provide search services to the terminal.

[0039] The server can be a single physical server, a server cluster or distributed system consisting of at least two physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms. The terminal can specifically refer to in-vehicle terminals, smartphones, tablets, laptops, desktop computers, smart speakers, speakers with screens, smartwatches, etc., but is not limited to these. The terminals and servers can be directly or indirectly connected via wired or wireless communication. The number of terminals and servers can be one or at least two; this application does not impose any restrictions.

[0040] Please see Figure 2A This is a flowchart illustrating a text processing method based on advertising review, provided in an embodiment of this application. Figure 1 As shown, this method can be derived from... Figure 1 It can be executed by the terminal in the middle, or by Figure 1 The server in the middle can be used to execute it, or it can be executed by... Figure 1 The method is executed jointly by a terminal and a server. The device used to execute this method in this application can be collectively referred to as a computer device. Specifically, the method includes the following steps:

[0041] S201. Obtain M sample text pairs and the similarity of the labeled texts corresponding to the M sample text pairs.

[0042] A sample text pair comprises two sample texts. M is a positive integer greater than or equal to 2. The text mentioned in this application embodiment includes, but is not limited to, words or sentences. The sample texts mentioned in this application embodiment can be different types of text depending on the application scenario, such as advertising text, article text (articles to be published or published), short video text, video text, etc. The methods for obtaining M sample text pairs include, but are not limited to, obtaining them from the database where the M sample text pairs reside. For example, the sample texts included in each of the M sample text pairs can be in the same database, partially in the same database and partially in different databases, or completely in different databases.

[0043] The M sample text pairs may include at least two sample text pairs associated with the target sample text. The target sample text refers to the text selected for training the initial text similarity recognition model. There may be one or more target sample texts; when there are multiple target sample texts, they are all different. The M sample text pairs may include multiple sample text pairs associated with the target sample text. Each sample text pair includes the target sample text and other sample texts besides the target sample text. The other sample texts included in each sample text pair are different. Here, the other sample texts may be sample texts similar to the target sample text or sample texts dissimilar to the target sample text. In one embodiment, the sample texts similar to the target sample text may be texts with a similarity greater than a preset value, or the sample texts similar to the target sample text may be texts with a similarity less than or equal to a preset value. The similarity between the target sample text included in a sample text pair and the other sample texts included in that sample text pair can be determined based on the similarity of the labeled text corresponding to that sample text pair.

[0044] Text similarity is essentially a text similarity label assigned to a pair of sample texts. It indicates the degree of similarity between two sample texts within a single text pair. Each of the M sample text pairs can carry a corresponding text similarity label. It should be noted that, unlike the purely positive and negative labels (0 and 1) used to indicate similarity, the text similarity label in this embodiment can be any value within a preset text similarity range. The two endpoints of this range can be a first value and a second value, with the second value being greater than the first value; a larger value indicates a higher degree of similarity. For example, the text similarity label can be any value between -1 and 1, with -1 representing the lowest similarity and 1 representing the highest. Alternatively, it can be any value between 0 and 5, such as 0, 1, 2, 3, 4, 5, or 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, or further subdivided as described in this embodiment. In this system, 0 represents the lowest similarity, and 5 represents the highest similarity. It should be noted that the text similarity annotation can be set in other formats besides the example above, and can be adjusted according to actual needs. This application does not impose any restrictions on this. Text similarity annotations include, but are not limited to, using numbers, letters, and text.

[0045] S202. Input the M sample text pairs into the initial text similarity recognition model, and use the initial text similarity recognition model to perform similarity recognition on the M sample text pairs respectively, and output the M predicted text similarities.

[0046] In this embodiment of the application, M sample texts can be input into an initial text similarity recognition model. The initial text similarity recognition model calculates the similarity between the two texts in each of the M sample text pairs, thereby obtaining the predicted text similarity corresponding to each of the M sample text pairs, and thus obtaining M predicted text similarities.

[0047] In one embodiment, the method of performing similarity recognition on M sample text pairs using an initial text similarity recognition model and outputting M predicted text similarities can be as follows: The initial text similarity recognition model extracts features from the two sample texts in each of the M sample text pairs, obtaining text vectors for each pair. The predicted text similarity between these vectors is then calculated and used as the predicted text similarity for each of the M sample text pairs, resulting in M ​​predicted text similarities. This process involves representing each text with features using a model, and then using the feature vectors obtained from the feature representation to calculate the text similarity, thus obtaining the predicted text similarity. The method used to calculate the similarity between the text vectors of the two sample texts in each sample text pair can be the cosine similarity calculation method. In this embodiment, in addition to the cosine similarity calculation method, other similarity calculation methods can also be used to calculate the similarity between the text vectors of the two sample texts in each sample text pair; these will not be elaborated upon here. Furthermore, in this embodiment, the similarity calculation method used in the model training phase and the model prediction phase is the same. For example, if the cosine similarity calculation method is used to calculate the similarity between texts in the model training phase, then the cosine similarity calculation method is also used in the model prediction phase to calculate the similarity between texts, thereby ensuring the consistency of the model training process. In one embodiment, when it is detected that each of the two sample texts in each of the M sample text pairs has generated text vectors, the generated text vectors of those sample texts can be directly obtained to calculate the predicted text similarity between the two sample texts.

[0048] In one embodiment, if M sample text pairs include sample text pair M t Sample text for M t Given a first sample text and a second sample text, where t is an integer greater than or equal to 2 and less than or equal to M, the initial text similarity recognition model is used to identify the similarity of M sample text pairs and output M predicted text similarities. One method is to encode the first sample text and the second sample text separately, obtaining the first text edit value corresponding to the first sample text and the second text encoded value corresponding to the second sample text. Then, pooling is performed on the first text edit value and the second text encoded value to obtain the first text vector corresponding to the first sample text and the second text vector corresponding to the second sample text. Finally, the similarity between the first text vector and the second text vector is calculated to obtain the M sample text pairs. t The corresponding predicted text similarity. Among the M sample text pairs, excluding sample text pair M...t The method for calculating the predicted text similarity of other sample text pairs can refer to this method, and will not be elaborated on in this embodiment. The first text edit value is the text vector obtained by encoding the first sample text, and the second text encoding value corresponding to the second sample text is the text vector obtained by encoding the second sample text. Encoding can be understood as a feature representation process. The first text vector refers to the text vector obtained by pooling the first text edit value, and the second text vector refers to the text vector obtained by pooling the second text edit value. The method for calculating the similarity between the first and second text vectors includes, but is not limited to, the aforementioned cosine similarity calculation method. The above process is equivalent to implementing the feature extraction process. Specifically, through encoding, text vectors can be obtained; through pooling, the dimensionality of the text vectors can be reduced, thereby reducing the time required to calculate similarity and improving the training speed of the model.

[0049] In one embodiment, the initial text similarity recognition model may include an encoding layer. The encoding layer is used to encode the input text. In one embodiment, the encoding layer may be a BERT model. Here, the encoding layer enables the process of feature representation of the text; that is, it obtains the text vectors corresponding to the text for similarity calculation.

[0050] In one embodiment, the initial text similarity recognition model may include an encoding layer and a pooling layer. The pooling layer is used to perform pooling processing on the encoding results from the encoding layer. Here, the encoding layer and the pooling layer can realize the process of feature representation of the text; that is, the encoding layer and the pooling layer work together to obtain the text vector corresponding to the text for similarity calculation.

[0051] In one embodiment, if M sample text pairs include sample text pair M t Sample text for M t Including a first sample text and a second sample text, the initial text similarity recognition model is used to identify the similarity of M sample text pairs and output M predicted text similarities. This can be achieved by using the encoding layer of the initial text similarity recognition model to encode the first and second sample texts respectively, obtaining a first text edit value corresponding to the first sample text and a second text encoded value corresponding to the second sample text; then using the pooling layer of the initial text similarity recognition model to pool the first text edit value and the second text encoded value respectively, obtaining a first text vector corresponding to the first sample text and a second text vector corresponding to the second sample text; finally, similarity calculation is performed on the first and second text vectors to obtain the M sample text pairs. tThe corresponding predicted text similarity. The method for calculating the similarity between the first and second text vectors includes, but is not limited to, the cosine similarity calculation method.

[0052] In one embodiment, the initial text similarity recognition model may further include a similarity recognition layer, which calculates the similarity between the first text vector and the second text vector to obtain sample text pairs M. t The corresponding method for predicting text similarity can be to calculate the similarity between the first and second text vectors using the similarity recognition layer of the initial text similarity recognition model, thereby obtaining the sample text pair M. t The corresponding predicted text similarity. The similarity recognition layer can be a neural network or functional module used to calculate the similarity between the text vectors corresponding to the two sample texts in a sample text pair.

[0053] In one embodiment, the initial text similarity recognition model can also use other models for feature extraction; that is, the encoding layer can be a BERT model, a GBDT model, or other models. The encoding layers in this embodiment include, but are not limited to, the BERT and GBDT models, which will not be listed individually here.

[0054] In one embodiment, M sample texts can be input into an initial text similarity recognition model sequentially according to the similarity prediction order. The initial text similarity recognition model then calculates the similarity of each of the M sample text pairs to obtain the predicted text similarity for each of the M sample text pairs, thus obtaining M predicted text similarities. In one embodiment, the similarity prediction order can be the order in which the first M sample text pairs are arranged before inputting the M sample text pairs into the model.

[0055] S203. Obtain the discrimination parameters between the M predicted text similarities, and determine the total similarity prediction error of the initial text similarity recognition model based on the discrimination parameters, the labeled text similarities corresponding to the M sample text pairs, and the M predicted text similarities.

[0056] S204. Based on the total error of the similarity prediction, adjust the initial text similarity recognition model to obtain a target text similarity recognition model for recognizing the target similarity of target text pairs.

[0057] In this embodiment, the total similarity prediction error of the initial text similarity recognition model can be determined based on the similarity of the labeled text corresponding to each of the M sample text pairs and the similarity of the predicted text corresponding to each of the M sample text pairs. In this embodiment, a discrimination parameter can be further introduced to determine the total similarity prediction error of the initial text similarity recognition model. Specifically, a discrimination parameter can be obtained between the M predicted text similarities, and the total similarity prediction error of the initial text similarity recognition model can be determined based on the discrimination parameter, the similarity of the labeled text corresponding to each of the M sample text pairs, and the similarity of the predicted text corresponding to each of the M sample text pairs.

[0058] The discrimination parameter is used to measure the discriminative power between the predicted text similarities of different sample text pairs. Specifically, the discrimination parameter can be used to measure the discriminative power between the predicted text similarities of each pair of sample text pairs in M ​​sample text pairs. In one embodiment, each pair of sample text pairs includes one positive sample text pair and one negative sample text pair. If there is a second sample text pair among the M sample text pairs with a labeled text similarity less than that of the first sample text pair, then the first sample text pair is a positive sample text pair, and the second sample text pair is a negative sample text pair. The first sample text pair is any one of the M sample text pairs. The second sample text pair is the sample text pair among the M sample text pairs whose labeled text similarity is less than that of the first sample text pair. Therefore, the positive and negative sample text pairs described in this embodiment are relative concepts. By comparing the labeled text similarities of two sample text pairs, the sample text pair with the relatively smaller labeled text similarity is the negative sample text pair, and the text pair with the relatively larger labeled text similarity is the positive sample text pair. For example, if there are M sample text pairs including sample text pair 1, sample text pair 2, and sample text pair 3, and the similarity of the labeled text of sample text pair 1 is 5, the similarity of the labeled text of sample text pair 2 is 3, and the similarity of the labeled text of sample text pair 3 is 2, then the similarity of the labeled text of sample text pair 1 is greater than that of sample text pair 2, and the similarity of the labeled text of sample text pair 1 is also greater than that of sample text pair 3. Therefore, for sample text pair 1 and sample text pair 2, sample text pair 1 is a positive sample text pair, and sample text pair 2 is a negative sample text pair. For sample text pair 1 and sample text pair 3, sample text pair 1 is a positive sample text pair, and sample text pair 3 is a negative sample text pair. Furthermore, the similarity of the labeled text of sample text pair 2 is also greater than that of sample text pair 3. Therefore, for sample text pair 2 and sample text pair 3, sample text pair 2 is a positive sample text pair, and sample text pair 3 is a negative sample text pair. Here, the discrimination parameter can be used to measure the discrimination between the predicted text similarities corresponding to sample text pair 1, sample text pair 2, and sample text pair 3, respectively. Furthermore, it can be used to measure the discrimination between sample text pair 1 and sample text pair 2, the discrimination between sample text pair 1 and sample text pair 2, and the discrimination between sample text pair 2 and sample text pair 3.

[0059] In one embodiment, the distinguishing parameter can be the similarity difference between the predicted text similarities corresponding to the M sample text pairs. In another embodiment, the similarity difference between the predicted text similarities corresponding to the M sample text pairs can include the similarity difference between the predicted text similarity of each positive sample text pair and the predicted text similarity of each negative sample text pair corresponding to that positive sample text pair. Here, the difference between the predicted text similarity of a positive sample text pair and the predicted text similarity of a negative sample text pair corresponding to that positive sample text pair is the difference between the predicted text similarity of the positive sample text pair and the predicted text similarity of the negative sample text pair corresponding to that positive sample text pair. In one embodiment, the predicted text similarity of the positive sample text pair can be used as the subtrahend, and the predicted text similarity of the negative sample text pair corresponding to the positive sample text pair can be used as the minuend. For example, if M sample text pairs include sample text pair 1, sample text pair 2, and sample text pair 3, and the labeled text similarity of sample text pair 1 is 5, the labeled text similarity of sample text pair 2 is 3, and the labeled text similarity of sample text pair 3 is 2, then the labeled text similarity of sample text pair 1 is greater than that of sample text pair 2, and the labeled text similarity of sample text pair 1 is also greater than that of sample text pair 3. The similarity difference between the predicted text similarities corresponding to the M sample text pairs can include the similarity difference between the predicted text similarity of sample text pair 1 and the predicted text similarity of sample text pair 2, the similarity difference between the predicted text similarity of sample text pair 1 and the predicted text similarity of sample text pair 3, and the similarity difference between the predicted text similarity of sample text pair 2 and the predicted text similarity of sample text pair 3. In the above examples, when calculating the similarity difference between the predicted text similarity of sample text pair 1 and the predicted text similarity of sample text pair 2, the predicted text similarity of sample text pair 1 is used as the subtrahend, and the predicted text similarity of sample text pair 2 is used as the minuend. Similarly, when calculating the similarity difference between the predicted text similarity of sample text pair 1 and the predicted text similarity of sample text pair 3, the predicted text similarity of sample text pair 1 is used as the subtrahend, and the predicted text similarity of sample text pair 3 is used as the minuend. Finally, when calculating the similarity difference between the predicted text similarity of sample text pair 2 and the predicted text similarity of sample text pair 3, the predicted text similarity of sample text pair 2 is used as the subtrahend, and the predicted text similarity of sample text pair 3 is used as the minuend.

[0060] In one embodiment, the method for obtaining the discrimination parameters among the M predicted text similarities, and determining the total similarity prediction error of the initial text similarity recognition model based on the discrimination parameters, the labeled text similarities corresponding to the M sample text pairs, and the M predicted text similarities, can be as follows: Obtain the similarity prediction order of the M sample text pairs and the model output order of the M predicted text similarities; determine the discrimination parameters among the M predicted text similarities based on the model output order, the similarity prediction order, the labeled text similarities corresponding to the M sample text pairs, and the M predicted text similarities; determine the sequential prediction error of the initial text similarity recognition model based on the discrimination parameters; and determine the sequential prediction error of the initial text similarity recognition model as the total similarity prediction error of the initial text similarity recognition model. The concepts of similarity prediction order and model output order are explained below.

[0061] In one embodiment, the similarity prediction order is the arrangement of the M sample text pairs before the input model. This arrangement can be any order, and this embodiment does not limit it. In one embodiment, the arrangement of the M sample text pairs before the input model can specifically be the arrangement of the identification information of the M sample text pairs before the input model. The identification information can be, for example, a number or other information used to uniquely identify the sample text pair. The model output order can be the arrangement of the M sample text pairs output by the model, and each sample text pair output by the model corresponds to a predicted text similarity. In one embodiment, the arrangement of the M sample text pairs output by the model can be the arrangement of the identification information of the M sample text pairs. In this case, the model input order and model output order can be used to correspond the input sample text pairs to the output sample text pairs. That is, based on the model input order and model output order, it can be determined which sample text pair the input labeled text similarity corresponds to, and which sample text pair the output predicted text similarity corresponds to. Alternatively, the similarity prediction order can be the order in which the M sample text pairs (excluding the target sample text) are arranged before being input into the model, and the model output order can be the order in which the M other sample texts are output by the model, with each other sample text corresponding to a predicted text similarity. Or, the similarity prediction order can be the order in which the target sample text and the M other sample texts are arranged before being input into the model, and the model output order can be the order in which the target sample text and the M other sample texts are output by the model, with each other sample text corresponding to a predicted text similarity. In this case, the model input order and model output order can be used to correspond the input sample texts to the output sample texts. That is, based on the model input order and model output order, it can be determined which sample text pair the input labeled text similarity corresponds to, and which sample text pair the output predicted text similarity corresponds to.

[0062] In one embodiment, the sequential prediction error can reflect the difference between the discriminative power of the predicted text similarities corresponding to the M sample text pairs and the model optimization objective. A larger sequential prediction error indicates that the similarity differences corresponding to the M predicted text similarities deviate more from the model optimization objective. The model optimization objective of this embodiment is to maximize the predicted text similarity of positive sample text pairs and minimize the predicted text similarity of negative sample text pairs, thereby maximizing the similarity difference between positive and negative sample text pairs. For example, if the similarity prediction order is as follows: (sample text pair 1, 5), (sample text pair 2, 3), (sample text pair 3, 2), and assuming sample text pair 1 includes statements A and B, (sample text pair 1, 5) can also be represented as (statement A, statement B, 5). Other sample text pairs can also refer to this representation. Where 5, 3, and 2 are the labeled text similarities of sample text pair 1, sample text pair 2, and sample text pair 3, respectively. The model output order is as follows: (Sample text pair 1, 0.2), (Sample text pair 2, 0.6), (Sample text pair 3, 0.1). Here, 0.2, 0.6, and 0.1 represent the predicted text similarities for sample text pairs 1, 2, and 3, respectively. The similarity prediction order corresponds to the model output order. Because the relationship between the predicted text similarities of sample text pair 1 and sample text pair 2 is inconsistent with that of sample text pair 1 (the predicted text similarity for sample text pair 1 is lower, and the predicted text similarity for sample text pair 2 is higher), the order prediction error is calculated based on the difference in predicted similarity between sample text pair 1 and sample text pair 2. The initial similarity recognition model has a relatively large order prediction error. Consequently, a larger total similarity prediction error will also be obtained.

[0063] In one embodiment, the similarity prediction order can be determined based on the magnitude relationship between the similarity scores of the labeled texts corresponding to the M sample text pairs. The similarity prediction order can reflect the magnitude relationship between the magnitude relationship between the magnitude relationship between the labeled texts corresponding to the M sample text pairs. For example, the similarity prediction order can be the order in which the M sample text pairs are arranged according to the magnitude of their labeled text similarity, from smallest to largest, or the order in which they are arranged according to the magnitude of their labeled text similarity, from largest to smallest. Embodiments of this application include, but are not limited to, the similarity prediction orders listed herein. Correspondingly, the model output order can also be determined based on the magnitude relationship between the predicted text similarity scores of the M sample text pairs. The model output order can reflect the magnitude relationship between the predicted text similarity scores of the M sample text pairs. For example, the model output order can be the order in which the M sample text pairs are arranged according to the magnitude relationship between their predicted text similarity scores, from smallest to largest, or the order in which they are arranged according to the magnitude of their predicted text similarity, from largest to smallest. Embodiments of this application include, but are not limited to, the model output order listed herein. In this case, the model input order and the model output order can be used to determine the magnitude relationship between the input sample text pairs and the magnitude relationship between the output sample text pairs, respectively.

[0064] In one embodiment, the sequential prediction error can also reflect the difference between the magnitude of the predicted text similarity corresponding to each of the M sample text pairs and the magnitude of the magnitude of the labeled text similarity corresponding to each of the M sample text pairs. A larger sequential prediction error indicates a greater difference between the magnitude of the predicted text similarity corresponding to each of the M sample text pairs and the magnitude of the labeled text similarity corresponding to each of the M sample text pairs. For example, if the similarity prediction order is as follows: (sample text pair 1, 5), (sample text pair 2, 3), (sample text pair 3, 2), where 5, 3, and 2 are the labeled text similarities for sample text pairs 1, 2, and 3, respectively, and the model prediction order is as follows: (sample text pair 1, 0.2), (sample text pair 2, 0.6), (sample text pair 3, 0.1), where 0.2, 0.6, and 0.1 are the predicted text similarities for sample text pairs 1, 2, and 3, respectively. Originally, the labeled text similarity of sample text pair 1 was > the labeled text similarity of sample text pair 2 was > the labeled text similarity of sample text pair 3. However, the predicted text similarity of sample text pair 2 was > the predicted text similarity of sample text pair 1 was > the predicted text similarity of sample text pair 3 was. This indicates that the initial text similarity recognition model cannot accurately predict the similarity relationship between sample text pair 1, sample text pair 2, and sample text pair 3, and the initial text similarity recognition model has a large order prediction error. Alternatively, if the similarity prediction order is as follows: sample text pair 1, sample text pair 2, sample text pair 3, the model's prediction order is as follows: sample text pair 1, sample text pair 2, sample text pair 3. It turns out that the annotated text similarity of sample text pair 1 is greater than that of sample text pair 2, which in turn is greater than that of sample text pair 3. However, the predicted text similarity of sample text pair 2 is greater than that of sample text pair 1, which is greater than that of sample text pair 3. This indicates that the initial text similarity recognition model cannot accurately predict the similarity relationship between sample text 1, sample text pair 2, and sample text pair 3, and the initial text similarity recognition model has a large order prediction error. In other words, the initial text similarity recognition model will also have a large total similarity recognition error. In one embodiment, the optimization objective of the model can also include making the relationship between the annotated text similarity of the M sample text pairs consistent with the relationship between the predicted text similarity of the M sample text pairs. Furthermore, the order prediction error can also reflect the difference between the relationship between the predicted text similarity of the M sample text pairs and the optimization objective of the model.

[0065] In one embodiment, the annotation text similarity corresponding to each of the M sample text pairs includes the annotation text similarity P. r and the text similarity P of the labeled text r+1M predicted text similarities include predicted text similarity Q. r And predicting text similarity Q r+1 The method for determining the discrimination parameters among the M predicted text similarities based on the model output order, similarity prediction order, the similarity of the labeled texts corresponding to the M sample text pairs, and the similarity of the M predicted texts can be as follows: obtain the labeled text similarity P. r Similarity P with the labeled text r+1 The relationship between the magnitudes; based on this relationship, compare the predicted text similarity Qr with the predicted text similarity Q. r+1 The difference is calculated to obtain the predicted text similarity Q. r The corresponding similarity difference is used to determine the distinguishing parameters between the M predicted text similarities based on the similarity differences between them. For example, if the M sample text pairs include sample text pair 1, sample text pair 2, and sample text pair 3, and the labeled text similarity of sample text pair 1 is 5, the labeled text similarity of sample text pair 2 is 3, and the labeled text similarity of sample text pair 3 is 2, then the labeled text similarity of sample text pair 1 is greater than that of sample text pair 2, and the labeled text similarity of sample text pair 1 is also greater than that of sample text pair 3. Therefore, the similarity difference between the predicted text similarity of sample text pair 1 and the predicted text similarity of sample text pair 2 can be calculated, as can the similarity difference between the predicted text similarity of sample text pair 1 and the predicted text similarity of sample text pair 3. The similarity difference between the predicted text similarity of sample text pair 2 and the predicted text similarity of sample text pair 3, and the similarity differences between the predicted text similarities of the M sample text pairs respectively, can include the similarity differences between the predicted text similarities of sample text pair 1 and sample text pair 2, the similarity differences between the predicted text similarities of sample text pair 1 and sample text pair 3, and the similarity differences between the predicted text similarities of sample text pair 2 and sample text pair 3. These similarity differences are used as the distinguishing parameters between the M sample text pairs. This embodiment of the application can obtain the labeled text similarity P. r Similarity P with the labeled text r+1 The size relationship between them is used to select the predicted text similarity Q. r As a text similarity metric for meiosis prediction, Q r+1 As the minuend, or selected based on the size relationship, the predicted text similarity Q is... r As the minuend, the predicted text similarity Q is used. r+1 As the subtrahend, the difference between the determined minuend and subtrahend is calculated to obtain the predicted text similarity Q. rCorresponding to the similarity difference, the similarity difference corresponding to each of the M predicted text similarities is determined as the difference parameter between the similarities corresponding to the M predicted text similarities. In one embodiment, the predicted text similarity Q is specifically used here. r As a text similarity metric for meiosis prediction, Q r+1 As the minuend, the predicted text similarity Q will still be used. r As the minuend, the predicted text similarity Q is used. r+1 As a subtrahend, it depends on the predicted text similarity Q. r The similarity Q between the corresponding sample text pairs and the predicted text r+1 Which of the corresponding sample text pairs is the positive sample text pair and which is the negative sample text pair? Since the labeled text similarity in this embodiment is no longer limited to positive and negative sample labels like 0 and 1, but rather any value within a preset similarity range, this predicted similarity range can include, for example, three or more similarity values, four or more similarity values, five or more similarity values, or various values ​​within a preset similarity interval. Therefore, in this embodiment, the positive and negative sample text pairs are determined by comparing the labeled text similarity of the two sample text pairs. If the predicted text similarity Q... r The labeled text similarity of the corresponding sample text pairs is greater than the predicted text similarity Q. r+1 The predicted text similarity Q is the similarity between the labeled text of the corresponding sample text pairs. r The corresponding sample text pairs are positive sample text pairs, and the predicted text similarity Q is... r+1 The corresponding sample text pair is the negative sample text pair, and the predicted text similarity Q is... r+1 As a subtrahend, the predicted text similarity Q is... r As the minuend, conversely, if the predicted text similarity Q... r The similarity between the labeled text of the corresponding sample text pair is less than or equal to the predicted text similarity Q. r+1 The predicted text similarity Q is the similarity between the labeled text of the corresponding sample text pairs. r The corresponding sample text pair is the negative sample text pair, and the predicted text similarity Q is... r+1 The corresponding sample text pairs are positive sample text pairs, and the predicted text similarity Q is... r+1 As the minuend, the predicted text similarity Q is... r As a subtrahend.

[0066] In one embodiment, the M sample text pairs correspond to labeled text similarity, including labeled text similarity P. r and the text similarity P of the labeled text r+1 M predicted text similarities include predicted text similarity Q. rAnd predicting text similarity Q r+1 Text similarity P is labeled r The similarity prediction order of the corresponding sample text pairs and the predicted text similarity Q r The model output order of corresponding sample text pairs is the same, and the labeled text similarity P r+1 The similarity prediction order of the corresponding sample text pairs and the predicted text similarity Q r+1 The corresponding sample text pairs have the same model output order. The method for determining the order prediction error of the initial text similarity recognition model based on the model output order, similarity prediction order, the similarity scores of the labeled texts for each of the M sample text pairs, and the similarity scores of the M predicted texts can be: obtaining the labeled text similarity P... r Similarity P with the labeled text r+1 The size relationship between them; based on the size relationship, predict the text similarity Q. r Similarity Q to predicted text r+1 The difference is calculated to obtain the predicted text similarity Q. r Corresponding similarity differences; the similarity differences corresponding to the similarities of the M predicted texts are determined as the distinguishing parameters among the similarities of the M predicted texts. This application embodiment can obtain the labeled text similarity P. r Similarity P with the labeled text r+1 The size relationship between them is used to select the predicted text similarity Q. r As a text similarity metric for meiosis prediction, Q r+1 As the minuend, or selected based on the size relationship, the predicted text similarity Q is... r As the minuend, the predicted text similarity Q is used. r+1 As the subtrahend, the difference between the determined minuend and subtrahend is calculated to obtain the predicted text similarity Q. r Based on the similarity difference, the sequential prediction error of the initial text similarity recognition model is determined according to the similarity difference corresponding to the similarity of the M predicted texts.

[0067] The following describes a loss function for calculating the total error of similarity prediction, provided in an embodiment of this application. This function will be referred to as the ranking loss function for short. The embodiments of this application include, but are not limited to, using the ranking loss function to calculate the total error of similarity prediction.

[0068] Assume x i There are positive sample text pairs (x) i ,x i + ), negative sample text pairs (x i ,x i - ), where x iThis can be understood as the target sample text mentioned in the embodiments of this application, specifically representing the i-th sample text x used to train the initial text similarity recognition model. The positive and negative sample text pairs mentioned in the embodiments are relative concepts; for specific descriptions of the positive and negative sample text pairs mentioned in the embodiments of this application, please refer to the preceding text, which will not be repeated here. The model optimization objective of the embodiments of this application can be that for any positive sample text pair and its corresponding negative sample text pair, the following relationship holds: cos(hi, hi) + >cos(hi, hi) - ), where x i + For x i The corresponding positive sample, that is, the other sample texts included in the positive sample text pair. i - For x i The corresponding negative sample, that is, the other sample texts included in the negative sample text pair. hi is x i The corresponding text vector used for similarity calculation. hi + For x i + The corresponding text vector used for similarity calculation. hi - For x i - The corresponding text vectors are used for similarity calculation. In this embodiment, the greater the predicted text similarity of positive sample text pairs compared to the predicted text similarity of negative sample text pairs, the better.

[0069] To directly optimize predicted text similarity, this application proposes a loss function based on cosine similarity, which can be based on cos(hi, hi). + ) and cos(hi, hi) - The difference between (hi, hi) is used to calculate the initial text similarity prediction loss value of the text similarity recognition model, which is equivalent to calculating the initial text similarity prediction total error. This initial text similarity prediction loss value is then optimized to improve the overall similarity prediction error, thus achieving the model optimization process. Wherein, cos(hi, hi) + ) and cos(hi, hi) -) is the difference between the predicted text similarity of the positive sample text pair and the predicted text similarity of the negative sample text pair corresponding to the positive sample text pair. The ranking loss function mentioned in the embodiments of the present application is improved based on the Circle loss function. Among them, Circle loss is a pair-based similarity optimization method, which is improved from triplet loss. Triplet loss optimizes positive and negative samples in an equally weighted manner, while Circle loss adds a weight to the positive and negative sample text pairs to control the respective gradient contributions of the positive and negative sample text pairs, and finally obtains a more discriminative model. Circle loss proposes the following loss function (1):

[0070]

[0071] Different from the i mentioned earlier, i here represents the i-th Sp, j represents the j-th Sn, K represents the number of Sp, and L represents the number of Sn. Sp is the intra-class similarity, and Sn is the inter-class similarity. γ is a scale factor. m is a threshold. The purpose of Circle loss is to maximize Sp while minimizing Sn. Under the cosine similarity metric, Sp approaches 1 and Sn approaches 0. It can be seen that Circle loss is a solution for processing the similarity of sample text pairs. By simplifying formula (1), the following loss function (2) is obtained:

[0072] log(1+∑ n∈neg,p∈pos e Sn-Sp )(2)

[0073] That is, if it is desired to achieve Sn<Sp, then e is added to the log Sn-Sp , corresponding to the solution implemented in the embodiments of the present application, the following loss function (3) can be obtained:

[0074]

[0075] Then the formula (3) is improved to obtain the following ranking loss function (4), which is a loss function based on cos():

[0076]

[0077] t represents temperature, which is a temperature coefficient and a hyperparameter, and can be taken as 0.05 in the experiment. And cos(hi, hi in formula (4) here - )-cos(hi, hi + ) represents the negative sample text pair(x i ,x i -The predicted text similarity of ) and the positive sample text pair (x) i ,x i + The similarity difference between the predicted text similarities.

[0078] After obtaining the difference in predicted text similarity among M predicted text similarities, the order prediction error can be calculated based on the loss function shown in formula (4), thus obtaining the total similarity prediction error. In one embodiment, the labeled text similarity P is obtained. r Similarity P with the labeled text r+1 The size relationship between the two texts; based on the size relationship, determine the predicted text similarity Q. r Similarity Q to predicted text r+1 In this application embodiment, the predicted text similarity of the positive sample text pair is used as the subtrahend, and the predicted text similarity of the negative sample text pair corresponding to the positive sample text pair is used as the minuend. After determining the minuend and subtrahend, the predicted text similarity Q is... r Similarity Q to predicted text r+1 The difference is calculated to obtain the predicted text similarity Q. r The corresponding similarity difference; based on the similarity difference corresponding to the M predicted text similarities, the distinction parameter between the M predicted text similarities is determined. Here, the similarity difference corresponding to the M predicted text similarities can be determined as the distinction parameter between the M predicted text similarities. Specifically, if the size relationship reflects the similarity P of the labeled text... r Greater than the text similarity P r+1 This indicates that the similarity P of the labeled text is... r The corresponding sample text pairs are positive sample text pairs, and the labeled text similarity P r+1 If the corresponding sample text pair is the negative sample text pair corresponding to the positive sample text pair, then the predicted text similarity Q will be... r+1 Similarity Q to predicted text r Subtracting the two, we get the predicted text similarity Q. r The corresponding similarity difference; or, if the size relationship reflects the similarity P of the labeled text. r Less than or equal to the text similarity P of the labeled text r+1 This indicates that the similarity P of the labeled text is... r+1 The corresponding sample text pairs are positive sample text pairs, and the labeled text similarity P r The corresponding sample text pair is the negative sample text pair corresponding to the positive sample text pair, and the predicted text similarity Q is calculated. r Similarity Q to predicted text r+1 Subtracting the two, we get the predicted text similarity Q. rThe corresponding similarity difference. Considering the ranking loss function shown in formula (4), if the similarity P of the labeled text... r+1 If the corresponding sample text pair is a negative sample text pair, then the predicted text similarity Q is... r+1 For cos(hi, hi) - If the text similarity P is labeled r If the corresponding sample text pair is the positive sample text pair corresponding to the negative sample text pair, then the predicted text similarity Q is... r For cos(hi, hi) + (hi, hi) - Q is used to predict text similarity. r+1 The corresponding text vectors for the two sample texts in the sample text pair. (hi, hi) + Q is used to predict text similarity. r The corresponding text vectors for the two sample texts in a sample text pair. For example, if there are M sample text pairs including sample text pair 1, sample text pair 2, and sample text pair 3, and the labeled text similarity of sample text pair 1 is 5, the labeled text similarity of sample text pair 2 is 3, and the labeled text similarity of sample text pair 3 is 2, then the labeled text similarity of sample text pair 1 is greater than that of sample text pair 2, and the labeled text similarity of sample text pair 1 is also greater than that of sample text pair 3. Therefore, the predicted text similarity of sample text pair 1 can be used as the subtrahend, and the predicted text similarity of sample text pair 2 as the minuend. The similarity difference between the predicted text similarity of sample text pair 1 and the predicted text similarity of sample text pair 2 can be calculated. The similarity difference between the predicted text similarity of sample text pair 1 and the predicted text similarity of sample text pair 3 is calculated by taking the predicted text similarity of sample text pair 2 as the subtrahend and the predicted text similarity of sample text pair 3 as the minuend. The similarity difference between the predicted text similarity of the M sample text pairs can include the similarity difference between the predicted text similarity of sample text pair 1 and the predicted text similarity of sample text pair 2, the similarity difference between the predicted text similarity of sample text pair 1 and the predicted text similarity of sample text pair 3, and the similarity difference between the predicted text similarity of sample text pair 2 and the predicted text similarity of sample text pair 3.

[0079] In one embodiment, the similarity difference between the predicted text similarities corresponding to each pair of target sample texts in the M sample text pairs can be determined based on the discrimination parameter. Therefore, the order prediction error of the initial text similarity recognition model can be determined based on the similarity difference between the predicted text similarities corresponding to each pair of target sample texts. Each pair of target sample texts includes a positive sample text pair and a negative sample text pair, and the predicted text similarity corresponding to the positive sample text pair is greater than the predicted text similarity corresponding to the negative sample text pair. For example, if the M sample text pairs include sample text pair 1, sample text pair 2, and sample text pair 3, and the labeled text similarity of sample text pair 1 is 5, the labeled text similarity of sample text pair 2 is 3, and the labeled text similarity of sample text pair 3 is 2, then the labeled text similarity of sample text pair 1 is greater than the labeled text similarity of sample text pair 2, and the labeled text similarity of sample text pair 1 is also greater than the labeled text similarity of sample text pair 3. Therefore, for sample text pair 1 and sample text pair 2, sample text pair 1 is a positive sample text pair, and sample text pair 2 is a negative sample text pair. For sample text pair 1 and sample text pair 3, sample text pair 1 is a positive sample text pair, and sample text pair 3 is a negative sample text pair. In one case, if, based on the discrimination parameter, it is determined that the predicted text similarity corresponding to sample text pair 1 is greater than the predicted text similarity corresponding to sample text pair 2, then sample text pair 1 and sample text pair 2 are two target sample text pairs, and the similarity difference between the predicted text similarity corresponding to sample text pair 1 and the predicted text similarity corresponding to sample text pair 2 can be obtained. Similarly, if it is determined that the predicted text similarity corresponding to sample text pair 1 is greater than the predicted text similarity corresponding to sample text pair 3, then sample text pair 2 and sample text pair 3 are two target sample text pairs, and the similarity difference between the predicted text similarity corresponding to sample text pair 2 and the predicted text similarity corresponding to sample text pair 3 can be obtained. In this case, the order prediction error of the initial text similarity recognition model can be determined based on the similarity difference between the predicted text similarity of sample text pair 1 and the predicted text similarity of sample text pair 2, the similarity difference between the predicted text similarity of sample text pair 1 and the predicted text similarity of sample text pair 3, and the similarity difference between the predicted text similarity of sample text pair 2 and the predicted text similarity of sample text pair 3.If, based on the discrimination parameters, the predicted text similarity of sample text pair 1 is determined to be greater than the predicted text similarity of sample text pair 2, then sample text pair 1 and sample text pair 2 are two target sample text pairs. The similarity difference between the predicted text similarity of sample text pair 1 and the predicted text similarity of sample text pair 2 can be obtained. If it is also determined that the predicted text similarity of sample text pair 1 is greater than the predicted text similarity of sample text pair 3, then sample text pair 1 and sample text pair 3 are two target sample text pairs. The similarity difference between the predicted text similarity of sample text pair 1 and the predicted text similarity of sample text pair 3 can be obtained. If it is also determined that the predicted text similarity of sample text pair 2 is less than or equal to the predicted text similarity of sample text pair 3, then sample text pair 2 and sample text pair 3 are not two target sample text pairs. In this case, the order prediction error of the initial text similarity recognition model can be determined based on the similarity difference between the predicted text similarity of sample text pair 1 and the predicted text similarity of sample text pair 2, and the similarity difference between the predicted text similarity of sample text pair 1 and the predicted text similarity of sample text pair 3.

[0080] In one embodiment, the method for determining the order prediction error of the initial text similarity recognition model based on the discrimination parameter can be as follows: from the similarity differences corresponding to the M predicted text similarities, determine each similarity difference with a similarity difference less than 0, and determine the order prediction error of the initial text similarity recognition model based on each similarity difference with a similarity difference less than 0. After obtaining the discrimination parameter, it can be determined which similarity differences satisfy the accumulation condition, and then the order prediction error of the initial text similarity recognition model can be determined based on the similarity differences that satisfy the accumulation condition. In this embodiment, the similarity differences that satisfy the accumulation condition are those where the similarity difference between the predicted text similarity of the positive sample text pair and the predicted text similarity of the corresponding negative sample text pair is greater than 0. Combining the loss function shown in formula (4), after obtaining the predicted text similarity differences between the M predicted text similarities, the order prediction error of the initial text similarity recognition model can be determined based on the loss function shown in formula (4) according to each similarity difference with a similarity difference less than 0. Furthermore, the sequential prediction error of the initial text similarity recognition model can be calculated based on the loss function shown in formula (4), according to each similarity difference less than 0 and the temperature coefficient.

[0081] In one embodiment, the distinguishing parameter can be the comparison result between the predicted text similarities of the M sample text pairs. That is, the comparison result between the predicted text similarities of the M sample text pairs can be obtained, and this comparison result is determined as the distinguishing parameter between the predicted text similarities of the M sample text pairs. The comparison result indicates whether the predicted text similarity of the positive sample text pair in the two sample text pairs being compared is greater than the predicted text similarity of the negative sample text pair. The distinguishing parameter can be used to distinguish the magnitude relationship between the predicted text similarities of the M sample text pairs. For example, if M sample text pairs include sample text pair 1, sample text pair 2, and sample text pair 3, and the labeled text similarity of sample text pair 1 is 5, the labeled text similarity of sample text pair 2 is 3, and the labeled text similarity of sample text pair 3 is 2, then the labeled text similarity of sample text pair 1 is greater than that of sample text pair 2, and the labeled text similarity of sample text pair 1 is also greater than that of sample text pair 3. The similarity difference between the predicted text similarities corresponding to the M sample text pairs can include a comparison between the predicted text similarity of sample text pair 1 and the predicted text similarity of sample text pair 2. As a result, the comparison results are used to indicate whether the predicted text similarity of sample text pair 1 is greater than the predicted text similarity of sample text pair 2, and the comparison results between the predicted text similarity of sample text pair 1 and the predicted text similarity of sample text pair 3 are used to indicate whether the predicted text similarity of sample text pair 1 is greater than the predicted text similarity of sample text pair 3, and the comparison results between the predicted text similarity of sample text pair 2 and the predicted text similarity of sample text pair 3 are used to indicate whether the predicted text similarity of sample text pair 2 is greater than the predicted text similarity of sample text pair 3. The total similarity prediction error of the initial model similarity recognition model can be calculated based on the comparison results between the predicted text similarities of the M sample text pairs, the comparison results of the labeled text similarities of the M sample text pairs, and the predicted text similarities of the M sample text pairs. The comparison results of the similarity between the labeled texts corresponding to the M sample text pairs are used to determine which sample text pair corresponds to the predicted text similarity as a positive sample text pair and which sample text pair corresponds to the predicted text similarity as a negative sample text pair. The comparison results of the similarity between the predicted texts corresponding to the M sample text pairs are used to determine which positive sample text pair corresponds to the predicted text similarity and the predicted text similarity of that positive sample text pair satisfies the accumulation condition. Based on the similarity difference that satisfies the accumulation condition and the temperature coefficient, the order prediction error of the initial similarity recognition model is calculated.

[0082] In this embodiment, after obtaining the total similarity prediction error, the model parameters of the initial text similarity recognition model can be optimized based on the total similarity prediction error to obtain a target text similarity recognition model for recognizing the target similarity of target text pairs. Here, the target text pair can be any text pair whose text similarity is to be predicted. Target similarity refers to the text similarity between the two texts included in the target text pair. In this embodiment, the model optimization objective is to ensure that for positive sample text pairs and their corresponding negative sample text pairs, the predicted text similarity of the positive sample text pair is greater than that of the negative sample text pair, and that the predicted text similarity of the positive sample text pair is as great as possible greater than that of the negative sample text pair, thereby effectively distinguishing sample text pairs with different labeled text similarities, and ensuring that the magnitude relationship of the predicted text similarities of the M sample text pairs is consistent with the magnitude relationship of the labeled text similarities of the M sample text pairs.

[0083] In one embodiment, the model training and model prediction process of this application can be found in [reference needed]. Figure 2B ,pass Figure 2B The method shown ensures consistency between model training and prediction. This embodiment employs this approach, guaranteeing consistency between model training and prediction—both are based on cosine similarity training and evaluation (Spearman coefficients) for text similarity recognition—while also utilizing supervised training to enhance the distinction between similar and dissimilar text pairs based on labeled similarity, making it more suitable for text matching tasks. Experiments clearly demonstrate stronger model robustness and faster convergence. Furthermore, this embodiment, based on a BERT model or a similar language model, supervises the training of a sentence vector representation model, resulting in a target text similarity recognition model. This model more effectively represents text as vectors, allowing for more efficient similarity calculations based on the obtained text vectors. This target text similarity recognition model performs better on text matching tasks, especially text semantic matching tasks.

[0084] As can be seen, the computer device can acquire M sample text pairs and the corresponding labeled text similarities for each of the M sample text pairs. It then uses an initial text similarity recognition model to identify the similarity of each of the M sample text pairs, outputting M predicted text similarities. The computer device can also acquire the discrimination parameters between the M predicted text similarities. Based on these discrimination parameters, the labeled text similarities for each of the M sample text pairs, and the M predicted text similarities, the total similarity prediction error of the initial text similarity recognition model is determined. Based on this total similarity prediction error, the initial text similarity recognition model is adjusted to obtain a target text similarity recognition model for identifying the target text pairs. This method introduces similarity calculation into the model training process, ensuring consistency between the model's training and prediction methods. This leads to more accurate similarity recognition by the target text similarity recognition model. Furthermore, the introduction of ranking features into the training process allows the similarity generated by the target similarity recognition model to be used for ranking, recall, and other scenarios.

[0085] See Figure 3 This is a flowchart illustrating a text processing method based on advertising review, provided in an embodiment of this application. Figure 1 As shown, this method can be derived from... Figure 1 It can be executed by the terminal in the middle, or by Figure 1 The server in the middle can be used to execute it, or it can be executed by... Figure 1 The method is executed jointly by a terminal and a server. The device used to execute this method in this application can be collectively referred to as a computer device. Specifically, the method includes the following steps:

[0086] S301. Obtain M sample text pairs and the text similarity of the labeled text corresponding to the M sample text pairs.

[0087] S302. The initial text similarity recognition model is used to perform similarity recognition on the M sample text pairs respectively, and outputs M predicted text similarities.

[0088] Wherein, steps S301 and S302 are referred to Figure 2A Steps S201 and S202 in the embodiments are not described in detail here.

[0089] S303. Obtain the similarity prediction order of the M sample text pairs and the model output order of the similarity of the M predicted texts.

[0090] S304. Based on the model output order, the similarity prediction order, the similarity of the labeled texts corresponding to the M sample text pairs, and the similarity of the M predicted texts, determine the discrimination parameters among the M predicted text similarities.

[0091] S305. Determine the order prediction error of the initial text similarity recognition model based on the distinguishing parameters.

[0092] The specific methods for determining the distinction parameters among the M predicted text similarities based on the model output order, the similarity prediction order, the labeled text similarities of the M sample text pairs, and the similarities of the M predicted texts, as well as the methods for determining the order prediction error of the initial text similarity recognition model based on the distinction parameters, have been described above and will not be repeated here in this application embodiment.

[0093] S306. Based on the similarity of the labeled texts corresponding to the M sample text pairs and the similarity of the M predicted texts, determine the similarity prediction error of the initial text similarity recognition model.

[0094] S307. The sum of the sequential prediction error of the initial text similarity recognition model and the similarity prediction error of the initial text similarity recognition model is determined as the total similarity prediction error of the initial text similarity recognition model.

[0095] In steps S306-S307, the similarity prediction error of the initial text similarity recognition model can be determined based on the labeled text similarity of the M sample text pairs and the M predicted text similarity. The sum of the sequential prediction error and the overall similarity prediction error of the initial text similarity recognition model is determined as the total similarity prediction error of the initial text similarity recognition model. Subsequently, based on the sequential prediction error and the sum of the overall similarity prediction errors of the initial text similarity recognition model, the model parameters of the initial text similarity recognition model are optimized to obtain the target text similarity recognition model used to identify the target similarity of target text pairs.

[0096] By optimizing the sequential prediction error, we can increase the discriminative power among the M sample text pairs and reduce the difference between the similarity relationships of the predicted texts for each of the M sample text pairs and the similarity relationships of their corresponding labeled texts. Optimizing the similarity prediction error makes the similarity indices of the predicted texts for each of the M sample text pairs closer to the similarity indices of their corresponding labeled texts. The model optimization objective can also encompass making the similarity indices of the predicted texts for each of the M sample text pairs closer to the similarity indices of their corresponding labeled texts.

[0097] In one embodiment, the similarity prediction error of the initial text similarity recognition model can be determined based on the similarity of the labeled text corresponding to the M sample text pairs and the similarity of the M predicted texts. The sequential prediction error and the total similarity prediction error of the initial text similarity recognition model are then defined as the total similarity prediction error of the initial text similarity recognition model. Subsequently, based on the sequential prediction error and the total similarity prediction error of the initial text similarity recognition model, the model parameters of the initial text similarity recognition model are optimized to obtain a target text similarity recognition model for recognizing the target similarity of target text pairs. Unlike the aforementioned method, the method for determining the total similarity prediction error of the initial text similarity recognition model here does not require calculating the sum of the sequential prediction error and the total similarity prediction error of the initial text similarity recognition model.

[0098] In one embodiment, the similarity prediction error of the initial text similarity recognition model can be calculated based on the similarity of the labeled text corresponding to each of the M sample text pairs and the similarity of the M predicted texts. This can be achieved by calculating the similarity difference between the labeled text similarity and the predicted text similarity of each of the M sample text pairs, and then determining the similarity prediction error of the initial text similarity recognition model based on this difference. Alternatively, in another embodiment, the labeled text similarity and the predicted text similarity of each of the M sample text pairs can be superimposed, and the superposition result can be determined as the similarity prediction error of the initial text similarity recognition model. In one embodiment, the similarity prediction error of the initial text similarity recognition model can be calculated based on the similarity of the labeled text corresponding to the M sample text pairs and the similarity of the M predicted texts. This can be achieved by normalizing the similarity of the labeled text corresponding to the M sample text pairs to obtain normalized labeled text similarities for each pair; calculating the similarity difference between the normalized labeled text similarities and the predicted text similarities for each pair; and determining the similarity prediction error of the initial text similarity recognition model based on this difference. Alternatively, in one embodiment, the normalized labeled text similarities and the predicted text similarities for each pair can be superimposed, and the superposition result can be used as the similarity prediction error of the initial text similarity recognition model. It should be noted that whether or not to normalize the labeled text similarities depends on the actual model prediction performance. S308. Based on the total error of the similarity prediction, the initial text similarity recognition model is adjusted to obtain a target text similarity recognition model for recognizing the target similarity of target text pairs.

[0099] Step S308 can be found in [reference needed]. Figure 2A Step S204 in the embodiment will not be repeated here.

[0100] Next, we will adopt... Figure 2A or Figure 3 This paper introduces some application scenarios of the target similarity recognition model obtained by the text processing method based on advertising review.

[0101] In one embodiment, search keywords provided by a terminal can be obtained; multiple texts from a specified database can be combined with the search keywords to obtain multiple text pairs; the target text similarity recognition model can be used to identify the similarity of the multiple text pairs to obtain the similarity corresponding to each of the multiple text pairs; the multiple texts can be sorted according to the similarity corresponding to each of the multiple texts to obtain a sorting result; and the sorting result can be output through the terminal. Here, the search keyword can be one or multiple. The specified database can be a database storing data related to the search keyword, or it can be a database corresponding to a server. Combining multiple texts in the specified search data with the search keyword can be done by combining all texts in the specified search database with the search keyword in pairs, or by combining some keywords in the specified search database with the search keyword in pairs. The similarity corresponding to each of the multiple text pairs refers to the similarity between the two texts included in the multiple text pairs. The sorting result can be sorting the multiple texts in descending order of similarity. After obtaining the input keywords, the text processing scheme described in this application can be used to achieve the process of matching the input keywords with texts in the database to search for texts similar to the keywords and providing them to the user. For example, if the computer device is a server, a user can enter search keywords on the terminal to search for information related to those keywords. After entering the search keywords, the user can click the search button to send a search command to the server. The server can receive the search command, obtain the search keywords carried in the search command, and can also combine multiple texts from a specified database with the search keywords to obtain the similarity scores of multiple text pairs. The server then sorts the multiple texts according to their respective similarity scores to obtain a ranking result, which is then output through the terminal.

[0102] In one embodiment, the method can also obtain the text to be published provided by the terminal; combine multiple texts from a specified database with the text to be published to obtain multiple text pairs; use the target text similarity recognition model to identify the similarity of the multiple text pairs to obtain the similarity of each text pair; and determine the processing method for the message based on the similarity of each text pair. Alternatively, the specified database can be a sensitive word database. Multiple texts are combined with the text to be published to obtain multiple text pairs; the target text similarity recognition model is used to identify the similarity of the multiple text pairs to obtain the similarity of each text pair; if there is a text among the multiple texts with a similarity greater than or equal to a preset value, the text to be published is rejected. This method can automate the review process for content such as advertisements, preventing the publication of illegal content.

[0103] In one embodiment, messages sent by the terminal, such as instant messaging messages, can also be acquired; multiple texts from a specified database are combined with the messages to obtain multiple text pairs; the target text similarity recognition model is used to identify the similarity of the multiple text pairs to obtain the similarity scores corresponding to each text pair; and the processing method for the messages is determined based on the similarity scores corresponding to the multiple text pairs. For example, the specified database can be a sensitive word database. Multiple texts are combined with the messages to obtain multiple text pairs; the target text similarity recognition model is used to identify the similarity of the multiple text pairs to obtain the similarity scores corresponding to each text pair; when there are texts among the multiple texts with a similarity score greater than or equal to a preset value, a sensitive information prompt is output through the terminal or the message is rejected. This method can automate the review process for content such as advertisements, prevent the sending of illegal messages, and facilitate message management.

[0104] As can be seen, the computer device can acquire M sample text pairs and the corresponding labeled text similarities for each of the M sample text pairs. It then uses an initial text similarity recognition model to identify the similarity of each of the M sample text pairs, outputting M predicted text similarities. The computer device can also acquire the discrimination parameters between the M predicted text similarities. Based on these discrimination parameters, the labeled text similarities for each of the M sample text pairs, and the M predicted text similarities, the total similarity prediction error of the initial text similarity recognition model is determined. Based on this total similarity prediction error, the initial text similarity recognition model is adjusted to obtain a target text similarity recognition model for identifying the target text pairs. This method introduces similarity calculation into the model training process, ensuring consistency between the model's training and prediction methods. This leads to more accurate similarity recognition by the target text similarity recognition model. Furthermore, the introduction of ranking features into the training process allows the similarity generated by the target similarity recognition model to be used for ranking, recall, and other scenarios.

[0105] See Figure 4 This is a schematic diagram of a text processing device based on advertising review, provided in an embodiment of this application. The text processing device can be installed on the aforementioned computer equipment. Specifically, the device may include:

[0106] The acquisition module 401 is used to acquire M sample text pairs and the labeled text similarity corresponding to the M sample text pairs respectively; M is an integer greater than or equal to 2, and a sample text pair includes two sample texts;

[0107] The recognition module 402 is used to input the M sample texts into the initial text similarity recognition model, and to perform similarity recognition on the M sample text pairs through the initial text similarity recognition model, and output M predicted text similarities;

[0108] The determining module 403 is used to obtain the discrimination parameters between the M predicted text similarities through the obtaining module 401, and determine the total similarity prediction error of the initial text similarity recognition model based on the discrimination parameters, the labeled text similarities corresponding to the M sample text pairs, and the M predicted text similarities.

[0109] The adjustment module 404 is used to adjust the initial text similarity recognition model based on the total error of the similarity prediction, so as to obtain a target text similarity recognition model for recognizing the target similarity of target text pairs.

[0110] In one embodiment, the determining module 403 obtains the discrimination parameters between the M predicted text similarities, and determines the total similarity prediction error of the initial text similarity recognition model based on the discrimination parameters, the labeled text similarities corresponding to the M sample text pairs, and the M predicted text similarities, specifically:

[0111] Obtain the similarity prediction order of the M sample text pairs, and the model output order of the similarity of the M predicted texts;

[0112] Based on the model output order, the similarity prediction order, the similarity of the labeled texts corresponding to the M sample text pairs, and the similarity of the M predicted texts, the discrimination parameters among the M predicted text similarities are determined.

[0113] Based on the distinguishing parameters, determine the order prediction error of the initial text similarity recognition model;

[0114] Based on the similarity scores of the labeled texts corresponding to the M sample text pairs and the similarity scores of the M predicted texts, the similarity prediction error of the initial text similarity recognition model is determined.

[0115] The sum of the sequential prediction error of the initial text similarity recognition model and the similarity prediction error of the initial text similarity recognition model is determined as the total similarity prediction error of the initial text similarity recognition model.

[0116] In one embodiment, the determining module 403 obtains the discrimination parameters between the M predicted text similarities, and determines the total similarity prediction error of the initial text similarity recognition model based on the discrimination parameters, the labeled text similarities corresponding to the M sample text pairs, and the M predicted text similarities, specifically:

[0117] Obtain the similarity prediction order of the M sample text pairs, and the model output order of the similarity of the M predicted texts;

[0118] Based on the model output order, the similarity prediction order, the similarity of the labeled texts corresponding to the M sample text pairs, and the similarity of the M predicted texts, the discrimination parameters among the M predicted text similarities are determined.

[0119] Based on the distinguishing parameters, determine the order prediction error of the initial text similarity recognition model;

[0120] The sequential prediction error of the initial text similarity recognition model is determined as the total similarity prediction error of the initial text similarity recognition model.

[0121] In one embodiment, the annotation text similarity corresponding to the M sample text pairs includes the annotation text similarity P. r and the text similarity P of the labeled text r+1 ; r is an integer greater than or equal to 2 and less than or equal to M; the M predicted text similarities include predicted text similarity Q. r And predicting text similarity Q r+1 The text similarity P of the labeled text r The similarity prediction order of the corresponding sample text pairs and the predicted text similarity Q r The corresponding sample text pairs have the same model output order, and the labeled text similarity P r+1 The similarity prediction order of the corresponding sample text pairs and the predicted text similarity Q r+1 The corresponding sample text pairs have the same output order from the model;

[0122] The determining module 403 determines the discrimination parameters among the M predicted text similarities based on the model output order, the similarity prediction order, the similarity of the labeled texts corresponding to the M sample text pairs, and the similarity of the M predicted texts, specifically:

[0123] Obtain the similarity P of the labeled text r Similarity P with the labeled text r+1 The size relationship between them;

[0124] Based on the aforementioned size relationship, the predicted text similarity Q is... r Similarity Q to predicted text r+1 The difference is calculated to obtain the predicted text similarity Q. r Corresponding similarity difference;

[0125] Based on the similarity differences corresponding to the M predicted text similarities, a discrimination parameter is determined among the M predicted text similarities.

[0126] In one embodiment, the determining module 403 determines the predicted text similarity Q based on the size relationship. r Similarity Q to predicted text r+1 The difference is calculated to obtain the predicted text similarity Q. r The corresponding similarity difference is as follows:

[0127] If the size relationship reflects the similarity P of the labeled text r Greater than the labeled text similarity P r+1 Then the predicted text similarity Q will be... r+1 Similarity Q to the predicted text r Subtracting the two values ​​yields the predicted text similarity Q. r The corresponding similarity difference; or,

[0128] If the size relationship reflects the similarity P of the labeled text r Less than or equal to the labeled text similarity P r+1 Then the predicted text similarity Q will be... r Similarity Q to the predicted text r+1 Subtracting the two values ​​yields the predicted text similarity Q. r The corresponding similarity difference.

[0129] In one embodiment, the M sample texts include the M sample text pairs, which include sample text pairs M. t The sample text pairs M t Includes the first sample text and the second sample text, where t is an integer greater than or equal to 2 and less than or equal to M;

[0130] The recognition module 402 performs similarity recognition on the M sample text pairs using the initial text similarity recognition model, and outputs the M predicted text similarities, specifically as follows:

[0131] The encoding layer of the initial text similarity recognition model encodes the first sample text and the second sample text respectively, to obtain the first text edit value corresponding to the first sample text and the second text encoding value corresponding to the second sample text.

[0132] The pooling layer of the initial text similarity recognition model is used to pool the first text edit value and the second text encoding value to obtain the first text vector corresponding to the first sample text and the second text vector corresponding to the second sample text.

[0133] The similarity recognition layer of the initial text similarity recognition model is used to calculate the similarity between the first text vector and the second text vector to obtain the sample text pair M. t The corresponding predicted text similarity.

[0134] In one embodiment, the text processing device further includes a search module 405.

[0135] In one embodiment, the search module 405 is used for:

[0136] Obtain the search keywords provided by the terminal;

[0137] Multiple texts from a specified database are combined with the search keywords to obtain multiple text pairs;

[0138] The target text similarity recognition model is used to identify the similarity of the multiple text pairs, and the similarity of the multiple text pairs is obtained respectively;

[0139] The multiple texts are sorted according to their respective similarity scores to obtain a sorting result;

[0140] The sorting result is output through the terminal.

[0141] As can be seen, the text processing device can acquire M sample text pairs and the labeled text similarities corresponding to each of the M sample text pairs. It then uses an initial text similarity recognition model to perform similarity recognition on each of the M sample text pairs, outputting M predicted text similarities. Furthermore, the text processing device can determine the total similarity prediction error of the initial text similarity recognition model based on the discrimination parameters between the M predicted text similarities, the labeled text similarities corresponding to each of the M sample text pairs, and the M predicted text similarities. Based on this total similarity prediction error, the initial text similarity recognition model is adjusted to obtain a target text similarity recognition model for recognizing the target text pairs. This method introduces similarity calculation into the model training process, ensuring consistency between the model's training and prediction methods. This results in more accurate similarity recognition by the target text similarity recognition model. Moreover, the introduction of ranking features into the training process allows the similarity generated by the target similarity recognition model to be used for ranking, recall, and other scenarios.

[0142] Please see Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 5As shown, the computer device 1000 may include a processor 1001, a network interface 1004, and a memory 1005. Furthermore, the computer device 1000 may also include a user interface 1003 and at least one communication bus 1002. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen and a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as at least one disk storage device. Optionally, the memory 1005 may also be at least one storage device located remotely from the processor 1001. Figure 5 As shown, the memory 1005, which is a computer-readable storage medium, may include an operating system, a network communication module, a user interface module, and a device control application.

[0143] exist Figure 5 In the computer device 1000 shown, the network interface 1004 provides network communication functionality; the user interface 1003 is mainly used to provide an input interface; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:

[0144] Obtain M sample text pairs and the labeled text similarity corresponding to the M sample text pairs respectively; M is an integer greater than or equal to 2, and a sample text pair includes two sample texts;

[0145] The M sample texts are input into the initial text similarity recognition model, and the initial text similarity recognition model is used to perform similarity recognition on the M sample text pairs respectively, and outputs M predicted text similarities;

[0146] Obtain the discrimination parameters among the M predicted text similarities, and determine the total similarity prediction error of the initial text similarity recognition model based on the discrimination parameters, the labeled text similarities corresponding to the M sample text pairs, and the M predicted text similarities.

[0147] Based on the total error of the similarity prediction, the initial text similarity recognition model is adjusted to obtain a target text similarity recognition model for recognizing the target similarity of target text pairs.

[0148] In one embodiment, the processor 1001 can be used to call a device control application stored in the memory 1005 to obtain the discrimination parameters between M predicted text similarities, and determine the total similarity prediction error of the initial text similarity recognition model based on the discrimination parameters, the labeled text similarities corresponding to the M sample text pairs, and the M predicted text similarities, specifically:

[0149] Obtain the similarity prediction order of the M sample text pairs, and the model output order of the similarity of the M predicted texts;

[0150] Based on the model output order, the similarity prediction order, the similarity of the labeled texts corresponding to the M sample text pairs, and the similarity of the M predicted texts, the discrimination parameters among the M predicted text similarities are determined.

[0151] Based on the distinguishing parameters, determine the order prediction error of the initial text similarity recognition model;

[0152] Based on the similarity scores of the labeled texts corresponding to the M sample text pairs and the similarity scores of the M predicted texts, the similarity prediction error of the initial text similarity recognition model is determined.

[0153] The sum of the sequential prediction error of the initial text similarity recognition model and the similarity prediction error of the initial text similarity recognition model is determined as the total similarity prediction error of the initial text similarity recognition model.

[0154] In one embodiment, the processor 1001 can be used to call a device control application stored in the memory 1005 to obtain the discrimination parameters between the M predicted text similarities, and determine the total similarity prediction error of the initial text similarity recognition model based on the discrimination parameters, the labeled text similarities corresponding to the M sample text pairs, and the M predicted text similarities, specifically:

[0155] Obtain the similarity prediction order of the M sample text pairs, and the model output order of the similarity of the M predicted texts;

[0156] Based on the model output order, the similarity prediction order, the similarity of the labeled texts corresponding to the M sample text pairs, and the similarity of the M predicted texts, the discrimination parameters among the M predicted text similarities are determined.

[0157] Based on the distinguishing parameters, determine the order prediction error of the initial text similarity recognition model;

[0158] The sequential prediction error of the initial text similarity recognition model is determined as the total similarity prediction error of the initial text similarity recognition model.

[0159] In one embodiment, the annotation text similarity corresponding to the M sample text pairs includes the annotation text similarity P. r and the text similarity P of the labeled text r+1 ; r is an integer greater than or equal to 2 and less than or equal to M; the M predicted text similarities include predicted text similarity Q. r And predicting text similarity Q r+1 The text similarity P of the labeled text r The similarity prediction order of the corresponding sample text pairs and the predicted text similarity Q r The corresponding sample text pairs have the same model output order, and the labeled text similarity P r+1 The similarity prediction order of the corresponding sample text pairs and the predicted text similarity Q r+1 The corresponding sample text pairs have the same output order from the model;

[0160] Processor 1001 can be used to call the device control application stored in memory 1005 to determine the discrimination parameters among the M predicted text similarities based on the model output order, the similarity prediction order, the labeled text similarities corresponding to the M sample text pairs, and the M predicted text similarities, specifically:

[0161] Obtain the similarity P of the labeled text r Similarity P with the labeled text r+1 The size relationship between them;

[0162] Based on the aforementioned size relationship, the predicted text similarity Q is... r Similarity Q to predicted text r+1 The difference is calculated to obtain the predicted text similarity Q. r Corresponding similarity difference;

[0163] Based on the similarity differences corresponding to the M predicted text similarities, a discrimination parameter is determined among the M predicted text similarities.

[0164] In one embodiment, processor 1001 can be used to invoke a device control application stored in memory 1005 to perform the calculation of the predicted text similarity Q based on the size relationship. r Similarity Q to predicted text r+1 The difference is calculated to obtain the predicted text similarity Q. r The corresponding similarity differences include:

[0165] If the size relationship reflects the similarity P of the labeled text r Greater than the labeled text similarity P r+1 Then the predicted text similarity Q will be... r+1 Similarity Q to the predicted text r Subtracting the two values ​​yields the predicted text similarity Q. r The corresponding similarity difference; or,

[0166] If the size relationship reflects the similarity P of the labeled text r Less than or equal to the labeled text similarity P r+1 Then the predicted text similarity Q will be... r Similarity Q to the predicted text r+1 Subtracting the two values ​​yields the predicted text similarity Q. r The corresponding similarity difference.

[0167] In one embodiment, the M sample texts include the M sample text pairs, which include sample text pairs M. t The sample text pairs M t Includes the first sample text and the second sample text, where t is an integer greater than or equal to 2 and less than or equal to M;

[0168] Processor 1001 can be used to call the device control application stored in memory 1005 to perform similarity recognition on the M sample text pairs respectively through the initial text similarity recognition model, and output the M predicted text similarities, specifically:

[0169] The encoding layer of the initial text similarity recognition model encodes the first sample text and the second sample text respectively, to obtain the first text edit value corresponding to the first sample text and the second text encoding value corresponding to the second sample text.

[0170] The pooling layer of the initial text similarity recognition model is used to pool the first text edit value and the second text encoding value to obtain the first text vector corresponding to the first sample text and the second text vector corresponding to the second sample text.

[0171] The similarity recognition layer of the initial text similarity recognition model is used to calculate the similarity between the first text vector and the second text vector to obtain the sample text pair M. t The corresponding predicted text similarity.

[0172] In one embodiment, the processor 1001 can be used to invoke a device control application stored in the memory 1005 to achieve:

[0173] Obtain the search keywords provided by the terminal;

[0174] Multiple texts from a specified database are combined with the search keywords to obtain multiple text pairs;

[0175] The target text similarity recognition model is used to identify the similarity of the multiple text pairs, and the similarity of the multiple text pairs is obtained respectively;

[0176] The multiple texts are sorted according to their respective similarity scores to obtain a sorting result;

[0177] The sorting result is output through the terminal.

[0178] It should be understood that the computer device 1000 described in the embodiments of this application can perform the foregoing... Figure 2A and Figure 3 The description of the text processing method based on advertisement review in the corresponding embodiments can also be implemented as described above. Figure 4 The description of the text processing device based on advertisement review in the corresponding embodiments will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated.

[0179] Furthermore, it should be noted that this application embodiment also provides a computer-readable storage medium, which stores a computer program executed by the aforementioned text processing device for advertising review. The computer program includes program instructions, and when the processor executes the program instructions, it can execute the aforementioned... Figure 2A as well as Figure 3 The description of the text processing method based on advertising review in the corresponding embodiments is already provided and will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the computer-readable storage medium embodiments related to this application, please refer to the description of the method embodiments of this application.

[0180] As an example, the above program instructions can be deployed and executed on a computer device, or deployed and executed on at least two computer devices in one location, or executed on at least two computer devices distributed in at least two locations and interconnected by a communication network. At least two computer devices distributed in at least two locations and interconnected by a communication network can form a blockchain network.

[0181] The aforementioned computer-readable storage medium can be the text processing device based on advertising review provided in any of the foregoing embodiments, or the central storage unit of the aforementioned computer device, such as the hard disk or central storage of the computer device. The computer-readable storage medium can also be an external storage device of the computer device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., provided on the computer device. Furthermore, the computer-readable storage medium may include both the central storage unit and external storage devices of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.

[0182] The terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish content in different media, rather than to describe a specific order. Furthermore, the term "comprising," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product, or device that includes a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other step units inherent to these processes, methods, apparatuses, products, or devices.

[0183] This application also provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the foregoing description. Figure 2A and Figure 3 The text processing method described in the corresponding embodiments will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the embodiments of the computer program product involved in this application, please refer to the description of the method embodiments of this application.

[0184] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.

[0185] The methods and related apparatus provided in this application are described with reference to the method flowcharts and / or structural diagrams provided in this application. Specifically, each block of the method flowchart and / or structural diagram, as well as combinations of blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable network-connected device to create a machine, such that the instructions, which execute via the processor of the computer or other programmable network-connected device, generate instructions for implementing the process. Figure 1 A schematic diagram of one or more processes and / or structures. Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable network-connected device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 A schematic diagram of one or more processes and / or structures. Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable network-connected device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1 A process or multiple processes and / or structures illustrate the steps of the functions specified in one or more boxes.

[0186] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.

Claims

1. A text processing method based on advertising review, characterized in that, The method includes: Obtain M sample text pairs and the labeled text similarity corresponding to each of the M sample text pairs; M is an integer greater than or equal to 2, and a sample text pair includes two sample texts; the sample texts include advertising texts; The M sample text pairs are input into the initial text similarity recognition model. The initial text similarity recognition model is used to perform similarity recognition on the M sample text pairs respectively, and outputs M predicted text similarities. Obtain the similarity prediction order of the M sample text pairs, and the model output order of the similarity of the M predicted texts; Based on the model output order, the similarity prediction order, the similarity of the labeled texts corresponding to the M sample text pairs, and the similarity of the M predicted texts, the discrimination parameters among the M predicted text similarities are determined. Based on the distinguishing parameters, determine the order prediction error of the initial text similarity recognition model; Based on the similarity scores of the labeled texts corresponding to the M sample text pairs and the similarity scores of the M predicted texts, the similarity prediction error of the initial text similarity recognition model is determined. The sum of the sequential prediction error of the initial text similarity recognition model and the similarity prediction error of the initial text similarity recognition model is determined as the total similarity prediction error of the initial text similarity recognition model. Based on the total similarity prediction error, the initial text similarity recognition model is adjusted to obtain a target text similarity recognition model for recognizing the target similarity of target text pairs. Multiple texts from a specified database are combined with advertising-related texts to obtain multiple text pairs; the target text similarity recognition model is used to identify the similarity of the multiple text pairs to obtain the similarity of each text pair; when there is a text pair with a similarity greater than or equal to a preset value, the text to be published is rejected; the specified database includes texts that are prohibited from being published.

2. The method according to claim 1, characterized in that, The similarity of the labeled texts corresponding to the M sample text pairs includes the labeled text similarity P. r and the text similarity P of the labeled text r+1 ; r is an integer greater than or equal to 2 and less than or equal to M; the M predicted text similarities include predicted text similarity Q. r And predicting text similarity Q r+1 The text similarity P of the labeled text r The similarity prediction order of the corresponding sample text pairs and the predicted text similarity Q r The corresponding sample text pairs have the same model output order, and the labeled text similarity P r+1 The similarity prediction order of the corresponding sample text pairs and the predicted text similarity Q r+1 The corresponding sample text pairs have the same output order from the model; The step of determining the discrimination parameters among the M predicted text similarities based on the model output order, the similarity prediction order, the labeled text similarities corresponding to the M sample text pairs, and the M predicted text similarities includes: Obtain the similarity P of the labeled text r Similarity P with the labeled text r+1 The size relationship between them; Based on the aforementioned size relationship, the predicted text similarity Q is... r Similarity Q to predicted text r+1 The difference is calculated to obtain the predicted text similarity Q. r The corresponding similarity difference; Based on the similarity differences corresponding to the M predicted text similarities, a discrimination parameter is determined among the M predicted text similarities.

3. The method according to claim 2, characterized in that, The predicted text similarity Q is calculated based on the size relationship. r Similarity Q to predicted text r+1 The difference is calculated to obtain the predicted text similarity Q. r The corresponding similarity differences include: If the size relationship reflects the similarity P of the labeled text r Greater than the labeled text similarity P r+1 Then the predicted text similarity Q will be... r+1 Similarity Q to the predicted text r Subtracting the two values ​​yields the predicted text similarity Q. r The corresponding similarity difference; or, If the size relationship reflects the similarity P of the labeled text r Less than or equal to the labeled text similarity P r+1 Then the predicted text similarity Q will be... r Similarity Q to the predicted text r+1 Subtracting the two values ​​yields the predicted text similarity Q. r The corresponding similarity difference.

4. The method according to claim 1, characterized in that, The M sample texts include the M sample text pairs, including sample text pairs M. t The sample text pairs M t Includes the first sample text and the second sample text, where t is an integer greater than or equal to 2 and less than or equal to M; The step of performing similarity recognition on the M sample text pairs using the initial text similarity recognition model and outputting the M predicted text similarities includes: The first sample text and the second sample text are encoded through the encoding layer of the initial text similarity recognition model to obtain the first text encoding value corresponding to the first sample text and the second text encoding value corresponding to the second sample text. The pooling layer of the initial text similarity recognition model is used to pool the first text encoding value and the second text encoding value to obtain the first text vector corresponding to the first sample text and the second text vector corresponding to the second sample text. The similarity recognition layer of the initial text similarity recognition model is used to calculate the similarity between the first text vector and the second text vector to obtain the sample text pair M. t The corresponding predicted text similarity.

5. The method according to claim 1, characterized in that, The method further includes: Obtain the search keywords provided by the terminal; Multiple texts from a specified database are combined with the search keywords to obtain multiple text pairs; The target text similarity recognition model is used to identify the similarity of the multiple text pairs, and the similarity of the multiple text pairs is obtained respectively; The multiple texts are sorted according to their respective similarity scores to obtain a sorting result; The sorting result is output through the terminal.

6. A text processing device based on advertising review, characterized in that, The device includes: The acquisition module is used to acquire M sample text pairs and the labeled text similarity corresponding to the M sample text pairs respectively; M is an integer greater than or equal to 2, and a sample text pair includes two sample texts; the sample texts include advertising texts; The recognition module is used to input the M sample text pairs into the initial text similarity recognition model, and to perform similarity recognition on the M sample text pairs through the initial text similarity recognition model, and output M predicted text similarities; A determining module is used to acquire the similarity prediction order of the M sample text pairs and the model output order of the similarity of the M predicted texts through an acquisition module; determine the discrimination parameters among the M predicted text similarities based on the model output order, the similarity prediction order, the labeled text similarities corresponding to the M sample text pairs, and the similarities of the M predicted texts; determine the order prediction error of the initial text similarity recognition model based on the discrimination parameters; determine the similarity prediction error of the initial text similarity recognition model based on the labeled text similarities corresponding to the M sample text pairs and the similarities of the M predicted texts; and determine the total similarity prediction error of the initial text similarity recognition model by summing the order prediction error and the similarity prediction error of the initial text similarity recognition model. An adjustment module is used to adjust the initial text similarity recognition model based on the total error of the similarity prediction, to obtain a target text similarity recognition model for recognizing the target similarity of target text pairs. Multiple texts from a specified database are combined with advertising-related texts to be published to obtain multiple text pairs. The target text similarity recognition model is used to perform similarity recognition on the multiple text pairs to obtain the similarity corresponding to each text pair. When there is a text pair among the multiple text pairs with a similarity greater than or equal to a preset value, the text to be published is rejected. The specified database includes texts that are prohibited from being published.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.

9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.