Detailed Description
Embodiments of the present disclosure are described in detail below, examples of which are illustrated in the accompanying drawings. The embodiments described below by referring to the drawings are exemplary and intended for the purpose of explaining the present disclosure and are not to be construed as limiting the present disclosure.
The terms first and second and the like in the description, the claims and the drawings of embodiments of the disclosure are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the disclosure described herein may be capable of implementation in sequences other than those illustrated or described herein, for example. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The training method of the ranking model provided by the embodiment of the disclosure can be operated on a terminal device or a server. The terminal device may be a local terminal device. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligent platforms.
With the development of scientific technology, the information search technology can help users to quickly and accurately find required information data, and the ranking (retrieval ranking) refers to the process of ranking search results, which is a vital ring of the information search technology; the ranking technique generally utilizes various statistical and machine learning methods to build a ranking model to rank the search results through the ranking model, or directly ranks the search results in a fixed ranking manner, such as according to information release time and according to rules such as information heat, but when the search requirement of the user changes, the ranking model or the fixed ranking manner cannot adjust the ranking rule of the search results in real time, so that the actual requirement of the user is difficult to meet.
Taking an example that the training method of the ordering model is applied to an information searching scene in a financial platform application program, various information data related to financial products can be provided in the financial platform application program: information, bulletin, financial newspaper, quotation, fund, help center, etc. When a user uses a search function corresponding to a client of a financial platform application program, a query word is generally input in a search input box provided by the client, after the search function is triggered, the client performs communication interaction with a background server to obtain a search result, and the search result includes various information data, for example, but not limited to: stock quotation, company announcements, related information, help centers, etc.; after the client acquires the search results which are returned by different servers and are related to the query words, the search results can be displayed in a module-by-module manner, namely, different kinds of information data are displayed through one information module. The existing information search technology can only sort search results (such as information data corresponding to the search results in each information module) but cannot sort the display sequence of the information modules, the display sequence of the information modules is fixed, and the actual requirements of users are difficult to meet.
The following describes the technical scheme of the present disclosure and how the technical scheme of the present disclosure solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present disclosure will be described below with reference to the accompanying drawings.
Fig. 1 is a flowchart of a training method of a ranking model according to an exemplary embodiment of the present disclosure, which may be applicable to various devices having a data processing function. Taking the application of the method to a server as an example, the scheme at least comprises the following steps S101-S104:
s101, receiving a sample search request sent by first equipment.
In some embodiments, the first device primarily refers to an electronic device used by a user. Specifically, the user may send a search request for querying a query result corresponding to the target query term to a server (execution body) through the first device. It will be appreciated that the sample search request may be a search request sent by the first device to the server in real time, and the server may use the search request as a sample search request for training the ranking model while recalling the corresponding search results from the database in response to the search request.
In some embodiments, the sample search request includes at least a first query term. In particular, the first query term may be one or a combination of numbers, letters, graphics or words. And will not be described in detail herein.
S102, determining a first word vector corresponding to a first query word in the sample search request, and respectively inputting the first word vector into a first ordering model and a second ordering model to respectively obtain a first probability distribution and a second probability distribution.
The first sorting model and the second sorting model are both models for solving sorting tasks, wherein the second sorting model can be a sorting model obtained by training the first sorting model for one round by using sample data.
In some embodiments, the first ranking model and the second ranking model may be tree models, BRET (Bidirectional Encoder Representations from Transformers) models, or other neural network models, which are not illustrated herein.
In some embodiments, the first probability distribution includes a plurality of first probability values for a plurality of information modules being operated on, and the second probability distribution includes a plurality of second probability values for the information modules being operated on.
The information module mainly refers to a module for displaying different kinds of information data, such as a news information module, an announcement information module, a market information module, a help center module and the like. For example, the first query word corresponds to "a company" in the sample search request, where the search result corresponding to the sample search request includes various information data, such as quotation information of financial products such as stocks and funds corresponding to the a company, bulletin information such as bulletin and financial newspaper issued by the a company, and information such as news information related to the a company, the quotation information module is used for displaying a plurality of pieces of quotation information related to financial products such as stocks and funds corresponding to the a company, and the news information module is used for displaying a plurality of pieces of information related to the a company, and the bulletin information module is used for displaying bulletin information such as bulletin and financial newspaper issued by the a company.
In some embodiments, the probability value that an information module is operated refers to the probability that the information module is first clicked or selected by the user. The probability that the information module corresponds to being clicked or selected by the user for the first time can be used for sequencing the display sequence of the information model, and when the probability value that a certain information module is operated is larger, the display sequence is more forward. Continuing taking the first query word corresponding to the first query word as "company a" in the sample search request as an example, as shown in fig. 2, inputting the first query word "company a" into the first ranking model 21 to obtain the probability value of the information module corresponding to the search result corresponding to the first query word, that is, the information module includes a quotation information module (the probability value of the quotation information module being operated is 40%), a bulletin information module (the probability value of the bulletin information module being operated is 30%), a news information module (the probability value of the news information module being operated is 20%) and a help center module (the probability value of the help center module being operated is 10%), and when the first device displays the search result, the information module may be used as a display unit, and displays each information module in the order from large to small based on the probability value, that is, the information module is displayed in the order of the quotation information module, the bulletin information module, the news information module and the help center module.
In some embodiments, before inputting the first word vector into the first ranking model and the second ranking model, respectively, to obtain the first probability distribution and the second probability distribution, respectively, the method further includes:
when the number of sample search requests sent by the first device is determined to be larger than a preset second threshold, the first word vector is respectively input into a first ordering model and a second ordering model, and a first probability distribution and a second probability distribution are respectively obtained. For example, when the second threshold is 10 and the number of sample search requests is 8, the server only recalls the corresponding search results from the database in response to the sample search requests and does not train the ranking model, and when the number of sample search requests is greater than 10, the server can use the search requests as sample search requests for training the ranking model while recalling the corresponding search results from the database in response to the sample search requests.
In the embodiment of the disclosure, by setting the second threshold corresponding to the number of the sample search requests sent by the first device, the training update of the ordering model is ensured to ensure a certain frequency, the consumption of a large amount of training resources is avoided, and the receiver can adjust the training update frequency of the ordering model more flexibly according to the number of the search requests.
In other embodiments, before inputting the first word vector into the first ranking model and the second ranking model, respectively, to obtain the first probability distribution and the second probability distribution, respectively, the method further includes:
when the using time value of the first ordering module is determined to be larger than a preset third threshold value, the first word vector is respectively input into a first ordering model and a second ordering model, and a first probability distribution and a second probability distribution are respectively obtained. For example, when the third threshold is 60, the time value used by the first ranking model is 50 minutes, that is, less than 60 minutes, the server only recalls the corresponding search result from the database in response to the sample search request, and does not train the ranking model, and when the time value used by the first ranking model is 67 minutes, that is, greater than 60 minutes, the server can use the search request as the sample search request for training the ranking model while recalling the corresponding search result from the database in response to the search request.
In the embodiment of the disclosure, by setting the third threshold corresponding to the use time value of the first sorting module, the training update of the sorting model is ensured to ensure a certain frequency, so that the consumption of a large amount of training resources is avoided, and the training update frequency of the sorting model is adjusted more flexibly according to the number of the search requests.
In other embodiments, before inputting the first word vector into the first ranking model and the second ranking model, respectively, to obtain the first probability distribution and the second probability distribution, respectively, the method further includes:
when the number of sample search requests sent by the first device is determined to be larger than a preset second threshold value and the using time value of the original target ordering module is determined to be larger than a preset third threshold value, the first word vector is respectively input into a first ordering model and a second ordering model, and a first probability distribution and a second probability distribution are respectively obtained.
For example, when the second threshold is 10, the third threshold is 60, the time value used by the first ranking model is 50 minutes, that is, less than 60 minutes, or the number of sample search requests is 8, the server only recalls the corresponding search result from the database in response to the sample search request, and does not train the ranking model, and when the time value used by the first ranking model is 67 minutes, that is, greater than 60 minutes, and the number of sample search requests is greater than 10, the server can recall the corresponding search result from the database in response to the search request and take the search request as a sample search request for training the ranking model.
And S103, based on the first probability distribution and the second probability distribution, the original loss value of the second sorting model is adjusted to obtain a first loss value.
The original loss value refers to the loss value obtained by the second sorting model during the last training.
In order to avoid that the model update step length of the second sorting model is too large due to the deviation of individual samples in the online learning process, the loss value of the second sorting model can be adjusted according to the probability distribution difference between the first probability distribution output by the first sorting model and the second probability distribution output by the second sorting model, so that the iterative update of the second sorting model is more stable, and the performance degradation of the second sorting model is avoided.
In some embodiments, adjusting the original loss value of the second ranking model to obtain a first loss value based on the first probability distribution and the second probability distribution includes steps S201-S202:
s201, determining a relative entropy between the first probability distribution and the second probability distribution based on the first probability distribution and the second probability distribution.
In some embodiments, the relative entropy, also known as KL (short for Kullback-Leibler) divergence, is a measure of asymmetry of the difference between two probability distributions.
S202, adjusting the original loss value of the second sorting model based on the relative entropy, and determining the first loss value of the second sorting model.
If the relative entropy between the first probability distribution and the second probability distribution is larger, it is indicated that the difference between the ordering result of the information module by the second ordering model and the ordering result of the information module by the first ordering model is larger, that is, the difference between the second probability distribution output by the second ordering model and the history learning result is larger, if the original loss value of the second ordering model is directly used to adjust the model parameters of the second ordering model, knowledge that the second ordering model has learned may be damaged, so that the performance of the second ordering model is reduced in a catastrophic manner, and at this time, the original loss value of the second ordering model can be reduced appropriately based on the relative entropy, so that the parameter difference between before and after the iteration of the second ordering model is not excessively large, so as to realize the stability of the performance of the second ordering model; if the relative entropy between the first probability distribution and the second probability distribution is smaller, the difference between the prediction ordering result of the second ordering model on the information module and the prediction ordering result of the first ordering model on the information module is smaller, namely, the second probability distribution output by the second ordering model is different from the history learning result output by the first ordering model but has smaller difference, if the original loss value of the second ordering model is directly used for adjusting the model parameters of the second ordering model, the performance improvement efficiency of the model is low, the utilization rate of samples is lower, and at the moment, the utilization rate of samples can be improved and the training duration is reduced by properly improving the original loss value of the second ordering model based on the relative entropy.
In some embodiments, the original penalty value of the second ranking model is adjusted based on the relative entropy, and a first penalty value of the second ranking model is determined, comprising steps S2021-S2022:
s2021, comparing the relative entropy with a preset first threshold value, and obtaining a target penalty coefficient of the relative entropy.
In some embodiments, the target penalty coefficient refers to a coefficient used for adjusting the relative entropy, and is a variable parameter, and by adding the target penalty coefficient and matching with the relative entropy, a loss value of the second ranking model can be adjusted, so that iterative updating of the second ranking model is more stable, and performance degradation of the second ranking model is avoided.
In some embodiments, the first threshold is a fixed super parameter, and is used to define a difference between each update training of the ranking model, and if the first threshold is larger, the difference between each update training of the ranking model is larger, that is, the second probability distribution outputted by the second ranking model is larger than the difference between the historical learning results outputted by the first ranking model.
In some embodiments, comparing the relative entropy with a preset first threshold value, and obtaining the target penalty coefficient of the relative entropy includes:
When the relative entropy is greater than the first threshold, the target penalty coefficient is determined to be one time the preamble penalty coefficient. The preamble penalty coefficient refers to a penalty coefficient of relative entropy between the first probability distribution and the second probability distribution when the second ranking model is trained last time.
When the relative entropy is less than the first threshold, the target penalty coefficient is determined to be half of the preamble penalty coefficient.
And determining the target penalty coefficient as the preamble penalty coefficient when the relative entropy is equal to the first threshold.
Specifically, D KL For the relative entropy, d is the first threshold, β k-1 For the preamble penalty coefficient, beta k For the target penalty coefficient, the specific calculation process is as follows:
if D KL <d, beta k =β k-1 /2;
If D KL >d, beta k =β k-1 *2;
If D KL D, then beta k =β k-1 。
S2022, determining a first loss value of the second ordering model based on the relative entropy, the target penalty coefficient and an original loss value of the second ordering model.
In some embodiments, the first penalty value of the second ranking model is a sum of an original penalty value of the second ranking model and a product of the relative entropy and the target penalty coefficient.
Further, determining the first loss value of the second sorting model may also be obtained through a formula, where the first loss value of the second sorting model is determined as follows:
Wherein,for the original loss value of the second ranking model, beta is the target penalty coefficient, D KL Is the relative entropy.
And S104, adjusting model parameters of the second sorting model based on the first loss value until the training ending condition is met, and obtaining a target sorting model.
In some embodiments, the target probability distribution corresponding to each information module output by the target ranking model is used to indicate that the query result corresponding to each information module is displayed by the first device according to the probability value that each information module is operated.
In some embodiments, the query results refer primarily to the individual recall information contained by the individual information modules. Specifically, the query results corresponding to the news information module are different news information.
The training ending condition can be set or adjusted according to actual requirements; specifically, the search request and the user behavior data corresponding to the search request can be collected in real time, the first ordering model and the second ordering model are subjected to effect verification, and when the effect of the second ordering model is superior to that of the first ordering model, the training ending condition is met; the maximum training times can be set, and when the training times of the second sequencing model reach the maximum training times, the training ending condition can be considered to be reached; the maximum training time may also be set, and when the training duration for the second ranking model reaches the maximum training time, the training end condition may be considered to be reached.
The following provides a specific embodiment to further explain the training scheme of the ranking model in the scheme, wherein the first ranking model refers to a ranking model used on the current line, and the second ranking model refers to a model obtained by iteratively updating the first ranking model; the kth training process of the online learning process of the second ranking model comprises the following specific steps:
step 1, acquiring a sample search request, and determining a first word vector corresponding to a first query word in the sample search request.
And 2, determining a first word vector corresponding to the first query word in the sample search request, and respectively inputting the first word vector into a first ordering model and a second ordering model to respectively obtain a first probability distribution and a second probability distribution.
Specifically, taking a sample search request as a search request A as an example, inputting a word vector of a first query word corresponding to the sample search request A into a first sorting model, and outputting first probability distribution by the first sorting model; and simultaneously, inputting word vectors of the first query words corresponding to the sample search request A into a second ranking model, and outputting second probability distribution by the second ranking model.
And step 3, determining the relative entropy between the first probability distribution and the second probability distribution based on the first probability distribution and the second probability distribution.
Specifically, the KL divergence is calculated according to the first probability distribution and the second probability distribution, and the relative entropy is obtained.
And 4, adjusting the original loss value of the second sorting model based on the relative entropy, and determining the first loss value of the second sorting model.
Specifically, the first Loss value Loss of the present training may be calculated according to the following formula;
wherein,is the original loss value of the second sorting model, beta is the target penalty coefficient, D KL Is the relative entropy;
in some embodiments, the first ordering model and the second ordering model may specifically adopt a BRET model, and the prediction of the operated probability of each information module is implemented through multiple classification tasks of the BRET model; correspondingly, the last activation function of the second ranking model is a softmax function, and the corresponding loss function generally employs a cross entropy loss function (cross entropy loss).
And step 5, adjusting model parameters of the second sorting model according to the first loss value to obtain a new second sorting model.
And (3) repeating the steps 1 to 5 to iteratively update the model parameters of the second sorting model until the training ending condition is met, and taking the second sorting model as a new first sorting model and taking the second sorting model as an online using model.
In order to avoid overlarge model update step length caused by the deviation of individual samples in the online learning process of the second sorting model in the sorting model training process, the stability of the sorting model training is improved by adjusting the loss value of the second sorting model according to the probability distribution difference between the first probability distribution output by the first sorting model and the second probability distribution output by the second sorting model, namely the relative entropy.
In some embodiments, the method further comprises steps S21-S27:
s21, acquiring a first search request and a second search request.
S22, determining a second word vector corresponding to a second query word in the first search request, and inputting the second word vector into the first ordering model to obtain a third probability distribution.
S23, determining a third word vector corresponding to a third query word in the second search request, and inputting the third word vector into the second ordering model to obtain a fourth probability distribution.
S24, determining first ordering information of each information module according to the third probability value of each information module in the third probability distribution, and determining second ordering information of each information module according to the second probability value of each information module in the fourth probability distribution.
S25, receiving first user behavior data corresponding to the first search request and second user behavior data corresponding to the second search request.
In some embodiments, the first user behavior data includes at least first operation information in which a query result is operated in each of the information modules; for example, the information modules include a quotation information module (the operating probability value of the quotation information module is 40%), a bulletin information module (the operating probability value of the bulletin information module is 30%), a news information module (the operating probability value of the news information module is 20%), and a help center module (the operating probability value of the help center module is 10%), that is, the terminal device (such as the first device) responds to the first search request, displays the query results corresponding to each information model according to the sequence of the quotation information module, the bulletin information module, the news information module and the help center module, and the user clicks, shares or praise the query results through the terminal device, and the terminal device can return the corresponding operation and the information module to which the operation object (that is, different query results) belongs as the first user behavior data corresponding to the first search request to the server. Likewise, the second user behavior data at least includes second operation information of the query result operated in each information module, which is not described herein.
S26, determining a first operation score of the first ordering model according to the first operation information and the first ordering of the information modules, and determining a second operation score of the second ordering model according to the second operation information and the second ordering of the information modules.
The operation score is used for indicating whether the information module operated in the plurality of information modules corresponding to each sequencing model module is the same as the information module with the highest probability value in the operated probability values in the plurality of information modules.
In some embodiments, determining a first operational score for the first ranking model based on the first operational information and the first ranking of the information modules comprises: and performing data cleaning on the first operation information to obtain first target operation information, and determining a first operation score of the first sequencing model according to the first target operation information and the first sequencing of each information module. Also, in some embodiments, determining a second operational score for the second ranking model based on the second operational information and a second ranking for each information module comprises: and performing data cleaning on the second operation information to obtain second target operation information, and determining a second operation score of the second sequencing model according to the second target operation information and the second sequencing of each information module.
In the embodiment of the disclosure, the data cleaning of the operation information is mainly used for removing noise data in the operation information, so that the accuracy of the operation information is improved.
The first target operation information may refer to a target information module corresponding to a query result that is operated for the first time; specifically, the target information module corresponding to the query result which is operated for the first time may be determined from the first operation information, the ordering information corresponding to the target information module is obtained from the first ordering of each information module, and then the corresponding first operation score is determined according to the ordering information corresponding to the target information module.
Further, the first target operation information may also refer to a target information module with the largest number of times that the query result is operated in the information module; specifically, the target information module with the most operation times of the query result in the information modules can be determined from the first operation information, the ordering information corresponding to the target information modules is obtained from the first ordering of each information module, and then the corresponding first operation score is determined according to the ordering information corresponding to the target information modules.
Taking the above example as the example, the ranking of each information model is a quotation information module, a bulletin information module, a news information module, and a help center module, when the target information module corresponding to the query result that is operated for the first time or the target information module with the largest number of times of being operated in the information module is the quotation information module that ranks first, the first operation score of the first ranking model may be determined to be 10, and when the target information module corresponding to the query result that is operated for the first time or the target information module with the largest number of times of being operated in the information module is the quotation information module that ranks third, the first operation score of the first ranking model may be determined to be 5.
It will be appreciated that the procedure of determining the second operation score of the second ranking model is identical to the procedure of determining the first operation score of the first ranking model, and will not be described in detail herein.
In some embodiments, when the user initiates a search request a, a series of ranked information modules are returned, and assuming that the information modules are a quotation information module, a bulletin information module, a news information module, and a help center module, if the user clicks on the content in the bulletin information module in the second ranking result, the first device may collect a data sequence: "search request a", "click bulletin information module", and "rank second". In the embodiment, the same search request of the user is attached with a request id, and various data in the user behavior data corresponding to the same search request are marked with the same request id.
And S27, determining the second sorting model as a target sorting model when the first operation score is smaller than the second operation score.
Specifically, taking the first operation score of the first sorting model as 5 and the second operation score of the second sorting model as 10 as an example, the first operation score of the first sorting model is smaller than the second operation score of the second sorting model, so the second sorting model is taken as a target sorting model.
In the embodiment of the disclosure, by maintaining two sorting models, namely a first sorting model and a second sorting model, on line, when a search request of a user is received, the search request is equally divided into a first search request and a second search request, the first search request is input into the first sorting model, the second search request is input into the second sorting model, and meanwhile, user behavior data corresponding to each search request, namely first user behavior data corresponding to the first search request and second user behavior data corresponding to the second search request, are collected; and then, comparing the first operation score of the first sorting model with the second operation score of the second sorting model through the first user behavior data and the second behavior data to realize the effect of comparing the first sorting model with the second sorting model, wherein it can be understood that the higher the operation score is, the better the prediction effect of the sorting model is represented, namely, the target probability distribution corresponding to each information module output by the sorting module can effectively predict the information module to which the recall information clicked by the user prefers, and finally, the sorting model with better prediction effect is used as the target sorting model to ensure that the query result corresponding to each information module is displayed by the first equipment through each information module to be more consistent with the user preference, and the accuracy is high.
According to the technical scheme, a sample search request sent by first equipment is received; determining a first word vector corresponding to a first query word in the sample search request, and respectively inputting the first word vector into a first ordering model and a second ordering model to respectively obtain a first probability distribution and a second probability distribution, wherein the first probability distribution comprises a plurality of first probability values of a plurality of information modules operated, and the second probability distribution comprises a plurality of second probability values of the information modules operated; based on the first probability distribution and the second probability distribution, the original loss value of the second sorting model is adjusted to obtain a first loss value; and adjusting model parameters of the second sorting model based on the first loss value until a training ending condition is met, so as to obtain a target sorting model, wherein target probability distribution corresponding to each information module output by the target sorting model is used for indicating that query results corresponding to each information module are displayed through first equipment according to the probability value operated by each information module. According to the technical scheme provided by the embodiments of the disclosure, the ordering model does not need to be trained in a line, so that the training cost is greatly reduced, the training efficiency is improved, the ordering model can be updated in real time according to the sample search request of the user, different actual demands of the user are met, and the applicability of the target ordering model is improved.
Fig. 3 is a flowchart of an information retrieval method according to an exemplary embodiment of the present disclosure, which may be applied to various devices having a data processing function. The method at least comprises the following steps S301-S304:
s301, receiving a target search request sent by the first device.
S302, acquiring query results corresponding to each information module according to the target search request;
s303, determining target word vectors corresponding to target query words in the target search request, and inputting the target word vectors into a target ordering model to respectively obtain target probability distribution.
In some embodiments, the target probability distribution includes target probability values for each of the information modules operated on.
The target sorting model is the target sorting model in the above embodiment.
S304, the query results corresponding to the information modules and the target probability values operated by the information modules are fed back to the first equipment, so that the first equipment sequentially displays the information modules and the query results corresponding to the information modules according to the target probability values operated by the information modules.
According to the technical scheme, a target search request sent by first equipment is received; acquiring query results corresponding to each information module according to the target search request; determining a target word vector corresponding to a target query word in the target search request, and inputting the target word vector into a target ordering model to obtain target probability distribution; the target probability distribution comprises target probability values of the information modules operated, query results corresponding to the information modules and the target probability values of the information modules operated are fed back to the first equipment, and the first equipment sequentially displays the information modules and the query results corresponding to the information modules according to the target probability values of the information modules operated. The target search request sent by the first device is processed through the target ordering model, so that the first device sequentially displays the information modules and the query results corresponding to the information modules according to the target probability value operated by the information modules, different actual demands of users can be met, and the efficiency of search work is greatly improved.
FIG. 4 is a schematic diagram of a training device for a ranking model according to an exemplary embodiment of the present disclosure;
wherein the device includes: a first receiving unit 401, an input unit 402, and an adjusting unit 403;
a first receiving unit 401, configured to receive a sample search request sent by a first device;
an input unit 402, configured to determine a first word vector corresponding to a first query word in the sample search request, and input the first word vector into a first ranking model and a second ranking model respectively, to obtain a first probability distribution and a second probability distribution respectively, where the first probability distribution includes a plurality of first probability values of a plurality of information modules being operated, and the second probability distribution includes a plurality of second probability values of the information modules being operated;
an adjusting unit 403, configured to adjust an original loss value of the second ranking model based on the first probability distribution and the second probability distribution to obtain a first loss value;
the adjusting unit 403 is further configured to adjust model parameters of the second ranking model based on the first loss value until a training end condition is satisfied, so as to obtain a target ranking model, where a target probability distribution corresponding to each information module output by the target ranking model is used to indicate a query result corresponding to each information module to be displayed by the first device according to the probability value operated by each information module.
In some embodiments, the method further comprises adjusting the original loss value of the second ranking model to obtain a first loss value based on the first probability distribution and the second probability distribution, the method further comprising:
determining a relative entropy between the first probability distribution and the second probability distribution based on the first probability distribution and the second probability distribution;
and adjusting the original loss value of the second sorting model based on the relative entropy, and determining a first loss value of the second sorting model.
In some embodiments, the method further comprises adjusting an original loss value of the second ranking model based on the relative entropy, determining a first loss value of the second ranking model, the method further comprising:
comparing the relative entropy with a preset first threshold value to obtain a target penalty coefficient of the relative entropy;
adjusting the relative entropy based on the target penalty coefficient to obtain a target relative entropy;
a first penalty value for the second ranking model is determined based on the target relative entropy and the original penalty value for the second ranking model.
In some embodiments, the apparatus is further to:
determining the target penalty coefficient as one time of a preamble penalty coefficient when the relative entropy is greater than the first threshold; the preamble penalty coefficient refers to a penalty coefficient of relative entropy between the first probability distribution and the second probability distribution when the second ordering model is trained last time;
Determining the target penalty coefficient to be half of the preamble penalty coefficient when the relative entropy is less than the first threshold;
and determining the target penalty coefficient as the preamble penalty coefficient when the relative entropy is equal to the first threshold.
In some embodiments, the adjusting the model parameters of the second ranking model based on the first loss value results in a target ranking model, and the apparatus is further configured to:
acquiring a first search request and a second search request;
determining a second word vector corresponding to a second query word in the first search request, and inputting the second word vector into the first ordering model to obtain a third probability distribution;
determining a third word vector corresponding to a third query word in the second search request, and inputting the third word vector into the second ordering model to obtain a fourth probability distribution;
determining first ordering information of each information module according to a third probability value of each information module operated in the third probability distribution, and determining second ordering information of each information module according to a second probability value of each information module operated in the fourth probability distribution;
Receiving first user behavior data corresponding to a first search request and second user behavior data corresponding to a second search request, wherein the first user behavior data at least comprises first operation information of which the query result is operated in each information module, and the second user behavior data at least comprises second operation information of which the query result is operated in each information module;
determining a first operation score of the first ordering model according to the first operation information and the first ordering of the information modules, and determining a second operation score of the second ordering model according to the second operation information and the second ordering of the information modules;
and determining the second ranking model as a target ranking model when the first operation score is smaller than the second operation score.
In some embodiments, before inputting the first word vector into the first ranking model and the second ranking model, respectively, to obtain the first probability distribution and the second probability distribution, respectively, the apparatus is further configured to:
when the number of sample search requests sent by the first device is determined to be larger than a preset second threshold, the first word vector is respectively input into a first ordering model and a second ordering model, and a first probability distribution and a second probability distribution are respectively obtained.
According to the technical scheme, a sample search request sent by first equipment is received; determining a first word vector corresponding to a first query word in the sample search request, and respectively inputting the first word vector into a first ordering model and a second ordering model to respectively obtain a first probability distribution and a second probability distribution, wherein the first probability distribution comprises a plurality of first probability values of a plurality of information modules operated, and the second probability distribution comprises a plurality of second probability values of the information modules operated; based on the first probability distribution and the second probability distribution, the original loss value of the second sorting model is adjusted to obtain a first loss value; and adjusting model parameters of the second sorting model based on the first loss value until a training ending condition is met, so as to obtain a target sorting model, wherein target probability distribution corresponding to each information module output by the target sorting model is used for indicating that query results corresponding to each information module are displayed through first equipment according to the probability value operated by each information module. According to the technical scheme provided by the embodiments of the disclosure, the ordering model does not need to be trained in a line, so that the training cost is greatly reduced, the training efficiency is improved, the ordering model can be updated in real time according to the sample search request of the user, different actual demands of the user are met, and the applicability of the target ordering model is improved.
FIG. 5 is a schematic diagram of an information retrieval apparatus according to an exemplary embodiment of the present disclosure;
wherein the device includes: a second receiving unit 501, an acquiring unit 502, a determining unit 503, and a presenting unit 504;
a second receiving unit 501, configured to receive a target search request sent by a first device;
an obtaining unit 502, configured to obtain a query result corresponding to each information module according to the target search request;
a determining unit 503, configured to determine a target word vector corresponding to a target query word in the target search request, and input the target word vector into a target ranking model to obtain target probability distribution respectively; the target probability distribution comprises target probability values of the information modules operated, wherein the target sorting model is the target sorting model in the embodiment;
and a display unit 504, configured to feed back, to the first device, a query result corresponding to each information module and a target probability value for each information module to be operated, so that the first device sequentially displays each information module and the query result corresponding to each information module according to the target probability value for each information module to be operated.
It should be understood that apparatus embodiments and method embodiments may correspond with each other and that similar descriptions may refer to the method embodiments. To avoid repetition, no further description is provided here. Specifically, the apparatus may perform the above method embodiments, and the foregoing and other operations and/or functions of each module in the apparatus are respectively for corresponding flows in each method in the above method embodiments, which are not described herein for brevity.
The apparatus of the embodiments of the present disclosure are described above in terms of functional modules with reference to the accompanying drawings. It should be understood that the functional module may be implemented in hardware, or may be implemented by instructions in software, or may be implemented by a combination of hardware and software modules. Specifically, each step of the method embodiments in the embodiments of the present disclosure may be implemented by an integrated logic circuit of hardware in a processor and/or an instruction in software form, and the steps of the method disclosed in connection with the embodiments of the present disclosure may be directly implemented as a hardware decoding processor or implemented by a combination of hardware and software modules in the decoding processor. Alternatively, the software modules may be located in a well-established storage medium in the art such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, and the like. The storage medium is located in a memory, and the processor reads information in the memory, and in combination with hardware, performs the steps in the above method embodiments.
Fig. 6 is a schematic block diagram of an electronic device provided by an embodiment of the present disclosure, which may include:
a memory 601 and a processor 602, the memory 601 being adapted to store a computer program and to transfer the program code to the processor 602. In other words, the processor 602 may call and run a computer program from the memory 601 to implement the methods in the embodiments of the present disclosure.
For example, the processor 602 may be used to perform the method embodiments described above in accordance with instructions in the computer program.
In some embodiments of the present disclosure, the processor 602 may include, but is not limited to:
a general purpose processor, digital signal processor (Digital Signal Processor, DSP), application specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like.
In some embodiments of the present disclosure, the memory 601 includes, but is not limited to:
volatile memory and/or nonvolatile memory. The nonvolatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable EPROM (EEPROM), or a flash Memory. The volatile memory may be random access memory (Random Access Memory, RAM) which acts as an external cache. By way of example, and not limitation, many forms of RAM are available, such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (Double Data Rate SDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), and Direct memory bus RAM (DR RAM).
In some embodiments of the present disclosure, the computer program may be partitioned into one or more modules that are stored in the memory 601 and executed by the processor 602 to perform the methods provided by the present disclosure. The one or more modules may be a series of computer program instruction segments capable of performing the specified functions, which are used to describe the execution of the computer program in the electronic device.
As shown in fig. 6, the electronic device may further include:
a transceiver 603, the transceiver 603 being connectable to the processor 602 or the memory 601.
The processor 602 may control the transceiver 603 to communicate with other devices, and in particular, may send information or data to other devices or receive information or data sent by other devices. The transceiver 603 may include a transmitter and a receiver. The transceiver 603 may further include antennas, the number of which may be one or more.
It will be appreciated that the various components in the electronic device are connected by a bus system that includes, in addition to a data bus, a power bus, a control bus, and a status signal bus.
The present disclosure also provides a computer storage medium having stored thereon a computer program which, when executed by a computer, enables the computer to perform the method of the above-described method embodiments. Alternatively, embodiments of the present disclosure also provide a computer program product comprising instructions which, when executed by a computer, cause the computer to perform the method of the method embodiments described above.
When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function, in whole or in part, according to embodiments of the present disclosure. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a digital video disc (digital video disc, DVD)), or a semiconductor medium (e.g., a Solid State Disk (SSD)), or the like.
Those of ordinary skill in the art will appreciate that the various illustrative modules and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.
In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or modules, which may be in electrical, mechanical, or other forms.
The modules illustrated as separate components may or may not be physically separate, and components shown as modules may or may not be physical modules, i.e., may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. For example, functional modules in various embodiments of the present disclosure may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module.
The foregoing is merely a specific embodiment of the disclosure, but the protection scope of the disclosure is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the disclosure, and it should be covered in the protection scope of the disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.