Training method and device of ranking model and electronic equipment

By generating sample pairs containing positive and negative samples in dropdown list search scenarios and optimizing the ranking model parameters using the number of keystrokes and relevance scores, the problem of ranking models failing to meet user needs was solved, resulting in better ranking results.

CN114880597BActive Publication Date: 2026-03-20BEIJING SANKUAI ONLINE TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-05
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

In existing technologies, ranking models cannot effectively utilize information from the user's search process in dropdown list search scenarios, resulting in ranking results that fail to meet user needs.

Method used

By obtaining a list of final states from the user's historical search process, sample pairs containing positive and negative samples are generated. During the iteration process, the target gradient is calculated based on the relevance score of the samples and the number of times they are typed, and the parameters of the ranking model are updated to optimize the model's ranking ability.

Benefits of technology

The ranking model's ranking ability in dropdown list search scenarios has been improved, making its ranking results better meet user needs. By taking into account the number of keystrokes and relevance scores, more accurate training samples are generated, and model parameters are optimized.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114880597B_ABST
    Figure CN114880597B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a kind of training method, device and electronic equipment of ranking model, the method includes: obtaining the terminal state list in user history search process;Based on the terminal state list, generate the sample pair containing positive sample and negative sample;In each iteration process, based on the first score of current sample pair, second score and the typing frequency corresponding to the terminal state list to which the current sample pair belongs, determine target gradient;In each iteration process, based on the target gradient obtained by this iteration, update the model parameter in the ranking model.The gradient required for the optimization of the ranking model is calculated in the embodiments of the present application, in addition to the correlation degree score output by the ranking model for positive and negative samples, the typing frequency that can represent search process information is also considered, so that the target gradient calculated can more accurately guide the optimization direction of the ranking model, so that the ranking result of the ranking model can more reasonably meet the search demand of user.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of model training, and in particular to a training method and device of a ranking model and an electronic device. BACKGROUND

[0002] With the rise of mobile Internet, users can quickly and conveniently obtain a large amount of information through the network, and search engines play an important role. The user inputs a corresponding search term in the search engine, the search engine obtains a large number of search results associated with the search term, and then outputs the search results after sorting.

[0003] At present, for search ranking algorithms, according to different loss functions corresponding to the algorithms, there are mainly three categories: pointwise, pairwise and listwise. However, no matter which of the above search ranking algorithms, only the final search results can be used to train the ranking model.

[0004] However, in the drop-down list search scenario, there is a dynamic process of continuous typing. Therefore, from the time the user starts to input the search term to the time the user finally clicks the search result, a plurality of different lists will be displayed in turn. Since the user only clicks the search result in the finally displayed list, it is impossible to determine the positive and negative samples in the remaining lists, resulting in that the remaining lists in the search process cannot be directly used for training of the ranking model. That is, the training of the ranking model does not take into account the information of the search process, resulting in that the ability of the ranking model is limited, and the ranking result cannot reasonably meet the user's search demand. SUMMARY

[0005] The embodiments of the present application provide a training method and device of a ranking model and an electronic device to at least solve the technical problem that the ability of the ranking model trained in the prior art is limited, and the ranking result cannot meet the user's search demand.

[0006] According to an aspect of an embodiment of the present application, a training method of a ranking model is provided, and the method comprises:

[0007] obtaining a terminal state list in a user's historical search process, wherein the terminal state list comprises a plurality of search results obtained based on target information input by the user;

[0008] generating a sample pair comprising a positive sample and a negative sample based on the terminal state list, wherein the positive sample is any search result in the terminal state list triggered by the user, and the negative sample is any search result in the terminal state list arranged before the positive sample and not triggered by the user;

[0009] determine a target gradient based on a first score of the current sample pair, a second score of the current sample pair, and a typing frequency corresponding to the terminal state list to which the current sample pair belongs, wherein the first score comprises a relevance score output by the ranking model based on a positive sample of the current sample pair, the second score comprises a relevance score output by the ranking model based on a negative sample of the current sample pair, and the typing frequency comprises a number of times that the input box updates data in the process of inputting the target information by the user;

[0010] update the model parameters in the ranking model based on the target gradient obtained in each iteration.

[0011] Optionally, the determining of the target gradient based on the first score of the current sample pair, the second score of the current sample pair, and the typing frequency corresponding to the terminal state list to which the current sample pair belongs comprises:

[0012] determine a first intermediate gradient with a loss of the optimization document list method as a target based on the first score, the second score, and a change of a target evaluation index, wherein the target evaluation index comprises an evaluation index of information retrieval determined based on the current sample pair;

[0013] determine a second intermediate gradient based on a first typing frequency corresponding to the positive sample in the current sample pair and a second typing frequency corresponding to the negative sample, wherein the first typing frequency is equal to the typing frequency corresponding to the terminal state list to which the current sample pair belongs, and the second typing frequency is a preset target number of times greater than the first typing frequency;

[0014] determine the product of the first intermediate gradient and the second intermediate gradient as the target gradient.

[0015] Optionally, the determining of the second intermediate gradient based on the first typing frequency corresponding to the positive sample in the current sample pair and the second typing frequency corresponding to the negative sample comprises:

[0016] calculate a reciprocal of a sum of the first typing frequency plus 1 to obtain a first reciprocal;

[0017] calculate a reciprocal of a sum of the second typing frequency plus 1 to obtain a second reciprocal;

[0018] calculate an absolute value of a difference between the first reciprocal and the second reciprocal to obtain a first target value;

[0019] determine a sum of the first target value plus 1 as the second intermediate gradient.

[0020] Optionally, the method further comprises: obtaining a target operating system of an electronic device used in a historical search process of the user, wherein different operating systems correspond to different scaling coefficients.

[0021] The calculation of the reciprocal of the sum of the first typing number plus 1 obtains a first reciprocal, comprising:

[0022] The calculation of the product of the first typing number and a target coefficient obtains a second target value; wherein the target coefficient is a scaling coefficient corresponding to the target operating system;

[0023] The calculation of the reciprocal of the sum of the second target value plus 1 obtains a first reciprocal.

[0024] Optionally, the determination of the first intermediate gradient taking the loss of the optimization of the document list method as the target according to the first score, the second score and the change of the target evaluation index, comprising:

[0025] The determination of the third intermediate gradient taking the loss of the optimization of the document pair method as the target based on the first score and the second score;

[0026] The calculation of the normalized loss cumulative gain change value of the positive sample and the negative sample in the current text pair before and after the exchange of their positions in the final state list;

[0027] The multiplication of the third intermediate gradient and the normalized loss cumulative gain change value is determined as the first intermediate gradient.

[0028] According to another aspect of the embodiments of the present application, a training device of a ranking model is provided, the device comprising:

[0029] The first acquisition module is configured to acquire a final state list in a user historical search process, wherein the final state list comprises a plurality of search results obtained based on user input target information search;

[0030] The sample module is configured to generate a sample pair comprising a positive sample and a negative sample based on the final state list, wherein the positive sample is any search result in the final state list triggered by a user, and the negative sample is any search result in the final state list arranged before the positive sample and not triggered by a user;

[0031] The first iteration module is configured to determine a target gradient based on a first score, a second score of a current sample pair and a typing number corresponding to a final state list to which the current sample pair belongs in each iteration process, wherein the first score comprises a relevance score output by the ranking model based on the positive sample of the current sample pair, the second score comprises a relevance score output by the ranking model based on the negative sample of the current sample pair, and the typing number comprises the number of times of updating data in an input box in the process of inputting the target information by a user;

[0032] a second iteration module, configured to update a model parameter in the ranking model based on the target gradient obtained in each iteration process.

[0033] Optionally, the first iteration module comprises:

[0034] a first determination unit, configured to determine a first intermediate gradient with a loss of an optimized document list method as a target according to the first score, the second score, and a variation of a target evaluation index, wherein the target evaluation index comprises an evaluation index of information retrieval determined based on the current sample pair;

[0035] a second determination unit, configured to determine a second intermediate gradient based on a first typing frequency corresponding to a positive sample pair in the current sample pair and a second typing frequency corresponding to a negative sample pair, wherein the first typing frequency is equal to a typing frequency corresponding to a terminal list pair to which the current sample pair belongs, and the second typing frequency is a preset target frequency greater than the first typing frequency;

[0036] a product of the first intermediate gradient and the second intermediate gradient is determined as the target gradient.

[0037] Optionally, the second determination unit comprises:

[0038] a first calculation sub-unit, configured to calculate a reciprocal of a sum of the first typing frequency plus 1 to obtain a first reciprocal;

[0039] a second calculation sub-unit, configured to calculate a reciprocal of a sum of the second typing frequency plus 1 to obtain a second reciprocal;

[0040] a third calculation sub-unit, configured to calculate an absolute value of a difference between the first reciprocal and the second reciprocal to obtain a first target value;

[0041] a first determination sub-unit, configured to determine a sum of the first target value plus 1 as the second intermediate gradient.

[0042] Optionally, the apparatus further comprises:

[0043] a second acquisition module, configured to acquire a target operating system of an electronic device used in a historical search process of a user, wherein different operating systems correspond to different scaling coefficients;

[0044] the first calculation sub-unit is specifically configured to calculate a product of the first typing frequency and a target coefficient to obtain a second target value, wherein the target coefficient is a scaling coefficient corresponding to the target operating system; and calculate a reciprocal of a sum of the second target value plus 1 to obtain the first reciprocal.

[0045] Optionally, the first determination unit comprises:

[0046] a second determining sub-unit, configured to determine a third intermediate gradient aiming at optimizing the loss of the document pair method based on the first score and the second score;

[0047] a fourth calculating sub-unit, configured to calculate a normalized loss cumulative gain change value before and after the positions of the positive sample and the negative sample in the final state list are exchanged respectively;

[0048] a third determining sub-unit, configured to determine the product of the third intermediate gradient and the normalized loss cumulative gain change value as a first intermediate gradient.

[0049] According to still another aspect of the embodiments of the present application, an electronic device is provided, comprising:

[0050] a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the training method of the ranking model when executing the program.

[0051] According to still another aspect of the embodiments of the present application, a readable storage medium is provided, which, when the instructions in the readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform the training method of the ranking model.

[0052] In the embodiments of the present application, the training sample required for training the final state list generation model, i.e., the sample pair containing the positive sample and the negative sample, can be generated in the drop-down list search scenario. Any search result triggered by the user can be regarded as the positive sample, and any search result arranged before the positive sample in the final state list and not triggered by the user can be regarded as the negative sample. When calculating the gradient required for optimizing the ranking model, in addition to the relevance score output by the ranking model for the positive and negative samples, the number of keystrokes that can represent the search process information is also considered, so that the target gradient calculated can more accurately guide the optimization direction of the ranking model. Here, the number of keystrokes includes the number of times the input box is updated in the process of inputting the target information by the user, that is, the search process information associated with the search process. Finally, the model parameters in the ranking model are updated using the target gradient, and the optimization of the ranking model is completed, so that the ranking model obtained after the training has better ranking ability, and the ranking result can more reasonably meet the search needs of the user. BRIEF DESCRIPTION OF DRAWINGS

[0053] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the description of the embodiments of the present application. Obviously, the drawings in the following description only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor.

[0054] Figure 1 The step flow chart of the training method of the ranking model provided by the embodiments of the present application;

[0055] Figure 2 The display schematic diagram of the terminal state list in the pull-down search scenario;

[0056] Figure 3 The distribution diagram of the real typing frequency in a period of time;

[0057] Figure 4 The distribution diagram of the corresponding typing frequency in different operating systems in a day;

[0058] Figure 5 The display schematic diagram of the optimization direction and intensity in the terminal state list;

[0059] Figure 6 The structural block diagram of the training device of the ranking model provided by the embodiments of the present application. DETAILED DESCRIPTION

[0060] The technical solutions in the embodiments of the present application will be described clearly and completely in the following with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the present application.

[0061] It should be understood that the "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily mean the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner.

[0062] In various embodiments of the present application, it should be understood that the size of the serial number of the following processes does not mean the execution order, and the execution order of the processes should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0063] Reference Figure 1The embodiment of the present application provides a training method of a ranking model, which comprises the following steps:

[0064] In step 101, a terminal state list in a user historical search process is acquired.

[0065] In this step, the terminal state list comprises a plurality of search results obtained based on target information input by a user. In a drop-down list search scenario, the user can input any information, and a terminal device searches for data (search results) associated with the information input by the user based on the information input by the user, and displays the search results to the user. Here, the search results are usually a plurality of data, and each piece of data becomes a search result. The search results are usually displayed to the user in the form of a list, that is, a terminal state list is displayed, and the list comprises a plurality of data, and each piece of data is a search result. It can be understood that the target information input by the user can be the result of multiple inputs, and in this case, the terminal state list is the list finally displayed to the user.

[0066] It should be noted that all actions of acquiring signals, information or data in the present application are performed under the premise of complying with the corresponding data protection regulations and policies of the country where the corresponding device is located, and with the authorization given by the owner of the corresponding device. For example, here the data in the user historical search process can be the search data of the user acquired after the authorization of the user. Of course, here the search data without the personal information of the user can also be directly acquired, and this part of data does not contain any information of the user.

[0067] In step 102, a sample pair comprising a positive sample and a negative sample is generated based on the terminal state list.

[0068] In this step, the terminal state list serves as a data source for model training, and the number of terminal state lists is usually large because the number of samples required for model training is large. Here, the training samples required for model training are presented in the form of sample pairs, wherein each sample pair comprises a positive sample and a negative sample, and the two samples are derived from the same terminal state list. Specifically, the positive sample is any search result in the terminal state list triggered by the user, and the negative sample is any search result arranged before the positive sample in the terminal state list and not triggered by the user.

[0069] In step 103, a target gradient is determined based on a first score and a second score of a current sample pair and a key-in frequency corresponding to a terminal state list to which the current sample pair belongs in each iteration process.

[0070] In this step, the training process of the ranking model is actually an iterative process, and since the process of each iteration is the same, only the process of an arbitrary iteration is described here. In the process of an iteration, the gradient of the ranking model that optimizes the ranking model, i.e., the direction that most reduces the loss, is calculated using the output of the ranking model. Here, the output of the ranking model is a relevance score, i.e., a score that is positively correlated with the relevance of the sample to the target information. Specifically, the first score includes the relevance score output by the ranking model based on the positive sample of the current sample pair, and the second score includes the relevance score output by the ranking model based on the negative sample of the current sample pair.

[0071] In the drop-down search scenario, since the user needs to enter information multiple times to achieve the purpose of inputting the target information, the number of times of entering information can be used as the search process information. Since the data in the search input box is updated each time the information is entered, the latest data is displayed, and therefore the number of times of updating the data in the search input box is equal to the number of times of entering information, the number of times of updating the data in the search input box can be regarded as the number of times of entering. As shown in Figure 2 , the target information is "hot pot", and the user enters "hot pot" in the search input box by entering information three times. Correspondingly, the list containing C1-C9 is the final list, and the corresponding number of times of entering is three. Preferably, since there is a case where the user enters information too quickly, causing the terminal device to fail to display the list in time, the number of times of entering can also refer to the number of times of updating the list on the front-end page in a complete search process. Continuing to take Figure 2 as an example, the information entered by the user for the first time is "h", the front-end page list displays A1-A9, the information entered by the user for the second time is "u", and then the information entered by the user for the third time is "o" in a very short time. At this time, since the front-end page fails to display the search results based on the information entered for the first two times in time, the front-end page displays the search results based on the information entered for the first three times, i.e., B1-B9, after displaying A1-A9. After the user enters the information for the last time, C1-C9 will be displayed, and in this process, the number of times of entering information by the user is four, but the number of times of updating the front-end page is three. At this time, the three times of updating the front-end page can be regarded as the number of times of entering.

[0072] Step 104: In each iteration process, based on the target gradient obtained in this iteration, update the model parameters in the ranking model.

[0073] In this step, each iteration process is actually a training process, and in each training or iteration process, the ranking model is optimized once, that is, the model parameters of the ranking model are updated. The model parameters are updated based on the calculated gradient, which is a specific way to optimize the model during model training. Here, the details are not repeated. It can be understood that the model parameters will be updated once in each iteration, and then the updated model parameters will be used for model training in the next iteration, so that the model parameters are constantly updated to constantly optimize the model. The training ends when the training result meets the preset condition, which can be a certain number of training times, but is not limited to this.

[0074] In the embodiments of this application, in the drop-down list search scenario, the training samples required for training the terminal state list generation model, that is, the sample pairs containing positive samples and negative samples, can be generated. Any search result triggered by the user can be regarded as a positive sample, and any search result arranged before the positive sample in the terminal state list and not triggered by the user can be regarded as a negative sample. When calculating the gradient required for optimizing the ranking model, in addition to the relevance scores output by the ranking model for the positive and negative samples, the number of keystrokes representing search process information is also considered, so that the target gradient calculated can more accurately guide the optimization direction of the ranking model. Here, the number of keystrokes includes the number of times the input box updates data in the process of the user inputting target information in the input box, that is, the search process information associated with the search process. Finally, the target gradient is used to update the model parameters in the ranking model to optimize the ranking model, so that the ranking model obtained after the training has better ranking ability, and the ranking result can more reasonably meet the user's search demand.

[0075] Optionally, based on the first score, the second score, and the number of keystrokes corresponding to the terminal state list to which the current sample pair belongs, the target gradient is determined, including:

[0076] According to the first score, the second score, and the change of the target evaluation index, a first intermediate gradient with the loss of optimizing the document list method as the target is determined, wherein the target evaluation index includes an information retrieval evaluation index determined based on the current sample pair.

[0077] It should be noted that the document list method is a listwise method, and the loss of the document list method is optimized, that is, the position information of the document or sample in the list is introduced on the basis of reducing the sample pairs of wrong relative relations, and the ranking position of the high-quality document in the front position is further improved. The position of the high-quality document in the front position can be effectively avoided. The evaluation indexes of information retrieval include: MRR (Mean Reciprocal Rank), MAP (Mean Average Precision) and the like. The MAP can be understood as the average accuracy of a single topic, which is the average value of the accuracy after each relevant document is retrieved. The MRR can be understood as taking the reciprocal of the ranking of the standard answer in the result given by the evaluated system as its accuracy, and then taking the average of all questions. The target evaluation index can be any one of them.

[0078] Based on the first key-in times corresponding to the positive sample in the current sample pair and the second key-in times corresponding to the negative sample, a second intermediate gradient is determined, wherein the first key-in times are equal to the key-in times corresponding to the terminal state list to which the current sample pair belongs, and the second key-in times are a preset target number greater than the first key-in times.

[0079] It should be noted that, in theory, the key-in times of different search results or documents in the same list should be the same regardless of whether they are clicked or not. Here, a transformation is performed, and the key-in times value corresponding to the clicked search results (positive samples) in the terminal state list is set to the real key-in times at the time of clicking. The key-in times value of the non-clicked search results (negative samples) is set to a preset constant. When determining the preset constant, the value of the preset constant needs to be greater than the real key-in times. Preferably, the distribution of the real key-in times in a period of time can be pulled, such as shown in FIG. 1, since the key-in times of most users are less than 40, the preset constant can be set to 40, but is not limited thereto. Figure 3

[0080] The product of the first intermediate gradient and the second intermediate gradient is determined as the target gradient.

[0081] In the embodiments of the present application, the second intermediate gradient determined based on the search process information is added to the first intermediate gradient with the loss of the document list method as the target, so that the target gradient can be further optimized based on the original document list method.

[0082] Optionally, based on the first key-in times corresponding to the positive sample in the current sample pair and the second key-in times corresponding to the negative sample, the second intermediate gradient is determined, comprising:

[0083] The reciprocal of the sum of the first key-in times plus 1 is calculated to obtain a first reciprocal;​

[0084] calculating the reciprocal of the sum of the second typing number plus 1, to obtain a second reciprocal;

[0085] calculating the absolute value of the difference between the first reciprocal and the second reciprocal, to obtain a first target value;

[0086] adding the sum of the first target value plus 1 to determine a second intermediate gradient.

[0087] It should be noted that the second intermediate gradient can be calculated by using Formula One, Formula One:

[0088]

[0089] wherein, denotes the second intermediate gradient, KS i denotes the first sample in the sample pair, KS j denotes the second sample in the sample pair, i denotes the position of the first sample in the terminal state list, j denotes the position of the second sample in the terminal state list, and abs is an absolute value function. When the first sample is a positive sample, KS i the value of is equal to the real typing number at the click time, i.e., the first typing number, and when the first sample is a negative sample, KS i the value of is equal to a preset constant, i.e., the second typing number.

[0090] In the embodiments of the present application, the typing numbers corresponding to the positive and negative samples are set to different values, and the second intermediate gradient is obtained by using the operation mode of reciprocal and absolute value.

[0091] Optionally, the method further includes: obtaining a target operating system of an electronic device used in a historical search process of a user, wherein different operating systems correspond to different scaling coefficients;

[0092] calculating the reciprocal of the sum of the first typing number plus 1, to obtain a first reciprocal, including:

[0093] calculating the product of the first typing number and a target coefficient, to obtain a second target value; wherein the target coefficient is a scaling coefficient corresponding to the target operating system;

[0094] calculating the reciprocal of the sum of the second target value plus 1, to obtain the first reciprocal.

[0095] It should be noted that due to the particularity of the dropdown list search scenario, the number of keystrokes corresponding to a user's single search process is strongly related to the device model. Taking the Android system and the Apple system as examples, the target information input by the user needs to pass through the input method before the upper box. For different input method types, the situation of the upper box is different. Assuming that users of different systems use the built-in input methods of the systems themselves, for the same input word "hot pot" in Chinese characters, the list of users using the Apple system will continuously switch during the process of typing the pinyin. For users using the Android system, before the user types the complete Chinese characters of "hot pot" through the input method, the pinyin in the process will not be shown in the upper box, so the dropdown list will not switch frequently. The differences in the input methods of the two systems will cause a large difference in the numerical value of the number of keystrokes during a single search process of the user. To avoid biased estimation during the training process, a scaling factor is used here. Specifically, the distribution of the number of keystrokes corresponding to different operating systems in a day can be retrieved, such as Figure 4 As shown, curve 41 represents the distribution of the number of keystrokes corresponding to users using the Apple system, and curve 42 represents the distribution of the number of keystrokes corresponding to users using the Android system. It can be found that in the overall distribution, the number of keystrokes corresponding to users using the Android system is indeed naturally lower than that of users using the Apple system. To eliminate this bias, we add a scaling factor to further normalize the number of keystrokes of the two operating systems. Specifically, the second target value can be determined using Formula 2.

[0096] Formula 2:

[0097]

[0098] where KS i represents the positive sample in the sample pair, os i represents the operating system, IOS represents the Apple operating system, and Android represents the Android operating system. scale represents the scaling factor corresponding to the Android operating system. Among them, the scaling factor corresponding to the Apple system can be regarded as 1.

[0099] In the embodiments of the present application, the data of different operating systems are normalized through the scaling factor, further avoiding the problem of deviation in the optimization direction.

[0100] Optionally, determining the first intermediate gradient with the loss of optimizing the document list method as the target according to the changes in the first score, the second score, and the target evaluation index includes:

[0101] Based on the first score and the second score, determining the third intermediate gradient with the loss of optimizing the document pair method as the target;

[0102] Calculate the normalized discounted cumulative gain (NDCG) change value of the positive sample and the negative sample in the position before and after the position of each sample in the final state list after the positive sample and the negative sample are exchanged in the current document pair;

[0103] The product of the third intermediate gradient and the normalized discounted cumulative gain change value is determined as the first intermediate gradient.

[0104] It should be noted that the document pair method is a pairwise method, and the loss of the document pair method is optimized, that is, the sample pair of the wrong relative relationship is reduced. The following will explain the calculation process of the target gradient in detail by a specific calculation formula. Here, LambdaRank can be used to calculate the target gradient on the basis of the Lambda gradient. Specifically, as formula three:

[0105]

[0106] Where λ ij represents the target gradient, σ represents a preset parameter, s i represents the first score of the positive sample, s j represents the second score of the negative sample, represents the NDCG change value of the positive sample and the negative sample in the position before and after the position of each sample in the final state list after the positive sample and the negative sample are exchanged, Referring to formula one.

[0107] In the embodiments of the present application, the LambdaRank algorithm is used to calculate the target gradient on the basis of the Lambda gradient. The model is optimized by taking advantage of the Lambda gradient, so that the ranking model obtained by training has good ranking effect.

[0108] As shown in Figure 5 , the final state list 1 and the final state list 2 are the corresponding final state lists in the two user search processes respectively. It is assumed that the number of keystrokes corresponding to the final state list 1 is less than the number of keystrokes corresponding to the final state list 2. Figure 5The horizontal bars in the middle target area 50 represent the clicked samples in the final state list, and the remaining horizontal bars represent the samples that are not clicked by the user. The first arrow 51, the second arrow 52, and the third arrow 53 represent the optimization direction and strength of the next round of samples corresponding to the three optimization methods of Pointwise, Listwise, and the method provided in the present application, respectively. Pointwise focuses only on the number of error sample pairs between positive and negative sample pairs, and to reduce the number of error samples, the optimization strength of the clicked samples at the back is greater. In addition to considering the errors between sample pairs, Listwise also considers the position information of the clicked samples in the list, that is, it considers the change in NDCG after the positive and negative sample pairs are exchanged. For the clicked samples at the top position, the NDCG changes greatly after the exchange, and therefore, the next iteration strength is as shown by the second arrow 52. In the method provided in the present application, for the case where the clicked samples in the final state list have the same position, we will add a larger coefficient to the final state list with a smaller number of keystrokes, resulting in the optimization strength of the final state list with a smaller number of keystrokes being greater than that of the final state list with a larger number of keystrokes. The sample plays a relatively greater role in the optimization process, and the present application does not change the relative optimization strength of the clicked samples. Therefore, the next iteration strength is as shown by the third arrow 53.

[0109] The test results of various parameters representing the performance of the ranking model trained using the method provided in the present application are shown in Table 1 and Table 2.

[0110] Offline metrics AUC NDCG@all NDCG@1 NDCG@7 Baseline group 0.892112 0.835752 0.656725 0.824474 Experimental group 0.900728 0.845832 0.675111 0.835786 Absolute difference +0.0086 +0.0100 +0.0183 +0.0113

[0111] Table 1

[0112]

[0113]

[0114] Table 2

[0115] In Table 1, AUC (Area Under Curve) is defined as the area enclosed by the ROC curve and the coordinate axis, QVCTR (Query view click through rate) represents the exposure click rate under one search intent; and KS represents the number of keystrokes.

[0116] The embodiments of the present application construct an optimization target conforming to a drop-down list search scenario, consider search process information, and simultaneously consider the optimization of the sorting effect inside and between the final state lists; the business characteristics of the present scenario are considered, normalization is performed on data of different operating systems through a scaling coefficient, and deviation problems in the optimization direction are avoided. Meanwhile, the overall link complexity is relatively low, and the effect is controllable, and from the data, feature, and model perspectives, the offline training and online service overheads are basically not increased.

[0117] Referring to Figure 6 The embodiments of the present application provide a training device of a sorting model, which comprises:

[0118] The first acquisition module 61 is configured to acquire a final state list in a user historical search process, wherein the final state list comprises a plurality of search results obtained based on user input target information search;

[0119] The sample module 62 is configured to generate a sample pair comprising a positive sample and a negative sample based on the final state list, wherein the positive sample is any search result in the final state list that is triggered by the user, and the negative sample is any search result in the final state list that is arranged before the positive sample and is not triggered by the user;

[0120] The first iteration module 63 is configured to determine a target gradient based on a first score, a second score, and a typing frequency corresponding to the final state list to which the current sample pair belongs in each iteration process, wherein the first score comprises a relevance score output by the sorting model based on the positive sample of the current sample pair, the second score comprises a relevance score output by the sorting model based on the negative sample of the current sample pair, and the typing frequency comprises the number of times of updating the data in the input box in the process of inputting the target information by the user in the input box;

[0121] The second iteration module 64 is configured to update the model parameters in the sorting model based on the target gradient obtained in each iteration process.

[0122] Optionally, the first iteration module 62 comprises:

[0123] The first determination unit is configured to determine a first intermediate gradient with the loss of the optimization document list method as the target according to the first score, the second score, and the change of the target evaluation index, wherein the target evaluation index comprises an information retrieval evaluation index determined based on the current sample pair;

[0124] The second determination unit is configured to determine a second intermediate gradient based on a first typing frequency corresponding to the positive sample in the current sample pair and a second typing frequency corresponding to the negative sample, wherein the first typing frequency is equal to the typing frequency corresponding to the final state list to which the current sample pair belongs, and the second typing frequency is a preset target number of times greater than the first typing frequency.

[0125] The product of the first intermediate gradient and the second intermediate gradient is determined as the target gradient.

[0126] Optionally, the second determining unit comprises:

[0127] The first calculating subunit is configured to calculate the reciprocal of the sum of the first typing frequency plus 1 to obtain a first reciprocal;

[0128] The second calculating subunit is configured to calculate the reciprocal of the sum of the second typing frequency plus 1 to obtain a second reciprocal;

[0129] The third calculating subunit is configured to calculate the absolute value of the difference between the first reciprocal and the second reciprocal to obtain a first target value.

[0130] The first determining subunit is configured to determine the sum of the first target value plus 1 as the second intermediate gradient.

[0131] Optionally, the apparatus further comprises:

[0132] The second obtaining module is configured to obtain a target operating system of an electronic device used in a historical search process of a user, wherein different operating systems correspond to different scaling coefficients.

[0133] The first calculating subunit is specifically configured to calculate the product of the first typing frequency and a target coefficient to obtain a second target value, wherein the target coefficient is a scaling coefficient corresponding to the target operating system; and calculate the reciprocal of the sum of the second target value plus 1 to obtain the first reciprocal.

[0134] Optionally, the first determining unit comprises:

[0135] The second determining subunit is configured to determine, based on the first score and the second score, a third intermediate gradient taking the loss of the optimization document pair method as a target.

[0136] The fourth calculating subunit is configured to calculate the normalized loss cumulative gain change value of the positive sample and the negative sample in the current text pair before and after the positions of the positive sample and the negative sample in the terminal state list are exchanged.

[0137] The third determining subunit is configured to determine the product of the third intermediate gradient and the normalized loss cumulative gain change value as the first intermediate gradient.

[0138] The training apparatus of the ranking model provided by the embodiments of the present application can implement the training method of the ranking model in the method embodiments, and thus the details are not repeated here. Figures 1-5 The training apparatus of the ranking model provided by the embodiments of the present application can implement the training method of the ranking model in the method embodiments, and thus the details are not repeated here.

[0139] In the embodiments of the present application, in the drop-down list search scenario, the training samples required for training the terminal state list generation model, i.e., sample pairs containing positive samples and negative samples, can be generated. Any search result triggered by the user can be regarded as a positive sample, and any search result arranged before the positive sample in the terminal state list and not triggered by the user can be regarded as a negative sample. When calculating the gradient required for optimizing the ranking model, in addition to the relevance scores output by the ranking model for the positive and negative samples, the number of keystrokes that can represent search process information is also considered, so that the target gradient calculated can more accurately guide the optimization direction of the ranking model. Here, the number of keystrokes includes the number of times the input box updates data in the process of the user inputting target information in the input box, i.e., search process information associated with the search process. Finally, the target gradient is used to update the model parameters in the ranking model, and the optimization of the ranking model is completed, so that the ranking model obtained after the training has better ranking ability, and the ranking result can more reasonably meet the search needs of the user.

[0140] In another aspect, the embodiments of the present application also provide an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor implements the training method of the ranking model provided by the above-mentioned embodiments of the application when executing the program.

[0141] In another aspect, the embodiments of the present application also provide a readable storage medium, when the instructions in the readable storage medium are executed by the processor of the electronic device, the electronic device can execute the training method of the ranking model provided by the above-mentioned embodiments of the application.

[0142] It should be noted that, for the above-mentioned method embodiments, in order to simply describe, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the action order described, because according to the present application, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0143] The device embodiments described above are only schematic, and the units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, i.e., they can be located in one place, or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the present embodiment scheme according to actual needs. Those skilled in the art can understand and implement without creative labor.

[0144] Those skilled in the art can clearly understand the implementation of the various embodiments by means of software and necessary general hardware platforms through the description of the above embodiments, and of course, the embodiments can also be implemented by hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part of the prior art that makes a contribution, can be embodied in the form of a software product. The computer software product can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, and the like, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0145] Finally, it should be noted that: the above examples are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing examples, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing examples, or make equivalent replacement for some 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 training method for a ranking model, characterized in that, The method includes: Obtain a list of final states in the user's historical search process, wherein the list of final states includes multiple search results obtained based on the target information input by the user; Based on the final state list, a sample pair containing positive and negative samples is generated, wherein the positive sample is any search result in the final state list that has been triggered by the user, and the negative sample is any search result in the final state list that has not been triggered by the user and is listed before the positive sample; In each iteration, the target gradient is determined based on the first score, the second score of the current sample pair, and the number of keystrokes corresponding to the final state list to which the current sample pair belongs. The first score includes the relevance score of the ranking model based on the positive sample output of the current sample pair, the second score includes the relevance score of the ranking model based on the negative sample output of the current sample pair, and the number of keystrokes includes the number of times the input box updates data during the process of the user inputting the target information in the input box. In each iteration, the model parameters in the ranking model are updated based on the target gradient obtained in this iteration; determining the target gradient based on the first score, second score of the current sample pair, and the number of keystrokes corresponding to the final state list to which the current sample pair belongs includes: Based on the changes in the first score, the second score, and the target evaluation index, a first intermediate gradient is determined with the objective of optimizing the loss of the document list method. The target evaluation index includes an evaluation index for information retrieval determined based on the current sample pair. Based on the first number of keystrokes corresponding to positive samples and the second number of keystrokes corresponding to negative samples in the current sample pair, a second intermediate gradient is determined, wherein the first number of keystrokes is equal to the number of keystrokes corresponding to the final state list to which the current sample pair belongs, and the second number of keystrokes is a preset target number greater than the first number of keystrokes; The product of the first intermediate gradient and the second intermediate gradient is determined as the target gradient; The step of determining the second intermediate gradient based on the first number of keystrokes corresponding to positive samples and the second number of keystrokes corresponding to negative samples in the current sample pair includes: Calculate the reciprocal of the sum of the first number of keystrokes and 1 to obtain the first reciprocal; Calculate the reciprocal of the sum of the second number of keystrokes and 1, and obtain the second reciprocal; Calculate the absolute value of the difference between the first reciprocal and the second reciprocal to obtain the first target value; The first target value is summed with 1 to determine the second intermediate gradient.

2. The method according to claim 1, characterized in that, The method further includes: obtaining the target operating system of the electronic devices used by the user during the historical search process, wherein different operating systems correspond to different scaling factors; The calculation of the reciprocal of the sum of the first number of keystrokes and 1 to obtain the first reciprocal includes: Calculate the product of the first number of keystrokes and the target coefficient to obtain the second target value; wherein, the target coefficient is the scaling factor corresponding to the target operating system; Calculate the reciprocal of the sum of the second target value and 1 to obtain the first reciprocal.

3. The method according to claim 1, characterized in that, The step of determining the first intermediate gradient, with the objective of optimizing the loss of the document list method, based on the changes in the first score, the second score, and the target evaluation index, includes: Based on the first and second scores, a third intermediate gradient is determined with the objective of optimizing the loss of the document pair method. Calculate the normalized cumulative gain change before and after swapping the positions of the positive and negative samples in the final state list in the current text pair; The product of the third intermediate gradient and the normalized cumulative gain change value is determined as the first intermediate gradient.

4. A training device for a ranking model, characterized in that, The device includes: The first acquisition module is used to acquire a list of final states in the user's historical search process, wherein the list of final states includes multiple search results obtained based on the target information input by the user. The sample module is used to generate sample pairs containing positive and negative samples based on the final state list, wherein the positive sample is any search result in the final state list that has been triggered by the user, and the negative sample is any search result in the final state list that has not been triggered by the user and is arranged before the positive sample; The first iteration module is used to determine the target gradient in each iteration based on the first score, the second score of the current sample pair and the number of keystrokes corresponding to the final state list to which the current sample pair belongs. The first score includes the relevance score of the ranking model based on the positive sample output of the current sample pair, the second score includes the relevance score of the ranking model based on the negative sample output of the current sample pair, and the number of keystrokes includes the number of times the input box updates data during the process of the user inputting the target information in the input box. The second iteration module is used to update the model parameters in the ranking model based on the target gradient obtained in each iteration; the first iteration module includes: The first determining unit is configured to determine a first intermediate gradient with the objective of optimizing the loss of the document list method based on the changes in the first score, the second score, and the target evaluation index, wherein the target evaluation index includes an evaluation index for information retrieval determined based on the current sample pair. The second determining unit is used to determine a second intermediate gradient based on the first number of keystrokes corresponding to positive samples and the second number of keystrokes corresponding to negative samples in the current sample pair, wherein the first number of keystrokes is equal to the number of keystrokes corresponding to the final state list to which the current sample pair belongs, and the second number of keystrokes is a preset target number greater than the first number of keystrokes; The product of the first intermediate gradient and the second intermediate gradient is determined as the target gradient; the second determining unit includes: The first calculation subunit is used to calculate the reciprocal of the sum of the first number of keystrokes and 1, to obtain the first reciprocal; The second calculation subunit is used to calculate the reciprocal of the sum of the second number of keystrokes and 1, to obtain the second reciprocal; The third calculation subunit is used to calculate the absolute value of the difference between the first reciprocal and the second reciprocal to obtain the first target value; The first determining subunit is used to add 1 to the first target value and determine it as the second intermediate gradient.

5. The apparatus according to claim 4, characterized in that, The device further includes: The second acquisition module is used to acquire the target operating system of the electronic devices used by the user during the historical search process, wherein different operating systems correspond to different scaling factors; The first calculation subunit is specifically used to calculate the product of the first number of keystrokes and the target coefficient to obtain a second target value; wherein the target coefficient is the scaling factor corresponding to the target operating system; and to calculate the reciprocal of the sum of the second target value and 1 to obtain a first reciprocal.

6. The apparatus according to claim 4, characterized in that, The first determining unit includes: The second determining subunit is used to determine a third intermediate gradient based on the first and second scores, with the goal of optimizing the loss of the document pair method. The fourth calculation subunit is used to calculate the normalized cumulative gain change before and after the positive and negative samples in the current text pair swap their respective positions in the final state list; The third determining subunit is used to determine the first intermediate gradient by multiplying the third intermediate gradient and the normalized loss cumulative gain change value.

7. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements claim 1. Training methods for one or more of the ranking models described in section 3.

8. A readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is able to perform the operation as claimed in claim 1. Training methods for one or more of the ranking models described in section 3.

Citation Information

Patent Citations

  • Searching and ordering method and device based on transfer learning

    CN106570197A

  • Reinforcement learning-based personalized search method

    CN111241407A

  • Sorting method and device, electronic equipment and readable storage medium

    CN111428125A