Construction method and device of matching model, matching method and device and related product

By acquiring multiple search sample scenarios and training data, and using the model to be trained to process vector weights and adjust parameters, a matching model suitable for multiple scenarios was constructed, which solved the problem of resource waste and improved the matching effect and cross-domain perception capability.

CN121365160APending Publication Date: 2026-01-20TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410977547.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2026-01-20

AI Technical Summary

Technical Problem

In existing technologies, the matching model needs to be built separately for each scenario, which results in excessive resource consumption and makes it impossible to effectively utilize multi-scenario search tasks.

Method used

By acquiring multiple search sample scenarios and training data, the model to be trained is used to process vector weights to obtain scenario weight vectors. The word and result vectors are then fused for matching prediction. Finally, the model parameters are adjusted to build a matching model that meets the needs of multiple scenarios.

Benefits of technology

This enables the training of a matching model across multiple scenarios, avoiding resource waste, improving matching performance, and enhancing the model's ability to perceive cross-domain scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121365160A_ABST
    Figure CN121365160A_ABST
Patent Text Reader

Abstract

The invention discloses a construction method and device of a matching model, a matching method and device and a related product. For each search sample scene, obtaining a word fusion vector corresponding to the search sample word and a result fusion vector corresponding to the search sample result through the to-be-trained model according to the scene weight vector corresponding to the search sample scene, and the search sample word and the search sample result in the training data corresponding to the search sample scene; for each search sample scene, performing matching prediction processing on the word fusion vector and the result fusion vector through a to-be-trained model to obtain a matching prediction score; and for the plurality of search sample scenes, based on the plurality of matching label scores and the plurality of matching prediction scores, adjusting parameters of the to-be-trained model until the adjusted model meets a model adjustment cut-off condition, and obtaining a matching model after adjustment is finished. In this way, the model meeting the multi-scene search task can be trained, and consumption of a large number of resources is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data search, and particularly relates to a construction method of a matching model, a matching method, a device and related products. BACKGROUND

[0002] With the continuous popularity of the Internet and the rapid progress of technology, a search task has become an indispensable part of people's daily life and work, and before a search result is output based on a search object, a matching model is usually used to determine whether the search task and the search result match, and if the search task and the search result match, the search result of the search task is output to the search object.

[0003] At present, in the related art, a matching model is usually obtained by constructing search data in the same scene, and at this time, the matching model can only implement matching work on search data in the scene. With the continuous increase of search tasks, search tasks may belong to different scenes, and at this time, if matching work is to be implemented on search data in different scenes, a matching model needs to be obtained by constructing for each scene, which will result in a large amount of resource consumption.

[0004] Therefore, how to avoid a large amount of resource consumption when constructing a model has become a technical problem to be solved in the current field. SUMMARY

[0005] Embodiments of the present application provide a construction method of a matching model, a matching method, a device and related products, which aim to avoid a large amount of resource consumption when constructing a model.

[0006] The first aspect of the present application provides a construction method of a matching model, comprising:

[0007] obtaining a plurality of search sample scenes and a plurality of sets of training data, wherein each set of training data includes a matching label score, a search sample word and a search sample result corresponding to the search sample word, and each set of training data corresponds to a different search sample scene;

[0008] performing vector weight processing on the plurality of search sample scenes by a to-be-trained model to obtain a scene weight vector corresponding to each search sample scene;

[0009] For each search sample scene, obtaining a word fusion vector corresponding to the search sample word and a result fusion vector corresponding to the search sample result according to the scene weight vector corresponding to the search sample scene, the search sample word and the search sample result in the training data corresponding to the search sample scene by the to-be-trained model;

[0010] The word fusion vector and the result fusion vector are matched and predicted by the to-be-trained model for each search sample scene, to obtain a matching prediction score;

[0011] For the plurality of search sample scenes, the parameters of the to-be-trained model are adjusted based on the plurality of matching label scores and the plurality of matching prediction scores, until the adjusted model meets a model adjustment stop condition, and a matching model is obtained after the adjustment is completed.

[0012] The second aspect of the application provides a matching method, comprising:

[0013] Obtaining a to-be-matched search word in a target search scene, and a to-be-matched search result corresponding to the to-be-matched search word;

[0014] The target search scene is processed by a vector weight through a matching model to obtain a target scene weight vector corresponding to the target search scene, wherein the matching model is a model trained according to the construction method of the matching model of the first aspect;

[0015] The first matching vector corresponding to the to-be-matched search word and the second matching vector corresponding to the to-be-matched search result are obtained by the matching model according to the target scene weight vector, the to-be-matched search word and the to-be-matched search result;

[0016] The first matching vector and the second matching vector are matched and predicted by the matching model to obtain a target matching score, wherein the target matching score is used to indicate whether the to-be-matched search result is shown to a search object.

[0017] The third aspect of the application provides a construction device of a matching model, comprising:

[0018] A training data acquisition unit is configured to acquire a plurality of search sample scenes and a plurality of sets of training data, wherein each set of training data includes a matching label score, a search sample word and a search sample result corresponding to the search sample word, and each set of training data corresponds to a different search sample scene;

[0019] A weight vector obtaining unit is configured to perform vector weight processing on the plurality of search sample scenes by a to-be-trained model to obtain scene weight vectors corresponding to the plurality of search sample scenes respectively;

[0020] A fusion vector obtaining unit is configured to, for each search sample scene, obtain a word fusion vector corresponding to a search sample word and a result fusion vector corresponding to a search sample result by the to-be-trained model according to the scene weight vector corresponding to the search sample scene, the search sample word and the search sample result in the training data corresponding to the search sample scene.

[0021] a prediction score obtaining unit configured to, for each search sample scene, obtain a matching prediction score by performing matching prediction processing on the word fusion vector and the result fusion vector by using the to-be-trained model;

[0022] a matching model obtaining unit configured to, for the plurality of search sample scenes, adjust parameters of the to-be-trained model based on the plurality of matching label scores and the plurality of matching prediction scores until the adjusted model satisfies a model adjustment stop condition, and obtain a matching model after the adjustment is completed.

[0023] The fourth aspect of the present application provides a matching device, comprising:

[0024] a to-be-matched data obtaining unit configured to obtain a to-be-matched search word in a target search scene and a to-be-matched search result corresponding to the to-be-matched search word;

[0025] a target weight vector obtaining unit configured to obtain a target scene weight vector corresponding to the target search scene by performing vector weight processing on the target search scene by using a matching model, wherein the matching model is a model trained according to the construction method of the matching model of the first aspect;

[0026] a matching vector obtaining unit configured to obtain a first matching vector corresponding to the to-be-matched search word and a second matching vector corresponding to the to-be-matched search result by using the matching model according to the target scene weight vector, the to-be-matched search word and the to-be-matched search result;

[0027] a target matching score obtaining unit configured to obtain a target matching score by performing matching prediction processing on the first matching vector and the second matching vector by using the matching model, wherein the target matching score is used to indicate whether the to-be-matched search result is to be shown to a search object.

[0028] The fifth aspect of the present application provides a computer device, comprising a processor and a memory:

[0029] The memory is configured to store a computer program and transmit the computer program to the processor;

[0030] The processor is configured to execute the steps of the construction method of the matching model provided in the first aspect or the steps of the matching method provided in the second aspect according to instructions in the computer program.

[0031] The sixth aspect of the present application provides a computer readable storage medium configured to store a computer program, wherein the computer program is executed by a computer device to implement the steps of the construction method of the matching model provided in the first aspect or the steps of the matching method provided in the second aspect.

[0032] The seventh aspect of the present application provides a computer program product comprising a computer program which, when executed by a computer device, implements the steps of the construction method of the matching model provided in the first aspect, or implements the steps of the matching method provided in the second aspect.

[0033] From the above technical solutions, the embodiments of the present application have the following advantages:

[0034] In the technical solution of the present application, first, a plurality of search sample scenarios and a plurality of sets of training data are obtained. Then, the vector weight of each search sample scenario is obtained by the to-be-trained model. For each search sample scenario, the word fusion vector corresponding to the search sample word and the result fusion vector corresponding to the search sample result are obtained by the to-be-trained model according to the scene weight vector corresponding to the search sample scenario, the search sample word and the search sample result in the training data corresponding to the search sample scenario. Finally, for each search sample scenario, the matching prediction score is obtained by the to-be-trained model through the matching prediction processing of the word fusion vector and the result fusion vector. Based on the plurality of matching label scores and the plurality of matching prediction scores, the parameters of the to-be-trained model are adjusted until the adjusted model meets the model adjustment stop condition, and the matching model is obtained.

[0035] As can be seen, in the present application, the to-be-trained model can first learn the scene weight vector of different search sample scenarios. Then, under the action of the scene weight vector, the word fusion vector corresponding to the search sample word and the result fusion vector corresponding to the search sample result in the training data corresponding to each search sample scenario are determined. Finally, the matching prediction score can be obtained based on the word fusion vector and the result fusion vector, so as to realize the construction of the matching model. In this way, in the present application, a model meeting the multi-scenario search task can be trained, avoiding the problem of large resource consumption caused by the need to construct a matching model for each scenario in the related art. BRIEF DESCRIPTION OF DRAWINGS

[0036] Figure 1 The flowchart for constructing the matching model proposed in the related art;

[0037] Figure 2 The scene architecture diagram of the construction method of the matching model provided by the embodiments of the present application;

[0038] Figure 3 The schematic diagram of the construction method of the matching model in the actual application scenario provided by the embodiments of the present application;

[0039] Figure 4A flowchart of a method for constructing a matching model according to an embodiment of the present application is provided.

[0040] Figure 5 A structure diagram of a model to be trained in a method for constructing a matching model according to an embodiment of the present application is provided.

[0041] Figure 6 A structure diagram of a model to be trained in another method for constructing a matching model according to an embodiment of the present application is provided.

[0042] Figure 7 A structure diagram of a model to be trained in still another method for constructing a matching model according to an embodiment of the present application is provided.

[0043] Figure 8 A structure diagram of a model to be trained in yet another method for constructing a matching model according to an embodiment of the present application is provided.

[0044] Figure 9 A flowchart of a matching method according to an embodiment of the present application is provided.

[0045] Figure 10 A scenario diagram of a matching method according to an embodiment of the present application is provided.

[0046] Figure 11 A structure diagram of a device for constructing a matching model according to an embodiment of the present application is provided.

[0047] Figure 12 A structure diagram of a matching device according to an embodiment of the present application is provided.

[0048] Figure 13 A structure diagram of a server according to an embodiment of the present application is provided.

[0049] Figure 14 A structure diagram of a terminal device according to an embodiment of the present application is provided. DETAILED DESCRIPTION

[0050] Embodiments of the present application are described below with reference to the accompanying drawings.

[0051] With the continuous popularity of the Internet and the rapid progress of technology, search tasks have become an indispensable part of people's daily life and work, and before a search result is output based on a search object, a matching model is usually used to determine whether the search task and the search result match, and if the search task and the search result match, the search result of the search task is output to the search object. For example, the search task of the search object is "search task A", the search result of the search task is "search result A" (i.e. the search result related to the search task A), at this time, it can be determined whether the search task A and the search result A match based on the matching model.

[0052] Currently, in the related art, a matching model is usually constructed by search data in the same scene, and at this time, the matching model can only match search data in the scene. For example, a matching model can be trained based on search task A in scene a and search result A of search task A, so that the matching model can determine whether search task A in scene a and search result A of search task A match. As the search tasks continue to increase, the search tasks can belong to different scenes, such as search task A can belong to scene a or scene b. At this time, if the matching model constructed based on scene a is used to match search task A in scene b, there can be matching errors. Therefore, in the related art, a matching model can be constructed for each scene to match search data in different scenes.

[0053] As shown in Figure 1 , a flowchart for constructing a matching model in the related art is shown in Figure 1 (a), which shows the process of obtaining a pre-trained model, Figure 1 (b) shows the process of obtaining a matching model based on a pre-trained model, where the pre-trained model is the base model of the matching model. Specifically, in Figure 1 (a), a pre-trained model can be constructed according to a task and a result, which can predict the matching degree of the task and the result, and in Figure 1 (b), the pre-trained model can be fine-tuned using search tasks and search results in a scene to obtain a matching model, where the scene can be scene a or scene b, so as to construct a matching model for each scene. However, constructing a matching model for each scene can consume a lot of resources. Therefore, how to avoid consuming a lot of resources when constructing a model has become a technical problem to be solved in the current field. Figure 1

[0054] ​In view of the above problems, a matching model construction method, a matching method, a device and related products are provided in the present application, and the purpose is to avoid the consumption of a large amount of resources when constructing the model. In the technical solution provided in the present application, first, a plurality of search sample scenarios and a plurality of sets of training data can be obtained, and then the to-be-trained model can learn the scenario weight vectors corresponding to different search sample scenarios, and for each search sample scenario, the search sample word corresponding word fusion vector and the search sample result corresponding result fusion vector can be obtained according to the scenario weight vector corresponding to the search sample scenario, the search sample word and the search sample result in the training data corresponding to the search sample scenario, and the matching prediction score can be predicted and obtained according to the word fusion vector and the result fusion vector, and finally the model parameters can be adjusted according to the matching prediction score and the matching label score in the plurality of search sample scenarios to obtain the matching model. In this way, in the present application, the training data in a plurality of search sample scenarios can be introduced at the same time for model training, so that the present application can train a model that meets the multi-scenario search task, avoiding the problem of a large amount of resource consumption caused by the need to construct a matching model for each scenario in related technologies, and also improving the matching effect when the matching model is applied subsequently to a certain extent.

[0055] The execution subject of the matching model construction method provided in the embodiments of the present application can be a terminal device, for example, a plurality of search sample scenarios and a plurality of sets of training data are obtained on the terminal device. Or the execution subject of the matching method provided in the embodiments of the present application can be a terminal device, for example, a to-be-matched search word in a target search scenario and a to-be-matched search result corresponding to the to-be-matched search word are obtained on the terminal device. As an example, the terminal device can include but is not limited to a mobile phone, a desktop computer, a tablet computer, a notebook computer, a palm computer, a smart voice interaction device, a smart home appliance, a vehicle-mounted terminal, an aircraft, etc. The execution subject of the matching model construction method provided in the embodiments of the present application can also be a server, that is, a plurality of search sample scenarios and a plurality of sets of training data can be obtained on the server. Or the execution subject of the matching method provided in the embodiments of the present application can also be a server, that is, a to-be-matched search word in a target search scenario and a to-be-matched search result corresponding to the to-be-matched search word can be obtained on the server. In addition, the matching model construction method or the matching method provided in the embodiments of the present application can also be executed by the terminal device and the server in cooperation. The terminal and the server can be directly or indirectly connected through wired or wireless communication, which is not limited in the present application. Therefore, the implementation subject of the technical solution of the present application is not limited in the embodiments of the present application.

[0056] Figure 2 An exemplary scenario architecture diagram of a matching model construction method is shown. Figure 2The server and various forms of terminal devices are included, wherein the terminal devices include mobile phones, desktop computers, tablet computers, notebook computers, and palm computers, such as the present application can obtain a search sample word through the terminal device, at which time the server can determine a search sample scene and a search sample result corresponding to the search sample word according to the search sample word, so that the server can construct a matching model based on the search sample word, the search sample scene, and the search sample result. Figure 2 The server shown can be a standalone physical server, or a server cluster or distributed system composed of multiple physical servers. In addition, the server can also be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, and basic cloud computing services such as big data and artificial intelligence platforms.

[0057] In order to facilitate understanding of the technical solutions provided by the embodiments of the present application, next, a matching model construction method provided by the embodiments of the present application will be introduced in combination with an actual application scenario. Referring to Figure 3 , Figure 3 The matching model construction method provided by the embodiments of the present application in an actual application scenario is shown in the schematic diagram, in which the processing device is a server 300 with model training function.

[0058] First, the server 300 obtains multiple search sample scenes and multiple sets of training data; at the beginning of model training, the server 300 performs vector weight processing on the multiple search sample scenes through the to-be-trained model to obtain scene weight vectors corresponding to the multiple search sample scenes respectively, and for each search sample scene, the server 300 obtains a word fusion vector corresponding to the search sample word and a result fusion vector corresponding to the search sample result according to the scene weight vector corresponding to the search sample scene, the search sample word in the training data corresponding to the search sample scene, and the search sample result through the to-be-trained model; in the model training stage, for each search sample scene, the server 300 performs matching prediction processing on the word fusion vector and the result fusion vector through the to-be-trained model to obtain a matching prediction score; finally, for multiple search sample scenes, the server 300 adjusts the parameters of the to-be-trained model based on multiple matching label scores and multiple matching prediction scores until the adjusted model meets the model adjustment cutoff condition, and the adjustment ends to obtain a matching model. Thus, in the present application, through the scene weight vector, the word fusion vector corresponding to the search sample word and the result fusion vector corresponding to the search sample result can be determined, which to some extent enhances the model's perception ability for cross-domain scenes, so that a model meeting the multi-scene search task can be trained and obtained, avoiding the problem of large resource consumption caused by the need to construct a matching model for each scene in related technologies.

[0059] See Figure 4 This figure is a flowchart of a matching model construction method provided in an embodiment of this application. Figure 4 The method for constructing the matching model shown includes the following steps:

[0060] S401: Acquire multiple search sample scenarios and multiple sets of training data.

[0061] In this step, the search sample scenarios include video scenarios, emoji scenarios, and group chat scenarios. No specific limitations are imposed on the search sample scenarios here, and they can be set according to actual needs in practical applications. Each set of training data includes matching label scores, search sample words, and the corresponding search sample results. Each set of training data corresponds to a different search sample scenario. The matching label scores are used to assist in the parameter adjustment of the model to be trained subsequently, while the search sample words and the corresponding search sample results are training data under the same search sample scenario.

[0062] As an example, if the search sample scenario is a video scenario, and the search sample term in this video scenario is "word A", then the search sample result in this video scenario is "result A" (i.e., videos related to "word A"). If the search sample scenario is an emoji scenario, and the search sample term in this video scenario is "word B", then the search sample result in this emoji scenario is "result B" (i.e., emoji images related to "word B"). If the search sample scenario is a group chat scenario, and the search sample term in this video scenario is "word C", then the search sample result in this video scenario is "result C" (i.e., group chat organizations related to "word C"). It should be noted that the same search sample term can exist in different search sample scenarios, and different search sample terms can also exist in different search sample scenarios. Furthermore, if the same search sample term exists in different search sample scenarios, the search sample results for that search sample term will be different in each of the different search sample scenarios.

[0063] It should also be noted that in this application, random sampling can first be performed on the log data of the database to obtain search sample words under different search sample scenarios. Then, random sampling is performed on the search sample words under each search sample scenario to obtain search sample results under that search sample scenario. Next, the search sample words and search sample results under each search sample scenario are labeled (the labeling conditions include irrelevant / weakly relevant / partially relevant / relevant / strongly relevant), and the matching label score of the search sample words and search sample results is determined based on the labeling conditions to facilitate subsequent model training.

[0064] S402: The multiple search sample scenarios are processed by the model to be trained to obtain the scene weight vectors corresponding to the multiple search sample scenarios respectively.

[0065] First, it should be noted that this application addresses the technical problems existing in related technologies by proposing an improvement to the model structure of the pre-trained model. This improvement allows for subsequent model training based on the enhanced model structure. The pre-trained model structure includes a BERT model structure, which incorporates Roberta and Albert models. This pre-trained model includes a model for predicting the matching scores of search terms and search results. The improved model structure includes the model structure of the model to be trained; that is, the model structure of the model to be trained contains the model structure of the pre-trained model. Thus, this application allows for model training based on the predictive matching capabilities of the pre-trained model, combined with the improved model structure, enabling the training of a model that satisfies multi-scenario search tasks.

[0066] The following describes part of the model structure of the model to be trained in this application, which includes an embedding layer and a gating layer. In this application, the embedding layer of the model to be trained can perform vector mapping on multiple search sample scenarios to obtain search scenario vectors corresponding to each of the multiple search sample scenarios. Furthermore, the gating layer of the model to be trained can perform weight allocation on multiple search scenario vectors to obtain scene weight vectors corresponding to each of the multiple search scenario vectors, where each search scenario vector corresponds to a single search sample scenario. Thus, in this application, the scene information of the search sample scenarios can be learned in advance, and the scene weight vector corresponding to each search sample scenario can be determined, facilitating the subsequent enhancement of the model's perceptual capabilities based on these scene weight vectors.

[0067] Furthermore, such as Figure 5 As shown, Figure 5 This is a schematic diagram of the structure of the model to be trained in a matching model construction method provided in an embodiment of this application. Figure 5The to-be-trained model comprises an embedding layer and a gating layer, wherein the gating layer comprises a first activation layer and a second activation layer, the first activation layer comprises a relu function, and the second activation layer comprises a sigmoid function. Specifically, the plurality of search sample scenarios can be first input into the embedding layer in the to-be-trained model to obtain search scenario vectors corresponding to the embedding layer outputs of the plurality of search sample scenarios, then the plurality of search scenario vectors are input into the first activation layer of the embedding layer in the to-be-trained model to obtain initial weight vectors corresponding to the first activation layer outputs of the plurality of search scenario vectors, wherein the initial weight vectors are non-negative vectors, and finally the plurality of initial weight vectors are input into the second activation layer of the embedding layer in the to-be-trained model to obtain scenario weight vectors corresponding to the second activation layer outputs of the plurality of initial weight vectors, wherein the scenario weight vectors are vectors between 0 and 1, and the sum of the plurality of scenario weight vectors can be 1. In this way, the model learns the interaction information between the search scenario and the search sample in the subsequent model training process.

[0068] S403: For each search sample scenario, obtaining a word fusion vector corresponding to a search sample word and a result fusion vector corresponding to a search sample result by the to-be-trained model according to the scenario weight vector corresponding to the search sample scenario, the search sample word in the training data corresponding to the search sample scenario, and the search sample result.

[0069] In this step, a single search sample scenario is described. The to-be-trained model can obtain a word fusion vector corresponding to a search sample word and a result fusion vector corresponding to a search sample result based on the scenario weight vector corresponding to a single search sample scenario, in combination with the search sample word and the search sample result in the search sample scenario. Since the fusion vector contains scenario weight information at this time, it can strengthen the prediction matching ability of the model for the search sample word and the search sample result under the search sample scenario. It should be noted that in the present application, if vector fusion processing is required for multiple search sample scenarios, the vector fusion processing can be performed on each search sample scenario by referring to the above fusion vector process of a single search sample scenario.

[0070] Next, the part of the model structure of the to-be-trained model in the present application is introduced, wherein the to-be-trained model includes a neural layer and a fusion layer, the neural layer is the model structure of the pre-trained model (i.e., the transformer structure), and the execution process of the embedding layer and the gating layer in the present application can be a parallel process with the execution process of the neural layer. For each search sample scene, the to-be-trained model in the present application can convert the search sample word in the training data corresponding to the search sample scene into a vector through the neural layer to obtain a sample word vector corresponding to the search sample word, and can convert the search sample result in the training data corresponding to the search sample scene into a vector through the neural layer to obtain a sample result vector corresponding to the search sample result.

[0071] The fusion layer is used to fuse the scene weight vector into the word vector and the result vector. Specifically, the scene weight vector and the sample word vector corresponding to the search sample scene can be fused into a word fusion vector through the fusion layer in the to-be-trained model, and the scene weight vector and the sample result vector corresponding to the search sample scene can be fused into a result fusion vector through the fusion layer in the to-be-trained model. It should be noted that the scene weight vector and the sample word vector (the scene weight vector and the sample result vector) can be multiplied element by element (i.e., element by element) in the present application to obtain the word fusion vector (the result fusion vector), and the implementation means of the vector fusion is not limited herein and can be selected in actual application. In this way, the word fusion vector and the result fusion vector with scene information fused in can be obtained through the vector fusion process in the present application, so as to increase the perception ability of the model to the cross-domain scene.

[0072] As shown in Figure 6 , Figure 6 The structure diagram of the to-be-trained model in another construction method of the matching model provided by the embodiments of the present application is shown in Figure 6 The to-be-trained model includes an embedding layer, a gating layer, a neural layer and a fusion layer, wherein Q1 and Q2 represent a plurality of words in the search sample word, T1 and T2 represent a plurality of words in the search sample result, CLS is used for a classification task in the neural layer (i.e., Q1 and Q2 belong to the search sample word, and T1 and T2 belong to the search sample result), SEP is used for a division task in the neural layer (i.e., Q1, Q2, T1 and T2 are divided), E CLS represents the word semantic vector corresponding to the search sample word and the result semantic vector corresponding to the search sample result, E Q1 and EQ2 represent a plurality of first word vectors corresponding to the search sample word, and ET1 and ET2 represent a plurality of second word vectors corresponding to the search sample result.

[0073] Specifically, in the present application, firstly, the scene weight vectors corresponding to the plurality of search sample scenarios can be determined according to the embedding layer and the gating layer in the to-be-trained model; then, for each search sample scenario, the present application can perform vector conversion on the search sample words in the search sample scenario according to the neural layer in the to-be-trained model to obtain the initial word semantic vector and the plurality of initial first word vectors corresponding to the search sample words, and perform vector conversion on the search sample results in the search sample scenario to obtain the initial result semantic vector and the plurality of initial second word vectors corresponding to the search sample results, wherein the initial word semantic vector and the plurality of initial first word vectors corresponding to the search sample words can be used as the sample word vectors corresponding to the search sample words, and the initial result semantic vector and the plurality of initial second word vectors corresponding to the search sample results can be used as the sample result vectors corresponding to the search sample results.

[0074] Finally, the scene weight vector, the initial word semantic vector and the plurality of initial first word vectors in the search sample scenario can be input into the fusion layer in the to-be-trained model to obtain the word semantic vector and the plurality of first word vectors (i.e., the word fusion vector) corresponding to the search sample words, and the scene weight vector, the initial result semantic vector and the plurality of initial second word vectors in the search sample scenario can be input into the fusion layer in the to-be-trained model to obtain the result semantic vector and the plurality of second word vectors (i.e., the result fusion vector) corresponding to the search sample results. In this way, the semantic vector and the word vector can be fully integrated into the scene weight vector, and the prediction matching ability of the subsequent model for the search words and the search results in different search scenarios is enhanced to a certain extent.

[0075] S404: For each search sample scenario, the word fusion vector and the result fusion vector are input into the to-be-trained model for matching prediction processing to obtain a matching prediction score.

[0076] First of all, it should be noted that in the related art, when the matching model implements the matching work, the matching degree of the task and the result is usually predicted through the semantic vector of the task and the semantic vector of the result, which may have the problem of semantic drift, thereby affecting the prediction effect of the matching degree. In the embodiment of the present application, before step S404 is performed, the following optional implementation manner can also be performed to improve the prediction effect of the model, which will be introduced below. It should be noted that the implementation manner given in the following introduction is only exemplary and does not represent all implementation manners of the embodiment of the present application.

[0077] The first optional implementation manner is:

[0078] According to step S403, the word fusion vector includes a plurality of first word vectors corresponding to the search sample word, and the plurality of first word vectors fuse the scene weight information. In this optional implementation manner, the to-be-trained model further includes a discrimination layer, which is used to discriminate the importance of the word vectors in the plurality of first word vectors. It can be understood that, in the present application, the importance of the word vectors is discriminated, so that the word that can dominate the sentence semantics can be determined, thereby improving the prediction effect of the subsequent model to a certain extent, and the problem of semantic drift can also be avoided.

[0079] Specifically, for each search sample scene, the discrimination layer in the to-be-trained model can be used to discriminate the plurality of first word vectors to obtain a plurality of first word vector weights corresponding to the plurality of first word vectors, respectively. In this way, in the present application, the word vector weights of the word vectors can be determined through discrimination, so as to grasp the key information of the text in the subsequent model prediction process, so as to further improve the prediction ability of the model. It should be noted that when the search sample word and the search sample result in each search sample scene are labeled, the word vector weight of the search sample word in each search sample scene can also be labeled, so as to facilitate the parameter adjustment of the subsequent model.

[0080] The second optional implementation manner is:

[0081] According to step S403, the result fusion vector includes a plurality of second word vectors corresponding to the search sample result, and the plurality of second word vectors fuse the scene weight information. In this optional implementation manner, the to-be-trained model further includes a matching layer and a convolution layer, wherein the matching layer is used to perform explicit matching and implicit matching on the search sample word and the search sample result, so as to pre-calculate the matching degree of the search sample word and the search sample result, and facilitate the subsequent prediction of the matching score in combination with the semantic vector, so as to improve the prediction ability of the model to a certain extent.

[0082] Specifically, for each search sample scene, the matching layer in the to-be-trained model can be used to perform explicit matching on the search sample word and the search sample result in the training data corresponding to the search sample scene to obtain a first matching matrix. The search sample word and the search sample result can be matched word by word in the order of the word arrangement. If the word in the search sample word is equal to the word in the search sample result, 1 is output. If the word in the search sample word is not equal to the word in the search sample result, 0 is output, so as to obtain the first matching matrix. In this way, the correlation between the search sample word and the search sample result can be directly and quickly captured.

[0083] After that, the application can perform implicit matching on the plurality of first word vectors and the plurality of second word vectors one by one (i.e., one first word vector and one second word vector are matched) through a matching layer in the to-be-trained model to obtain a second matching matrix, wherein the plurality of first word vectors and the plurality of second word vectors can be subjected to cosine similarity calculation to obtain the second matching matrix. In this way, the understanding ability and generalization ability of the model for text semantics can be enhanced, so that the model can be more accurate and effective when processing complex semantic relationships.

[0084] Finally, the first matching matrix and the second matching matrix can be convolved through a convolution layer in the to-be-trained model to obtain a matrix fusion vector. In this way, a more representative vector can be obtained through matrix convolution processing, which reduces data redundancy and improves processing efficiency to a certain extent. It should be noted that for the above two optional implementation manners, the terminal device can implement one or a combination of multiple manners, and the application does not limit this.

[0085] In an implementable embodiment, according to step S403, the word fusion vector further includes a word semantic vector corresponding to the search sample word, and the result fusion vector further includes a result semantic vector corresponding to the search sample result. Further, the to-be-trained model in the application further includes a prediction layer. For each search sample scene, the application can obtain a first splicing vector corresponding to the word semantic vector and a second splicing vector corresponding to the result semantic vector through the prediction layer in the to-be-trained model according to the plurality of first word vector weights, the matrix fusion vector, the word semantic vector and the result semantic vector. Based on this, the prediction layer in the to-be-trained model can be used to match and predict the first splicing vector and the second splicing vector to obtain a matching prediction score. In this way, the word semantic vector and the result semantic vector in the application respectively fuse the word vector weight and the matrix fusion vector, so that the prediction matching ability of the model can be improved from the dimensions of scene information, word importance and matrix matching.

[0086] Further, the obtaining process of the first splicing vector and the obtaining process of the second splicing vector in the application will be introduced. For each search sample scene, the prediction layer in the to-be-trained model can be used to perform weighted calculation on the plurality of first word vector weights and the matrix fusion vector to obtain a weighted matrix fusion vector in the application. In this way, the literal similarity and semantic similarity of the search sample word and the search sample result and the word importance of the search sample word can be comprehensively considered in the application, so that more comprehensive and accurate prediction results can be obtained in the subsequent process.

[0087] After that, the weighted matrix fusion vector and the word semantic vector can be vector spliced through the prediction layer in the to-be-trained model to obtain a first spliced vector corresponding to the word semantic vector, and the weighted matrix fusion vector and the result semantic vector can be vector spliced through the prediction layer in the to-be-trained model to obtain a second spliced vector corresponding to the result semantic vector. In this way, the spliced vector fusing multi-dimensional information can be used for score prediction in the subsequent process, and the prediction ability of the model is improved.

[0088] As shown in Figure 7 , Figure 7 is a structural schematic diagram of a to-be-trained model provided by another matching model construction method of an embodiment of the present application. In Figure 7 , the to-be-trained model includes a prediction layer, wherein the prediction layer includes a pooling layer, an aggregation layer, and a normalization layer, and the normalization layer includes a softmax function. Specifically, in the present application, the weighted matrix fusion vector can be obtained by performing weighted calculation on the plurality of first word vector weights and the matrix fusion vector through the pooling layer in the prediction layer, after which the first spliced vector corresponding to the word semantic vector and the second spliced vector corresponding to the result semantic vector can be obtained by performing vector splicing on the weighted matrix fusion vector, the word semantic vector, and the result semantic vector through the aggregation layer in the prediction layer, and finally the matching prediction score can be obtained according to the first spliced vector and the second spliced vector through the normalization layer in the prediction layer.

[0089] S405: For the plurality of search sample scenarios, based on the plurality of matching label scores and the plurality of matching prediction scores, the parameters of the to-be-trained model are adjusted until the adjusted model meets the model adjustment stop condition, and the matching model is obtained after the adjustment is completed.

[0090] In this step, for each search sample scenario, the parameters of the to-be-trained model can be adjusted based on the matching label score and the matching prediction score corresponding to the search sample scenario. Correspondingly, for the plurality of search sample scenarios, the parameters of the to-be-trained model can be adjusted based on the matching label scores and the matching prediction scores corresponding to the plurality of search sample scenarios respectively. In this way, the matching model finally obtained can meet the multi-scenario search task.

[0091] It should be noted that in the present application, for each search sample scenario, the model adjustment stop condition includes a first condition and a second condition, wherein the first condition is a condition about the loss of the matching prediction score, and the second condition is a condition about the loss of the discriminative word vector weight. It can be understood that the first condition can support the adjustment of the parameters of the prediction layer in the to-be-trained model, and the second condition can support the adjustment of the parameters of the discriminative layer in the to-be-trained model.

[0092] In another implementable embodiment, the to-be-trained model in the present application further comprises a classification layer. Specifically, for each search sample scene, the present application can classify the search sample word and / or the search sample result under the search sample scene through the classification layer in the to-be-trained model to determine the category corresponding to the search sample word and / or the search sample result while discriminating the plurality of first word vectors through the discrimination layer in the to-be-trained model to obtain the first word vector weights corresponding to the plurality of first word vectors respectively, so as to improve the semantic generalization capability of the model. Moreover, through the discrimination of the word vector weights and the classification of the category in the present application, the model can be prevented from excessively deviating from semantic matching and losing the capability of text matching to a certain extent.

[0093] It should be noted that the category can be understood as a classification category to which the search sample word or the search sample result belongs, and the present application can further perform classification labeling on the search sample word and / or the search sample result under each search sample scene when labeling the search sample word and the search sample result under each search sample scene, so as to facilitate the subsequent model parameter adjustment. Further, the model adjustment stop condition further comprises a third condition, wherein the third condition is a condition about the loss of the classification of the search sample word and / or the search sample result, which can support the adjustment of the parameters of the classification layer in the to-be-trained model.

[0094] As shown in Figure 8 , Figure 8 FIG. 2 is a structural schematic diagram of a to-be-trained model in another matching model construction method provided by the embodiments of the present application. Next, the construction process of the to-be-trained model will be described by taking a single search sample scene as an example. Figure 8 In the to-be-trained model, the search sample scene can be first input into the embedding layer and the gating layer to obtain the output scene weight vector corresponding to the search sample scene, and the search sample word and the search sample result under the search sample scene can be input into the neural layer to obtain the output sample word vector corresponding to the search sample word and the output sample result vector corresponding to the search sample result.

[0095] After that, the scene weight vector, the sample word vector and the sample result vector can be input into the fusion layer to obtain the output word fusion vector corresponding to the search sample word and the output result fusion vector corresponding to the search sample result. Moreover, the word fusion vector can be input into the discrimination layer and the classification layer to obtain the first word vector weights corresponding to the plurality of first word vectors in the word fusion vector output by the discrimination layer, and the search sample word, the search sample result, the word fusion vector and the result fusion vector can be input into the matching layer to obtain the first matching matrix and the second matching matrix.

[0096] Finally, the first matching matrix and the second matching matrix can be convolved based on the convolution layer to obtain a matrix fusion vector, and a matching prediction score output by the prediction layer can be obtained according to the plurality of first word vector weights, the word fusion vector, the result fusion vector, the first matching matrix, and the second matching matrix through the prediction layer.

[0097] It can be seen that in the embodiments of the present application, training data in multiple search sample scenarios can be introduced at the same time for model training, so that the present application can train a model that meets the multi-scenario search task, avoiding the problem of a large amount of resource consumption caused by the need to construct a matching model for each scenario in the related art, and to some extent, also improving the matching effect when the matching model is applied subsequently.

[0098] The above process is the construction process of the matching model in the present application. Next, the application process of the matching model in the present application is introduced. Referring to Figure 9 , which is a flowchart of a matching method provided by an embodiment of the present application. As shown in the matching method Figure 9 , the following steps are included, and the matching model used in the following steps is obtained according to the construction method of the matching model described above:

[0099] S901: Obtain a to-be-matched search word in a target search scenario and a to-be-matched search result corresponding to the to-be-matched search word.

[0100] In this step, the to-be-matched search word is a search word input by a search object. At this time, the server can determine the target search scenario corresponding to the to-be-matched search word based on the to-be-matched search word, and recall the to-be-matched search result corresponding to the to-be-matched search word from the database according to the to-be-matched search word. The recalled to-be-matched search result can be one or multiple, which is not limited here.

[0101] S902: Perform vector weight processing on the target search scenario through the matching model to obtain a target scene weight vector corresponding to the target search scenario.

[0102] In this step, the target scene weight vector corresponding to the target search scenario can be determined based on the matching model, which facilitates the fusion of subsequent scene information. It should be noted that the process of determining the scene weight vector in this step is similar to the process of obtaining the scene weight vector in the model construction method described above, which will not be described here.

[0103] S903: Obtain a first matching vector corresponding to the to-be-matched search word and a second matching vector corresponding to the to-be-matched search result through the matching model according to the target scene weight vector, the to-be-matched search word, and the to-be-matched search result.

[0104] In this step, the target scene weight vector and the search term to be matched can be processed using a matching model to obtain the first matching vector corresponding to the search term. Similarly, the target scene weight vector and the search result to be matched can be processed using the matching model to obtain the second matching vector corresponding to the search result. By fusing scene information, the prediction performance of subsequent models can be improved. It should be noted that the process of determining the matching vector in this step is similar to the process of determining the fusion vector in the model construction method described above, and will not be repeated here.

[0105] S904: The first matching vector and the second matching vector are matched and predicted using the matching model to obtain the target matching score.

[0106] It should be noted that the process of determining the target matching score in this step is similar to the process of determining the matching prediction score in the model construction method described above, and will not be repeated here. The target matching score indicates whether to display the search result to be matched to the search object. Understandably, if the target matching score is 10 (i.e., the target matching score indicates that the search result to be matched should be displayed to the search object), then the search result to be matched can be displayed to the search object. Furthermore, if it is necessary to predict multiple search results to be matched for the search term, the matching scores corresponding to the multiple search results can be sorted, and the search results can be displayed to the search object sequentially according to the sorting result.

[0107] like Figure 10 As shown, Figure 10 This is a schematic diagram illustrating a matching method provided in an embodiment of this application. Figure 10 This illustrates the process of displaying corresponding search results to a search object based on the search terms used to search for that object. Figure 10 In the search query, “XXXX” represents the search term to be matched entered by the search object. At this time, the server can determine that the search scenario corresponding to the search term is an emoji scenario, and determine multiple search results to be matched for the search term under the emoji scenario from the database. After that, the matching model predicts and matches the search term and multiple search results to be matched to obtain multiple matching scores. Finally, based on the multiple matching scores, the search results to be matched are displayed to the search object.

[0108] It can be seen that in the embodiments of the present application, the search scene corresponding to the search term can be determined according to the search term first, so that the scene weight vector corresponding to the search scene can be determined through the matching model. Based on this, the scene weight vector can be fused into the search term and the search result, thereby improving the prediction performance of the model. In addition, in actual application, the application time length of the search result shown to the search object based on the matching model shows a growth trend, such as: the total play time of the video shown to the search object increases by 20.3%, and the group chat organization shown to the search object, the joining object of the group chat organization increases by 1.6%, etc.

[0109] Based on the construction method of the matching model provided in the foregoing embodiments, the present application also correspondingly provides a construction device of a matching model. The construction device of the matching model provided in the embodiments of the present application is specifically introduced as follows.

[0110] Referring to Figure 11 , the figure is a structural schematic diagram of a construction device of a matching model provided in the embodiments of the present application. As Figure 11 indicated, the construction device of the matching model specifically comprises:

[0111] The training data acquisition unit 1101 is configured to acquire a plurality of search sample scenes and a plurality of sets of training data, wherein each set of training data comprises a matching label score, a search sample term and a search sample result corresponding to the search sample term, and each set of training data corresponds to a different search sample scene.

[0112] The weight vector obtaining unit 1102 is configured to perform vector weight processing on the plurality of search sample scenes by a to-be-trained model to obtain a scene weight vector corresponding to each of the plurality of search sample scenes.

[0113] The fusion vector obtaining unit 1103 is configured to, for each search sample scene, obtain a term fusion vector corresponding to the search sample term and a result fusion vector corresponding to the search sample result according to the scene weight vector corresponding to the search sample scene, the search sample term and the search sample result in the training data corresponding to the search sample scene by the to-be-trained model.

[0114] The prediction score obtaining unit 1104 is configured to, for each search sample scene, perform matching prediction processing on the term fusion vector and the result fusion vector by the to-be-trained model to obtain a matching prediction score.

[0115] The matching model obtaining unit 1105 is configured to, for the plurality of search sample scenes, adjust the parameters of the to-be-trained model based on a plurality of matching label scores and a plurality of matching prediction scores until the adjusted model meets a model adjustment stop condition, and the adjustment is ended to obtain a matching model.

[0116] In an implementable embodiment, the weight vector obtaining unit 1102 is specifically configured to:

[0117] vector mapping is performed on the plurality of search sample scenes by an embedding layer in the to-be-trained model, to obtain search scene vectors respectively corresponding to the plurality of search sample scenes;

[0118] weight distribution is performed on the plurality of search scene vectors by a gating layer in the to-be-trained model, to obtain scene weight vectors respectively corresponding to the plurality of search scene vectors.

[0119] In an implementable embodiment, the fusion vector obtaining unit 1103 is specifically configured to:

[0120] vector conversion is performed on a search sample word and a search sample result in the training data corresponding to each search sample scene by a neural layer in the to-be-trained model, to obtain a sample word vector corresponding to the search sample word and a sample result vector corresponding to the search sample result;

[0121] vector fusion is performed on the scene weight vector corresponding to the search sample scene and the sample word vector by a fusion layer in the to-be-trained model, to obtain a word fusion vector corresponding to the search sample word;

[0122] vector fusion is performed on the scene weight vector corresponding to the search sample scene and the sample result vector by the fusion layer in the to-be-trained model, to obtain a result fusion vector corresponding to the search sample result.

[0123] In an implementable embodiment, the apparatus further includes:

[0124] a word vector discrimination unit configured to, for each search sample scene, perform discrimination on the plurality of first word vectors by a discrimination layer in the to-be-trained model, to obtain first word vector weights respectively corresponding to the plurality of first word vectors.

[0125] In an implementable embodiment, the apparatus further includes:

[0126] a first matching matrix obtaining unit configured to, for each search sample scene, perform matching on a search sample word and a search sample result in the training data corresponding to the search sample scene by a matching layer in the to-be-trained model, to obtain a first matching matrix;

[0127] a second matching matrix obtaining unit configured to perform matching on the plurality of first word vectors and the plurality of second word vectors by the matching layer in the to-be-trained model, to obtain a second matching matrix;

[0128] The matrix fusion vector obtaining unit is configured to obtain a matrix fusion vector by performing convolution on the first matching matrix and the second matching matrix through a convolution layer in the to-be-trained model.

[0129] In an implementable embodiment, the prediction score obtaining unit 1104 includes:

[0130] The splicing vector obtaining unit is configured to, for each search sample scene, obtain a first splicing vector corresponding to the word semantic vector and a second splicing vector corresponding to the result semantic vector by performing vector splicing on the weighted matrix fusion vector and the word semantic vector through a prediction layer in the to-be-trained model.

[0131] The score matching prediction unit is configured to obtain a matching prediction score by performing matching prediction on the first splicing vector and the second splicing vector through a prediction layer in the to-be-trained model.

[0132] In an implementable embodiment, the splicing vector obtaining unit is specifically configured to:

[0133] For each search sample scene, the splicing vector obtaining unit is configured to perform weighted calculation on the plurality of first word vector weights and the matrix fusion vector through a prediction layer in the to-be-trained model to obtain a weighted matrix fusion vector.

[0134] The splicing vector obtaining unit is configured to obtain a first splicing vector corresponding to the word semantic vector by performing vector splicing on the weighted matrix fusion vector and the word semantic vector through a prediction layer in the to-be-trained model.

[0135] The splicing vector obtaining unit is configured to obtain a second splicing vector corresponding to the result semantic vector by performing vector splicing on the weighted matrix fusion vector and the result semantic vector through a prediction layer in the to-be-trained model.

[0136] In an implementable embodiment, for each search sample scene, the model adjustment stop condition includes a first condition and a second condition, wherein the first condition is a condition about the loss of the matching prediction score, and the second condition is a condition about the loss of the discriminative word vector weight.

[0137] The matching model construction apparatus provided in the embodiments of the present application has the same beneficial effects as the matching model construction method provided in the above embodiments, and thus will not be described again.

[0138] Based on the matching method provided in the above embodiments, the present application further provides a matching apparatus. The matching apparatus provided in the embodiments of the present application will be described in detail below. Referring to Figure 12 The figure is a structural schematic diagram of a matching apparatus provided in an embodiment of the present application. As shown in Figure 12As shown, the matching device specifically comprises:

[0139] The to-be-matched data acquisition unit 1201 is configured to acquire a to-be-matched search term in a target search scenario and a to-be-matched search result corresponding to the to-be-matched search term.

[0140] The target weight vector obtaining unit 1202 is configured to perform vector weight processing on the target search scenario by using a matching model to obtain a target scene weight vector corresponding to the target search scenario, wherein the matching model is a model trained according to the construction method of the matching model.

[0141] The matching vector obtaining unit 1203 is configured to obtain a first matching vector corresponding to the to-be-matched search term and a second matching vector corresponding to the to-be-matched search result by using the matching model according to the target scene weight vector, the to-be-matched search term, and the to-be-matched search result.

[0142] The target matching score obtaining unit 1204 is configured to perform matching prediction processing on the first matching vector and the second matching vector by using the matching model to obtain a target matching score, wherein the target matching score is used to indicate whether the to-be-matched search result is to be shown to a search object.

[0143] The matching device provided in the embodiments of the present application has the same beneficial effects as the matching method provided in the above embodiments, and thus will not be described again.

[0144] The embodiments of the present application provide a computer device, which can be a server. Figure 13 FIG. 9 is a schematic diagram of a server structure according to an embodiment of the present application. The server 900 can have a great difference due to different configurations or performances, and can include one or more central processing units (CPUs) 922 (for example, one or more processors) and a memory 932, one or more storage media 930 (for example, one or more mass storage devices) storing application programs 942 or data 944. The memory 932 and the storage media 930 can be temporary storage or persistent storage. The programs stored in the storage media 930 can include one or more modules (not shown in the figure), and each module can include a series of instruction operations in the server. Further, the central processing unit 922 can be configured to communicate with the storage media 930 and execute a series of instruction operations in the storage media 930 on the server 900.

[0145] The server 900 can also include one or more power supplies 926, one or more wired or wireless network interfaces 950, one or more input / output interfaces 958, and / or one or more operating systems 941, such as Windows Server TM , Mac OS X TM , Unix TM , Linux TM , FreeBSD TM , etc.

[0146] The CPU 922 is configured to perform the following steps:

[0147] obtain a plurality of search sample scenarios and a plurality of sets of training data, wherein each set of training data includes a matching label score, a search sample word, and a search sample result corresponding to the search sample word, and each set of training data corresponds to a different search sample scenario;

[0148] perform vector weight processing on the plurality of search sample scenarios by a to-be-trained model to obtain a scenario weight vector corresponding to each search sample scenario;

[0149] for each search sample scenario, obtain a word fusion vector corresponding to the search sample word and a result fusion vector corresponding to the search sample result by the to-be-trained model according to the scenario weight vector corresponding to the search sample scenario, the search sample word, and the search sample result in the training data corresponding to the search sample scenario;

[0150] for each search sample scenario, perform matching prediction processing on the word fusion vector and the result fusion vector by the to-be-trained model to obtain a matching prediction score;

[0151] for the plurality of search sample scenarios, adjust parameters of the to-be-trained model based on a plurality of matching label scores and a plurality of matching prediction scores until the adjusted model meets a model adjustment stop condition, and the adjustment ends to obtain a matching model.

[0152] or

[0153] obtain a to-be-matched search word in a target search scenario and a to-be-matched search result corresponding to the to-be-matched search word;

[0154] perform vector weight processing on the target search scenario by a matching model to obtain a target scenario weight vector corresponding to the target search scenario, wherein the matching model is a model trained according to the construction method of the matching model described above;

[0155] obtaining, by the matching model, a first matching vector corresponding to the to-be-matched search word and a second matching vector corresponding to the to-be-matched search result according to the target scene weight vector, the to-be-matched search word and the to-be-matched search result;

[0156] performing matching prediction processing on the first matching vector and the second matching vector by the matching model to obtain a target matching score, wherein the target matching score is used to indicate whether the to-be-matched search result is shown to a search object.

[0157] The embodiment of the present application further provides another computer device, which can be a terminal device. As shown in the figure, for the convenience of illustration, only parts related to the embodiment of the present application are shown, and specific technical details not disclosed are for reference to the method part of the embodiment of the present application. Taking the terminal device as a mobile phone as an example: Figure 14

[0158] Figure 14 The figure shows a block diagram of part of the structure of the mobile phone provided by the embodiment of the present application. Referring to the figure, Figure 14 the mobile phone includes: radio frequency (English full name: Radio Frequency, English abbreviation: RF) circuit 1010, memory 1020, input unit 1030, display unit 1040, sensor 1050, audio circuit 1060, wireless fidelity (English full name: wireless fidelity, English abbreviation: WiFi) module 1070, processor 1080, and power supply 1090 and the like. Those skilled in the art can understand that, Figure 14 the structure of the mobile phone shown in the figure does not constitute a limitation on the mobile phone, and can include more or fewer components than the figure, or combine certain components, or different component arrangements.

[0159] The specific components of the mobile phone will be introduced below: Figure 14

[0160] ​​The RF circuit 1010 can be configured to receive and send signals during a process of information or communication, in particular, after receiving the downlink information from the base station, the processor 1080 processes the information; in addition, the uplink data is sent to the base station. Generally, the RF circuit 1010 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 1010 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), Email, Short Messaging Service (SMS), etc.

[0161] The memory 1020 can be configured to store software programs and modules, and the processor 1080 can execute various function applications and data processing of the mobile phone by running the software programs and modules stored in the memory 1020. The memory 1020 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 1020 can include a high-speed random access memory, and can also include a non-volatile memory, for example, at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device.

[0162] The input unit 1030 can be used to receive inputted digital or character information, and to generate key signal input with respect to user setting of the mobile phone and function control. Specifically, the input unit 1030 can include a touch panel 1031 and other input devices 1032. The touch panel 1031, also called a touch screen, can collect a touch operation (such as an operation of a user using a finger, a stylus, or any suitable object or accessory on or near the touch panel 1031) of the user on or near the touch panel 1031, and drive a corresponding connection device according to a pre-set program. Optionally, the touch panel 1031 can include two parts of a touch detection device and a touch controller. The touch detection device detects a touch position of the user and detects a signal caused by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into touch coordinates, and sends it to the processor 1080, and can receive a command from the processor 1080 and execute it. In addition, the touch panel 1031 can be implemented in various types such as a resistive type, a capacitive type, an infrared type, and a surface acoustic wave type. In addition to the touch panel 1031, the input unit 1030 can also include other input devices 1032. Specifically, the other input devices 1032 can include one or more of a physical keyboard, a function key (such as a volume control key, an on-off key, etc.), a trackball, a mouse, a joystick, etc.

[0163] The display unit 1040 can be used to display information input by the user or information provided to the user, and various menus of the mobile phone. The display unit 1040 can include a display panel 1041, which can be configured in the form of a liquid crystal display (English full name: Liquid Crystal Display, English abbreviation: LCD), an organic light-emitting diode (English full name: Organic Light-Emitting Diode, English abbreviation: OLED), etc. Further, the touch panel 1031 can cover the display panel 1041, and when the touch panel 1031 detects a touch operation on or near it, it is transmitted to the processor 1080 to determine the type of touch event, and then the processor 1080 provides corresponding visual output on the display panel 1041 according to the type of touch event. Although in the above embodiment, the touch panel 1031 and the display panel 1041 are realized as two independent components to realize the input and output functions of the mobile phone, in some embodiments, the touch panel 1031 and the display panel 1041 can be integrated to realize the input and output functions of the mobile phone. Figure 14

[0164] ​The mobile phone can further include at least one sensor 1050, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor can include an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 1041 according to the brightness of ambient light, and the proximity sensor can turn off the display panel 1041 and / or the backlight when the mobile phone is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and when at rest, it can detect the magnitude and direction of gravity, which can be used for identifying the posture of the mobile phone (such as switching between landscape and portrait, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), and the like. As for other sensors that can also be configured on the mobile phone, such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, and the like, they will not be described here.

[0165] The audio circuit 1060, the speaker 1061, and the microphone 1062 can provide an audio interface between the user and the mobile phone. The audio circuit 1060 can convert the received audio data into an electrical signal, transmit it to the speaker 1061, and convert it into a sound signal output by the speaker 1061; on the other hand, the microphone 1062 converts the collected sound signal into an electrical signal, which is received by the audio circuit 1060 and converted into audio data, and then output to the processor 1080 for processing, and then transmitted to another mobile phone through the RF circuit 1010, or output to the memory 1020 for further processing.

[0166] WiFi belongs to a short-range wireless transmission technology, and the mobile phone can help the user to send and receive emails, browse web pages, and access streaming media through the WiFi module 1070, which provides the user with wireless broadband Internet access. Although Figure 14 The WiFi module 1070 is shown, but it can be understood that it does not belong to the essential components of the mobile phone, and can be omitted as needed without changing the essence of the application.

[0167] The processor 1080 is the control center of the mobile phone, which connects all parts of the mobile phone through various interfaces and lines, executes various functions of the mobile phone and processes data by running or executing software programs and / or modules stored in the memory 1020 and calling data stored in the memory 1020, thereby collecting overall data and information of the mobile phone. Optionally, the processor 1080 can include one or more processing units; preferably, the processor 1080 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 1080.

[0168] The mobile phone further includes a power supply 1090 (such as a battery) for supplying power to various components, and preferably, the power supply is logically connected to the processor 1080 through a power management system, so that the power management system can realize functions such as charge management, discharge management, and power consumption management.

[0169] Although not shown, the mobile phone can further include a camera, a Bluetooth module, and the like, which will not be described here.

[0170] In the embodiments of the present application, the processor 1080 included in the mobile phone further has the following functions:

[0171] obtaining a plurality of search sample scenes and a plurality of sets of training data, wherein each set of training data includes a matching label score, a search sample word, and a search sample result corresponding to the search sample word, and each set of training data corresponds to a different search sample scene;

[0172] performing vector weight processing on the plurality of search sample scenes by using the to-be-trained model to obtain a scene weight vector corresponding to each of the plurality of search sample scenes;

[0173] For each search sample scene, obtaining a word fusion vector corresponding to the search sample word and a result fusion vector corresponding to the search sample result by using the to-be-trained model according to the scene weight vector corresponding to the search sample scene, the search sample word in the training data corresponding to the search sample scene, and the search sample result corresponding to the search sample scene;

[0174] For each search sample scene, performing matching prediction processing on the word fusion vector and the result fusion vector by using the to-be-trained model to obtain a matching prediction score;

[0175] For the plurality of search sample scenes, adjusting parameters of the to-be-trained model based on the plurality of matching label scores and the plurality of matching prediction scores until the adjusted model meets a model adjustment stop condition, and obtaining a matching model after the adjustment is completed.

[0176] Or;

[0177] obtaining a to-be-matched search word in a target search scene and a to-be-matched search result corresponding to the to-be-matched search word;

[0178] performing vector weight processing on the target search scene by using the matching model to obtain a target scene weight vector corresponding to the target search scene, wherein the matching model is a model trained according to the construction method of the matching model described above;

[0179] obtaining a first matching vector corresponding to the to-be-matched search word and a second matching vector corresponding to the to-be-matched search result by using the matching model according to the target scene weight vector, the to-be-matched search word, and the to-be-matched search result.

[0180] performing matching prediction processing on the first matching vector and the second matching vector through the matching model to obtain a target matching score, wherein the target matching score is used to indicate whether the to-be-matched search result is shown to a search object.

[0181] The embodiments of the present application further provide a computer readable storage medium for storing a computer program, which, when running on a computer device, causes the computer device to execute any of the embodiments of the method for constructing a matching model or any of the embodiments of the matching method.

[0182] The embodiments of the present application further provide a computer program product including a computer program, which, when running on a computer device, causes the computer device to execute any of the embodiments of the method for constructing a matching model or any of the embodiments of the matching method.

[0183] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.

[0184] In several embodiments provided in the present application, it should be understood that the disclosed system and method can be implemented in other ways. For example, the system embodiments described above are merely illustrative, for example, the division of the system is only a logical function division, and actual implementation can have another division manner, for example, multiple systems can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed systems can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0185] The system described as a separate component can or can not be physically separated, and the component displayed as a unit can or can not be a physical unit, that is, it can be located in one place, or it can be distributed on multiple network units. According to actual needs, part or all of the units can be selected to achieve the purpose of the embodiment scheme.

[0186] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0187] The integrated unit, if implemented in the form of a software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (English full name: Read-Only Memory, English abbreviation: ROM), a random access memory (English full name: Random Access Memory, English abbreviation: RAM), a magnetic disk or an optical disk, and various computer program storage media.

[0188] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined target, and can be implemented entirely or partially by using software, hardware (such as a processing circuit or a memory) or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an integral module or unit that includes the functions of the module or unit.

[0189] The above embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method of constructing a matching model, characterized by, The method comprises: obtaining a plurality of search sample scenarios and a plurality of sets of training data, wherein each set of training data comprises a matching label score, a search sample word and a search sample result corresponding to the search sample word, and each set of training data corresponds to a different search sample scenario; performing vector weight processing on the plurality of search sample scenarios by a to-be-trained model to obtain a scenario weight vector corresponding to each of the plurality of search sample scenarios; for each search sample scenario, obtaining a word fusion vector corresponding to a search sample word and a result fusion vector corresponding to a search sample result by the to-be-trained model according to the scenario weight vector corresponding to the search sample scenario, the search sample word and the search sample result in the training data corresponding to the search sample scenario; for each search sample scenario, performing matching prediction processing on the word fusion vector and the result fusion vector by the to-be-trained model to obtain a matching prediction score; for the plurality of search sample scenarios, adjusting parameters of the to-be-trained model based on a plurality of matching label scores and a plurality of matching prediction scores until the adjusted model meets a model adjustment stop condition, and obtaining a matching model when the adjustment is completed.

2. The method of claim 1, wherein, The to-be-trained model comprises an embedding layer and a gating layer, and the vector weight processing on the plurality of search sample scenarios by the to-be-trained model comprises: performing vector mapping on the plurality of search sample scenarios by the embedding layer in the to-be-trained model to obtain a search scenario vector corresponding to each of the plurality of search sample scenarios; performing weight distribution on a plurality of search scenario vectors by the gating layer in the to-be-trained model to obtain a scenario weight vector corresponding to each of the plurality of search scenario vectors.

3. The method of claim 1, wherein, The to-be-trained model comprises a neural layer and a fusion layer, and the obtaining, for each search sample scenario, of a word fusion vector corresponding to a search sample word and a result fusion vector corresponding to a search sample result by the to-be-trained model according to the scenario weight vector corresponding to the search sample scenario, the search sample word and the search sample result in the training data corresponding to the search sample scenario comprises: for each search sample scenario, performing vector conversion on the search sample word and the search sample result in the training data corresponding to the search sample scenario by the neural layer in the to-be-trained model to obtain a sample word vector corresponding to the search sample word and a sample result vector corresponding to the search sample result; performing vector fusion on the scenario weight vector corresponding to the search sample scenario and the sample word vector by the fusion layer in the to-be-trained model to obtain the word fusion vector corresponding to the search sample word; performing vector fusion on the scenario weight vector corresponding to the search sample scenario and the sample result vector by the fusion layer in the to-be-trained model to obtain the result fusion vector corresponding to the search sample result.

4. The method of claim 3, wherein, The word fusion vector includes a plurality of first word vectors corresponding to the search sample word, and the to-be-trained model further includes a discrimination layer; before the matching prediction score is obtained by matching the word fusion vector and the result fusion vector through the to-be-trained model for each search sample scene, the method further includes: For each search sample scene, the plurality of first word vectors are discriminated through the discrimination layer in the to-be-trained model to obtain first word vector weights corresponding to the plurality of first word vectors respectively.

5. The method of claim 4, wherein, The result fusion vector includes a plurality of second word vectors corresponding to the search sample result, and the to-be-trained model further includes a matching layer and a convolution layer; before the matching prediction score is obtained by matching the word fusion vector and the result fusion vector through the to-be-trained model for each search sample scene, the method further includes: For each search sample scene, the search sample word and the search sample result in the training data corresponding to the search sample scene are matched through the matching layer in the to-be-trained model to obtain a first matching matrix; The plurality of first word vectors and the plurality of second word vectors are matched through the matching layer in the to-be-trained model to obtain a second matching matrix; The first matching matrix and the second matching matrix are convolved through the convolution layer in the to-be-trained model to obtain a matrix fusion vector.

6. The method of claim 5, wherein, The word fusion vector further includes a word semantic vector corresponding to the search sample word, the result fusion vector further includes a result semantic vector corresponding to the search sample result, and the to-be-trained model further includes a prediction layer; the matching prediction score is obtained by matching the word fusion vector and the result fusion vector through the to-be-trained model for each search sample scene, including: For each search sample scene, the first splicing vector corresponding to the word semantic vector and the second splicing vector corresponding to the result semantic vector are obtained through the prediction layer in the to-be-trained model according to the plurality of first word vector weights, the matrix fusion vector, the word semantic vector and the result semantic vector; The matching prediction score is obtained by matching and predicting the first splicing vector and the second splicing vector through the prediction layer in the to-be-trained model.

7. The method of claim 6, wherein, For each search sample scene, the first splicing vector corresponding to the word semantic vector and the second splicing vector corresponding to the result semantic vector are obtained through the prediction layer in the to-be-trained model according to the plurality of first word vector weights, the matrix fusion vector, the word semantic vector and the result semantic vector, including: For each search sample scene, the weighted matrix fusion vector is obtained by performing weighted calculation on the plurality of first word vector weights and the matrix fusion vector through the prediction layer in the to-be-trained model; The first splicing vector corresponding to the word semantic vector is obtained by performing vector splicing on the weighted matrix fusion vector and the word semantic vector through the prediction layer in the to-be-trained model; and The weighted matrix fusion vector and the result semantic vector are vector spliced through a prediction layer in the to-be-trained model, to obtain a second spliced vector corresponding to the result semantic vector.

8. The method of claim 4, wherein, The model adjustment stop condition includes a first condition and a second condition, where the first condition is a condition related to loss of a matching prediction score, and the second condition is a condition related to loss of a discriminative word vector weight.

9. A matching method, characterized by, The method comprises: obtaining a to-be-matched search word in a target search scenario and a to-be-matched search result corresponding to the to-be-matched search word; performing vector weight processing on the target search scenario through a matching model to obtain a target scenario weight vector corresponding to the target search scenario, where the matching model is a model trained according to the method for constructing the matching model in any one of claims 1-8; obtaining a first matching vector corresponding to the to-be-matched search word and a second matching vector corresponding to the to-be-matched search result through the matching model according to the target scenario weight vector, the to-be-matched search word, and the to-be-matched search result; performing matching prediction processing on the first matching vector and the second matching vector through the matching model to obtain a target matching score, where the target matching score is used to indicate whether to show the to-be-matched search result to a search object.

10. A matching model construction device characterized by comprising: The method comprises: a training data acquisition unit configured to obtain a plurality of search sample scenarios and a plurality of sets of training data, where each set of training data includes a matching label score, a search sample word, and a search sample result corresponding to the search sample word, and each set of training data corresponds to a different search sample scenario; a weight vector obtaining unit configured to perform vector weight processing on the plurality of search sample scenarios through a to-be-trained model to obtain scenario weight vectors corresponding to the plurality of search sample scenarios respectively; a fusion vector obtaining unit configured to, for each search sample scenario, obtain a word fusion vector corresponding to a search sample word and a result fusion vector corresponding to a search sample result through the to-be-trained model according to the scenario weight vector corresponding to the search sample scenario, the search sample word in the training data corresponding to the search sample scenario, and the search sample result corresponding to the search sample scenario; a prediction score obtaining unit configured to, for each search sample scenario, perform matching prediction processing on the word fusion vector and the result fusion vector through the to-be-trained model to obtain a matching prediction score; a matching model obtaining unit configured to, for the plurality of search sample scenarios, adjust parameters of the to-be-trained model based on a plurality of matching label scores and a plurality of matching prediction scores until the adjusted model satisfies a model adjustment stop condition, and obtain a matching model when the adjustment is completed.

11. A matching device, characterized by The method comprises: a to-be-matched data acquisition unit configured to obtain a to-be-matched search word in a target search scenario and a to-be-matched search result corresponding to the to-be-matched search word; a target weight vector obtaining unit configured to perform vector weight processing on the target search scenario through a matching model to obtain a target scenario weight vector corresponding to the target search scenario, where the matching model is a model trained according to the method for constructing the matching model. The matching vector obtaining unit is configured to obtain, according to the target scene weight vector, the search term to be matched, and the search result to be matched, a first matching vector corresponding to the search term to be matched and a second matching vector corresponding to the search result to be matched by using the matching model. The target matching score obtaining unit is configured to perform matching prediction processing on the first matching vector and the second matching vector by using the matching model to obtain a target matching score, wherein the target matching score is used to indicate whether the search result to be matched is to be shown to a search object.

12. A computer device, comprising: The device comprises a processor and a memory: The memory is configured to store a computer program and transmit the computer program to the processor; The processor is configured to execute the steps of the construction method of the matching model according to the instructions in the computer program, or execute the steps of the matching method.

13. A computer-readable storage medium, characterized in that, The computer readable storage medium is configured to store a computer program, and the computer program is executed by a computer device to implement the steps of the construction method of the matching model according to any one of claims 1 to 8, or implement the steps of the matching method according to claim 9.

14. A computer program product, characterised in that, The computer program is executed by a computer device to implement the steps of the construction method of the matching model according to any one of claims 1 to 8, or implement the steps of the matching method according to claim 9.