Method for determining matching degree prediction model and related apparatus

A hybrid training method for a matching degree prediction model addresses the inefficiencies of multiple models by sharing parameters and adjusting weights, resulting in improved deployment and training efficiency for diverse relevance tasks.

US20260377659A1Pending Publication Date: 2026-11-26TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
US19/743247
Authority / Receiving Office
US · United States
Patent Type
Applications(United States)
Current Assignee / Owner
Priority Date
2024-08-12
Filing Date
2026-07-15
Publication Date
2026-11-26

AI Technical Summary

Technical Problem

Existing search scenarios require multiple matching degree prediction models for different relevance tasks, leading to low deployment efficiency and high resource overhead due to the varying semantic matching requirements of these tasks.

Method used

A hybrid training method is employed to create a single matching degree prediction model that covers two classes of relevance tasks by sharing model parameters and adjusting weights based on specific differences in semantic matching requirements, allowing the model to adapt to both tasks efficiently.

Benefits of technology

This approach improves model deployment efficiency and reduces resource overhead by deploying a single model that can handle multiple relevance tasks, enhancing training efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure US20260377659A1-D00000_ABST
    Figure US20260377659A1-D00000_ABST
Patent Text Reader

Abstract

This application discloses a method for adjusting a matching degree prediction model performed by a computer device. For a target search scenario, hybrid training is performed on an initial model by using training samples from two classes of relevance tasks. During the training, a shared model parameter and its weights are adjusted for different classes of relevance tasks. The initial model can learn that the shared model parameter participates in prediction for a first-class relevance task by using a first weight, and participates in prediction for a second-class relevance task by using a second weight. In a final matching degree prediction model, the shared model parameter has two sets of weights corresponding to the two classes of relevance tasks, to be compatible with a difference between different requirements of different classes of relevance tasks for semantic matching, and to enable a single model covering the two classes of relevance tasks.
Need to check novelty before this filing date? Find Prior Art

Description

CROSS-REFERENCE TO RELATED APPLICATIONS

[0001] This application is a continuation application of PCT Patent Application No. PCT / CN2025 / 107679, entitled “METHOD FOR DETERMINING MATCHING DEGREE PREDICTION MODEL AND RELATED APPARATUS” filed on Jul. 9, 2025, which claims priority to Chinese Patent Application No. 202411105455X, entitled “METHOD FOR DETERMINING MATCHING DEGREE PREDICTION MODEL AND RELATED APPARATUS”, filed with the China National Intellectual Property Administration on Aug. 12, 2024, both of which are incorporated herein by reference in their entirety.FIELD OF THE TECHNOLOGY

[0002] This application relates to the field of data processing technologies, and in particular, to determination of a matching degree prediction model.BACKGROUND OF THE DISCLOSURE

[0003] Based on a search function, a user may acquire required information in a manner of entering a search text to initiate a search. Usually, semantic matching conditions between a text and the search text are evaluated first, to select a more matched text and present the text to the user, and then the user can acquire the required information in this search.

[0004] In practical applications, one search scenario includes a plurality of classes of relevance tasks. Based on the plurality of classes of relevance tasks, a user can acquire different information in one search, and a search experience is better. Usually, each class of relevance task is configured for evaluating semantic matching conditions between two texts. However, the classes of relevance tasks have different requirements for semantic matching. In this way, whether the two texts semantically match show a difference between different classes of relevance tasks. For example, whether a question text semantically matches an answer text further depends on whether the answer text can logically answer the question text, while whether the question text semantically matches the question text focuses more on literal-level overlap degree of the two texts.

[0005] Due to such difference, in the related art, one matching degree prediction model is correspondingly deployed for each class of relevance task, to better adapt to a requirement for semantic matching and improve matching degree prediction accuracy. However, in this manner, a plurality of matching degree prediction models needs to be deployed in one search scenario, which leads to low deployment efficiency, and a need of occupying a large quantity of computing resources.SUMMARY

[0006] To solve the foregoing technical problems, this application provides a method for determining a matching degree prediction model and a related apparatus. One matching degree prediction model is determined to cover two classes of relevance tasks based on hybrid training, to improve model deployment efficiency, and reduce resource overhead caused by deploying a plurality of models.

[0007] Embodiments of this application disclose the following technical solutions:

[0008] According to an aspect, an embodiment of this application provides a method for adjusting a matching degree prediction model performed by a computer device, the method including:

[0009] acquiring a first training sample and a first sample label from a first-class relevance task and a second training sample and a second sample label from a second-class relevance task, both the first-class relevance task and the second-class relevance task belonging to a target search scenario, and the first-class relevance task and the second-class relevance task having different requirements for semantic matching;

[0010] determining a first predicted matching degree of a first text pair in the first training sample and a second predicted matching degree of a second text pair in the second training sample by using an initial model;

[0011] determining a training loss based on a first difference between the first predicted matching degree and the first sample label and a second difference between the second predicted matching degree and the second sample label; and

[0012] adjusting a shared model parameter in the initial model based on the training loss, a first weight of the shared model parameter based on the first difference, and a second weight of the shared model parameter based on the second difference, to obtain a matching degree prediction model configured to determine a matching degree of a target text pair in the target search scenario.

[0013] According to another aspect, an embodiment of this application provides a computer device, the computer device including a processor and a memory:

[0014] the memory being configured to store a computer program and transmit the computer program to the processor; and

[0015] the processor being configured to perform the method according to any one of the foregoing aspects according to instructions in the computer program.

[0016] According to another aspect, an embodiment of this application provides a non-transitory computer-readable storage medium. The computer-readable storage medium is configured to store a computer program, and the computer program, when executed by a processor of a computer device, enables the computer device to perform the method according to any one of the foregoing aspects.

[0017] It can be learned from the foregoing technical solutions that, for a target search scenario including two classes of relevance tasks, because the both classes of relevance tasks focus on semantic matching of a text pair, in view of such commonality, hybrid training is performed on an initial model by using training samples from the two classes of relevance tasks in this application, to cover the two classes of relevance tasks by using a single model. Specifically, a training loss is determined based on a first difference between a first predicted matching degree and a first sample label and a second difference between a second predicted matching degree and a second sample label. Next, the shared model parameter in the initial model is adjusted based on to the training loss, a first weight of the shared model parameter is adjusted based on the first difference, and a second weight of the shared model parameter is adjusted based on the second difference. The first weight is configured for indicating a degree of impact of the shared model parameter on determining the first predicted matching degree, and the second weight is configured for indicating a degree of impact of the shared model parameter on determining the second predicted matching degree. During the hybrid training, a model parameter is shared, and for the shared model parameter, weights are adjusted for different classes of relevance tasks. Therefore, during the hybrid training, the initial model can learn that the shared model parameter participates in prediction for a first-class relevance task by using the first weight, and participates in prediction for a second-class relevance task by using the second weight. Based on this, in a finally obtained matching degree prediction model, the shared model parameter has two sets of weights corresponding to the two classes of relevance tasks, to be compatible with such difference between different requirements of different classes of relevance tasks for semantic matching, and to enable this model to have a capability of covering two classes of relevance tasks. Correspondingly, in the target search scenario, only the matching degree prediction model needs to be deployed, which is beneficial to improving model deployment efficiency and reducing resource overhead caused by deploying a plurality of models. In addition, only one model needs to be trained. Compared with a manner of training one model for one task, this is beneficial to improving model training efficiency.BRIEF DESCRIPTION OF THE DRAWINGS

[0018] FIG. 1 is a schematic diagram of an application scenario in a method for determining a matching degree prediction model according to an embodiment of this application.

[0019] FIG. 2 is a flowchart of a method for determining a matching degree prediction model according to an embodiment of this application.

[0020] FIG. 3 is a schematic diagram of a target search scenario according to an embodiment of this application.

[0021] FIG. 4 is a schematic structural diagram of an initial model according to an embodiment of this application.

[0022] FIG. 5 is a schematic diagram of another target search scenario according to an embodiment of this application.

[0023] FIG. 6 is a structural diagram of an apparatus for determining a matching degree prediction model according to an embodiment of this application.

[0024] FIG. 7 is a structural diagram of a terminal according to an embodiment of this application.

[0025] FIG. 8 is a structural diagram of a server according to an embodiment of this application.DESCRIPTION OF EMBODIMENTS

[0026] The following describes embodiments of this application with reference to accompanying drawings.

[0027] For a plurality of classes of relevance tasks included in a search scenario because the classes of relevance tasks have different requirements for semantic matching, whether two texts in different classes of relevance tasks semantically match shows a difference.

[0028] Due to such difference, in the related art, for each class of relevance task, a matching degree prediction model adapted to the class of relevance task is determined based on model training, to better adapt to a requirement for semantic matching in this class of relevance task and improve matching degree prediction accuracy. However, in this way, a plurality of matching degree prediction models need to be deployed in one search scenario, model deployment efficiency is low, and a large amount of computing resources need to be occupied for online inference of the models. Correspondingly, a plurality of matching degree prediction models further need to be separately trained, which leads to low model training efficiency, high model training costs, and the like.

[0029] Therefore, embodiments of this application provide a method for determining a matching degree prediction model and a related apparatus. For a target search scenario including two classes of relevance tasks, because the both classes of relevance tasks focus on semantic matching of a text pair, in view of such commonality, hybrid training is performed on an initial model by using training samples from the two classes of relevance tasks in this application, to cover the two classes of relevance tasks by using a single model. Specifically, during the hybrid training, a model parameter of the initial model is shared, and for the shared model parameter, weights are adjusted for different classes of relevance tasks. Therefore, during the hybrid training, the initial model can learn that the shared model parameter participates in prediction for a first-class relevance task by using a first weight, and participates in prediction for a second-class relevance task by using a second weight.

[0030] Based on this, in a finally obtained matching degree prediction model, the shared model parameter has two sets of weights corresponding to the two classes of relevance tasks, to be compatible with such difference between different requirements of different classes of relevance tasks for semantic matching, and to enable this model to have a capability of covering two classes of relevance tasks. Correspondingly, in the target search scenario, only the matching degree prediction model needs to be deployed, which improves model deployment efficiency and reduces resource overhead. In addition, only one model needs to be trained. Compared with a manner of training one model for one task, this is beneficial to improving model training efficiency, reducing training costs, and the like.

[0031] The method for determining a matching degree prediction model according to the embodiments of this application may be implemented by using a computer device. The computer device may be a terminal or a server. The server may be an independent physical server, may be a server cluster or a distributed system including a plurality of physical servers, or may be a cloud server providing a cloud computing service. The terminal includes, but is not limited to, a smartphone, a computer, an intelligent voice interaction device, an intelligent household appliance, an in-vehicle terminal, and the like. The terminal and the server may be directly or indirectly connected in a wired or wireless communication mode. This is not limited in this application.

[0032] Specifically, the embodiments of this application may be applied to various scenarios in which a matching degree needs to be predicted. For example, in a target search scenario, a matching degree between two texts needs to be predicted. For example, a search box is provided in the target search scenario, and a user may enter a search text in the search box. In this case, a matching degree needs to be predicted to select a text that needs to be fed back to the user. For another example, in a target search scenario, a user may read an e-book. In a reading process, the user may trigger a search by selecting (for example, long-pressing to select) a segment of text in the e-book. In this case, a matching degree needs to be predicted to select a text that needs to be fed back to the user.

[0033] In a specific implementation of this application, related data such as user information may be involved in a matching degree prediction model determining process. When the above embodiments of this application are applied to specific products or technologies, separate consent or separate permission of a user needs to be obtained, and collection, use, and processing of relevant data need to comply with relevant laws, regulations, and standards of relevant countries and regions.

[0034] FIG. 1 is a schematic diagram of an application scenario of a method for determining a matching degree prediction model according to an embodiment of this application. In the scenario shown in FIG. 1, an example in which a server 100 is used as the foregoing computer device is used for description.

[0035] For a target search scenario including two classes of relevance tasks, because the both classes of relevance tasks focus on semantic matching of a text pair, in view of such commonality, hybrid training is performed on an initial model by using training samples from the two classes of relevance tasks in this application, to cover the two classes of relevance tasks by using a single model. Specifically:

[0036] First, the server 100 may acquire a first training sample from a first-class relevance task and a second training sample from a second-class relevance task. Next, the server 100 may input the first training sample to the initial model, and output a first predicted matching degree by using the initial model; and the server may input the second training sample to the initial model, and output a second predicted matching degree by using the initial model. The first predicted matching degree is configured for indicating a matching degree between texts in a first text pair included in the first training sample, and the second predicted matching degree is configured for indicating a matching degree between texts in a second text pair included in the second training sample.

[0037] Next, the server 100 may determine a first difference between the first predicted matching degree and a first sample label, determine a second difference between the second predicted matching degree and a second sample label, and determine a training loss based on the first difference and the second difference.

[0038] Finally, the server 100 may adjust a shared model parameter in the initial model based on the training loss, adjust a first weight of the shared model parameter based on the first difference, and adjust a second weight of the shared model parameter based on the second difference. The first weight is configured for indicating a degree of impact of the shared model parameter on determining the first predicted matching degree, and the second weight is configured for indicating a degree of impact of the shared model parameter on determining the second predicted matching degree. During the hybrid training, a model parameter is shared, and for the shared model parameter, weights are adjusted for different classes of relevance tasks. Therefore, during the hybrid training, the initial model can learn that the shared model parameter participates in prediction for a first-class relevance task by using the first weight, and participates in prediction for a second-class relevance task by using the second weight.

[0039] Based on this, in a finally obtained matching degree prediction model, the shared model parameter has two sets of weights corresponding to the two classes of relevance tasks, to be compatible with such difference between different requirements of different classes of relevance tasks for semantic matching, and to enable this model to have a capability of covering two classes of relevance tasks.

[0040] Correspondingly, in the target search scenario, only the matching degree prediction model needs to be deployed, to perform matching degree prediction on a target text pair from the target search scenario. For example, in an example in FIG. 1, a schematic diagram of a model application is marked by using a dashed box. A target text pair from a target search scenario may be input into a matching degree prediction model, and a matching degree of the target text pair may be output by using the matching degree prediction model, to quickly determine a matching degree between two texts in the target text pair.

[0041] Compared with a manner of training one model for one task, this application is beneficial to improving model deployment efficiency, and reducing resource overhead caused by deploying a plurality of models. In addition, only one model needs to be trained, which is beneficial to improving model training efficiency.

[0042] FIG. 2 is a flowchart of a method for determining a matching degree prediction model according to an embodiment of this application. An example in which a server is used as the foregoing computer device is used for description. The method includes S201 to S204.

[0043] S201: Acquire a first training sample and a first sample label from a first-class relevance task and a second training sample and a second sample label from a second-class relevance task.

[0044] The first sample label may be configured for indicating whether a first text pair included in the first training sample semantically matches. The first text pair may include two texts. The first sample label is configured for indicating whether the two texts semantically match. Similarly, the second sample label may be configured for indicating whether a second text pair included in the second training sample semantically matches. The second text pair may include two texts. The second sample label is configured for indicating whether the two texts semantically match.

[0045] In addition, both the first-class relevance task and the second-class relevance task belong to a target search scenario, and the first-class relevance task and the second-class relevance task have different requirements for semantic matching. That is, for a search scenario including two classes of relevance tasks, although the two classes of relevance tasks have different requirements for semantic matching, both classes of relevance tasks focus on semantic matching between two texts. In view of this commonality, hybrid training is performed on an initial model by using training samples from the two classes of relevance tasks in this application, to cover the two classes of relevance tasks by using a single model, and to solve a related problem that one class of relevance task needs one model.

[0046] This application does not have any limitation on specific cases of the two classes of relevance tasks. In different search scenarios, search functions that can be provided for a user may be different. This may lead to different relevance tasks included in the search scenarios. For ease of understanding, this embodiment of this application provides the following examples for description.

[0047] In various search scenarios, a common search function may support a user to enter a search text and then feed a corresponding answer text back to the user. The search text entered by the user is usually configured for reflecting a question of the user, and the answer text fed back to the user is expected to solve the question of the user. In addition, it may alternatively support feeding a similar query method back to the user, and then the user can change another query method to continue searching, and the like. Therefore, in an implementation, the foregoing first-class relevance task may be configured for indicating that one text in the first text pair belongs to a question type, and the other text in the first text pair belongs to an answer type; and the second-class relevance task is configured for indicating that both texts in the second text pair belong to the question type.

[0048] That is, the first-class relevance task focuses on providing a corresponding answer for the search text entered by the user, and the second-class relevance task focuses on providing a similar query method for the search text entered by the user. Based on this, hybrid modeling is performed on two common classes of relevance tasks in various search scenarios, which is beneficial to obtaining a matching degree prediction model that can cover a plurality of search scenarios, and has a wider application range.

[0049] In addition to the two classes of relevance tasks in the foregoing example, hybrid modeling may further be performed with reference to other classes of relevance tasks based on an actual condition in a search scenario, to implement that a single model covers a plurality of classes of relevance tasks, improve model deployment efficiency, improve model training efficiency, reduce model training costs, and the like. For example, in some search scenarios, in addition to feeding back a text of an answer type to the user, a citation source of the answer is further provided. The citation source may indicate references and the like for generating the answer, and then the user can learn why there is the answer is provided while acquiring the answer.

[0050] Specifically, a third-class relevance task may further be included, and a third training sample from the third-class relevance task may alternatively be mixed with the foregoing first training sample and second training sample, to implement a single model that can cover the three classes of relevance tasks. The third-class relevance task may be configured for indicating that one of the third texts included in the third training sample belongs to the answer type, and the other text belongs to a citation source type.

[0051] S202: Determine a first predicted matching degree of a first text pair in the first training sample by using an initial model, and determine a second predicted matching degree of a second text pair in the second training sample by using the initial model.

[0052] S203: Determine a training loss based on a first difference between the first predicted matching degree and a first sample label and a second difference between the second predicted matching degree and a second sample label.

[0053] After determining a training sample, the server may determine the first predicted matching degree by using the initial model based on the first training sample, and determine the second predicted matching degree by using the initial model based on the second training sample. The first predicted matching degree may be configured for indicating a semantic matching degree between two texts in the first text pair, and the second predicted matching degree may be configured for indicating a semantic matching degree between two texts in the second text pair.

[0054] Next, the server may determine the training loss based on the first difference between the first predicted matching degree and the first sample label and the second difference between the second predicted matching degree and the second sample label. The first difference may reflect a deviation when the initial model performs prediction on the first text pair. The second difference may reflect a deviation when the initial model performs prediction on the second text pair. The training loss determined based on the two parts can reflect an overall deviation when the initial model performs prediction on the two classes of relevance tasks. Subsequently, the initial model may be trained based on these deviations, and then the initial model can complete prediction more accurately.

[0055] This application does not have any limitation on a manner of determining the first difference, the second difference, and the training loss. For example, the first difference and the second difference may be separately determined by using a cross-entropy loss function, and then the first difference and the second difference are summed to determine the overall training loss.

[0056] S204: Adjust a shared model parameter in the initial model based on the training loss, adjust a first weight of the shared model parameter based on the first difference, and adjust a second weight of the shared model parameter based on the second difference, to obtain a matching degree prediction model.

[0057] The shared model parameter may refer to a model parameter that is in the initial model and that participates in prediction for the first text pair and participates in prediction for the second text pair. Because the training loss is jointly determined based on the two differences, and can reflect an overall deviation when prediction is performed on the two classes of relevance tasks, the server may adjust the shared model parameter based on the training loss. Meanwhile, the server may adjust the first weight of the shared model parameter based on the first difference, and adjust the second weight of the shared model parameter based on the second difference. The first weight is configured for indicating a degree of impact of the shared model parameter on determining the first predicted matching degree, and the second weight is configured for indicating a degree of impact of the shared model parameter on determining the second predicted matching degree.

[0058] This application does not have any limitation on determining of the shared model parameter. In an actual model training process, a model internally learns knowledge carried in a training sample, and continuously adjusts a model parameter inside the model and the foregoing first weight and second weight by using minimizing an overall training loss as a training target. Usually, when overall training is minimum, it may be considered that model training reaches convergence, and the model training may be ended. In this case, the matching degree prediction model is obtained.

[0059] In addition to the shared model parameter, there may be a model parameter that is not shared. The model parameter that is not shared only participates in processing of a class of relevance task and does not participate in processing of another class of relevance task. Specifically, it may alternatively be considered that a non-zero weight participates in processing of a class of relevance task, and a weight with respect to another class of relevance task is zero.

[0060] During hybrid training, a model parameter is shared. Because there is commonality between two classes of relevance tasks, in a manner of deploying one model for one task, the same model parameter appears in different models, or the same part exists between structures of different models. Therefore, compared with the manner of deploying one model for one task, a manner of sharing the model parameter is used in this application, which is beneficial to reducing resource overhead and the like caused by deploying a plurality of models. In addition, for the shared model parameter, weights are not only adjusted based on an overall training loss, but also adjusted for different classes of relevance tasks. Therefore, during the hybrid training, the initial model can learn that the shared model parameter participates in prediction for a first-class relevance task by using a first weight, and participates in prediction for a second-class relevance task by using a second weight. Based on this, in a finally obtained matching degree prediction model, the shared model parameter has two sets of weights corresponding to the two classes of relevance tasks, to be compatible with such difference between different requirements of different classes of relevance tasks for semantic matching, and to enable this model to have a capability of covering two classes of relevance tasks.

[0061] In view of the above, a hybrid training manner is set in consideration of commonality between two classes of relevance tasks. During the hybrid training, the model parameter is shared, which is beneficial to reducing resource overhead. In addition, weights are adjusted for different classes of tasks, to be compatible with a difference between the two classes of relevance tasks. Therefore, the matching degree prediction model obtained under the hybrid training can have high prediction accuracy for both classes of relevance tasks, and an objective that a single model covers a plurality of tasks is achieved.

[0062] Correspondingly, the matching degree prediction model may be deployed in a target search scenario, and the matching degree prediction model may be configured to determine a matching degree of a target text pair in the target search scenario. The target text pair may include two texts from a first-class relevance task, or may include two texts from a second-class relevance task. That is, after the matching degree prediction model is deployed in the target search scenario, both the first-class relevance task and the second-class relevance task in the target search scenario are completed by using the model.

[0063] Based on this, only one model needs to be deployed in one search scenario, which improves model deployment efficiency, and reduces resource overhead caused by deploying a plurality of models. In addition, after this application is used, only one model needs to be trained. Compared with a manner of training one model for one task, this is beneficial to improving model training efficiency, reducing model training costs, and the like.

[0064] This application does not have any limitation on a manner of determining the first predicted matching degree and the second predicted matching degree by using the initial model. Different specific content is included in the training sample, which affects a manner of predicting the training sample and outputting a predicted matching degree by using the model. For ease of understanding, this embodiment of this application provides the following manners as examples for description.

[0065] (1) Because there is a difference between different classes of relevance tasks, this difference affects a model training effect. To improve the model training effect, in an implementation, in a manner of adding a task identifier to a training sample, the initial model may be explicitly informed of a class of relevance task from which a current training sample originates. This enables the initial model to better distinguish between the two classes of relevance tasks, to be better compatible with a difference between the two classes of relevance tasks, and ensure the model training effect.

[0066] Correspondingly, if the first training sample further includes a first task identifier corresponding to the first-class relevance task, and the second training sample further includes a second task identifier corresponding to the second-class relevance task, during a specific implementation of the foregoing S202, it may be determined, by using the initial model based on the first task identifier, that a shared model parameter participates in processing of a first text pair by using a first weight after a first training sample is input into the initial model, to obtain a first predicted matching degree, and it may be determined, by using the initial model based on the second task identifier, that the shared model parameter participates in processing of the second text pair by using a second weight after a second training sample is input into the initial model, to obtain a second predicted matching degree. Based on this, by adding the task identifier to the training sample, in a model training phase, the initial model is explicitly informed of a class of relevance task from which the current training sample originates, and a weight for activating the shared model parameter to participate in processing the text pair.

[0067] With the assistance of the task identifier, for each training sample, the initial model can accurately distinguish a class of relevance task, and more accurately learn related knowledge about whether two texts in the training sample semantically match. Via model training, the initial model can learn a feature of two texts with a high matching degree and a feature of two texts with a low matching degree in the first-class relevance task, and learn a feature of two texts with a high matching degree and a feature of two texts with a low matching degree in the second-class relevance task. Certainly, this learning result is embodied by using the model parameter and the weight of the shared model parameter.

[0068] Based on this, the initial model can better distinguish between the two classes of relevance tasks, to be better compatible with a difference between the two classes of relevance tasks, and ensure the model training effect. This enables the matching degree prediction model to have a more accurate prediction capability.

[0069] The essence of a model training process is a process of backpropagating a training loss to adjust a model parameter based on the training loss. The training loss is an overall deviation obtained by performing hybrid training based on training samples from the two classes of relevance tasks. Therefore, to better guide model training, to enable the model to learn two sets of weights corresponding to two classes of relevance tasks, in an implementation, corresponding to the foregoing manner in which the training sample carries a task identifier, the training loss may alternatively carry a task identifier. The model can be explicitly informed of difference between contributions of classes of relevance tasks in the overall training loss by using the task identifier, to correspondingly adjust the weights.

[0070] Correspondingly, if the training loss carries the first task identifier and the second task identifier, the server may determine, based on the first task identifier carried in the training loss, the first difference included in the training loss, and determine, based on the second task identifier carried in the training loss, the second difference included in the training loss in a process of backpropagating the training loss in the initial model. Next, the server may adjust the first weight based on the first difference, and adjust the second weight based on the second difference.

[0071] Based on this, in a manner in which the training loss carries a task identifier, various differences in the training loss may be distinguished based on the task identifier, to correspondingly adjust the weight, and better guide model training. Based on such an explicit distinguishing manner, the model can more quickly learn a weight for performing prediction on the first-class relevance task, and a weight for performing prediction on the second-class relevance task. This is beneficial to improving model training efficiency.

[0072] After the model training is completed, the matching degree prediction model obtained through training may be deployed in a target search scenario, and subsequently, a matching degree of a target text pair in the target search scenario may be determined by using the matching degree prediction model. This application does not have any limitation on a manner of determining the matching degree of the target text pair by using the matching degree prediction model. For better understanding, corresponding to the foregoing training manner in which the training sample carries a task identifier, this embodiment of this application provides an example description of determining a matching degree of a target text pair by using a matching degree prediction model:

[0073] For the target text pair in the target search scenario, if it is determined that the target text pair is from a target-class relevance task, and the target-class relevance task is the foregoing first-class relevance task or second-class relevance task, the server may first construct a target sample based on the target text pair and a target task identifier corresponding to the target-class relevance task, that is, the target sample carries a task identifier, to explicitly inform the matching degree prediction model that a relevance task from which the target text pair originates needs to be predicted currently, and determine, based on this, a weight for activating the shared model parameter for processing. Specifically, the server may determine, by using the matching degree prediction model based on the target task identifier, that the shared model parameter participates in processing of the target text pair by using the target weight after the target sample is input into the matching degree prediction model, to obtain a target matching degree. When the target-class relevance task is the first-class relevance task, the target task identifier is the first task identifier, and the target weight is the first weight, or when the target-class relevance task is the second-class relevance task, the target task identifier is the second task identifier, and the target weight is the second weight.

[0074] In a model application phase, an input of a model carries a task identifier, to determine a class of relevance task from which the target text pair originates, and then to activate the shared model parameter by using a weight adapted to the class of relevance task to participate in processing the target text pair, to obtain a more accurate target matching degree and improve prediction accuracy.

[0075] This application does not have any limitation on a manner of determining the target-class relevance task as the first-class relevance task or the second-class relevance task. For ease of understanding, this embodiment of this application provides the following manner as example for description by using an example in which the target text pair includes a first to-be-predicted text and a second to-be-predicted text:

[0076] Usually, the target search scenario may include a plurality of services. In practical applications, the to-be-predicted text may be generated in a service operation process. The to-be-predicted texts generated by different services may be different, which may lead to a difference between relevance tasks that the formed target text pair belongs. Therefore, in an implementation, a specific class of relevance task of the target-class relevance task may be determined based on a service that generates two to-be-predicted texts.

[0077] During a specific implementation, the server may first determine a first service that generates the first to-be-predicted text, and determine a second service that generates the second to-be-predicted text. Both the first service and the second service are services in the target search scenario. Next, the server may determine the target-class relevance task as the first-class relevance task or the second-class relevance task based on the first service and the second service.

[0078] Based on this, in an actual application phase, a corresponding relevance task class may be determined based on the service that generates the to-be-predicted text, which is beneficial to determining a target matching degree that better satisfies a service condition, and improving prediction accuracy.

[0079] This application does not have any limitation on a manner of determining the target-class relevance task based on the service. For ease of understanding, the foregoing first-class relevance task may be configured for indicating that one text in a first text pair belongs to a question type, and the other text in the first text pair belongs to an answer type, where the first-class relevance task is configured for determining a relevance between the text belonging to the question type and the text belonging to the answer type in the first text pair. The second-class relevance task is configured for indicating that both texts in a second text pair belong to the question type, where the second-class relevance task is configured for determining a relevance between the two texts belonging to the question type in the second text pair.

[0080] Using the foregoing condition as an example, the following examples are provided to describe a manner of determining a target-class relevance task based on a service in an application phase:

[0081] For example, if the first service is a search box service, the first to-be-predicted text may be a text entered by a user via a search box based on the search box service, and therefore, it is determined that the first to-be-predicted text belongs to a question type; and if the second service is an answer generation service, the second to-be-predicted text may be a text generated from the answer generation service, and therefore, it is determined that the second to-be-predicted text belongs to an answer type. Correspondingly, the target-class relevance task may be determined as a first-class relevance task.

[0082] For example, if the first service is still the foregoing search box service, and the second service is the question generation service, the second to-be-predicted text may be a text generated from the question generation service, and therefore, it is determined that the second to-be-predicted text belongs to the question type. Correspondingly, the target-class relevance task may be determined as a second-class relevance task.

[0083] The target search scenario may further include another service, or may further include another class of relevance task. Specifically, in actual application, this may be flexibly set according to an actual condition.

[0084] (2) From a perspective of an actual search service requirement in a search scenario, after a user initiates a search, it is expected that reliable content can be found. On a user side, a text with high confidence is usually considered to be more reliable. Because a background evaluates, based on a predicted matching degree determined by a model, whether the content is reliable and whether the content needs to be fed back to the user, in still another implementation, in addition to a text pair in a training sample, an auxiliary text may further be added to the training sample, and the confidence of the text is indicated based on the auxiliary text. Based on this, a matching degree prediction model that better meets an actual search service requirement can be trained.

[0085] In an implementation, if the first text pair includes a first search text and a historical answer text, the first training sample further includes a first auxiliary text, and the first auxiliary text is configured for indicating confidence of the historical answer text; the second text pair includes a second search text and a third search text, the second training sample further includes a second auxiliary text, and the second auxiliary text is configured for indicating confidence of the third search text. During a specific implementation of the foregoing S202, a server may perform semantic relevance analysis on the first search text and the historical answer text by using an initial model based on the first training sample, and perform confidence analysis on the historical answer text, to obtain a first predicted matching degree; and the server may perform semantic relevance analysis on the second search text and the third search text by using the initial model based on the second training sample, and perform confidence analysis on the third search text, to obtain a second predicted matching degree.

[0086] A matching degree between two texts can be predicted by combining semantics and confidence. In this way, in a model training process, the initial model can learn an association relationship between confidence and a matching degree. Usually, a text with higher confidence is more likely to be adopted by the user. Therefore, high confidence corresponds to a higher matching degree, and low confidence corresponds to a lower matching degree. Based on this, the obtained matching degree prediction model is more beneficial to determining a matching degree that better meets an actual search service requirement.

[0087] This application does not have any limitation on the first auxiliary text and the second auxiliary text. For ease of understanding, this embodiment of this application provides the following manner as an example:

[0088] In an actual search service, a search text entered by a user is configured for reflecting a question of the user, and a returned answer text is configured for answering the question of the user. A more reliable text source of the answer text (for example, from an authoritative book) indicates that the user is more likely to consider that the answer text is accurate and can answer the question. Otherwise, a less reliable text source indicates that it is more difficult for the user to believe the answer text. Therefore, to enable a matching degree to better meet an actual search service requirement, in an implementation, the foregoing first auxiliary text may be configured for indicating a text source of a historical answer text, that is, confidence of the answer text is reflected by using the text source.

[0089] Correspondingly, in a model application phase, for a target text pair including a first to-be-predicted text (for example, a search text entered by a user) and a second to-be-predicted text (for example, a candidate answer text), a text source of the second to-be-predicted text may alternatively be used as an auxiliary text and input into the matching degree prediction model, to determine a matching degree between the first to-be-predicted text and the second to-be-predicted text with reference to the confidence. Therefore, a target answer text that better meets a service requirement can be determined based on the matching degree.

[0090] In addition, in the actual search service, the search text entered by the user is configured for reflecting the question of the user, and a similar query method is returned to facilitate a continued search of the user, change a query method to re-search for the question of the user, or the like. If a search text is searched at high frequency in a search scenario, after the search text is returned to the user, there is a higher possibility that the user continues to search based on the search text. Therefore, in an implementation, the confidence of the text may be indicated based on a historical search count of the search text. Specifically, the foregoing second auxiliary text may be configured for indicating a historical search count of the third search text in a target search scenario.

[0091] Correspondingly, in a model application phase, for a target text pair including a first to-be-predicted text (for example, a search text entered by a user) and a second to-be-predicted text (for example, a candidate question text), a historical search count of the second to-be-predicted text in a target search scenario may further be used as an auxiliary text and input into the matching degree prediction model together, to determine a matching degree between the first to-be-predicted text and the second to-be-predicted text with reference to the confidence. Therefore, a target question text that better meets a service requirement can be determined based on the matching degree.

[0092] In an embodiment in which the training sample further includes an auxiliary text, this application does not have any limitation on a manner of constructing the training sample. For ease of understanding, this embodiment of this application provides the following manner as an example:

[0093] To improve model training efficiency, in an implementation, an identifier may further be added to the training sample to distinguish among an answer text, a search text, and an auxiliary text, to explicitly inform the model of functions of various parts of texts included in the training sample. This is beneficial for the model to understand various parts of texts more quickly, and is beneficial to improving the model training efficiency.

[0094] During a specific implementation, for construction of the first training sample, the server may sequentially concatenate an answer identifier, a historical answer text, a first auxiliary identifier, and a first auxiliary text, to obtain a first concatenated text, and determine the first training sample based on the first search text and the first concatenated text. The answer identifier is configured for indicating that the historical answer text following the answer identifier is configured for explaining the first search text, and the first auxiliary identifier is configured for indicating that the first auxiliary text following the first auxiliary identifier is configured for indicating confidence of the historical answer text preceding the first auxiliary identifier.

[0095] In addition, for construction of the second training sample, the server may sequentially concatenate a question identifier, a third search text, a second auxiliary identifier, and a second auxiliary text, to obtain a second concatenated text, and determine the second training sample based on the second search text and the second concatenated text. The question identifier is configured for indicating that the third search text following the question identifier is used as an extended search text of the second search text, and the second auxiliary identifier is configured for indicating that the second auxiliary text following the second auxiliary identifier is configured for indicating confidence of the third search text preceding the second auxiliary identifier.

[0096] By adding an identifier (such as an answer identifier, a question identifier, or an auxiliary identifier) to a training sample, a model can be explicitly informed of functions of various parts of texts in the training sample. In this way, the model can process various parts of texts more quickly and more accurately. Based on this, it is beneficial to accelerating model training, and improving model training efficiency.

[0097] Correspondingly, in a model application phase, for construction of the target sample, the server may sequentially concatenate a text identifier of a second to-be-predicted text, the second to-be-predicted text, the auxiliary identifier, and the auxiliary text, to obtain a concatenated text, and determine a target sample based on the first to-be-predicted text and the concatenated text. Then, the target sample is input into the matching degree prediction model, to determine a matching degree between the first to-be-predicted text and the second to-be-predicted text. If the second to-be-predicted text belongs to an answer type, the text identifier of the second to-be-predicted text is an answer identifier, or if the second to-be-predicted text belongs to a question type, the text identifier of the second to-be-predicted text may be a question identifier.

[0098] In practical applications, the training sample may include both the task identifier of the relevance task and the identifiers of various texts, to improve model training efficiency and the like. For example, the first training sample may be denoted as [first task identifier, first search text, [answer identifier-historical answer text-first auxiliary identifier-first auxiliary text]], and the second training sample may be denoted as [second task identifier, second search text, [question identifier-third search text-second auxiliary identifier-second auxiliary text]].

[0099] It can be learned from the foregoing technical solutions that, for a target search scenario including two classes of relevance tasks, because the both classes of relevance tasks focus on semantic matching of a text pair, in view of such commonality, hybrid training is performed on an initial model by using training samples from the two classes of relevance tasks in this application, to cover the two classes of relevance tasks by using a single model. Specifically, a training loss is determined based on a first difference between a first predicted matching degree and a first sample label and a second difference between a second predicted matching degree and a second sample label. Next, the shared model parameter in the initial model is adjusted based on the training loss, a first weight of the shared model parameter is adjusted based on the first difference, and a second weight of the shared model parameter is adjusted based on the second difference. The first weight is configured for indicating a degree of impact of the shared model parameter on determining the first predicted matching degree, and the second weight is configured for indicating a degree of impact of the shared model parameter on determining the second predicted matching degree. During the hybrid training, a model parameter is shared, and for the shared model parameter, weights are adjusted for different classes of relevance tasks. Therefore, during the hybrid training, the initial model can learn that the shared model parameter participates in prediction for a first-class relevance task by using the first weight, and participates in prediction for a second-class relevance task by using the second weight. Based on this, in a finally obtained matching degree prediction model, the shared model parameter has two sets of weights corresponding to the two classes of relevance tasks, to be compatible with such difference between different requirements of different classes of relevance tasks for semantic matching, and to enable this model to have a capability of covering two classes of relevance tasks. Correspondingly, in the target search scenario, only the matching degree prediction model needs to be deployed, which is beneficial to improving model deployment efficiency and reducing resource overhead caused by deploying a plurality of models. In addition, only one model needs to be trained. Compared with a manner of training one model for one task, this is beneficial to improving model training efficiency.

[0100] Based on the foregoing embodiment, the method for determining a matching degree prediction model provided in this application is described in detail. After the matching degree prediction model is obtained, the matching degree prediction model may be deployed in a target search scenario, to determine a matching degree of a target text pair in the target search scenario. For better understanding, in this embodiment of this application, application of the matching degree prediction model is further described by using an example in which the first-class relevance task is configured for indicating that one text in the first text pair belongs to the question type and the other text in the first text pair belongs to the answer type, and the second-class relevance task is configured for indicating that both texts in the second text pair belong to the question type.

[0101] In an implementation, when needing to use a search function, a user may enter a search text in a target search scenario. Correspondingly, the server may first acquire, in response to receiving the search text input in the target search scenario, a plurality of candidate answer texts generated for the search text, and acquire a plurality of candidate question texts generated for the search text. The search text belongs to a question type, the candidate answer text belongs to an answer type, and the candidate question text belongs to the question type.

[0102] Next, the server may determine a first target text pair from the first-class relevance task based on the search text and the candidate answer text, and determine a second target text pair from the second-class relevance task based on the search text and the candidate question text.

[0103] Then, the server may determine, by using the matching degree prediction model, that a shared model parameter participates in determining of a first matching degree of the first target text pair based on a first weight, and determine, by using the matching degree prediction model, that the shared model parameter participates in determining of a second matching degree of the second target text pair based on a second weight. The first matching degree refers to a matching degree between the search text and the candidate answer text, which may reflect a degree that the candidate answer text can answer the question indicated by the search text. In addition, the second matching degree refers to a matching degree between the search text and the candidate question text, which may reflect a similarity or a relevance between the candidate question text and the search text.

[0104] Finally, the server may determine, based on the first matching degrees respectively corresponding to the plurality of candidate answer texts, a target answer text corresponding to the search text, and determine, based on the second matching degrees respectively corresponding to the plurality of candidate question texts, a target question text corresponding to the search text. In addition, the server may present the target answer text and the target question text in the target search scenario.

[0105] Based on this, in a model application phase, for a target text pair from each class of relevance task, a shared model parameter is activated by using a weight corresponding to this class of relevance task for prediction, which ensures prediction accuracy when a single model processes two classes of relevance tasks. In addition, after the matching degree is determined, the target answer text and the target question text that need to be fed back to the user may be determined based on the matching degree, to enable the user to directly acquire information such as an answer and a similar query method after entering the search text.

[0106] Two target text pairs may be included in one search and respectively correspond to two classes of relevance tasks. In addition, the two target text pairs are for the same search text. In practical applications, since the two classes of relevance tasks in one search have such an association and both focus on semantic matching, hybrid modeling is performed on the two classes of relevance tasks. Therefore, model training can be performed based on richer training samples, which is beneficial to improving a prediction effect of the matching degree prediction model. In addition, experimental data further shows that hybrid modeling of a plurality of classes of relevance tasks can bring forward benefits to each other, which improves model performance.

[0107] In addition, in practical applications, a search function in a target search scenario may be provided for the user in a manner of an interaction page. The user may enter a search text in a search box on the interaction page. After performing searching, recalling, matching degree prediction, and selecting the target answer text and the target question text in a background, the target answer text may be presented in an answer area on the interaction page, and the target question text may be presented in a question area on the interaction page. In this way, the user can intuitively acquire information such as an answer and a similar query method. Due to such an association between the two classes of relevance tasks in practical applications, the same interaction page has different matching degree prediction requirements. After a single model is deployed to cover a plurality of classes of relevance tasks in the target search scenario, only this model needs to be called to predict a matching degree in one search. However, one model is deployed for one class of task in the related art, and a plurality of models needs to be called in one search. Therefore, after this application is used, not only resource overhead caused by deploying a plurality of models can be reduced, but also complexity of background processing logic in the target search scenario can be reduced.

[0108] For example, FIG. 3 is a schematic diagram of a target search scenario. An interaction page corresponding to the target search scenario is presented on a terminal 300. A user may enter a search text in a search box, for example, “When did event A occur?”. Finally, the target answer text presented in the answer area may include “Event A refers to xxxx, and occurs at time xxxx.”, and “At xxxx, affected by xxx, and event A broke out.”, and the target question text presented in the question area may include “What is a cause of outbreak of event A?”, and “What impacts did event A bring?”.

[0109] This application does not have any limitation on a manner of determining the target answer text and the target question text based on the matching degree. For ease of understanding, this embodiment of this application provides the following manners as examples for description.

[0110] Usually, a higher matching degree indicates that the text is more likely to be information needed by the user in this search. Therefore, in an implementation, a text with a high matching degree may be selected. During a specific implementation, the server may select, from a plurality of candidate answer texts, a candidate answer text with a first matching degree greater than a first threshold as the target answer text. In addition, the server may select, from a plurality of candidate question texts, a candidate question text with a second matching degree greater than a second threshold as the target question text.

[0111] If the first matching degree is greater than the first threshold, it is considered that the candidate answer text can be configured for answering a question in the search text, and therefore, the candidate answer text may be determined as the target answer text. Usually, a higher first matching degree indicates that it is considered that the target answer text is more likely to resolve the question of the user after being fed back to the user. Similarly, if the second matching degree is greater than the second threshold, it is considered that the candidate question text is similar to the search text, and can be used as an extended search text of the search text. For example, if the search text is a question A for xxx, the candidate question text may be a question B extending around xxx. Usually, a higher second matching degree indicates that it is considered that the text is more likely to be used by the user after being fed back to the user. For example, a search is directly continued based on the candidate question text.

[0112] Based on this, a text with a high matching degree is selected and fed back to a user. This enables the user to acquire information required in this search, and is beneficial to improving a search experience of the user.

[0113] The first threshold and the second threshold may be set according to actual conditions. This is not limited in this application. Usually, the matching degree may be a value between 0 and 1, and correspondingly, the threshold may be set to 0.6. Certainly, the first threshold and the second threshold may be set to the same value, or may be set to different values.

[0114] In practical applications, in different search scenarios, a quantity of texts fed back to the user in one search varies. Therefore, in still another implementation, the target answer text and the target question text may further be determined with reference to a quantity of answer presentations and a quantity of question presentations that are set in the target search scenario. During a specific implementation, a candidate answer text with a first matching degree ranked at a first answer presentation quantity digit may be determined as the target answer text, and a candidate question text with a second matching degree ranked at a first question presentation quantity digit may be determined as the target question text. Based on this, the method can be flexibly adapted to different search scenarios.

[0115] This application does not have any limitation on a manner of generating a plurality of candidate answer texts and a plurality of candidate question texts. In practical applications, the plurality of candidate answer texts and the plurality of candidate question texts may be generated by another model deployed in a target search scenario. For example, the plurality of candidate answer texts corresponding to the search text may be generated by using the answer generation module, and the plurality of candidate question texts corresponding to the search text may be generated by using the question generation model.

[0116] In addition, this application does not have any limitation on a model structure. For ease of understanding, this embodiment of this application provides the following examples for description.

[0117] In the target search scenario, both classes of relevance tasks focus on a matching condition between two texts. Therefore, in an implementation, a pre-trained language representation model having better performance in terms of semantic understanding of a text may be selected. The pre-trained language representation model may be obtained by performing unsupervised pre-training on a large-scale corpus based on a pre-trained language model technology, to improve a semantic understanding capability to the text. Next, the foregoing initial model may be constructed by using the pre-trained language representation model, and model training is further performed based on a training sample in a target search scenario, which is beneficial to accelerating model training, and more quickly determining a matching degree prediction model that can adapt to the target search scenario.

[0118] For better understanding, an embodiment of this application further provides a schematic diagram of a model structure of the initial model shown in FIG. 4, and specifically includes a bidirectional encoder representation from transforms (BERT), a feedforward neural network (FNN), and a mapping function (such as a Softmax function). Specifically:

[0119] The BERT may be the foregoing pre-trained language representation model, and has good performance in capturing and understanding language information in a text. The initial model is constructed based on the BERT, which improves a capability of the initial model in text understanding, and is beneficial to accelerating model training, to obtain the matching degree prediction model.

[0120] The FNN is a basic artificial neural network model. In the FNN, information can only be transmitted forward from an input layer to an output layer without backpropagation or loop, and therefore, the FNN is referred to as a feedforward neural network. The FNN is widely applied to various machine learning tasks due to features such as a simple network structure and ease of understanding and implementing. Usually, the FNN may include a plurality of layers, such as an input layer, a hidden layer, and an output layer. An output of the BERT is used as an input of the FNN, and a final prediction result is output after the FNN processes the input.

[0121] The Softmax function is a special logistic function, and is often used in a multi-class classification problem. A set of input values are mapped to a set of output values. The set of output values may be interpreted as a probability, and may specifically refer to a probability that the input belongs to each class, and a sum of all output values is 1. Therefore, the Softmax function is particularly suitable for processing a multi-class classification problem.

[0122] For ease of understanding, in an example in FIG. 4, the foregoing first training sample is used as an example for description. A corresponding first predicted matching degree is output after the first training sample is input into the initial model and is processed by using the initial model. For example, the input first training sample may be denoted as X. After X is input into the initial model, an overall representation H of a first search text and a historical answer text may be determined based on the BERT, that is, H=BERT(X). Then, based on FFN processing, and finally mapping by using the Softmax function, an output Y of the initial model is determined, Y=Softmax (FNN(H)). After the Softmax function is used, the output first predicted matching degree may specifically include two values, that is, a matching probability y1 and a mismatching probability y2. That is, the foregoing Y may include y1 and y2, where y1 may represent a probability that the first search text matches the historical answer text, and y2 may represent a probability that the first search text does not match the historical answer text. For example, y1=0.99, and y2=0.01.

[0123] In the example in FIG. 4, the first training sample may be denoted as [CLS] [first task identifier][first search text][SEP][historical answer text][SEP]. Similarly, the second training sample may be denoted as [CLS][second task identifier][second search text] [SEP][third search text][SEP].

[0124] CLS and SEP are special tokens commonly used during text processing in the field of natural language processing. Specifically, the CLS is an abbreviation of classification token. In a model structure such as BERT, a CLS token is usually appended to the beginning of an input sequence, and is configured for indicating a class or an intent of an entire sequence. In addition, the SEP is an abbreviation of separator token. In a model structure such as the BERT, an SEP token is usually configured for separating two sentences or paragraphs in an input sequence, to enable a model to distinguish between the two sentences or paragraphs and understand a relationship between the two sentences or paragraphs, and improve a capability of the model to process a complex text task.

[0125] According to the foregoing embodiments, the method for determining a matching degree prediction model provided in this application is described in detail. For better understanding, this embodiment of this application uses an example in which the target search scenario includes the foregoing first-class relevance task, second-class relevance task, and third-class relevance task to provide the following example description:

[0126] The first-class relevance task is configured for indicating that one text in a first text pair belongs to a question type, and the other text in the first text pair belongs to an answer type. For example, in a first training sample from the first-class relevance task, the first text pair includes a first search text and a historical answer text. Usually, a search text entered by a user is a short sentence, and an answer text is a long text, which may be considered as a paragraph. Therefore, such class of relevance task may alternatively be considered as modeling a matching degree between a search word and a paragraph, which may be denoted as [Question-Content], and the foregoing first task identifier may be denoted as TASK token1=[TASK-Question-Content].

[0127] For example, the first training sample may be denoted as [CLS][TASK-Question-Content][When did event A occur?][SEP][Event A refers to xxxx, and occurs at time xxxx.][SEP].

[0128] The second-class relevance task is configured for indicating that both texts in a second text pair belong to the question type. For example, in a second training sample from the second-class relevance task, the second text pair includes a second search text and a third search text. Usually, questions are both short, that is, both the second search text and the third search text may be considered as relatively short sentences, and in an actual search service, feeding a target question text back to a user is intended to enable the user to directly continue searching by using the target question text. Therefore, such class of relevance task may alternatively be considered as modeling a matching degree between search words. The search word may specifically refer to a question, which may be denoted as [Question-Question], and the foregoing second task identifier may be denoted as TASK token2=[TASK-Question-Question].

[0129] For example, the second training sample may be denoted as [CLS][TASK-Question-Question][When did event A occur?][SEP][What impacts did event A bring?][SEP].

[0130] The third-class relevance task is configured for indicating that one text in a third text pair included in a third training sample belongs to the answer type, and the other text belongs to a citation source type. For example, in the third training sample from the third-class relevance task, the third text pair includes a historical answer text and a citation source text. The third training sample has a third sample label, and the third sample label may be configured for indicating whether the historical answer text semantically matches the citation source text. Usually, both the answer text and the citation source text are long texts, may be considered as paragraphs, and may be correspondingly denoted as [Content-Content]; and a corresponding third task identifier may be denoted as TASK token3=[TASK-Content-Content].

[0131] For example, the third training sample may be denoted as [CLS][TASK-Content-Content][Event A refers to xxxx, and occurs at time of xxxx.][SEP][xxxxx is recorded in a book <xxx>.][SEP].

[0132] Similar to the first training sample and the second training sample, the third training sample may further include a third auxiliary text. For example, the third auxiliary text may be a source of a citation source text, for example, may be a book name, a periodical name, a book description, or an author biography. Correspondingly, the foregoing third training sample may be denoted as [CLS][TASK-Content-Content][Event A refers to xxxx, and occurs at time of xxxx.][SEP][Book-name]<xxx>[Book-des]<xxx>is a book published at xx, and the author is xx, and the book describes xxxxx. [xxxxx is recorded in a book <xxx>.][SEP]. The Book-name may be an auxiliary identifier, and is configured for indicating that <xxx> following the Book-name is a book name; and Book-des is an auxiliary identifier, and is configured for indicating that a text following the Book-des is a book description.

[0133] After hybrid training is performed in this way, an obtained matching degree prediction model is deployed in a target search scenario. In one search, for a search text entered by a user, the matching degree prediction model can be called, to complete prediction of a matching degree between the search text and a candidate answer text, prediction of a matching degree between the search text and a candidate question text, and prediction of a matching degree between the candidate answer text and a candidate source text. For ease of understanding, based on the foregoing example in FIG. 3, a schematic diagram of still another target search scenario shown in FIG. 5 is provided. Specifically:

[0134] An interaction page of a target search scenario is presented on the terminal 500. For details, refer to the description of the related part of the example in FIG. 3, and details are not described herein again. Finally, not only the target answer text but also a citation source corresponding to the target answer text may be presented in an answer area, for user reference. For example, for a target answer text “Event A refers to xxxx, which occurred at xxxx.”, a citation source text “Cited from book <xxxx>, at xxxx, event A broke out due to xxx, bringing about a series of changes.” may be presented below the text.

[0135] Based on this, for such a case in which there are different matching degree prediction requirements on the same interaction page, in a hybrid training manner, after a single model is deployed to cover a plurality of classes of relevance tasks, only this model needs to be called to complete prediction of a plurality of matching degrees, to select various parts of texts that need to be presented. In this way, not only resource overhead caused by deploying a plurality of models can be reduced, but also complexity of background processing logic in the target search scenario can be reduced.

[0136] In this application, based on the implementations provided in the foregoing aspects, further combinations may be performed to provide more implementations.

[0137] Based on the method for determining a matching degree prediction model provided in the embodiment corresponding to FIG. 2, an embodiment of this application further provides an apparatus 600 for determining a matching degree prediction model. The apparatus 600 for determining a matching degree prediction model includes an acquisition unit 601, a determination unit 602, and an adjustment unit 603.

[0138] The acquisition unit 601 is configured to acquire a first training sample from a first-class relevance task and a second training sample from a second-class relevance task, a first sample label being configured for indicating whether a first text pair included in the first training sample semantically matches, a second sample label being configured for indicating whether a second text pair included in the second training sample semantically matches, both the first-class relevance task and the second-class relevance task belonging to a target search scenario, and the first-class relevance task and the second-class relevance task having different requirements for semantic matching.

[0139] The determination unit 602 is configured to determine a first predicted matching degree of the first text pair by using an initial model based on the first training sample, and determine a second predicted matching degree of the second text pair by using the initial model based on the second training sample.

[0140] The determination unit 602 is further configured to determine a training loss based on a first difference between the first predicted matching degree and the first sample label and a second difference between the second predicted matching degree and the second sample label.

[0141] The adjustment unit 603 is configured to adjust a shared model parameter in the initial model based on the training loss, adjust a first weight of the shared model parameter based on the first difference, and adjust a second weight of the shared model parameter based on the second difference, to obtain a matching degree prediction model, the first weight being configured for indicating a degree of impact of the shared model parameter on determining the first predicted matching degree, the second weight being configured for indicating a degree of impact of the shared model parameter on determining the second predicted matching degree, and the matching degree prediction model being configured to determine a matching degree of a target text pair in the target search scenario.

[0142] In an implementation, if the first training sample further includes a first task identifier corresponding to the first-class relevance task, and the second training sample further includes a second task identifier corresponding to the second-class relevance task, the determination unit is further configured to:

[0143] determine, by using the initial model based on the first task identifier, that the shared model parameter participates in processing of the first text pair by using the first weight after the first training sample is input into the initial model, to obtain the first predicted matching degree; and

[0144] determine, by using the initial model based on the second task identifier, that the shared model parameter participates in processing of the second text pair by using the second weight after the second training sample is input into the initial model, to obtain the second predicted matching degree.

[0145] In an implementation, if the training loss carries the first task identifier and the second task identifier, the adjustment unit is further configured to:

[0146] determine, based on the first task identifier carried in the training loss, the first difference included in the training loss, and determine, based on the second task identifier carried in the training loss, the second difference included in the training loss in a process of backpropagating the training loss in the initial model; and

[0147] adjust the first weight based on the first difference, and adjust the second weight based on the second difference.

[0148] In an implementation, if it is determined that the target text pair is from a target-class relevance task, the determination unit is further configured to:

[0149] construct a target sample based on the target text pair and a target task identifier corresponding to the target-class relevance task; and

[0150] determine, by using the matching degree prediction model based on the target task identifier, that the shared model parameter participates in processing of the target text pair by using a target weight after the target sample is input into the matching degree prediction model, to obtain a target matching degree,

[0151] the target task identifier being the first task identifier, and the target weight being the first weight when the target-class relevance task is the first-class relevance task, or the target task identifier being the second task identifier, and the target weight being the second weight when the target-class relevance task is the second-class relevance task.

[0152] In an implementation, if the target text pair includes a first to-be-predicted text and a second to-be-predicted text, the determination unit is further configured to:

[0153] determine a first service that generates the first to-be-predicted text, and determine a second service that generates the second to-be-predicted text, both the first service and the second service being services in the target search scenario; and

[0154] determine the target-class relevance task as the first-class relevance task or the second-class relevance task based on the first service and the second service.

[0155] In an implementation, the first-class relevance task is configured for indicating a relevance between one text belonging to a question type and the other text belonging to an answer type in the first text pair, and the second-class relevance task is configured for indicating a relevance between two texts belonging to the question type in the second text pair.

[0156] In an implementation, the determination unit is further configured to:

[0157] acquire, in response to receiving a search text of the answer type input in the target search scenario, a plurality of candidate answer texts generated for the search text, and acquire a plurality of candidate question texts generated for the search text;

[0158] determine a first target text pair from the first-class relevance task based on the search text and the candidate answer text, and determine a second target text pair from the second-class relevance task based on the search text and the candidate question text;

[0159] determine the shared model parameter by using the matching degree prediction model to determine a first matching degree of the first target text pair based on the first weight, and determine the shared model parameter by using the matching degree prediction model to determine a second matching degree of the second target text pair based on the second weight;

[0160] determine, based on the first matching degrees respectively corresponding to the plurality of candidate answer texts, a target answer text corresponding to the search text, and determine, based on the second matching degrees respectively corresponding to the plurality of candidate question texts, a target question text corresponding to the search text; and

[0161] present the target answer text and the target question text in the target search scenario.

[0162] In an implementation, the determination unit is further configured to:

[0163] select a candidate answer text with a first matching degree greater than a first threshold from the plurality of candidate answer texts as the target answer text; and

[0164] select a candidate question text with a second matching degree greater than a second threshold from the plurality of candidate question texts as the target question text.

[0165] In an implementation, if the first text pair includes a first search text and a historical answer text, the first training sample further includes a first auxiliary text, and the first auxiliary text is configured for indicating confidence of the historical answer text; the second text pair includes a second search text and a third search text, the second training sample further includes a second auxiliary text, and the second auxiliary text is configured for indicating confidence of the third search text; and the determination unit is further configured to:

[0166] perform semantic relevance analysis on the first search text and the historical answer text and confidence analysis on the historical answer text by using the initial model based on the first training sample, to obtain the first predicted matching degree; and

[0167] perform semantic relevance analysis on the second search text and the third search text and confidence analysis on the third search text by using the initial model based on the second training sample, to obtain the second predicted matching degree.

[0168] In an implementation, the first auxiliary text is configured for indicating a text source of the historical answer text, and the second auxiliary text is configured for indicating a historical search count of the third search text in the target search scenario.

[0169] In an implementation, the determination unit is further configured to:

[0170] sequentially concatenate an answer identifier, the historical answer text, a first auxiliary identifier, and the first auxiliary text, to obtain a first concatenated text, the answer identifier being configured for indicating that the historical answer text following the answer identifier is configured for explaining the first search text, and the first auxiliary identifier being configured for indicating that the first auxiliary text following the first auxiliary identifier is configured for indicating confidence of the historical answer text preceding the first auxiliary identifier;

[0171] determine the first training sample based on the first search text and the first concatenated text;

[0172] sequentially concatenate a question identifier, the third search text, a second auxiliary identifier, and the second auxiliary text, to obtain a second concatenated text, the question identifier being configured for indicating that the third search text following the question identifier is used as an extended search text of the second search text, and the second auxiliary identifier being configured for indicating that the second auxiliary text following the second auxiliary identifier is configured for indicating confidence of the third search text preceding the second auxiliary identifier; and

[0173] determine the second training sample based on the second search text and the second concatenated text.

[0174] It can be learned from the foregoing technical solutions that, for a target search scenario including two classes of relevance tasks, because both classes of relevance tasks focus on semantic matching of a text pair, in view of such commonality, hybrid training is performed on an initial model by using training samples from the two classes of relevance tasks in this application, to cover the two classes of relevance tasks by using a single model. Specifically, a training loss is determined based on a first difference between a first predicted matching degree and a first sample label and a second difference between a second predicted matching degree and a second sample label. Next, the shared model parameter in the initial model is adjusted based on the training loss, a first weight of the shared model parameter is adjusted based on the first difference, and a second weight of the shared model parameter is adjusted based on the second difference. The first weight is configured for indicating a degree of impact of the shared model parameter on determining the first predicted matching degree, and the second weight is configured for indicating a degree of impact of the shared model parameter on determining the second predicted matching degree. During the hybrid training, a model parameter is shared, and for the shared model parameter, weights are adjusted for different classes of relevance tasks. Therefore, during the hybrid training, the initial model can learn that the shared model parameter participates in prediction for a first-class relevance task by using the first weight, and participates in prediction for a second-class relevance task by using the second weight. Based on this, in a finally obtained matching degree prediction model, the shared model parameter has two sets of weights corresponding to the two classes of relevance tasks, to be compatible with such difference between different requirements of different classes of relevance tasks for semantic matching, and to enable this model to have a capability of covering two classes of relevance tasks. Correspondingly, in the target search scenario, only the matching degree prediction model needs to be deployed, which is beneficial to improving model deployment efficiency and reducing resource overhead caused by deploying a plurality of models. In addition, only one model needs to be trained. Compared with a manner of training one model for one task, this is beneficial to improving model training efficiency.

[0175] The embodiments of this application further provide a computer device. The computer device may be a terminal. An example in which the terminal is a smartphone is used:

[0176] FIG. 7 is a block diagram of a partial structure of a smartphone according to an embodiment of this application. Referring to FIG. 7, the smartphone includes components such as a radio frequency (RF) circuit 1110, a memory 1120, an input unit 1130, a display unit 1140, a sensor 1150, an audio circuit 1160, a wireless fidelity (Wi-Fi) module 1170, a processor 1180, and a power supply 1190. The input unit 1130 may include a touch panel 1131 and another input device 1132. The display unit 1140 may include a display panel 1141. The audio frequency circuit 1160 may include a speaker 1161 and a microphone 1162. A person skilled in the art may understand that a structure of the smartphone shown in FIG. 7 does not constitute a limitation to the smartphone, more components or fewer components than those shown in the figure may be included, or some components may be combined, or a different component deployment may be used.

[0177] The memory 1120 may be configured to store a software program and module. The processor 1180 runs the software program and module stored in the memory 1120 to execute various functional applications and data processing of the smartphone. The memory 1120 may include a program storage area and a data storage area. The program storage area may store an operating system, an application program required by at least one function (for example, a sound playback function and an image playback function), and the like. The data storage area may store data (such as audio data and a phone book) created based on use of the smartphone, and the like. In addition, the memory 1120 may include a high-speed random access memory, and may alternatively include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or another volatile solid-state storage device.

[0178] The processor 1180 is a control center of the smartphone, is connected to various parts of the entire smartphone via various interfaces and lines, and executes various functions of the smartphone and processes data by running or executing the software program and / or module stored in the memory 1120 and calling data stored in the memory 1120. In some embodiments, the processor 1180 may include one or more processing units. Preferably, the processor 1180 may integrate an application processor and a modem processor. The application processor processes an operating system, a user interface, an application program, and the like. The modem processor processes wireless communication. The foregoing modem may not be integrated into the processor 1180.

[0179] In this embodiment, operations performed by the processor 1180 in the smartphone may be implemented based on the structure shown in FIG. 7.

[0180] The computer device provided in this embodiment of this application may alternatively be a server. FIG. 8 is a structural diagram of a server 1200 according to an embodiment of this application. The server 1200 may vary due to different configurations or performance, and may include one or more processors, for example, central processing units (CPU) 1222, a memory 1232, and one or more storage media 1230 (for example, one or more mass storage devices) that store applications 1242 or data 1244. The memory 1232 and the storage medium 1230 may be transient or persistent storages. The program stored in the storage medium 1230 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the server. Further, the central processing unit 1222 may be configured to communicate with the storage medium 1230, and execute, on the server 1200, the series of instruction operations stored in the storage medium 1230.

[0181] The server 1200 may further include one or more power supplies 1226, one or more wired or wireless network interfaces 1250, one or more input / output interfaces 1258, and / or one or more operating systems 1241, such as Windows Server™, Mac OS X™, Unix™, Linux™, and FreeBSD™.

[0182] In this embodiment, the central processing unit 1222 in the server 1200 may perform the following operations:

[0183] acquiring a first training sample from a first-class relevance task and a second training sample from a second-class relevance task, a first sample label being configured for indicating whether a first text pair included in the first training sample semantically matches, a second sample label being configured for indicating whether a second text pair included in the second training sample semantically matches, both the first-class relevance task and the second-class relevance task belonging to a target search scenario, and the first-class relevance task and the second-class relevance task having different requirements for semantic matching;

[0184] determining a first predicted matching degree of the first text pair by using an initial model based on the first training sample, and determining a second predicted matching degree of the second text pair by using the initial model based on the second training sample;

[0185] determining a training loss based on a first difference between the first predicted matching degree and the first sample label and a second difference between the second predicted matching degree and the second sample label; and

[0186] adjusting a shared model parameter in the initial model based on the training loss, adjusting a first weight of the shared model parameter based on the first difference, and adjusting a second weight of the shared model parameter based on the second difference, to obtain a matching degree prediction model, the first weight being configured for indicating a degree of impact of the shared model parameter on determining the first predicted matching degree, the second weight being configured for indicating a degree of impact of the shared model parameter on determining the second predicted matching degree, and the matching degree prediction model being configured to determine a matching degree of a target text pair in the target search scenario.

[0187] According to an aspect of this application, a computer-readable storage medium is provided. The computer-readable storage medium is configured to store a computer program, and the computer program, when executed by a computer device, enables the computer device to perform the method for determining a matching degree prediction model according to foregoing embodiments.

[0188] According to an aspect of this application, a computer program product is provided, the computer program product including a computer program, and the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, to enable the computer device to perform the method provided in exemplary implementations of the foregoing embodiments.

[0189] The descriptions of processes or structures corresponding to the foregoing accompanying drawings have respective focuses. For a part that is not described in detail in a process or structure, refer to related descriptions of other processes or structures.

[0190] Terms “first”, “second”, “third”, “fourth”, and the like (if any) in the specification of this application and the foregoing accompanying drawings are configured for distinguishing similar objects and are not necessarily configured for describing a particular order or sequence. Data used in this way is exchangeable in a proper case, so that the embodiments of this application described herein can be implemented in a sequence different from a sequence shown or described herein. In addition, terms “include”, “have” and any other variants mean to cover the non-exclusive inclusion, for example, a process, method, system, product, or device that includes a series of operations or units is not necessarily limited to those expressly listed operations or units, but may include other operations or units not expressly listed or inherent to the process, method, system, product, or device.

[0191] In several embodiments provided in this application, the disclosed system, apparatus, and method may be implemented in other manners. For example, the apparatus embodiment described above is only schematic, for example, division of the units is only logic function division, and other division manners may be adopted during practical implementation. For example, a plurality of units or components may be combined or integrated into another system, or some features may be neglected or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections may be implemented by using some interfaces. The indirect couplings or communication connections between the apparatuses or units may be implemented in electric, mechanical, or other forms.

[0192] The units described as separate components may be or may not be physically separated. The components displayed as units may be or may not be physical units, and may be located in one place or may be distributed over a plurality of network units. Part or all of the units may be selected based on actual needs to achieve the objectives of the solutions of the embodiments.

[0193] In addition, functional units in the embodiments of this application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The foregoing integrated unit may be implemented in a form of hardware, or may be implemented in a form of a software function unit.

[0194] If the integrated unit is implemented in the form of the software functional unit and is sold or used as an independent product, the integrated unit may be stored in a computer-readable storage medium. Based on such an understanding, the technical solutions of this application, or the part contributing to the related art, or all or some of the technical solutions may be implemented in the form of a software product. The computer software product is stored in a storage medium and includes several instructions to enable a computer device (which may be a computer, a server, a network device, or the like) to perform all or some of the operations of the methods according to the embodiments of this application. The foregoing storage medium includes various media capable of storing program codes, such as, a USB flash drive, a mobile hard disk, a read only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0195] In this embodiment of this application, a term “module” or “unit” refers to a computer program or a part of a computer program with a predetermined function, which works together with other related parts to achieve a predetermined objective, and may be fully or partially implemented using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, one processor (or a plurality of processors or memories) may be configured to implement one or more modules or units. In addition, each module or unit may be a part of an overall module or unit including the module or unit function.

[0196] Based on the above description, the foregoing embodiments are merely intended to describe the technical solutions of this application, and are not intended to limit this application. A person of ordinary skill in the art needs to understand that although this application has been described in detail with reference to the foregoing embodiments, modifications may be made to the technical solutions described in the foregoing embodiments, or equivalent replacements may be made to some technical features in the technical solutions. These modifications or replacements do not enable the essence of the corresponding technical solution to depart from the spirit and scope of the technical solution in embodiments of this application.

Claims

1. A method for adjusting a matching degree prediction model, performed by a computer device, and comprising:acquiring a first training sample and a first sample label from a first-class relevance task and a second training sample and a second sample label from a second-class relevance task, both the first-class relevance task and the second-class relevance task belonging to a target search scenario, and the first-class relevance task and the second-class relevance task having different requirements for semantic matching;determining a first predicted matching degree of a first text pair in the first training sample and a second predicted matching degree of a second text pair in the second training sample by using an initial model;determining a training loss based on a first difference between the first predicted matching degree and the first sample label and a second difference between the second predicted matching degree and the second sample label; andadjusting a shared model parameter in the initial model based on the training loss, a first weight of the shared model parameter based on the first difference, and a second weight of the shared model parameter based on the second difference, to obtain a matching degree prediction model configured to determine a matching degree of a target text pair in the target search scenario.

2. The method according to claim 1, wherein the first training sample further comprises a first task identifier corresponding to the first-class relevance task, and the second training sample further comprises a second task identifier corresponding to the second-class relevance task, the determining the first predicted matching degree of the first text pair in the first training sample by using the initial model comprises:determining, by using the initial model based on the first task identifier, that the shared model parameter participates in processing of the first text pair by using the first weight after the first training sample is input into the initial model, to obtain the first predicted matching degree; andthe determining the second predicted matching degree of the second text pair in the second training sample by using the initial model comprises:determining, by using the initial model based on the second task identifier, that the shared model parameter participates in processing of the second text pair by using the second weight after the second training sample is input into the initial model, to obtain the second predicted matching degree.

3. The method according to claim 2, wherein the training loss carries the first task identifier and the second task identifier, the adjusting the first weight of the shared model parameter based on the first difference and the second weight of the shared model parameter based on the second difference comprises:determining, based on the first task identifier carried in the training loss, the first difference comprised in the training loss, and determining, based on the second task identifier carried in the training loss, the second difference comprised in the training loss in a process of backpropagating the training loss in the initial model; andadjusting the first weight based on the first difference and the second weight based on the second difference.

4. The method according to claim 2, wherein the method further comprises:constructing a target sample based on the target text pair and a target task identifier corresponding to a target-class relevance task; anddetermining, by using the matching degree prediction model based on the target task identifier, that the shared model parameter participates in processing of the target text pair by using a target weight after the target sample is input into the matching degree prediction model, to obtain a target matching degree.

5. The method according to claim 4, wherein the target text pair comprises a first to-be-predicted text and a second to-be-predicted text, the method further comprises:determining a first service that generates the first to-be-predicted text, and determining a second service that generates the second to-be-predicted text, both the first service and the second service being services in the target search scenario; anddetermining the target-class relevance task as the first-class relevance task or the second-class relevance task based on the first service and the second service.

6. The method according to claim 1, wherein the first-class relevance task is configured for indicating a relevance between one text belonging to a question type and the other text belonging to an answer type in the first text pair, and the second-class relevance task is configured for indicating a relevance between two texts belonging to the question type in the second text pair.

7. The method according to claim 6, further comprising:acquiring, in response to receiving a search text of the question type input in the target search scenario, a plurality of candidate answer texts generated for the search text, and acquiring a plurality of candidate question texts generated for the search text;determining a first target text pair from the first-class relevance task based on the search text and the candidate answer text, and determining a second target text pair from the second-class relevance task based on the search text and the candidate question text;determining, by using the matching degree prediction model, that the shared model parameter participates in determining of a first matching degree of the first target text pair based on the first weight, and determining, by using the matching degree prediction model, that the shared model parameter participates in determining of a second matching degree of the second target text pair based on the second weight;determining, based on the first matching degrees respectively corresponding to the plurality of candidate answer texts, a target answer text corresponding to the search text, and determining, based on the second matching degrees respectively corresponding to the plurality of candidate question texts, a target question text corresponding to the search text; andpresenting the target answer text and the target question text in the target search scenario.

8. The method according to claim 7, wherein the determining, based on the first matching degrees respectively corresponding to the plurality of candidate answer texts, a target answer text corresponding to the search text comprises:selecting the candidate answer text with the first matching degree greater than a first threshold from the plurality of candidate answer texts as the target answer text; andthe determining, based on the second matching degrees respectively corresponding to the plurality of candidate question texts, a target question text corresponding to the search text comprises:selecting the candidate question text with the second matching degree greater than a second threshold from the plurality of candidate question texts as the target question text.

9. The method according to claim 1, wherein the first text pair comprises a first search text and a historical answer text, the first training sample further comprises a first auxiliary text indicating confidence of the historical answer text, the second text pair comprises a second search text and a third search text, the second training sample further comprises a second auxiliary text indicating confidence of the third search text, and the determining the first predicted matching degree of the first text pair in the first training sample by using the initial model comprises:performing semantic relevance analysis on the first search text and the historical answer text and confidence analysis on the historical answer text by using the initial model based on the first training sample, to obtain the first predicted matching degree; andthe determining the second predicted matching degree of the second text pair in the second training sample by using the initial model comprises:performing semantic relevance analysis on the second search text and the third search text and confidence analysis on the third search text by using the initial model based on the second training sample, to obtain the second predicted matching degree.

10. The method according to claim 9, wherein the first auxiliary text is configured for indicating a text source of the historical answer text, and the second auxiliary text is configured for indicating a historical search count of the third search text in the target search scenario.

11. The method according to claim 9, further comprising:sequentially concatenating an answer identifier, the historical answer text, a first auxiliary identifier, and the first auxiliary text, to obtain a first concatenated text, the answer identifier being configured for indicating that the historical answer text following the answer identifier is configured for explaining the first search text, and the first auxiliary identifier being configured for indicating that the first auxiliary text following the first auxiliary identifier is configured for indicating confidence of the historical answer text preceding the first auxiliary identifier;determining the first training sample based on the first search text and the first concatenated text;sequentially concatenating a question identifier, the third search text, a second auxiliary identifier, and the second auxiliary text, to obtain a second concatenated text, the question identifier being configured for indicating that the third search text following the question identifier is used as an extended search text of the second search text, and the second auxiliary identifier being used for indicating that the second auxiliary text following the second auxiliary identifier is configured for indicating confidence of the third search text preceding the second auxiliary identifier; anddetermining the second training sample based on the second search text and the second concatenated text.

12. A computer device, comprising a processor and a memory:the memory being configured to store a computer program and transmit the computer program to the processor; andthe processor being configured to perform a method for adjusting a matching degree prediction model according to instructions in the computer program, the method including:acquiring a first training sample and a first sample label from a first-class relevance task and a second training sample and a second sample label from a second-class relevance task, both the first-class relevance task and the second-class relevance task belonging to a target search scenario, and the first-class relevance task and the second-class relevance task having different requirements for semantic matching;determining a first predicted matching degree of a first text pair in the first training sample and a second predicted matching degree of a second text pair in the second training sample by using an initial model;determining a training loss based on a first difference between the first predicted matching degree and the first sample label and a second difference between the second predicted matching degree and the second sample label; andadjusting a shared model parameter in the initial model based on the training loss, a first weight of the shared model parameter based on the first difference, and a second weight of the shared model parameter based on the second difference, to obtain a matching degree prediction model configured to determine a matching degree of a target text pair in the target search scenario.

13. The computer device according to claim 12, wherein the first training sample further comprises a first task identifier corresponding to the first-class relevance task, and the second training sample further comprises a second task identifier corresponding to the second-class relevance task, the determining the first predicted matching degree of the first text pair in the first training sample by using the initial model comprises:determining, by using the initial model based on the first task identifier, that the shared model parameter participates in processing of the first text pair by using the first weight after the first training sample is input into the initial model, to obtain the first predicted matching degree; andthe determining the second predicted matching degree of the second text pair in the second training sample by using the initial model comprises:determining, by using the initial model based on the second task identifier, that the shared model parameter participates in processing of the second text pair by using the second weight after the second training sample is input into the initial model, to obtain the second predicted matching degree.

14. The computer device according to claim 13, wherein the training loss carries the first task identifier and the second task identifier, the adjusting the first weight of the shared model parameter based on the first difference and the second weight of the shared model parameter based on the second difference comprises:determining, based on the first task identifier carried in the training loss, the first difference comprised in the training loss, and determining, based on the second task identifier carried in the training loss, the second difference comprised in the training loss in a process of backpropagating the training loss in the initial model; andadjusting the first weight based on the first difference and the second weight based on the second difference.

15. The computer device according to claim 13, wherein the method further comprises:constructing a target sample based on the target text pair and a target task identifier corresponding to a target-class relevance task; anddetermining, by using the matching degree prediction model based on the target task identifier, that the shared model parameter participates in processing of the target text pair by using a target weight after the target sample is input into the matching degree prediction model, to obtain a target matching degree.

16. The computer device according to claim 12, wherein the first-class relevance task is configured for indicating a relevance between one text belonging to a question type and the other text belonging to an answer type in the first text pair, and the second-class relevance task is configured for indicating a relevance between two texts belonging to the question type in the second text pair.

17. The computer device according to claim 12, wherein the first text pair comprises a first search text and a historical answer text, the first training sample further comprises a first auxiliary text indicating confidence of the historical answer text, the second text pair comprises a second search text and a third search text, the second training sample further comprises a second auxiliary text indicating confidence of the third search text, and the determining the first predicted matching degree of the first text pair in the first training sample by using the initial model comprises:performing semantic relevance analysis on the first search text and the historical answer text and confidence analysis on the historical answer text by using the initial model based on the first training sample, to obtain the first predicted matching degree; andthe determining the second predicted matching degree of the second text pair in the second training sample by using the initial model comprises:performing semantic relevance analysis on the second search text and the third search text and confidence analysis on the third search text by using the initial model based on the second training sample, to obtain the second predicted matching degree.

18. A non-transitory computer-readable storage medium storing a computer program therein, the computer program, when executed by a processor of a computer device, enabling the computer device to perform a method for adjusting a matching degree prediction model including:acquiring a first training sample and a first sample label from a first-class relevance task and a second training sample and a second sample label from a second-class relevance task, both the first-class relevance task and the second-class relevance task belonging to a target search scenario, and the first-class relevance task and the second-class relevance task having different requirements for semantic matching;determining a first predicted matching degree of a first text pair in the first training sample and a second predicted matching degree of a second text pair in the second training sample by using an initial model;determining a training loss based on a first difference between the first predicted matching degree and the first sample label and a second difference between the second predicted matching degree and the second sample label; andadjusting a shared model parameter in the initial model based on the training loss, a first weight of the shared model parameter based on the first difference, and a second weight of the shared model parameter based on the second difference, to obtain a matching degree prediction model configured to determine a matching degree of a target text pair in the target search scenario.

19. The non-transitory computer-readable storage medium according to claim 18, wherein the first training sample further comprises a first task identifier corresponding to the first-class relevance task, and the second training sample further comprises a second task identifier corresponding to the second-class relevance task, the determining the first predicted matching degree of the first text pair in the first training sample by using the initial model comprises:determining, by using the initial model based on the first task identifier, that the shared model parameter participates in processing of the first text pair by using the first weight after the first training sample is input into the initial model, to obtain the first predicted matching degree; andthe determining the second predicted matching degree of the second text pair in the second training sample by using the initial model comprises:determining, by using the initial model based on the second task identifier, that the shared model parameter participates in processing of the second text pair by using the second weight after the second training sample is input into the initial model, to obtain the second predicted matching degree.

20. The non-transitory computer-readable storage medium according to claim 19, wherein the training loss carries the first task identifier and the second task identifier, the adjusting the first weight of the shared model parameter based on the first difference and the second weight of the shared model parameter based on the second difference comprises:determining, based on the first task identifier carried in the training loss, the first difference comprised in the training loss, and determining, based on the second task identifier carried in the training loss, the second difference comprised in the training loss in a process of backpropagating the training loss in the initial model; andadjusting the first weight based on the first difference and the second weight based on the second difference.