Content recall model training method and device, electronic equipment, and storage medium

By introducing a clustering loss function into the content recall model, the generation of user interest vectors is optimized, which solves the problems of low recall efficiency and high user vector similarity, and achieves efficient and accurate user interest representation.

CN115391589BActive Publication Date: 2026-03-03HANGZHOU NETEASE CLOUD MUSIC TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing content retrieval models are inefficient in low-latency retrieval scenarios, and the generated user vectors have too high similarity, resulting in poor retrieval performance.

Method used

By introducing a clustering loss function, the parameters of the content retrieval model are optimized based on the intra-class and inter-class distances between the cluster center vector and the feature vector of the user's historical clicks on media resources. This generates user interest vectors, and the clustering approach eliminates the need for complex network structures and multiple iterations.

Benefits of technology

It improves the accuracy and efficiency of content retrieval, and the generated user interest vectors are more accurate, making it suitable for low-latency retrieval scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115391589B_ABST
    Figure CN115391589B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a content recall model training method and device, electronic equipment and a storage medium. The method comprises: obtaining a training sample set; according to a pre-established content recall model, performing the following operation for each sample data in the sample set: inputting sample media resource features in the sample data and historical click media resource features of a sample user into the content recall model, and outputting a predicted score of the sample media resource; according to the predicted score of the sample media resource, an operation behavior label of the sample user for the sample media resource, and a preset loss function of the content recall model, iteratively optimizing each parameter of the content recall model until the content recall model converges, obtaining a trained content recall model, and the loss function comprises a clustering loss and a sample loss, and the clustering loss is determined according to an intra-class distance between generated clustering center vectors and historical click media resource feature vectors of the sample user and an inter-class distance between the clustering center vectors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to training methods, apparatus, electronic devices and storage media for content recall models. Background Technology

[0002] This section is intended to provide background or context for embodiments of this application. The description herein is not intended to imply that it is prior art simply because it is included in this section.

[0003] In music recommendation scenarios, users often have broad interests. For example, a user might be interested in media resources featuring genres like traditional Chinese music, rock, and country. Therefore, music recommendation systems need to cater to these diverse interests to improve recommendation effectiveness. Content recall is the first step in a music recommendation system, and its quality determines the overall recommendation quality. The recall phase must ensure the diversity of the recalled content.

[0004] In related technologies, the general framework of multi-interest content retrieval models typically includes: an embedding layer, a multi-interest extractor layer, and a label-aware attention layer. The embedding layer vectorizes the user's click history. The multi-interest extractor layer can employ a capsule network, where lower capsules represent the user's click history and upper capsules represent the user's interests. A dynamic routing algorithm adjusts the weights of the lower and upper capsules, ensuring that click histories representing the same user interest are routed to the same upper capsule. Multiple upper capsules can represent multiple user interests. The label attention layer uses an attention mechanism on the user's interest vectors output by the multi-interest extractor layer to generate the final user interest vector for retrieval. However, multi-interest extraction based on capsule networks requires more than 100 iterations, taking nearly 100ms, to potentially obtain diverse user interest vectors. This limits low-latency retrieval scenarios such as real-time retrieval, resulting in low content retrieval efficiency. Improving hardware computing performance would increase costs. The multi-interest extraction layer can also use a multi-head self-attention mechanism, which uses multiple independent attention operations in different spaces to aggregate user click history and generate user interest vectors to represent the user's diverse interests. However, this approach may result in the generated user interest vectors having too high similarity, leading to poor recall performance. Summary of the Invention

[0005] To address the limitations of existing content recall models in low-latency recall scenarios and the poor recall performance due to excessively high similarity of generated user vectors, this application provides a training method, apparatus, electronic device, and storage medium for a content recall model.

[0006] On the one hand, embodiments of this application provide a training method for a content retrieval model, including:

[0007] Obtain the training sample set;

[0008] Based on the pre-established content retrieval model, the following operations are performed for each sample data in the sample set:

[0009] The sample media resource features and the historical click media resource features of the sample users in the sample data are input into the content retrieval model, and the predicted score of the sample media resource is output.

[0010] Based on the predicted scores of the sample media resources, the operation behavior tags of the sample users for the sample media resources, and the loss function of the preset content retrieval model, the parameters of the content retrieval model are iteratively optimized until the content retrieval model converges, resulting in the trained content retrieval model. The loss function includes clustering loss and sample loss. The clustering loss is determined based on the intra-class distance between the generated cluster center vector and the historical click media resource feature vector of the sample users, and the inter-class distance between the cluster center vectors.

[0011] In one possible implementation, the sample data in the sample set includes positive samples and negative samples; the sample set is generated in the following manner:

[0012] Candidate samples are obtained based on the characteristics of the media resources requested by the client, the historical click characteristics of the media resources by the sample users of the client, and the operational behavior characteristics of the sample users of the client for the requested media resources.

[0013] Iterate through each candidate sample. If the current candidate sample is a positive sample, store the current candidate sample in the sample pool.

[0014] If the current candidate sample is a negative sample, and it is determined that negative sampling is required according to the set negative sampling ratio, then a negative sample is randomly selected from the negative sampling pool and stored in the sample pool. The negative sample in the negative sampling pool is the exposure sample of other users.

[0015] If the current candidate sample is a negative sample, and it is determined that negative sampling is not required according to the set negative sampling ratio, then the current candidate sample is stored in the sample pool, and the positive and negative samples in the sample pool constitute the sample set.

[0016] In one possible implementation, candidate samples are obtained based on the characteristics of the media resource requested by the client, the historical click characteristics of the media resource by the sample users of the client, and the operational behavior characteristics of the sample users of the client regarding the requested media resource, specifically including:

[0017] Receive media resource requests sent by clients and return a list of target media resources to the clients;

[0018] Extract the historical click media resource features of the sample users of the client, as well as the features of each target media resource;

[0019] Obtain the operation behavior tags of the sample users of the client for each target media resource;

[0020] For each target media resource, the historical click media resource features of the sample users of the client, the target media resource features, and the behavioral tags of the sample users of the client for the target media resource are concatenated to obtain the sample corresponding to the target media resource.

[0021] The samples corresponding to each target media resource are determined as candidate samples.

[0022] In one possible implementation, the content recall model includes a vector layer, an interest extraction layer, and an attention layer;

[0023] The sample media resource features and historical click media resource features of the sample users in the sample data are input into the content retrieval model, and the predicted score of the sample media resource is output, specifically including:

[0024] Input the sample media resource features and the sample user's historical click media resource features into the vector layer to obtain the sample media resource feature vector and the sample user's historical click media resource feature vector.

[0025] The sample media resource feature vector and the sample user's historical click media resource feature vector are input into the interest extraction layer. The sample user's historical click media resource feature vector is clustered according to the generated cluster center vectors to obtain the sample user's interest vector.

[0026] The sample media resource feature vector and the sample user's interest vector are input into the attention layer to perform an attention mechanism operation, thereby obtaining the sample user's target interest vector.

[0027] The predicted score is determined based on the feature vector of the sample media resources and the target interest vector of the sample users.

[0028] In one possible implementation, clustering the historical click media resource feature vectors of the sample users based on the generated cluster center vectors yields the interest vectors of the sample users, specifically including:

[0029] For each historical click media resource feature of the sample user, the distance between the historical click media resource feature vector and each cluster center vector is calculated.

[0030] The historical click media resource feature vectors are grouped into one class with the cluster center vectors that have the smallest distance from each other.

[0031] The interest vectors of the sample users are generated based on the historical click media resource vectors categorized into the respective cluster center vectors.

[0032] In one possible implementation, the method further includes:

[0033] Obtain the characteristics of the user's historical clicks on media resources;

[0034] The user's historical click media resource features are input into the trained content retrieval model to obtain the user's interest vector;

[0035] The user's interest vector is compared with the candidate recall media resources using an attention mechanism to obtain the user's target interest vector.

[0036] A score is calculated based on the user's target interest vector and the candidate recall media resources, and the target recall media resources are determined based on the score.

[0037] On one hand, embodiments of this application provide a training apparatus for a content retrieval model, including:

[0038] The first acquisition unit is used to acquire the training sample set;

[0039] The training unit is used to perform the following operations for each sample data in the sample set according to the pre-established content retrieval model: inputting the sample media resource features and the sample user's historical click media resource features from the sample data into the content retrieval model, and outputting the predicted score of the sample media resource; iteratively optimizing each parameter of the content retrieval model according to the predicted score of the sample media resource, the sample user's operation behavior label for the sample media resource, and the pre-set loss function of the content retrieval model, until the content retrieval model converges, and obtaining the trained content retrieval model. The loss function includes clustering loss and sample loss. The clustering loss is determined based on the intra-class distance between the generated cluster center vector and the sample user's historical click media resource feature vector, and the inter-class distance between the cluster center vectors.

[0040] In one possible implementation, the sample data in the sample set includes positive samples and negative samples;

[0041] The first acquisition unit is specifically used to generate the sample set in the following manner: obtaining candidate samples based on the media resource characteristics requested by the client, the historical click media resource characteristics of the sample users of the client, and the operation behavior characteristics of the sample users of the client for the requested media resources; traversing each candidate sample, if the current candidate sample is a positive sample, storing the current candidate sample in the sample pool; if the current candidate sample is a negative sample, and it is determined that negative sampling is required according to the set negative sampling ratio, randomly selecting a negative sampling sample from the negative sampling pool and storing it in the sample pool, wherein the negative sampling samples in the negative sampling pool are exposure samples set for other users; if the current candidate sample is a negative sample, and it is determined that negative sampling is not required according to the set negative sampling ratio, storing the current candidate sample in the sample pool, wherein the positive samples and negative samples in the sample pool constitute the sample set.

[0042] In one possible implementation, the first acquisition unit is specifically configured to receive a media resource request sent by a client, return a list of target media resources to the client, extract the historical click media resource features of the client's sample users, and the features of each target media resource, respectively; acquire the operation behavior tags of the client's sample users for each target media resource; for each target media resource, concatenate the historical click media resource features of the client's sample users, the target media resource features, and the operation tags of the client's sample users for the target media resource to obtain a sample corresponding to the target media resource; and determine the samples corresponding to each target media resource as candidate samples.

[0043] In one possible implementation, the content recall model includes a vector layer, an interest extraction layer, and an attention layer;

[0044] The training unit is specifically configured to input sample media resource features and sample user's historical click media resource features into the vector layer to obtain sample media resource feature vectors and sample user's historical click media resource feature vectors; input the sample media resource feature vectors and sample user's historical click media resource feature vectors into the interest extraction layer, and cluster the sample user's historical click media resource feature vectors according to the generated cluster center vectors to obtain the sample user's interest vector; input the sample media resource feature vectors and sample user's interest vectors into the attention layer to perform attention mechanism operations to obtain the sample user's target interest vector; and determine the prediction score based on the sample media resource feature vectors and sample user's target interest vector.

[0045] In one possible implementation, the training unit is specifically configured to calculate the distance between the historical click media resource feature vector and each cluster center vector for each historical click media resource feature of the sample user; group the historical click media resource feature vector and the cluster center vector with the smallest distance into one class; and generate the corresponding interest vector of the sample user based on the historical click media resource vectors grouped into each cluster center vector.

[0046] In one possible implementation, the device further includes:

[0047] The second acquisition unit is used to acquire the user's historical click media resource characteristics;

[0048] The first obtaining unit is used to input the user's historical click media resource features into the trained content retrieval model to obtain the user's interest vector.

[0049] The second obtaining unit is used to perform an attention mechanism operation on the user's interest vector and the candidate recall media resources to obtain the user's target interest vector.

[0050] The determining unit is used to calculate a score based on the user's target interest vector and candidate recall media resources, and to determine the target recall media resources based on the score.

[0051] On one hand, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the training method of the content recall model described in this application.

[0052] On one hand, embodiments of this application provide a computer-readable storage medium storing computer program instructions thereon, which, when executed by a processor, implement the steps in the training method of the content recall model described in this application.

[0053] The beneficial effects of the embodiments of this application are as follows:

[0054] The training scheme for the content recall model provided in this application embodiment obtains a training sample set. Based on the pre-established content recall model, the following operations are performed on each sample data in the sample set: the sample media resource features and the historical click media resource features of the sample user are input into the content recall model, and the predicted score of the sample media resource is output. Based on the predicted score of the sample media resource, the operation behavior tags of the sample user for the sample media resource, and the pre-set loss function of the content recall model, the parameters of the content recall model are iteratively optimized until the content recall model converges, thus obtaining the trained content recall model. The loss function includes clustering loss and sample loss. The clustering loss is based on the intra-class distance between the generated cluster center vector and the historical click media resource feature vector of the sample user. The clustering loss introduced in the loss function during the training of the content retrieval model in this embodiment is determined by the distance between cluster centers and the inter-class distance between cluster center vectors. This loss is generated by clustering the historical click media resource feature vectors of sample users to produce corresponding user interest vectors. Each user interest vector represents one user interest, and multiple clusters can represent diverse user interests. The clustering loss considers the intra-class distance and inter-class distance of the cluster centers. As the content retrieval model is iteratively trained, the cluster centers learn continuously and become more accurate, thus making the generated user interest vectors more accurate. Furthermore, this clustering method does not require a complex network structure and does not require a large number of iterations to complete the training of the content retrieval model. Therefore, it improves both the accuracy and efficiency of content retrieval. Attached Figure Description

[0055] Figure 1 A schematic diagram illustrating an application scenario of the training method for the content retrieval model provided in this application embodiment;

[0056] Figure 2 A flowchart illustrating the implementation of the training method for the content retrieval model provided in this application embodiment;

[0057] Figure 3 A flowchart illustrating the implementation of generating a training sample set as provided in this application embodiment;

[0058] Figure 4 A flowchart illustrating the process of obtaining candidate samples provided in this application embodiment;

[0059] Figure 5 This is a structural diagram of the content recall model provided in the embodiments of this application;

[0060] Figure 6 A flowchart illustrating the implementation of obtaining predicted scores for sample resources, provided in an embodiment of this application;

[0061] Figure 7A flowchart illustrating the implementation of obtaining the interest vectors of sample users as provided in this application embodiment;

[0062] Figure 8 Clustering example diagram of historical click media resource vectors of sample users provided in the embodiments of this application;

[0063] Figure 9 An example diagram illustrating the aggregation of historical click media resource vectors from sample users clustered into a cluster center vector, as provided in this application embodiment;

[0064] Figure 10 A schematic diagram illustrating intra-class and inter-class distances provided in embodiments of this application;

[0065] Figure 11 Forward and backward propagation diagrams of the content recall model provided in the embodiments of this application;

[0066] Figure 12 A flowchart illustrating the implementation of the content recall method provided in this application embodiment;

[0067] Figure 13 A schematic diagram of the structure of the training device for the content recall model provided in the embodiments of this application;

[0068] Figure 14 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0069] The principles and spirit of this application will now be described with reference to several exemplary embodiments. It should be understood that these embodiments are provided merely to enable those skilled in the art to better understand and implement this application, and are not intended to limit the scope of this application in any way. Rather, these embodiments are provided to make this disclosure more thorough and complete, and to fully convey the scope of this disclosure to those skilled in the art.

[0070] Those skilled in the art will recognize that embodiments of this application can be implemented as a system, apparatus, device, method, or computer program product. Therefore, this disclosure can be specifically implemented in the following forms: entirely hardware, entirely software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.

[0071] In this document, it should be understood that the number of any elements in the accompanying drawings is for illustrative purposes only and not for limitation, and any naming is for distinction only and has no limiting meaning. The data involved in this disclosure can be data authorized by the user or fully authorized by all parties, and the collection, dissemination, and use of the data comply with the requirements of relevant national laws and regulations. The implementation methods / executives of this disclosure can be combined with each other.

[0072] The principles and spirit of this application are explained in detail below with reference to several representative embodiments. For ease of understanding, the technical terms used in the embodiments of this application are explained as follows:

[0073] 1. Multi-interest recall: Recall content that users are interested in based on multiple interests to meet users' diverse interest needs.

[0074] 2. Attention mechanism: This is a mechanism that focuses on local information. This mechanism comes from natural language processing. In content recommendation scenarios, the attention mechanism locates information of interest, suppresses useless information, and focuses on different parts of the user's interests.

[0075] 3. Multi-head attention uses multiple queries to compute multiple pieces of information from the input information in parallel, with each attention focusing on a different part of the input information. Invention Overview

[0077] In music recommendation scenarios, users often have broad interests. For example, a user might be interested in media resources featuring genres like traditional Chinese music, rock, and country. Therefore, music recommendation systems need to cater to these diverse interests to improve recommendation effectiveness. Content recall is the first step in a music recommendation system, and its quality determines the overall recommendation quality. The recall phase must ensure the diversity of the recalled content.

[0078] In related technologies, the general framework of multi-interest content retrieval models typically includes a vector layer, a multi-interest extraction layer, and a tag-aware attention layer. The vector layer vectorizes the user's click history. The multi-interest extraction layer can employ a capsule network, where lower capsules represent the user's click history and upper capsules represent the user's interests. A dynamic routing algorithm adjusts the weights of the lower and upper capsules, ensuring that click histories representing the same user interest are routed to the same upper capsule. Multiple upper capsules can represent multiple user interests. The tag-attention layer uses an attention mechanism on the user's interest vectors output by the multi-interest extraction layer to generate the final user interest vector for training or retrieval. However, multi-interest extraction based on capsule networks requires more than 100 iterations, taking nearly 100ms, to potentially obtain diverse user interest vectors. This limits low-latency retrieval scenarios such as real-time retrieval, resulting in low content retrieval efficiency. Improving hardware computing performance would increase costs. The multi-interest extraction layer can also use a multi-head self-attention mechanism, which uses multiple independent attention operations in different spaces to aggregate user click history and generate user interest vectors to represent the user's diverse interests. However, this approach may result in the generated user interest vectors having too high similarity, leading to poor recall performance.

[0079] Based on this, this application provides a training method for a content recall model. A training sample set is obtained, and according to a pre-established content recall model, the following operations are performed for each sample data in the sample set: The sample media resource features and the historical click media resource features of the sample user are input into the content recall model, and the predicted score of the sample media resource is output. Based on the predicted score of the sample media resource, the user's action behavior tags for the sample media resource, and the pre-defined loss function of the content recall model, the parameters of the content recall model are iteratively optimized until the content recall model converges, resulting in the trained content recall model. The loss function includes clustering loss and sample loss. The clustering loss is based on the relationship between the generated cluster center vector and the historical click media resource feature vector of the sample user. The intra-class distance and the inter-class distance between cluster center vectors are determined in this embodiment of the application. When training the content retrieval model, the clustering loss introduced in the loss function generates corresponding user interest vectors by clustering the historical click media resource feature vectors of sample users. Each user interest vector represents one user interest, and multiple clusters can represent diverse user interests. The clustering loss considers the intra-class distance and inter-class distance of the cluster centers. As the content retrieval model is iteratively trained, the cluster centers learn continuously and become more accurate, thus making the generated user interest vectors more accurate. Moreover, this clustering method does not require a complex network structure and does not require a large number of iterations to complete the training of the content retrieval model. Therefore, it improves both the accuracy and efficiency of content retrieval.

[0080] After introducing the basic principles of this application, the various non-limiting embodiments of this application will be described in detail below.

[0081] Application Scenarios Overview

[0082] refer to Figure 1This is a schematic diagram of an application scenario for the training method for content retrieval provided in the embodiments of this application. This application scenario is a training sample generation system for a content retrieval model. The training sample generation system can generate training samples online. The training sample generation system can include a client 101, a server 102, a sample service module 103, a feature extraction service module 104, and a sample library 105. The generated samples are stored in the sample library 105. During training, the server 102 obtains the training sample set from the sample library 105. Based on the pre-established content retrieval model, it performs the following operations for each sample data in the sample set: inputting the sample media resource features and the sample user's historical click media resource features from the sample data into the content retrieval model, outputting the predicted score of the sample media resource, and iteratively optimizing the parameters of the content retrieval model based on the predicted score of the sample media resource, the sample user's operation behavior tags for the sample media resource, and the preset loss function of the content retrieval model until the content retrieval model converges, thus obtaining the trained content retrieval model. The loss function includes clustering loss and sample loss. The clustering loss is determined based on the intra-class distance between the generated cluster center vector and the sample user's historical click media resource feature vector, and the inter-class distance between the cluster center vectors.

[0083] In this embodiment, the sample service module 103 and the feature extraction service module 104 can be modules deployed on the server 102 or stand-alone servers; this embodiment does not limit the specific deployment. The sample library 105 can use HDFS (Hadoop Distributed File System) or Kafka (a high-throughput distributed publish-subscribe messaging system), etc.

[0084] The client 101 may include an independent physical server or a cloud server that provides basic cloud computing services such as cloud servers, cloud databases, and cloud storage. The server 102 may be, but is not limited to, devices such as smartphones, tablets, laptops, and desktop computers. This application embodiment does not limit this.

[0085] Exemplary methods

[0086] The following describes a content recall method according to an exemplary embodiment of this application, using the above application scenarios as an example. It should be noted that the above application scenarios are shown only to facilitate understanding of the spirit and principles of this application, and the embodiments of this application are not limited in any way. Rather, the embodiments of this application can be applied to any applicable scenario.

[0087] refer to Figure 2 This application provides a training method for a content recall model, which can be applied to... Figure 1The server 102 shown may specifically include the following steps:

[0088] S21. Obtain the training sample set.

[0089] In practice, the training sample set includes positive and negative samples, which can be achieved through methods such as... Figure 3 The process shown generates the training sample set:

[0090] S211. Based on the characteristics of the media resources requested by the client, the historical click characteristics of the media resources by the sample users of the client, and the operational behavior characteristics of the sample users of the client for the requested media resources, candidate samples are obtained.

[0091] In specific implementation, it can be done according to the following: Figure 4 The process shown obtains candidate samples:

[0092] S2111: Receive media resource requests sent by the client and return a list of target media resources to the client.

[0093] For specific implementation, please refer to Figure 1 The architecture diagram of the training sample generation system shows that sample users send media resource requests to the server through the client. The server returns a list of target media resources requested by the user to the client. Simultaneously, the server sends the sample user identifier and the media resource list to the sample service module, requesting to obtain the characteristics of each target media resource in the list. The sample user performs actions on the target media resources in the list through the client, such as whether to perform a click action. The client then sends the sample user's action information for each target media resource in the list to the sample service module. The content retrieval model provided in this application embodiment can be applied to music recommendation scenarios. The media resources can be, but are not limited to, song resources or video resources, etc., and this application embodiment does not impose any limitations on this.

[0094] S2112. Extract the historical click media resource features of the sample users on the client side, as well as the features of each target media resource.

[0095] In practice, after receiving the media resource list and feature extraction request from the server, the sample service module retrieves the sample user's historical clicked media resources stored locally based on the sample user's identifier. It then sends a feature extraction request to the feature extraction service module, which includes the target media resources in the media resource list and the sample user's historical clicked media resources. The feature extraction service module extracts features from each historical clicked media resource and features from each target media resource in the target resource list. Finally, it returns the features of each historical clicked media resource and each target media resource to the sample service module. The media resource features may include, but are not limited to, the following: media resource name, style, language, etc.

[0096] To further improve the accuracy of the predicted interest vectors of sample users, the feature extraction service module can also extract the profile features of sample users and return them to the sample service module. This allows the sample service module to generate candidate samples based on the profile features of sample users, the target sample media resource features, and the sample user's historical click media resource features, for training the established content retrieval model. The profile features of sample users may include, but are not limited to, the following: the sample user's identity features and the sample user's preference features. The identity features may include, but are not limited to, features such as the sample user's age, gender, and the region to which the sample user's identifier belongs. The preference features may include, but are not limited to, features such as the sample user's preferred media resource style and preferred media resource language.

[0097] Taking music resources as an example, the characteristics of music resources can include: the name, style, and language of the music resources. The preferences of sample users can include: the music styles and languages ​​of the songs preferred by the sample users.

[0098] S2113. Obtain the operation behavior tags of sample users on the client for each target media resource.

[0099] In specific implementation, after the sample service module receives the historical click media resource features and various target media resource features of the sample user from the client returned by the feature extraction service module, or after the sample server module receives the historical click media resource features, various target media resource features, and the sample user's profile features from the client returned by the feature extraction module, the received features are cached for a period of time, waiting for the client to report the sample user's operation behavior tags for each target media resource in the sample resource list. Assuming the client requests a song resource from the server, and the server returns a media resource list containing 10 related songs (i.e., 10 target song resources), and assuming the sample user clicks on songs 1-3 through the client but does not perform any operation on songs 4-10, then the sample user's operation behavior tag for songs 1-3 can be set to "1", and the sample user's operation behavior tag for songs 4-10 can be set to "0". In implementation, the sample user's operation behavior tags can be set independently, and this embodiment does not limit this.

[0100] S2114. For each target media resource, the historical click media resource features of the client's sample users, the target media resource features, and the behavioral tags of the client's sample users for the target media resource are concatenated to obtain the sample corresponding to the target media resource.

[0101] In practice, for each target media resource, the sample service module concatenates the historical click media resource features of the client's sample users, the features of the target media resource, and the behavioral tags of the client's sample users for the target media resource to obtain the sample corresponding to the target media resource. Alternatively, the sample service module can also concatenate the historical click media resource features of the client's sample users, the features of the target media resource, the profile features of the sample users, and the behavioral tags of the client's sample users for the target media resource to obtain the sample corresponding to the target media resource.

[0102] S2115. The samples corresponding to each target media resource are determined as candidate samples.

[0103] In specific implementation, the sample service module determines the samples corresponding to each generated target media resource as candidate samples. Among the candidate samples, the samples corresponding to the target media resources clicked by the client's sample user are positive samples, and the samples corresponding to the target media resources not clicked by the client's sample user (i.e., exposed but not clicked target media resources) are negative samples. The sample service module caches each candidate sample for further negative sampling processing. This is because the recalled sample space is inconsistent with the online exposed media resources; therefore, negative sampling of candidate samples can improve the relevance learning ability. In this embodiment, online real-time negative sampling processing of candidate samples can reduce sample processing time from hours to minutes compared to offline sample processing, greatly improving sample generation efficiency.

[0104] S212. Iterate through each candidate sample. If the current candidate sample is a positive sample, store the current candidate sample in the sample pool.

[0105] In practice, after the sample service module obtains the candidate samples, it iterates through each candidate sample. If the current candidate sample is a positive sample, that is, the current candidate sample is the sample corresponding to the target media resource clicked by the client's sample user, then the current candidate sample is stored in the sample pool as a positive sample of the training sample set.

[0106] S213. If the current candidate sample is a negative sample, and it is determined that negative sampling is required according to the set negative sampling ratio, then a negative sample is randomly selected from the negative sampling pool and stored in the sample pool. The negative sample in the negative sampling pool is the exposure sample set for other users.

[0107] In practice, if the current candidate sample is a negative sample, that is, the sample corresponding to the target media resource that the client's sample user has not clicked, then it is determined whether negative sampling is needed based on the pre-set negative sampling ratio. If negative sampling is needed, then a negative sample is randomly selected from the exposure samples of other users contained in the negative sampling pool as a negative sample of the training sample set and stored in the sample pool.

[0108] Specifically, the negative sampling ratio can be set according to requirements, for example, it can be set to 50%, but this embodiment does not limit this. Assuming the negative sampling ratio is 50%, it means that 50% of the negative samples in the candidate samples are replaced with negative samples. In implementation, a random number can be generated using a uniform distribution function. If the random number is greater than or equal to the negative sampling ratio, it is determined that negative sampling is needed; if the random number is less than the negative sampling ratio, it is determined that negative sampling is not needed. The exposure samples of other users in the negative sampling pool can be selected according to requirements, and this embodiment does not limit this.

[0109] S214. If the current candidate sample is a negative sample, and it is determined that negative sampling is not required according to the set negative sampling ratio, then the current candidate sample is stored in the sample pool, and the positive and negative samples in the sample pool constitute the sample set.

[0110] In practice, if the current candidate sample is a negative sample and the random number generated using the uniform distribution function is less than the set negative sampling ratio, then negative sampling is unnecessary. The current candidate sample is directly stored in the sample pool as a negative sample in the training sample set. In other words, the positive samples in the sample pool are the positive samples from the candidate samples, and the negative samples in the sample pool are the negative samples from the candidate samples that were not replaced by the negative samples in the negative sampling pool, as well as other users' exposure-free samples that were replaced by the negative samples. For example, if there are 10 candidate samples corresponding to 10 target song resources, 6 are positive samples and 4 are negative samples. Two of the four negative samples are replaced by negative samples. Therefore, the positive samples in the sample pool include the 6 positive samples from the candidate samples, the 2 negative samples from the 4 negative samples from the candidate samples that were not replaced by negative samples, and the 2 negative samples from the 4 negative samples from the candidate samples that were replaced by negative samples.

[0111] For each sample user who requests a target sample media resource from the server through their client, the above sample processing operation is performed and the sample is stored in the sample pool. The positive and negative samples in the sample pool constitute the training sample set.

[0112] The real-time sample generation and sampling method used in the embodiments of this application can compress sample processing from the hour level to the minute level, further improving the real-time performance of content recall and making it easier to capture users' changing interests.

[0113] S22. Based on the pre-established content retrieval model, perform the following operations for each sample data in the sample set: input the sample media resource features and the historical click media resource features of the sample user into the content retrieval model, and output the predicted score of the sample media resource.

[0114] In specific implementation, the content recall model structure established in the embodiments of this application is as follows: Figure 5 As shown, it includes a vector layer, an interest extraction layer, and an attention layer. The vector layer is used to vectorize the features of sample media resources, the historical click features of sample users, and related features of sample users, such as the profile features of sample users. The interest extraction layer clusters the historical click media resource feature vectors of sample users by generating various cluster center vectors to obtain the interest vectors of sample users for multi-interest extraction of sample users. The attention layer is used to apply the attention mechanism to the interest vectors of sample users extracted by the interest extraction layer to generate the final user interest vector (i.e., the target interest vector of sample users) for recall.

[0115] Specifically, after the server obtains the training sample set from the sample pool, for each sample data in the sample set, it inputs the sample media resource features and the sample user's historical click media resource features into the content retrieval model and outputs the predicted score of the sample media resource. Alternatively, it inputs the sample media resource features, the sample user's historical click media resource features, and the sample user's profile features into the content retrieval model and outputs the predicted score of the sample media resource.

[0116] Specifically, it can be done according to such Figure 6 The process shown obtains the predicted score for the sample media resources, including the following steps:

[0117] S221. Input the sample media resource features and the sample user's historical click media resource features into the vector layer to obtain the sample media resource feature vector and the sample user's historical click media resource feature vector.

[0118] In specific implementation, the server inputs the sample media resource features and the sample user's historical click media resource features into the vector layer to obtain the sample media resource feature vector and the sample user's historical click media resource feature vector. Alternatively, the server inputs the sample media resource features, the sample user's historical click media resource features, and the sample user's profile features into the vector layer to obtain the sample media resource feature vector, the sample user's historical click media resource feature vector, and the sample user's profile feature vector.

[0119] S222. Input the sample media resource feature vector and the sample user's historical click media resource feature vector into the interest extraction layer. Cluster the sample user's historical click media resource feature vector according to the generated cluster center vectors to obtain the sample user's interest vector.

[0120] In practice, the server inputs the feature vector of the sample media resources and the historical click feature vector of the sample user into the interest extraction layer, or inputs the feature vector of the sample media resources, the historical click feature vector of the sample user, and the profile feature vector of the sample user into the interest extraction layer. The server pre-generates a preset number of cluster centers, and clusters the historical click feature vector of the sample user according to the vector of each cluster center to obtain the interest vector of the sample user.

[0121] Specifically, it can be done according to such Figure 7 The process shown clusters the historical click media resource feature vectors of sample users to obtain the interest vectors of sample users, including the following steps:

[0122] S2221. For each historical click media resource feature of the sample user, calculate the distance between the historical click media resource feature vector and each cluster center vector.

[0123] In practice, during initial model training, the server can randomly generate n cluster centers. Based on a distance metric, each historical click media resource feature vector of a sample user is assigned to the nearest cluster center. For each historical click media resource feature of a sample user, the distance between the historical click media resource feature vector and each cluster center vector can be determined by calculating the cosine similarity or inner product between the historical click media resource feature vector and each cluster center vector.

[0124] S2222. Group the historical click media resource features and the cluster center vectors with the smallest distance into one class.

[0125] In practice, after calculating the distance between the historical click media resource feature and each cluster center vector, the historical click media resource feature and the cluster center vector with the smallest distance are grouped into one category. In this way, each historical click media resource feature vector is classified into its corresponding cluster center vector.

[0126] S2223. Generate the interest vectors of the corresponding sample users based on the historical click media resource vectors categorized into each cluster center vector.

[0127] In practice, the historical click media resource vectors categorized into each cluster center vector are aggregated to generate the interest vectors of the sample users corresponding to each cluster center vector.

[0128] Specifically, the aggregation method can be sum_pooling, avg_pooling (average pooling, i.e., average filtering convolution), or attention mechanism operations, etc. This application embodiment does not limit this.

[0129] In this embodiment, by using a distance metric from the cluster center to classify the historical click media resource feature vectors of sample users into cluster center vectors and generating interest vectors for sample users, the iteration time is avoided, the real-time performance of model training is improved, and the hardware cost of real-time deployment is reduced.

[0130] S223. Input the feature vector of the sample media resources and the interest vector of the sample users into the attention layer to perform the attention mechanism operation and obtain the target interest vector of the sample users.

[0131] In practice, the feature vectors of sample media resources and the interest vectors of each sample user are input into the attention layer to perform the attention mechanism operation, thereby obtaining the target interest vector of the sample user, where there is only one target interest vector. Alternatively, the feature vectors of sample media resources, the profile feature vectors of sample users, and the interest vectors of each sample user are input into the attention layer to perform the attention mechanism operation, thereby obtaining the target interest vector of the sample user.

[0132] S224. Determine the prediction score based on the feature vector of the sample media resources and the target interest vector of the sample users.

[0133] In practice, the inner product or cosine similarity calculation can be performed between the feature vector of the sample media resource and the target interest vector of the sample user to obtain the predicted score of the sample media resource.

[0134] like Figure 8 As shown, this is an example clustering diagram of the historical click media resource vectors of sample users. Assuming there are 3 cluster centers and 5 historical click media resources, the first and fourth historical click media resource vectors are clustered to the 3rd cluster center vector, the second historical click media resource vector is clustered to the 1st cluster center vector, and the third and fifth historical click media resource vectors are clustered to the 2nd cluster center vector. For example... Figure 9 As shown, it is an example diagram of the aggregation of historical click media resource vectors of sample users to a cluster center vector. Suppose there are 4 historical click media resource vectors clustered to cluster center vector 1. Aggregating these 4 historical click media resource vectors can obtain the corresponding sample user's interest vector 1.

[0135] Since each clustering operation involves a distance metric to the cluster centers, the quality of the cluster centers directly impacts the quality of the user's interest vector. A good cluster center should be sufficiently close to the historical media resource feature vectors of the sample users categorized to that cluster center, while also being relatively far apart from each other. Therefore, a clustering loss is introduced during the training of the content retrieval model. This loss considers both intra-class and inter-class distances of the cluster center vectors. As the model iterates, the cluster centers are learned, adjusted, and optimized based on the sample loss and the clustering loss. Figure 10 As shown, it is a schematic diagram of intra-class distance and inter-class distance. Intra-class distance is the intra-class distance between the cluster center vector and the historical click media resource feature vector of the sample users who are clustered to that cluster center. Inter-class distance refers to the distance between different cluster center vectors.

[0136] S23. Based on the predicted scores of the sample media resources, the operation behavior tags of the sample users for the sample media resources, and the loss function of the preset content recall model, iteratively optimize each parameter of the content recall model until the content recall model converges, and obtain the trained content recall model.

[0137] The loss function includes clustering loss and sample loss. The clustering loss is determined based on the intra-class distance between the generated cluster center vector and the historical click media resource feature vector of the sample user, as well as the inter-class distance between the cluster center vectors.

[0138] In practice, if a sample user clicks on a sample media resource, the user's action label for that action is 1, meaning the actual score is 1. If the user does not click on the media resource, the label is 0, meaning the actual score is 0. For each media resource, the parameters of the content retrieval model are iteratively optimized based on the difference between the predicted score and the actual score of the user's action label, and a pre-defined loss function, until the model converges, resulting in the trained content retrieval model.

[0139] In the negative samples in the generated training sample set, considering that high-exposure media resource samples are more likely to appear in the negative sampling pool, which will lead to the suppression of popular media resources and affect the recall accuracy, it is necessary to adjust the weight of the negative samples to reduce the suppression. In implementation, the weight adjustment is introduced into the sample loss.

[0140] Specifically, the loss function can be calculated using the following formula:

[0141] Loss = Loss ctr +Loss cluster

[0142] Where Loss represents the loss function of the content recall model;

[0143] Loss ctr Indicates sample loss;

[0144] Loss cluster This represents the clustering loss.

[0145] The sample loss can be calculated using the following formula. ctr :

[0146]

[0147] Where N represents the number of samples, k = 1 to N; M represents the number of sample categories, l = 1 to M;

[0148] ω k This represents the weight corresponding to the k-th sample;

[0149] y kl Let y be a sign function. If the true class of the k-th sample is l, then y kl =1, if the true class of the k-th sample is not l, then y kl =0;

[0150] p kl This represents the predicted probability that the k-th sample belongs to category l.

[0151] Specifically, the weight corresponding to the k-th sample is calculated using the following formula:

[0152] If the k-th sample is a positive sample, then ω k =1;

[0153] If the k-th sample is a negative sample, then:

[0154]

[0155] Where ω0 represents the set weight;

[0156] p represents the exposure of the k-th sample on a given day;

[0157] threshold indicates the setting of a threshold value;

[0158] a′ and b′ are hyperparameters.

[0159] The values ​​of ω0 and threshold can be set empirically. When the k-th sample is a negative sample, ω k This is used to balance the probability of popular media resource samples being negatively sampled in the negative sampling pool, thereby improving the recall accuracy of the trained content recall model.

[0160] Clustering loss can be calculated using the following formula. cluster :

[0161]

[0162] in, This represents the intra-class distance between the cluster center vector and the historical click media resource features of the sample users;

[0163] This represents the inter-class distance between cluster center vectors;

[0164] n represents the number of cluster center vectors, i represents the i-th cluster center vector, t represents the (i+1)-th cluster center vector, m represents the number of historical click media resource features of the sample user, and j represents the j-th historical click media resource feature classified into the i-th cluster center.

[0165] cossim(i,j) represents the similarity between the i-th cluster center vector and the j-th historical click media resource feature that is classified into the i-th cluster center vector;

[0166] cossim(i,t) represents the similarity between the i-th cluster center vector and the t-th cluster center vector;

[0167] a, b, and c are hyperparameters.

[0168] The measurement functions for intra-class distance and inter-class distance can also be, but are not limited to, the following distance measurement functions: Euclidean distance, Mahalanobis distance, etc., and this application embodiment does not limit them.

[0169] The clustering loss introduced in this application's embodiments guarantees the quality of clustering, which in turn guarantees the quality of the predicted user's multiple interest vectors. This ensures that each user's interest vector can represent a certain aspect of the user's interests, and the media resources recalled through the user's multiple interest vectors can meet the user's diverse interest needs without having to forcibly shuffle the resources in the subsequent recall service, which would lead to suboptimal recall results.

[0170] During model training, since multiple interest vectors of sample users are generated in the interest extraction layer, an attention mechanism is needed to perform an attention operation on the feature vectors of sample media resources and the interest vectors of sample users to obtain the final target interest vectors of the sample users. To accelerate model convergence, a soft attention mechanism can be used, but is not limited to, to generate the target interest vectors of sample users, so that the model's parameters can be updated during gradient backpropagation. Figure 11 As shown, it is a forward and backward propagation diagram of the content recall model, where forward propagation is from bottom to top and backward propagation is from top to bottom.

[0171] Furthermore, based on the trained content retrieval model, online real-time predictions can be performed to retrieve multi-interest media resources for users, such as... Figure 12 The diagram shown is an implementation flowchart of the content recall method provided in this application embodiment, which may include the following steps:

[0172] S31. Obtain the user's historical click media resource characteristics.

[0173] In practice, the server obtains the user's historical click sequence based on the user's identifier. The historical click sequence contains a specified number of historical click media resources. The specified number can be set by the user, such as 100 or 50. The server extracts the features of each historical click media resource and can also obtain the user's profile features.

[0174] S32. Input the user's historical click media resource features into the trained content retrieval model to obtain the user's interest vector.

[0175] In practice, the server inputs the features of each historical media resource clicked in the user's historical click sequence into the trained content retrieval model to obtain the user's interest vector. Alternatively, the server inputs the features of each historical media resource clicked in the user's historical click sequence along with the obtained user profile features into the trained content retrieval model to obtain the user's interest vector.

[0176] S33. Perform attention mechanism operations on the user's interest vector and candidate recall media resources to obtain the user's target interest vector.

[0177] In practical implementation, to further improve recall efficiency, the full set of media resource feature vectors on the server can be pre-obtained and cached. The Faiss (Facebook AI Similarity Search) index server can be used to store the full set of media resource feature vectors. The full set of media resource feature vectors can be updated periodically (e.g., every 30 minutes, but not limited to). After the full set of media resource feature vectors is updated, it is stored in the Faiss index server, and the index is updated. The media resource feature vectors can be obtained by inputting the media resource features into the vector layer of the content recall model.

[0178] During implementation, the server recalls corresponding candidate media resources according to each user's interest vector, and performs attention mechanism operations on the feature vector of each candidate media resource and the user's interest vector to obtain the user's target interest vector corresponding to each candidate media resource.

[0179] Specifically, for each user's interest vector, the server calculates the similarity between the user's interest vector and each media resource feature vector stored in the Faiss index server (e.g., cosine similarity can be calculated), and recalls the media resource feature vectors with the highest similarity as candidate media resource feature vectors for recalling the user's interest vector.

[0180] For example, if the content recall model outputs three user interest vectors, it can recall 10 corresponding candidate media resources based on these three user interest vectors, thus recalling 30 candidate media resources. For each candidate media resource, it performs an attention mechanism operation on the feature vector of the candidate media resource and the interest vectors of the three users to obtain the target interest vector of the user corresponding to the candidate media resource. In this way, the 30 candidate media resources can obtain the target interest vectors of the 30 users.

[0181] S34. Calculate a score based on the user's target interest vector and candidate recall media resources, and determine the target recall media resources based on the score.

[0182] In practice, the server calculates a score for each candidate media resource based on the inner product of the user's target interest vector and the feature vector of the candidate media resource. The top K candidate media resources with the highest scores are then identified as target media resources. These target media resources can then be returned to a coarse-sorting module for further filtering.

[0183] Exemplary device

[0184] After introducing the training method of the content recall model of the exemplary embodiments of this application, the training apparatus of the content recall model of the exemplary embodiments of this application will be introduced next.

[0185] like Figure 13 The diagram shown is a structural schematic of a training apparatus for a content retrieval model provided in an embodiment of this application. The training apparatus for the content retrieval model may include:

[0186] The first acquisition unit 41 is used to acquire the training sample set;

[0187] Training unit 42 is used to perform the following operations for each sample data in the sample set according to a pre-established content retrieval model: inputting the sample media resource features and the sample user's historical click media resource features from the sample data into the content retrieval model, and outputting the predicted score of the sample media resource; iteratively optimizing each parameter of the content retrieval model according to the predicted score of the sample media resource, the sample user's operation behavior label for the sample media resource, and the pre-set loss function of the content retrieval model, until the content retrieval model converges, and obtaining the trained content retrieval model. The loss function includes clustering loss and sample loss. The clustering loss is determined based on the intra-class distance between the generated cluster center vector and the sample user's historical click media resource feature vector, and the inter-class distance between the cluster center vectors.

[0188] In one possible implementation, the sample data in the sample set includes positive samples and negative samples;

[0189] The first acquisition unit is specifically used to generate the sample set in the following manner: obtaining candidate samples based on the media resource characteristics requested by the client, the historical click media resource characteristics of the sample users of the client, and the operation behavior characteristics of the sample users of the client for the requested media resources; traversing each candidate sample, if the current candidate sample is a positive sample, storing the current candidate sample in the sample pool; if the current candidate sample is a negative sample, and it is determined that negative sampling is required according to the set negative sampling ratio, randomly selecting a negative sampling sample from the negative sampling pool and storing it in the sample pool, wherein the negative sampling samples in the negative sampling pool are exposure samples set for other users; if the current candidate sample is a negative sample, and it is determined that negative sampling is not required according to the set negative sampling ratio, storing the current candidate sample in the sample pool, wherein the positive samples and negative samples in the sample pool constitute the sample set.

[0190] In one possible implementation, the first acquisition unit is specifically configured to receive a media resource request sent by a client, return a list of target media resources to the client, extract the historical click media resource features of the client's sample users, and the features of each target media resource, respectively; acquire the operation behavior tags of the client's sample users for each target media resource; for each target media resource, concatenate the historical click media resource features of the client's sample users, the target media resource features, and the operation tags of the client's sample users for the target media resource to obtain a sample corresponding to the target media resource; and determine the samples corresponding to each target media resource as candidate samples.

[0191] In one possible implementation, the content recall model includes a vector layer, an interest extraction layer, and an attention layer;

[0192] The training unit is specifically configured to input sample media resource features and sample user's historical click media resource features into the vector layer to obtain sample media resource feature vectors and sample user's historical click media resource feature vectors; input the sample media resource feature vectors and sample user's historical click media resource feature vectors into the interest extraction layer, and cluster the sample user's historical click media resource feature vectors according to the generated cluster center vectors to obtain the sample user's interest vector; input the sample media resource feature vectors and sample user's interest vectors into the attention layer to perform attention mechanism operations to obtain the sample user's target interest vector; and determine the prediction score based on the sample media resource feature vectors and sample user's target interest vector.

[0193] In one possible implementation, the training unit is specifically configured to calculate the distance between the historical click media resource feature vector and each cluster center vector for each historical click media resource feature of the sample user; group the historical click media resource feature vector and the cluster center vector with the smallest distance into one class; and generate the corresponding interest vector of the sample user based on the historical click media resource vectors grouped into each cluster center vector.

[0194] In one possible implementation, the device further includes:

[0195] The second acquisition unit is used to acquire the user's historical click media resource characteristics;

[0196] The first obtaining unit is used to input the user's historical click media resource features into the trained content retrieval model to obtain the user's interest vector.

[0197] The second obtaining unit is used to perform an attention mechanism operation on the user's interest vector and the candidate recall media resources to obtain the user's target interest vector.

[0198] The determining unit is used to calculate a score based on the user's target interest vector and candidate recall media resources, and to determine the target recall media resources based on the score.

[0199] Based on the same inventive concept as the training method of the content recall model described above, this application also provides an electronic device 50. For example... Figure 14 As shown, the electronic device 50 may include a processor 501 and a memory 502.

[0200] The processor 501 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the training methods, steps, and logic diagrams of the content retrieval models disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the training methods for the content retrieval models disclosed in the embodiments of this application can be directly manifested as execution by a hardware processor, or execution by a combination of hardware and software modules within the processor.

[0201] Memory 502, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory can include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic memory, magnetic disk, optical disk, etc. Memory is any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. Memory 502 in this embodiment can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.

[0202] It should be noted that although several units or sub-units of the training apparatus for the content recall model have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided and embodied by multiple units.

[0203] Furthermore, although the operation of the training method for recalling the content of this application is described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.

[0204] While the spirit and principles of this application have been described with reference to several specific embodiments, it should be understood that this application is not limited to the disclosed specific embodiments, and the division of aspects does not imply that features in these aspects cannot be combined for benefit; such division is merely for convenience of expression. This application is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims

1. A method for training a content recall model, the method comprising: The method comprises the following steps: obtaining a training sample set; for each sample data in the sample set, performing the following operations according to a pre-established content recall model: inputting sample media resource features in the sample data and historical click media resource features of a sample user into the content recall model, and outputting a predicted score of a sample media resource; iteratively optimizing each parameter of the content recall model according to the predicted score of the sample media resource, an operation behavior label of the sample user for the sample media resource, and a preset loss function of the content recall model until the content recall model converges, to obtain a trained content recall model, wherein the loss function comprises a clustering loss and a sample loss, and the clustering loss is determined according to an intra-class distance between a generated cluster center vector and a historical click media resource feature vector of the sample user, and an inter-class distance between the cluster center vectors; Wherein, the clustering loss Loss cluster is: wherein, represents the intra-class distance between the cluster center vector and the historical clicked media resource feature vector of the sample user. represents the inter-class distance between the cluster center vectors; n represents the number of cluster center vectors, i represents an i-th cluster center vector, t represents an i+1-th cluster center vector, m represents the number of historical click media resource feature vectors of the sample user, and j represents a j-th historical click media resource feature vector classified into the i-th cluster center vector; cossim(i,j) represents a similarity between the i-th cluster center vector and the j-th historical click media resource feature vector classified into the i-th cluster center vector; cossim(i,t) represents a similarity between the i-th cluster center vector and the t-th cluster center vector; a, b, and c are hyperparameters.

2. The method of claim 1, wherein, The sample data in the sample set comprises positive samples and negative samples; and the sample set is generated in the following manner: obtaining candidate samples according to media resource features requested by a client, historical click media resource features of a sample user of the client, and operation behavior features of the sample user of the client for the requested media resource; traversing each candidate sample, and if a current candidate sample is a positive sample, storing the current candidate sample into a sample pool; if the current candidate sample is a negative sample and it is determined that negative sampling is needed according to a set negative sampling ratio, randomly selecting a negative sampling sample from a negative sampling pool and storing the negative sampling sample into the sample pool, wherein the negative sampling samples in the negative sampling pool are exposure samples of other users; if the current candidate sample is a negative sample and it is determined that negative sampling is not needed according to the set negative sampling ratio, storing the current candidate sample into the sample pool, wherein the positive samples and the negative samples in the sample pool constitute the sample set.

3. The method of claim 2, wherein, obtaining candidate samples according to media resource features requested by a client, historical click media resource features of a sample user of the client, and operation behavior features of the sample user of the client for the requested media resource, specifically comprising: receiving a media resource request sent by the client, and returning a target media resource list to the client; extracting historical click media resource features of the sample user of the client and each target media resource feature respectively; obtaining operation behavior labels of the sample user of the client for the target media resources; For each target media resource, splice the historical clicked media resource features of the sample user of the client, the target media resource features and the behavior label of the sample user of the client for the target media resource to obtain the sample corresponding to the target media resource; Determine the sample corresponding to each target media resource as a candidate sample.

4. The method according to any one of claims 1 to 3, characterized in that, The content recall model comprises a vector layer, an interest extraction layer and an attention layer; Input the sample media resource features and the historical clicked media resource features of the sample user in the sample data into the content recall model to output a predicted score of the sample media resource, specifically comprising: Input the sample media resource features and the historical clicked media resource features of the sample user into the vector layer to obtain a sample media resource feature vector and a historical clicked media resource feature vector of the sample user; Input the sample media resource feature vector and the historical clicked media resource feature vector of the sample user into the interest extraction layer, cluster the historical clicked media resource feature vector of the sample user according to each generated cluster center vector to obtain an interest vector of the sample user; Input the sample media resource feature vector and the interest vector of the sample user into the attention layer to perform an attention mechanism operation to obtain a target interest vector of the sample user; Determine the predicted score according to the sample media resource feature vector and the target interest vector of the sample user.

5. The method of claim 4, wherein, Cluster the historical clicked media resource feature vector of the sample user according to each generated cluster center vector to obtain an interest vector of the sample user, specifically comprising: For each historical clicked media resource feature of the sample user, respectively calculate the distance between the historical clicked media resource feature vector and each cluster center vector; Classify the historical clicked media resource feature vector and the cluster center vector with the smallest distance into a class; Generate the interest vector of the sample user according to the historical clicked media resource feature vector classified into each cluster center vector.

6. The method of claim 1, wherein, The method further comprises: Obtain the historical clicked media resource features of the user; Input the historical clicked media resource features of the user into the trained content recall model to obtain an interest vector of the user; Perform an attention mechanism operation on the interest vector of the user and the candidate recall media resource to obtain a target interest vector of the user; Calculate a score according to the target interest vector of the user and the candidate recall media resource, and determine a target recall media resource according to the score.

7. A training device for a content recall model, characterized in that, Comprise: A first obtaining unit is configured to obtain a training sample set; The training unit is configured to, according to a pre-established content recall model, perform the following operations on each sample data in the sample set: inputting sample media resource features in the sample data and historical click media resource features of a sample user into the content recall model, and outputting a predicted score of a sample media resource; performing iterative optimization on each parameter of the content recall model according to the predicted score of the sample media resource, an operation behavior label of the sample user for the sample media resource, and a preset loss function of the content recall model, until the content recall model converges, to obtain a trained content recall model, wherein the loss function comprises a clustering loss and a sample loss, and the clustering loss is determined according to an intra-class distance between a generated clustering center vector and a historical click media resource feature vector of the sample user, and an inter-class distance between the clustering center vectors; Wherein, the clustering loss Loss cluster is: wherein, represents an intra-class distance between the cluster center vector and the historical clicked media resource feature vector of the sample user. represents the inter-class distance between the cluster center vectors; n represents a number of clustering center vectors, i represents an i-th clustering center vector, t represents an i+1-th clustering center vector, m represents a number of historical click media resource feature vectors of the sample user, and j represents a j-th historical click media resource feature vector classified into the i-th clustering center vector; cossim(i, j) represents a similarity between the i-th clustering center vector and the j-th historical click media resource feature vector classified into the i-th clustering center vector; cossim(i, t) represents a similarity between the i-th clustering center vector and the t-th clustering center vector; a, b, and c are hyperparameters.

8. The apparatus of claim 7, wherein, The sample data in the sample set comprises positive samples and negative samples; The first obtaining unit is specifically configured to generate the sample set by: obtaining candidate samples according to media resource features requested by a client, historical click media resource features of a sample user of the client, and operation behavior features of the sample user of the client for the requested media resource; traversing each candidate sample, and if a current candidate sample is a positive sample, storing the current candidate sample into a sample pool; if the current candidate sample is a negative sample, and it is determined that negative sampling is needed according to a set negative sampling ratio, randomly selecting a negative sampling sample from a negative sampling pool and storing the negative sampling sample into the sample pool, wherein the negative sampling samples in the negative sampling pool are exposure samples of other users; if the current candidate sample is a negative sample, and it is determined that negative sampling is not needed according to the set negative sampling ratio, storing the current candidate sample into the sample pool, wherein the positive samples and the negative samples in the sample pool constitute the sample set.

9. The apparatus of claim 8, wherein the first obtaining unit is specifically configured to receive a media resource request sent by a client, return a target media resource list to the client, extract historical click media resource features of a sample user of the client and each target media resource feature, respectively, Obtain operation behavior labels of the sample users of the client for the respective target media resources; for each target media resource, splice the historical clicked media resource features of the sample users of the client, the target media resource features, and the behavior labels of the sample users of the client for the target media resource, to obtain a sample corresponding to the target media resource; and determine the samples corresponding to the respective target media resources as candidate samples.

10. The device of any one of claims 7 to 9, wherein, The content recall model comprises a vector layer, an interest extraction layer, and an attention layer; The training unit is specifically configured to input the sample media resource features and the historical clicked media resource features of the sample user into the vector layer to obtain sample media resource feature vectors and historical clicked media resource feature vectors of the sample user; input the sample media resource feature vectors and the historical clicked media resource feature vectors of the sample user into the interest extraction layer, cluster the historical clicked media resource feature vectors of the sample user according to the generated respective cluster center vectors, and obtain interest vectors of the sample user; input the sample media resource feature vectors and the interest vectors of the sample user into the attention layer to perform attention mechanism operation, and obtain target interest vectors of the sample user; and determine the prediction scores according to the sample media resource feature vectors and the target interest vectors of the sample user.

11. The apparatus of claim 10, wherein, The training unit is specifically configured to calculate distances between the historical clicked media resource feature vectors and respective cluster center vectors for each historical clicked media resource feature of the sample user; classify the historical clicked media resource feature vectors and the cluster center vectors with the smallest distances into a class; and generate the interest vectors of the sample user according to the historical clicked media resource feature vectors classified into the respective cluster center vectors.

12. The apparatus of claim 11, wherein, The apparatus further comprises: A second obtaining unit configured to obtain historical clicked media resource features of a user; A first obtaining unit configured to input the historical clicked media resource features of the user into the trained content recall model to obtain interest vectors of the user; A second obtaining unit configured to perform attention mechanism operation on the interest vectors of the user and candidate recall media resources to obtain target interest vectors of the user; A determining unit configured to calculate scores of the target interest vectors of the user and the candidate recall media resources, and determine target recall media resources according to the scores.

13. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the training method of the content recall model according to any one of claims 1 to 6.

14. A computer-readable storage medium having stored thereon computer program instructions, wherein, The computer program instructions are executed by the processor to implement the steps of the training method of the content recall model according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Recommendation model training method and device, recommendation method and device, medium and equipment

    CN114117213A