Retrieval model updating method and device, computer equipment and storage medium
By using historical data from the early search stage as samples when retrieving model training and testing, the problem of low long-tail recall in the existing technology is solved, and the effect of improving the long-tail recall of the retrieval system is achieved.
Patent Information
- Application Number
- CN202510183565.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-19
- Publication Date
- 2025-05-30
AI Technical Summary
When training the search model, existing search systems mainly rely on exposed samples, resulting in a low long-tail recall.
The search model is trained and tested by using historical input data and output data from the early search stage in the search system as samples when training and testing the search model.
This approach can focus on large amounts of data that were not exposed in the early stage, thereby improving the long-tail recall of the retrieval system.
Smart Images

Figure CN120067423A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and particularly to a method, device, computer device and storage medium for updating a retrieval model. Background Art
[0002] In the daily life retrieval needs of serving hundreds of millions of users growing continuously, the long-tail needs are growing continuously. Due to the popularity bias in the distribution of long-tail content in each distribution link. Currently, the training of the retrieval model in the retrieval system will use the samples exposed by the retrieval system, and the long-tail recall rate of the obtained retrieval system is relatively low. Summary of the Invention
[0003] Based on this, it is necessary to provide a method, device, computer device, computer-readable storage medium and computer program product for updating a retrieval model that can improve the long-tail recall rate in view of the above technical problems.
[0004] In a first aspect, the present application provides a method for updating a retrieval model, which is applied to a retrieval system. The retrieval system includes retrieval models corresponding to at least two retrieval stages, and the output of the retrieval model corresponding to the previous retrieval stage is the input of the retrieval model corresponding to the next retrieval stage. The retrieval models corresponding to the at least two retrieval stages are used to recommend interesting content to users based on the retrieval information input by the users, and the method includes:
[0005] Obtain a first sample set;
[0006] Based on the first sample set, train and / or test the first retrieval model in the retrieval system to obtain the updated first retrieval model;
[0007] Wherein, the first sample set includes the historical input data and / or historical output data of the retrieval stage corresponding to the second retrieval model, and the second retrieval model is the retrieval model in the retrieval system whose retrieval stage is before the first retrieval model.
[0008] In a second aspect, the present application further provides a device for updating a retrieval model, which is applied to a retrieval system. The retrieval system includes retrieval models corresponding to at least two retrieval stages, and the output of the retrieval model corresponding to the previous retrieval stage is the input of the retrieval model corresponding to the next retrieval stage. The retrieval models corresponding to the at least two retrieval stages are used to recommend interesting content to users based on the retrieval information input by the users, and the device includes:
[0009] An obtaining module, configured to obtain a first sample set;
[0010] A training module, configured to train the first retrieval model in the retrieval system based on the first sample set to obtain the updated first retrieval model;
[0011] Among them, the first sample set includes historical input data and / or historical output data of the retrieval stage corresponding to the second retrieval model, and the second retrieval model is a retrieval model in the retrieval system whose retrieval stage is before that of the first retrieval model.
[0012] In a third aspect, the present application further provides a computer device, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the method described in the first aspect is implemented.
[0013] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method described in the first aspect is implemented.
[0014] In a fifth aspect, the present application further provides a computer program product, including a computer program. When the computer program is executed by a processor, the method described in the first aspect is implemented.
[0015] When training and / or testing the first retrieval model using the above retrieval model update method, device, computer device, storage medium, and computer program product, the historical input data and / or historical output data of the retrieval stage corresponding to the second model in the retrieval system that is before the first retrieval model are used. This is equivalent to using data produced at an earlier stage in the retrieval system as the sample production method for training and / or testing the retrieval model. In this way, a large number of early-unexposed data in the retrieval system can be taken into account as samples, so that the retrieval system obtained through training and / or testing can improve the long-tail recall rate. Description of the Drawings
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0017] Figure 1 It is a schematic diagram of a retrieval system provided in an embodiment of the present application;
[0018] Figure 2 It is a schematic flowchart of a retrieval model update method;
[0019] Figure 3 It is a schematic diagram of the construction of a first sample set;
[0020] Figure 4Schematic diagram for constructing another first sample set;
[0021] Figure 5 Schematic diagram of the structure of a relevance model constructed based on a pre-trained language model of Transformer;
[0022] Figure 6 Schematic diagram of a model deployment;
[0023] Figure 7 Schematic diagram of another model deployment;
[0024] Figure 8 Block diagram of the structure of a retrieval model update device in an embodiment;
[0025] Figure 9 Internal structure diagram of a computer device in an embodiment. Detailed implementation manners
[0026] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0027] In daily life, in order to serve the growing retrieval needs of hundreds of millions of users, the long-tail needs are constantly increasing. Long-tail needs refer to those collections of relatively niche, personalized, and non-popular needs. From a market perspective, in traditional market concepts, enterprises often focus on those popular products or services that occupy a large market share and have a high demand scale to pursue economies of scale. However, with the development of the Internet and the continuous segmentation of the market, it is found that a large number of niche needs at the tail of the demand curve, although the scale of a single need is small, the total quantity is huge, and the market scale and value formed by their accumulation cannot be underestimated. Therefore, in a retrieval system, it is necessary to improve the long-tail recall rate (i.e., the recall rate for long-tail needs).
[0028] Due to the popularity bias in the distribution of long-tail content in each distribution link. Currently, the training of the retrieval model in the retrieval system will use the samples exposed by the retrieval system, so the long-tail recall rate of the obtained retrieval system is relatively low.
[0029] To solve the above problems, the embodiments of the present application provide a method for updating a retrieval model. For a retrieval system including a retrieval model with multiple retrieval stages, by differentially modeling the samples of the models in different stages in the sample set used for model training and testing, the retrieval model in the early retrieval stage of the retrieval system is made to pay attention to the problem of missing relevant results, thereby improving the long-tail recall rate.
[0030] In an embodiment of the present application, the above-mentioned retrieval model updating method is applied to a retrieval system, which includes at least two retrieval models corresponding to retrieval stages, the output of the retrieval model corresponding to the previous retrieval stage is the input of the retrieval model corresponding to the next retrieval stage, and the retrieval models corresponding to the at least two retrieval stages are used to recommend content of interest to users based on the retrieval information input by the user.
[0031] Exemplarily, the retrieval models corresponding to the at least two retrieval stages include the following models set from the beginning to the end of the retrieval stage:
[0032] Recall model, coarse sorting model, and fine sorting model.
[0033] In some embodiments, the retrieval system in the embodiment of the present application may also include any two models among the recall model, the coarse sorting model, and the fine sorting model, which is not limited in the embodiment of the present application.
[0034] like Figure 1 FIG. 1 is a schematic diagram of a retrieval system provided in an embodiment of the present application. Figure 1 As shown, the retrieval system includes models of three retrieval stages, namely a recall model 101, a coarse ranking model 102, and a fine ranking model 103.
[0035] like Figure 1 As shown in , first, at the beginning of the search event, the full database data, that is, all the data in the entire database, can be obtained, and then basic recall is performed based on the search information entered by the user. This step is divided into two methods: sparse recall and dense recall. Sparse recall is usually based on some relatively simple rules or features for preliminary screening, such as screening according to specific tags, categories, etc., which is fast but may not be accurate enough. Dense recall uses more complex algorithms and models to conduct more in-depth analysis and screening of data to find data that better meets the requirements. After the basic recall, the intermediate recall result is obtained. Subsequently, the intermediate recall result is input into the recall model 101 for recall screening to obtain the recall result TopX. This recall model 101 is usually a trained machine learning model that can further evaluate and screen the intermediate recall results to find the results that are most likely to meet specific needs.
[0036] Next, the recall result TopX is input into the coarse ranking model 102. The function of the coarse ranking model 102 is to sort and filter these data relatively quickly. At this stage, the coarse ranking model will evaluate the data based on some relatively simple but effective indicators, remove some obviously inappropriate results, and obtain the coarse ranking result TopY. The advantage of the coarse ranking model is that it can quickly process a large amount of data and improve the efficiency of the entire process.
[0037] Then, the rough ranking result TopY is input into the fine ranking model 103. The fine ranking model 103 will then evaluate and rank these data more meticulously. It may use more complex algorithms and models, consider more factors and features, and conduct in-depth analysis of the data. The fine ranking result TopZ is the data carefully selected by the fine ranking model, which has higher quality and better matching with the requirements.
[0038] Finally, these fine ranking results TopZ can become the exposed content, that is, the interesting content recommended to the user based on the retrieval information input by the user, and be exposed to the user or used in specific application scenarios.
[0039] In an exemplary embodiment, as Figure 2 shown, a flowchart of a method for updating a retrieval model is provided. Taking the method applied to the Figure 1 retrieval system as an example, it includes the following steps 201 and 202.
[0040] 201. Obtain the first sample set.
[0041] Among them, the first sample set includes the historical input data and / or historical output data of the retrieval stage corresponding to the second retrieval model.
[0042] Among them, the above-mentioned second retrieval model is the retrieval model in the retrieval system before the first retrieval model.
[0043] Taking the Figure 1 retrieval system as an example, exemplarily, the first retrieval model can be the fine ranking model 103, and the second retrieval model can be the recall model 101.
[0044] Exemplarily, the first retrieval model can be the fine ranking model 103, and the second retrieval model can be the rough ranking model 102.
[0045] Exemplarily, the first retrieval model can be the fine ranking model 103, and the second retrieval model can be the rough ranking model 102 and the recall model 101.
[0046] Exemplarily, exemplarily, the first retrieval model can be the rough ranking model 102, and the second retrieval model can be the recall model 101.
[0047] 202. Based on the first sample set, train and / or test the first retrieval model in the retrieval system to obtain the updated first retrieval model.
[0048] In some embodiments, the first sample set can be used as the training set of the first retrieval model to train the first retrieval model to obtain the updated first retrieval model.
[0049] In some embodiments, a training set of the first retrieval model may also be determined based on the first sample set, and the first retrieval model may be tested to obtain the final first retrieval model.
[0050] In the retrieval model update method provided by the embodiments of the present application, when training and / or testing the first retrieval model, the historical input data and / or historical output data corresponding to the retrieval stage of the second model in the retrieval system before the first retrieval model are used. In this way, it is equivalent that the sample output method for training and / or testing the retrieval model is the data output at an earlier position in the retrieval stage of the retrieval system. Thus, a large amount of data that was not exposed earlier in the retrieval system can be used as samples, and the retrieval system obtained by training and / or testing can improve the long-tail recall rate.
[0051] In some embodiments, the first sample set includes the historical input data and historical output data corresponding to the retrieval stage of the second retrieval model, and the weight of the first sample in the first sample set is less than the weight of the second sample.
[0052] Among them, the first sample weight is the weight of the sample composed of the historical input data corresponding to the retrieval stage of the second retrieval model, and the second sample weight is the weight of the sample composed of the historical output data corresponding to the retrieval stage of the second retrieval model.
[0053] That is to say, the sample composed of the historical input data corresponding to the retrieval stage of the second retrieval model is used as the secondary sample, and the sample composed of the historical output data corresponding to the retrieval stage of the second retrieval model is used as the primary sample.
[0054] Exemplarily, taking the above-mentioned second retrieval model as the recall model 101 and the first retrieval model as the rough ranking model 102 as an example, as Figure 3 shown, it is a schematic diagram for constructing a first sample set. Among them, the recall result TopX in the first sample set is used as the primary sample, and the intermediate recall result is used as the secondary sample. After obtaining the first sample set, the first sample set can be manually annotated / large language model annotated to be used as the training set and / or test set of the rough ranking model 102.
[0055] Exemplarily, taking the above-mentioned second retrieval model as the rough ranking model 102 and the first retrieval model as the fine ranking model 103 as an example, as Figure 4 shown, it is another schematic diagram for constructing a first sample set. Among them, the rough ranking result TopY in the first sample set is used as the primary sample, and the recall result TopX is used as the secondary sample. After obtaining the first sample set, the first sample set can be manually annotated / large language model annotated to be used as the training set and / or test set of the fine ranking model 103.
[0056] In the above embodiments, the weight of the first sample in the first sample set is less than the weight of the second sample, such that in the retrieval stage, the weight of the sample closer to the first retrieval model in the link is greater. Since the positive sample rate of earlier samples is smaller, and the smaller the positive sample rate, the more complex the subsequent training and testing processes will be. Therefore, samples closer to the first retrieval model in the link are more frequently used in the first sample set, so that while improving the long-tail recall rate, the complexity of subsequent training and testing can be reduced.
[0057] In some embodiments, the weight allocation logic between the main samples and the secondary samples in the first sample set may include, but is not limited to:
[0058] The difference in positive sample rates is positively correlated with the difference in weights. The difference in positive sample rates is the difference between the historical positive sample rate of the first retrieval model and the historical positive sample rate of the corresponding retrieval stage of the second retrieval model, and the difference in weights is the difference between the weight of the second sample and the weight of the first sample.
[0059] Among them, the greater the difference in positive sample rates, the greater the difference in weights; the smaller the difference in positive sample rates, the smaller the difference in weights.
[0060] Exemplarily, when the historical positive sample rate of the corresponding retrieval stage of the second retrieval model is half of the historical positive sample rate of the first retrieval model, then the weight of the first sample is half of the weight of the second sample.
[0061] In the above embodiments, since the positive sample rate of earlier samples is smaller, generally the historical positive sample rate of the corresponding retrieval stage of the second retrieval model is less than the historical positive sample rate of the first retrieval model. The smaller the positive sample rate, the more complex the subsequent training and testing processes will be. Therefore, making the difference in positive sample rates positively correlated with the difference in weights can result in the greater the difference in positive sample rates, the greater the difference in weights; the smaller the difference in positive sample rates, the smaller the difference in weights. In this way, the weights between the main samples and the secondary samples can be reasonably configured, and the long-tail recall rate can be improved and the complexity of subsequent training and testing can be reduced to a greater extent simultaneously.
[0062] In some embodiments, the second retrieval model is the retrieval model corresponding to the first retrieval stage in the retrieval system. Based on the historical input data of the corresponding retrieval stage of the second retrieval model, the second retrieval model is trained to obtain the updated second retrieval model.
[0063] Exemplarily, taking the recall model 101 in the retrieval system shown above Figure 1 as an example, in the retrieval stage before it is modeled, at this time, in the subsequent training and / or testing processes, the recall model 101 can be trained and / or tested based on the recall intermediate results input to the recall model 101 in history to obtain the updated recall model.
[0064] Exemplarily, taking the Figure 1 retrieval system shown above as an example, assume that Figure 1 the above-mentioned recall model 101 does not exist in the retrieval system in [[]], then sampling can be performed according to the historical input data input to the rough ranking model 102, and the rough ranking model 102 can be trained and / or tested to obtain an updated rough ranking model.
[0065] Exemplarily, taking the Figure 1 retrieval system shown above as an example, assume that Figure 1 the above-mentioned rough ranking model 102 does not exist in the retrieval system in [[]], then sampling can be performed according to the historical input data input to the fine ranking model 103, and the fine ranking model 103 can be trained and / or tested to obtain an updated rough ranking model.
[0066] In the above-mentioned embodiments, the historical input data of the retrieval model can be used as training samples to train and test itself, so that the long-tail recall rate can also be improved.
[0067] In some embodiments, the weight of the positive samples in the first sample set is a preset multiple of the weight of the negative samples.
[0068] In the early retrieval stage of the retrieval system, the samples sampled often encounter the problem of data imbalance, that is, there are fewer positive samples and more negative samples. To address the data imbalance problem, different category weights can be used for positive and negative samples. The weight of the positive samples can be set to N times the weight of the negative samples, where (N >> 1). Here, N is the preset multiple. In the embodiments of the present disclosure, N can be much greater than 1, that is, the difference between N and 1 is greater than the preset value. The specific value of N is not limited in the embodiments of the present application.
[0069] In the above-mentioned embodiments, setting the weight of the positive samples in the first sample set to a preset multiple of the weight of the negative samples can improve the recall accuracy of the model on positive samples.
[0070] In some embodiments, the first retrieval model in the retrieval system can be trained according to the first sample set with the goal of minimizing the Focal Loss function to obtain an updated first retrieval model. Focal Loss is a loss function used to solve the problem of sample imbalance in tasks such as object detection.
[0071] In the embodiments of the present application, the ways that can replace Focal loss when solving the sample imbalance problem may include:
[0072] (1) Class Balanced Loss: Adjust the weights of the loss function according to the number of samples in each class. The basic idea is to assign a weight to each class, and this weight is inversely proportional to the number of samples in that class, so that the model can pay more attention to the classes with fewer samples during training.
[0073] (2) Reweighted Cross Entropy: Weight the loss of each sample in Reweighted Cross Entropy, and the weights are determined according to the rarity of the class to which the sample belongs. Similar to the class balanced loss, but may be different in the calculation method of the weights, and can be designed according to specific requirements and data characteristics.
[0074] (3) Hard Example Mining: Select those samples that are difficult for the model to classify from the training data, and then use these hard examples to train the model. Hard examples can be dynamically selected during the training process, or pre-screened according to certain criteria and then used together with the original training data to train the model.
[0075] For the problem of data imbalance often encountered in the samples sampled in the early retrieval stage of the retrieval system, the above Focal Loss function can be used to solve it. The Focal Loss function can pay more attention to the difficult-to-classify samples and improve the recall accuracy of the model on positive samples.
[0076] In some embodiments, a second sample set is obtained from the historical exposure data of the retrieval system; the first retrieval model is trained based on the second sample set to obtain an updated first retrieval model; then, based on the first sample set, the first retrieval model obtained in the previous step is trained to obtain the final first retrieval model.
[0077] For the problem of data imbalance often encountered in the samples sampled in the early retrieval stage of the retrieval system, training can be carried out in the way of curriculum learning, that is, first use the exposure samples with a more balanced sample ratio to construct an easy learning task, and then use the samples sampled in the early stage of the system with an unbalanced sample ratio to construct a difficult learning task. Through the learning of these two processes, the recall accuracy of the model on positive samples can be improved.
[0078] In some embodiments, after obtaining the above first sample set, the processes of annotation, model training, and model deployment can be performed to obtain a new retrieval system.
[0079] (A) Annotation:
[0080] For the training sets and test sets of the retrieval models corresponding to the above different retrieval stages, the relevance levels need to be labeled by means of manual annotation and / or large language model annotation. Generally speaking, the relevance levels can be set according to the degree of relevance, and are at least divided into two levels: relevant / irrelevant, or further subdivided into multiple relevance levels.
[0081] Among them, the large language model labels the samples according to the manual standards, which can improve the accuracy of the samples. It is an auxiliary and / or alternative to manual annotation, and is another output method for the training and test sets, which is equivalent to manual annotation.
[0082] (B) Model training:
[0083] During the model training process, Figure 5 FIG. is a schematic structural diagram of a relevance model constructed based on a pre-trained language model of Transformer. A twin-tower model as shown in (a) in can be constructed using a pre-trained language model of Transformer, or an interactive model as shown in (b) in can be used as the relevance model corresponding to each of the above retrieval stages, and is trained based on the above first sample set, and the retrieval models corresponding to each retrieval stage obtained after training are deployed to the corresponding positions in the retrieval system. Figure 5 as shown in Figure 5 It should be noted that the above pre-trained language model based on Transformer is only an example. In the embodiments of the present disclosure, there are replaceable models for the above pre-trained language model based on Transformer. Among them, the replaceable model can be a recurrent neural network (RNN) and its variants. Exemplarily, the following models can be included:
[0084] LSTM (Long Short-Term Memory): It can learn long-term dependencies and controls the flow of information through a gating mechanism, so as to effectively handle the long-term dependency problems in sequence data. It is also widely used in tasks such as language modeling and machine translation.
[0085] GRU (Gated Recurrent Unit): It is also a variant of RNN. It combines the forget gate and input gate in LSTM into an update gate, simplifies the model structure, and can also handle the long-term dependency problems in sequence data well.
[0086]
[0087] Convolutional Neural Network (CNN): Such as WaveNet, etc., which models text sequences through convolutional layers and can capture local features and patterns in the text. The receptive field can be expanded by stacking multiple convolutional layers and pooling layers to learn information from longer sequences.
[0088] Non-Transformer models based on attention mechanisms: Such as the SparseAttention model, etc., which aim to improve the efficiency and performance of attention calculation while maintaining the ability to model long sequences. These models may perform better on some specific tasks or data.
[0089] In the embodiments of this application, after training the retrieval model using the above training set, it can be evaluated based on the test set, and the parameters can be tuned according to the evaluation results to finally update the retrieval model.
[0090] (C) Model deployment:
[0091] The model trained through the above process can be deployed to the corresponding retrieval stage in the online retrieval system, so as to improve the long-tail recall rate in the retrieval stage.
[0092] Exemplarily, on the basis of the above Figure 3 a schematic diagram of model deployment is shown. According to the training set and / or test set of the rough ranking model, the new rough ranking model obtained is used in the rough ranking stage to improve the relevance recall accuracy in this stage. Figure 6
[0093] Exemplarily, on the basis of the above Figure 4 a schematic diagram of another model deployment is shown. According to the training set and / or test set of the model, the new fine ranking model obtained is used in the fine ranking stage to improve the relevance recall accuracy in this stage. Figure 7
[0094] The retrieval model update method provided by the embodiments of this application abandons the sample generation method mainly using exposure results, and mainly uses samples generated at earlier positions in the link of the retrieval system; different sample sampling methods are designed for different retrieval stages, so that the rough ranking stage and the fine ranking stage focus on different model classification surfaces and obtain better cooperation effects.
[0095] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are sequentially shown as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear indication in this article, there is no strict order limit for the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.
[0096] Based on the same inventive concept, an embodiment of the present application also provides a retrieval model update device for implementing the retrieval model update method described above. The solution provided by this device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the retrieval model update device provided below can refer to the limitations on the retrieval model update method in the above text, and will not be repeated here.
[0097] In an exemplary embodiment, as Figure 8 shown, a retrieval model update device is provided,
[0098] applied to a retrieval system, the retrieval system includes retrieval models corresponding to at least two retrieval stages, the output of the retrieval model corresponding to the previous retrieval stage is the input of the retrieval model corresponding to the next retrieval stage, and the retrieval models corresponding to the at least two retrieval stages are used to recommend interesting content to the user based on the retrieval information input by the user. The device includes:
[0099] An acquisition module 801, configured to acquire a first sample set;
[0100] An update module 802, configured to train and / or test the first retrieval model in the retrieval system based on the first sample set to obtain the updated first retrieval model;
[0101] Wherein, the first sample set includes historical input data and / or historical output data of the retrieval stage corresponding to the second retrieval model, and the second retrieval model is the retrieval model in the retrieval system whose retrieval stage is before the first retrieval model.
[0102] In some embodiments, the first sample set includes historical input data and historical output data of the retrieval stage corresponding to the second retrieval model, and the first sample weight in the first sample set is less than the second sample weight;
[0103] Among them, the first sample weight is the weight of the sample composed of the historical input data in the retrieval stage corresponding to the second retrieval model, and the second sample weight is the weight of the sample composed of the historical output data in the retrieval stage corresponding to the second retrieval model.
[0104] In some embodiments, the positive sample rate difference is positively correlated with the weight difference. The positive sample rate difference is the difference between the historical positive sample rate of the first retrieval model and the historical positive sample rate in the retrieval stage corresponding to the second retrieval model, and the weight difference is the difference between the second sample weight and the first sample weight.
[0105] In some embodiments, the second retrieval model is the retrieval model corresponding to the first retrieval stage in the retrieval system. The update module 802 is further configured to: based on the historical input data in the retrieval stage corresponding to the second retrieval model, train and / or the second retrieval model to obtain the updated second retrieval model.
[0106] In some embodiments, the weight of the positive sample in the first sample set is a preset multiple of the negative sample weight.
[0107] In some embodiments, the update module 802 is specifically configured to: with the goal of minimizing the Focal Loss function, train the first retrieval model in the retrieval system according to the first sample set to obtain the updated first retrieval model.
[0108] In some embodiments, the update module 802 is further configured to: before training the first retrieval model in the retrieval system based on the first sample set to obtain the updated first retrieval model,
[0109] Obtain a second sample set from the historical exposure data of the retrieval system; train the first retrieval model based on the second sample set to obtain the updated first retrieval model.
[0110] In some embodiments, the retrieval models corresponding to at least two retrieval stages include the following models arranged from front to back in the retrieval stage:
[0111] Recall model, rough ranking model, and fine ranking model.
[0112] Each module in the above retrieval model update device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor in the computer device in hardware form or independent of it, or stored in the memory in the computer device in software form, so that the processor can call and execute the operations corresponding to the above modules.
[0113] In an exemplary embodiment, a computer device is provided. The computer device can be a terminal or a server, and its internal structural diagram can be as shown in Figure 9 . The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it implements a method for updating a retrieval model.
[0114] Those skilled in the art can understand that Figure 9 the structure shown in is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0115] In an exemplary embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory and is applied to a retrieval system. The retrieval system includes retrieval models corresponding to at least two retrieval stages. The output of the retrieval model corresponding to the previous retrieval stage is the input of the retrieval model corresponding to the next retrieval stage. The retrieval models corresponding to the at least two retrieval stages are used to recommend interesting content to the user based on the retrieval information input by the user. When the processor executes the computer program, the following steps are implemented:
[0116] Obtain a first sample set;
[0117] Based on the first sample set, train and / or test the first retrieval model in the retrieval system to obtain the updated first retrieval model;
[0118] Among them, the first sample set includes historical input data and / or historical output data of the retrieval stage corresponding to the second retrieval model, and the second retrieval model is the retrieval model in the retrieval system whose retrieval stage is before the first retrieval model.
[0119] In some embodiments, the first sample set includes the historical input data and historical output data of the retrieval stage corresponding to the second retrieval model, and the weight of the first sample in the first sample set is less than the weight of the second sample;
[0120] Wherein, the first sample weight is the weight of the sample composed of the historical input data of the retrieval stage corresponding to the second retrieval model, and the second sample weight is the weight of the sample composed of the historical output data of the retrieval stage corresponding to the second retrieval model.
[0121] In some embodiments, the positive sample rate difference is positively correlated with the weight difference. The positive sample rate difference is the difference between the historical positive sample rate of the first retrieval model and the historical positive sample rate of the retrieval stage corresponding to the second retrieval model, and the weight difference is the difference between the second sample weight and the first sample weight.
[0122] In some embodiments, the second retrieval model is the retrieval model corresponding to the first retrieval stage in the retrieval system. When the processor executes the computer program, the following steps are further implemented:
[0123] Based on the historical input data of the retrieval stage corresponding to the second retrieval model, train and / or update the second retrieval model to obtain the updated second retrieval model.
[0124] In some embodiments, the weight of the positive sample in the first sample set is a preset multiple of the weight of the negative sample.
[0125] In some embodiments, when the processor executes the computer program, the following steps are further implemented:
[0126] Taking the minimum of the Focal Loss function as the goal, train the first retrieval model in the retrieval system according to the first sample set to obtain the updated first retrieval model.
[0127] In some embodiments, when the processor executes the computer program, the following steps are further implemented:
[0128] Before training the first retrieval model in the retrieval system based on the first sample set to obtain the updated first retrieval model, obtain a second sample set from the historical exposure data of the retrieval system;
[0129] Train the first retrieval model based on the second sample set to obtain the updated first retrieval model.
[0130] In some embodiments, the retrieval models corresponding to the at least two retrieval stages include the following models arranged from front to back in the retrieval stage:
[0131] Recall model, rough ranking model, and fine ranking model.
[0132] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored and applied to a retrieval system. The retrieval system includes retrieval models corresponding to at least two retrieval stages, and the output of the retrieval model corresponding to the previous retrieval stage is the input of the retrieval model corresponding to the next retrieval stage. The retrieval models corresponding to the at least two retrieval stages are used to recommend interesting content to the user based on the retrieval information input by the user. When the computer program is executed by a processor, the following steps are implemented:
[0133] Obtain a first sample set;
[0134] Based on the first sample set, train and / or test the first retrieval model in the retrieval system to obtain the updated first retrieval model;
[0135] Wherein, the first sample set includes historical input data and / or historical output data of the retrieval stage corresponding to the second retrieval model, and the second retrieval model is the retrieval model of the retrieval stage in the retrieval system before the first retrieval model.
[0136] In some embodiments, the first sample set includes historical input data and historical output data of the retrieval stage corresponding to the second retrieval model, and the weight of the first sample in the first sample set is less than the weight of the second sample;
[0137] Wherein, the first sample weight is the weight of the sample composed of the historical input data of the retrieval stage corresponding to the second retrieval model, and the second sample weight is the weight of the sample composed of the historical output data of the retrieval stage corresponding to the second retrieval model.
[0138] In some embodiments, the positive sample rate difference is positively correlated with the weight difference. The positive sample rate difference is the difference between the historical positive sample rate of the first retrieval model and the historical positive sample rate of the retrieval stage corresponding to the second retrieval model, and the weight difference is the difference between the second sample weight and the first sample weight.
[0139] In some embodiments, the second retrieval model is the retrieval model corresponding to the first retrieval stage in the retrieval system. When the processor executes the computer program, the following steps are also implemented:
[0140] Based on the historical input data of the retrieval stage corresponding to the second retrieval model, train and / or the second retrieval model to obtain the updated second retrieval model.
[0141] In some embodiments, the weight of the positive sample in the first sample set is a preset multiple of the negative sample weight.
[0142] In some embodiments, when the processor executes the computer program, the following steps are further implemented:
[0143] Taking the minimum of the Focal Loss function as the goal, training the first retrieval model in the retrieval system according to the first sample set to obtain the updated first retrieval model.
[0144] In some embodiments, when the processor executes the computer program, the following steps are further implemented:
[0145] Before training the first retrieval model in the retrieval system based on the first sample set to obtain the updated first retrieval model, obtaining a second sample set from the historical exposure data of the retrieval system;
[0146] Training the first retrieval model based on the second sample set to obtain the updated first retrieval model.
[0147] In some embodiments, the retrieval models corresponding to the at least two retrieval stages include the following models arranged from front to back in the retrieval stage:
[0148] Recall model, rough ranking model, and fine ranking model.
[0149] In one embodiment, a computer program product is provided, including a computer program, which is applied to a retrieval system. The retrieval system includes retrieval models corresponding to at least two retrieval stages, and the output of the retrieval model corresponding to the previous retrieval stage is the input of the retrieval model corresponding to the next retrieval stage. The retrieval models corresponding to the at least two retrieval stages are used to recommend interesting content to the user based on the retrieval information input by the user. When the computer program is executed by a processor, the following steps are implemented:
[0150] Obtaining a first sample set;
[0151] Training and / or testing the first retrieval model in the retrieval system based on the first sample set to obtain the updated first retrieval model;
[0152] Wherein, the first sample set includes historical input data and / or historical output data of the retrieval stage corresponding to the second retrieval model, and the second retrieval model is the retrieval model in the retrieval system whose retrieval stage is before the first retrieval model.
[0153] In some embodiments, the first sample set includes historical input data and historical output data of the retrieval stage corresponding to the second retrieval model, and the weight of the first sample in the first sample set is less than the weight of the second sample;
[0154] Wherein, the first sample weight is the weight of the sample composed of the historical input data of the retrieval stage corresponding to the second retrieval model, and the second sample weight is the weight of the sample composed of the historical output data of the retrieval stage corresponding to the second retrieval model.
[0155] In some embodiments, the positive sample rate difference is positively correlated with the weight difference. The positive sample rate difference is the difference between the historical positive sample rate of the first retrieval model and the historical positive sample rate of the retrieval stage corresponding to the second retrieval model, and the weight difference is the difference between the second sample weight and the first sample weight.
[0156] In some embodiments, the second retrieval model is the retrieval model corresponding to the first retrieval stage in the retrieval system. When the processor executes the computer program, the following steps are further implemented:
[0157] Based on the historical input data of the retrieval stage corresponding to the second retrieval model, train and / or optimize the second retrieval model to obtain the updated second retrieval model.
[0158] In some embodiments, the weight of the positive sample in the first sample set is a preset multiple of the negative sample weight.
[0159] In some embodiments, when the processor executes the computer program, the following steps are further implemented:
[0160] Taking the minimum of the Focal Loss function as the objective, train the first retrieval model in the retrieval system according to the first sample set to obtain the updated first retrieval model.
[0161] In some embodiments, when the processor executes the computer program, the following steps are further implemented:
[0162] Before training the first retrieval model in the retrieval system based on the first sample set to obtain the updated first retrieval model, obtain a second sample set from the historical exposure data of the retrieval system;
[0163] Train the first retrieval model based on the second sample set to obtain the updated first retrieval model.
[0164] In some embodiments, the retrieval models corresponding to the at least two retrieval stages include the following models arranged from front to back in the retrieval stage:
[0165] Recall model, rough ranking model, and fine ranking model.
[0166] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.
[0167] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memories. Non-volatile memories can include read-only memory (ROM), magnetic tapes, floppy disks, flash memories, optical memories, high-density embedded non-volatile memories, resistive random access memories (ReRAM), magnetoresistive random access memories (MRAM), ferroelectric random access memories (FRAM), phase change memories (PCM), graphene memories, etc. Volatile memories can include random access memory (RAM) or external cache memories, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in this application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.
[0168] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered to be within the scope described in this specification.
[0169] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims
1. A retrieval model updating method, characterized in that: Applied to a retrieval system, the retrieval system includes at least two retrieval models corresponding to retrieval stages, the output of the retrieval model corresponding to the previous retrieval stage is the input of the retrieval model corresponding to the next retrieval stage, and the retrieval models corresponding to the at least two retrieval stages are used to recommend interesting content to a user based on retrieval information input by the user. The method includes: Obtaining a first sample set; Based on the first sample set, training and / or testing a first retrieval model in the retrieval system to obtain an updated first retrieval model; The first sample set includes historical input data and / or historical output data of a retrieval stage corresponding to a second retrieval model, and the second retrieval model is a retrieval model in the retrieval stage of the retrieval system that precedes the first retrieval model.
2. The method according to claim 1, characterized in that The first sample set includes historical input data and historical output data of the retrieval stage corresponding to the second retrieval model, and the first sample weight in the first sample set is less than the second sample weight; Among them, the first sample weight is the weight of the sample composed of historical input data of the retrieval stage corresponding to the second retrieval model, and the second sample weight is the weight of the sample composed of historical output data of the retrieval stage corresponding to the second retrieval model.
3. The method according to claim 2, characterized in that The positive sample rate difference is positively correlated with the weight difference. The positive sample rate difference is the difference between the historical positive sample rate of the first retrieval model and the historical positive sample rate of the retrieval stage corresponding to the second retrieval model. The weight difference is the difference between the second sample weight and the first sample weight.
4. The method according to claim 1, characterized in that: The second retrieval model is a retrieval model corresponding to the first retrieval stage in the retrieval system, and the method further includes: Based on the historical input data of the retrieval stage corresponding to the second retrieval model, the second retrieval model is trained and / or to obtain an updated second retrieval model.
5. The method according to any one of claims 1 to 4, characterized in that: The weight of the positive sample in the first sample set is a preset multiple of the weight of the negative sample.
6. The method according to any one of claims 1 to 4, characterized in that: The step of training the first retrieval model in the retrieval system based on the first sample set to obtain the updated first retrieval model includes: With the minimum Focal Loss function as a goal, the first retrieval model in the retrieval system is trained according to the first sample set to obtain an updated first retrieval model.
7. The method according to any one of claims 1 to 4, characterized in that: Before training the first retrieval model in the retrieval system based on the first sample set to obtain the updated first retrieval model, the method further includes: Acquire a second sample set from historical exposure data of the retrieval system; The first retrieval model is trained based on the second sample set to obtain an updated first retrieval model.
8. The method according to any one of claims 1 to 4, characterized in that: The retrieval models corresponding to the at least two retrieval stages include the following models set from the beginning to the end of the retrieval stage: Recall model, coarse sorting model, and fine sorting model.
9. A retrieval model updating device, characterized in that: Applied to a retrieval system, the retrieval system includes at least two retrieval models corresponding to retrieval stages, the output of the retrieval model corresponding to the previous retrieval stage is the input of the retrieval model corresponding to the next retrieval stage, the retrieval models corresponding to the at least two retrieval stages are used to recommend interesting content to a user based on retrieval information input by the user, the device includes: An acquisition module, used for acquiring a first sample set; A training module, configured to train and / or test a first retrieval model in the retrieval system based on the first sample set to obtain an updated first retrieval model; The first sample set includes historical input data and / or historical output data of a retrieval stage corresponding to a second retrieval model, and the second retrieval model is a retrieval model in the retrieval stage of the retrieval system that precedes the first retrieval model.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.