Short video recommendation method and system based on comparative learning framework

By adopting a contrast learning framework and two comparison tasks in short video recommendations, the problem of insufficient distinction between users' preferences in different behavioral spaces is solved, and the accuracy and effectiveness of recommendations are improved.

CN119513358AInactive Publication Date: 2025-02-25SHAOXING YINGMI INFORMATION TECHNOLOGY CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411495303.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-25
Publication Date
2025-02-25
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The prior art ignores the user's preference distinction in different behavioral spaces in short video recommendations, resulting in poor recommendation results, especially when user preference learning under sparse behaviors is disturbed by dense behaviors.

Method used

Using a contrast learning framework-based approach, two contrast tasks are designed to increase the distinction between positive and negative preferences of users. The first comparison task directly allows the user to distinguish between positive and negative preferences. The second comparison task ensures that the distinction between positive and negative preferences is smaller than the similarity between positive and negative preferences, and negative preferences are also smaller than the similarity.

Benefits of technology

By enhancing the distinction between positive and negative preferences of users, the accuracy and effectiveness of short video recommendations are improved, ensuring that the preferences learned by multi-behavior sequence encoder are distinguished and accurate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119513358A_ABST
    Figure CN119513358A_ABST
Patent Text Reader

Abstract

The invention discloses a short video recommendation method and system based on a comparative learning framework, and the method and system are used for carrying out self-supervised learning on a multi-behavior sequence encoder, improving the discrimination of positive and negative preferences of a user, and further improving the recommendation accuracy of a short video recommendation model. The method is mainly divided into three parts: the first part is to calculate a pseudo tag for positive and negative preferences of a user of a multi-behavior sequence encoder, and design a contrast learning task to decouple the positive and negative preferences of the user; in the second part, a comparative learning task is designed, so that the middle states of the user positive preference and the user negative preference learned by the multi-behavior sequence encoder are distinguished all the time; and 3, fusing the user positive preference and the user negative preference to obtain fused preference, and training a short video recommendation model in combination with a recommendation task and a comparative learning task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of Internet service technology, and in particular relates to a short video recommendation method and system based on a comparative learning framework. Background Art

[0002] In order to improve the accuracy of recommendations, existing recommendation systems usually model users' multi-behavior sequences and learn users' positive and negative preferences. There are dependencies and associations between multiple behaviors in the platform. For example, there is a sequential dependency relationship of "watch → add to cart → purchase" in e-commerce shopping, a conditional dependency pattern of "jump out immediately → shallow reading → scan → fast reading → normal reading → deep reading" in article recommendation scenarios, and a dependency relationship of "skip → click" in short video recommendation scenarios. In order to capture the association between different behaviors, the recommendation method based on multi-behavior sequences designs a multi-behavior sequence encoder, which takes the user's multi-behavior sequence as input and outputs the user's preference representation in different behaviors. For example, the MBN model proposed by Shen et al. from Shanghai Jiao Tong University in 2022 proposed a meta multi-behavior sequence encoder to model user multi-behavior sequences and obtain user preferences in different behavior spaces.

[0003] Although this type of method can capture the connection between different user behaviors and obtain the user's preferences in different behavior spaces. However, preferences in different behavior spaces may affect each other, resulting in a lack of distinction. Especially when a certain type of behavior is sparse, dense behaviors will interfere with the learning of user preferences under sparse behaviors. For example, the MBN model models multiple behaviors in e-commerce, including "click", "buy", "add to cart" and "collection" behaviors. Among them, "buy", "add to cart" and "collection" behaviors are extremely sparse. In the IJCAI15 dataset, "add to cart" behavior only accounts for 0.14% of all behaviors. If the user preferences learned in different user behavior spaces are not distinguished, the user preferences in the "add to cart" behavior space will be affected by the "click" behavior. Summary of the invention

[0004] The purpose of the present invention is to solve the problems existing in the prior art and provide a short video recommendation method and system based on a contrastive learning framework. The method of the present invention is aimed at the fact that when multi-behavior encoders in the field of short video recommendation model the multi-behavior sequences of users, they ignore the discrimination of user preferences in different behavior spaces. The method aims to increase the discrimination of user preferences in different behavior spaces, thereby improving the recommendation effect. In the field of short video recommendation, multi-behavior encoders usually input the user's "skip" and "click" behavior sequences as a whole into the model to extract the user's positive and negative preferences. In order to capture the connection between "skip" and "click" behaviors, this type of encoder extracts the user's positive and negative preferences from a behavior sequence at the same time, resulting in a decrease in the discrimination of the user's positive and negative preferences. The method designs contrast tasks from two technical ideas to increase the discrimination of the user's positive and negative preferences. The first contrast task is to directly make the learned user's positive and negative preferences have discrimination. The first contrast task can only guarantee the discrimination of the results output by the model, but cannot guarantee the discrimination between positive and negative preferences during the model learning process. Therefore, the second comparison task is designed so that in the process of changes in users' positive and negative preferences, the distinction between users' positive preferences before and after is smaller than the similarity between their positive and negative preferences before and after. Similarly, the distinction between users' negative preferences before and after is also smaller than the similarity between their positive and negative preferences before and after.

[0005] In order to achieve the above-mentioned invention object, the present invention specifically adopts the following technical solutions:

[0006] In a first aspect, the present invention provides a short video recommendation method based on a contrastive learning framework, which comprises the following steps:

[0007] Input the user's historical behavior sequence and the target short video to be recommended into the trained short video recommendation model, output the probability of the user clicking the target short video, and complete the recommendation of the short video; wherein the user's historical behavior sequence is composed of the user's click behavior subsequence and the user's skip behavior subsequence;

[0008] The short video recommendation model is trained by a contrastive learning method. In the training of the short video recommendation model, the acquired user historical behavior sequence is input into a multi-behavior sequence encoder in the short video recommendation model. The multi-behavior sequence encoder extracts user positive preferences and user negative preferences from the user historical behavior sequence, calculates pseudo labels corresponding to the user positive preferences and user negative preferences, and decouples the user positive preferences and user negative preferences by two designed contrast tasks. The decoupling method is to make the user positive preferences and user negative preferences closer to their corresponding pseudo labels. After the user positive preferences and user negative preferences are fused to obtain the fused preferences, the fused preferences and the target short video are input into the prediction layer to obtain the probability of the user clicking on the target short video. The cross entropy loss between the probability of the user clicking on the target short video and the true value of the probability of the user clicking on the target short video is used as the recommendation task loss. The weighted sum of the recommendation task loss and the loss function of each contrast task is used as the total loss. The parameters of the short video recommendation model are updated based on minimizing the total loss.

[0009] In the first comparison task, the user's positive preference, the user's negative preference, the pseudo-label of the user's positive preference, and the pseudo-label of the user's negative preference are respectively passed through the first MLP layer to obtain the mapped user's positive preference, the mapped user's negative preference, the pseudo-label representation of the user's positive preference, and the pseudo-label representation of the user's negative preference. The loss function of the first comparison task is calculated based on the InfoNCE loss function and used as the first comparison learning loss.

[0010] In the second contrast task, the hidden state output by each unit of the multi-behavior sequence encoder is passed through the second MLP layer, and each unit obtains a mapped hidden state. The user's positive preference and the user's negative preference are passed through the second MLP layer to obtain the projected user's positive preference and the projected user's negative preference. The loss function of the second contrast task is calculated based on the InfoNCE loss function and used as the second contrast learning loss.

[0011] Based on the above scheme, each step can be implemented in the following preferred specific manner.

[0012] As a preferred embodiment of the above-mentioned first aspect, the specific calculation process of the pseudo-label representation corresponding to the user's positive preference and the user's negative preference is as follows: the user's click behavior subsequence is averaged pooled to obtain the pseudo-label of the user's positive preference, and the user's skip behavior subsequence is averaged pooled to obtain the pseudo-label of the user's negative preference.

[0013] As a preferred embodiment of the above-mentioned first aspect, the specific calculation process of the pseudo-label representation corresponding to the user's positive preference and the user's negative preference is as follows: the user's click behavior subsequence is input into the trained click behavior subsequence encoder to obtain the pseudo-label of the user's positive preference, and the user's skip behavior subsequence is input into the trained skip behavior subsequence encoder to obtain the pseudo-label of the user's negative preference.

[0014] As a preferred embodiment of the first aspect, the first contrastive learning loss The functional form is:

[0015]

[0016] in, represents the user's positive preference after mapping; Pseudo-label representations that represent users’ positive preferences; Represents the user's negative preference after mapping; Pseudo-label representations that represent users’ negative preferences; Represents the InfoNCE loss function, and its function form is:

[0017]

[0018] Among them, sim() represents the cosine similarity function; q, k + ,k - is the input of the InfoNCE loss function; τ is the temperature hyperparameter.

[0019] As a preferred embodiment of the above-mentioned first aspect, in a cycle of the t-th unit of the multi-behavior sequence encoder, the hidden state of the t-1-th unit is processed by the unit update function to obtain the hidden state of the t-th unit.

[0020] Furthermore, the one-time cycle process of the t-th unit of the multi-behavior sequence encoder is:

[0021]

[0022] Among them, p∈{+,-} is a placeholder, It is the logical NOT operation of p; represents the hidden state of the t-th unit; F(·) is the unit update function; represents the indicator function of the t-th unit; x t is the input short video representation at the t-th time step; They all represent the hidden state of the t-1th unit.

[0023] As a preferred embodiment of the first aspect, when the indicator function of the t-th unit is When , the unit update function of the t-th unit is represented by the indicator function of the t-1-th unit, the output of the hidden layer of the t-th unit, the output of the update gate, and the candidate activation vector.

[0024] Furthermore, when the indicator function of the tth unit When , the unit update function F(·) of the tth unit is expressed as:

[0025]

[0026] Among them, h t-1 represents the output of the hidden layer of the t-1th unit; All represent the indicator function of the t-1th unit; represents the output of the update gate; represents the output of the reset gate; represents the candidate activation vector; T represents the vector transpose operator; σ is the sigmoid activation function; tanh represents the tanh activation function; ⊙ is the Hadamard product; Both represent trainable parameters in the short video recommendation model.

[0027] As a preferred embodiment of the first aspect, the second contrastive learning loss The functional form is:

[0028]

[0029]

[0030] in, Indicates the first InfoNCE loss; represents the second InfoNCE loss; |S| represents the number of user historical behavior sequences; They represent the user's positive preference after projection and the user's negative preference after projection respectively; Both represent the hidden state representation after the mapping of the t-th unit; H + yes Matrix representation of H - yes The matrix representation of .

[0031] As a preferred embodiment of the first aspect, the user positive preference and the user negative preference are fused by weighted summation, or by directly adding the user positive preference and the user negative preference to obtain a fused preference.

[0032] As a preferred embodiment of the first aspect, the prediction layer is formed by cascading two MLP layers in sequence.

[0033] In a second aspect, the present invention provides a short video recommendation system based on a contrastive learning framework, comprising:

[0034] A data acquisition module is used to obtain the user's historical behavior sequence and target short video for short video recommendation;

[0035] The recommendation module is used to input the user's historical behavior sequence and the target short video to be recommended into the trained short video recommendation model, output the probability of the user clicking the target short video, and complete the recommendation of the short video; wherein the user's historical behavior sequence is composed of the user's click behavior subsequence and the user's skip behavior subsequence;

[0036] The short video recommendation model is trained by a contrastive learning method. In the training of the short video recommendation model, the acquired user historical behavior sequence is input into a multi-behavior sequence encoder in the short video recommendation model. The multi-behavior sequence encoder extracts user positive preferences and user negative preferences from the user historical behavior sequence, calculates pseudo labels corresponding to the user positive preferences and user negative preferences, and decouples the user positive preferences and user negative preferences by two designed contrast tasks. The decoupling method is to make the user positive preferences and user negative preferences closer to their corresponding pseudo labels. After the user positive preferences and user negative preferences are fused to obtain the fused preferences, the fused preferences and the target short video are input into the prediction layer to obtain the probability of the user clicking on the target short video. The cross entropy loss between the probability of the user clicking on the target short video and the true value of the probability of the user clicking on the target short video is used as the recommendation task loss. The weighted sum of the recommendation task loss and the loss function of each contrast task is used as the total loss. The parameters of the short video recommendation model are updated based on minimizing the total loss.

[0037] In the first comparison task, the user's positive preference, the user's negative preference, the pseudo-label of the user's positive preference, and the pseudo-label of the user's negative preference are respectively passed through the first MLP layer to obtain the mapped user's positive preference, the mapped user's negative preference, the pseudo-label representation of the user's positive preference, and the pseudo-label representation of the user's negative preference. The loss function of the first comparison task is calculated based on the InfoNCE loss function and used as the first comparison learning loss.

[0038] In the second contrast task, the hidden state output by each unit of the multi-behavior sequence encoder is passed through the second MLP layer, and each unit obtains a mapped hidden state. The user's positive preference and the user's negative preference are passed through the second MLP layer to obtain the projected user's positive preference and the projected user's negative preference. The loss function of the second contrast task is calculated based on the InfoNCE loss function and used as the second contrast learning loss.

[0039] Compared with the prior art, the present invention has the following beneficial effects:

[0040] This method applies contrastive learning to multi-behavior sequence modeling in short video recommendation, and constructs pseudo labels for the user's positive and negative preferences extracted by the multi-behavior sequence encoder, so that the user's positive and negative preferences are closer to their corresponding pseudo labels.

[0041] The method of the present invention designs a contrastive learning task so that the intermediate states of the user's positive preference and negative preference learned by the multi-behavior sequence encoder are always distinguishable.

[0042] The contrastive learning framework in the method of the present invention is a plug-and-play self-supervised learning component that can be used in different recommendation scenarios and can also be configured in different multi-behavior sequence encoders, thereby improving the accuracy of user preferences. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 It is a schematic diagram of the process of the present invention;

[0044] Figure 2 Schematic diagram of the training process of the short video recommendation model of the method of the present invention;

[0045] Figure 3 It is a system block diagram of the present invention. DETAILED DESCRIPTION

[0046] In order to make the above-mentioned purpose, features and advantages of the present invention more obvious and easy to understand, the specific implementation mode of the present invention is described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below. The technical features in each embodiment of the present invention can be combined accordingly without conflicting with each other.

[0047] In the description of the present invention, it should be understood that the terms "first" and "second" are only used for the purpose of distinguishing descriptions, and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features.

[0048] The purpose of this method is to obtain the user's positive and negative preferences based on the existing multi-behavior sequence encoder by modeling the user's "click" and "skip" multi-behavior sequences on the short video platform, improve the distinguishability of the two preferences, and thus improve the accuracy of the short video recommendation model in learning user preferences. The mathematical problem constructed is based on the user's multi-behavior sequence, obtain the user's distinguishable positive and negative preferences, and use the learned user preferences to predict the probability of the user clicking on the target item.

[0049] Let u∈U and v∈V represent users and items respectively, U and V represent user sets and item sets respectively. Assume that there are n types of user behaviors in the short video platform, represented as {b1, b2, ..., b n}, such as the "skip" and "click" behaviors in short video platforms. A user's historical behavior sequence is represented as S = {(v1, b1), (v2, b2), ..., (v j , b j ),...,(v |S| , b |S| )}, where (v j , b j ) represents the jth user v j The interaction behavior is b j ,(v1,b1),(v2,b2),...,(v j , b j ),...,(v |S| , b |S| ) represent the interaction behaviors of the 1st, 2nd, ..., j, ..., |S|th user with the 1st, 2nd, ..., j, ..., |S|th user respectively. The user's historical behavior sequence S can be further divided into several sub-behavior sequences according to the behavior type, namely in, represents the 1st, 2nd, ..., nth sub-behavior sequence. For any user behavior, its sub-behavior sequence can be expressed as In the field of short videos, the object is the short video.

[0050] A short video recommendation method based on contrastive learning framework consists of three parts. The first part is to calculate pseudo labels for the positive and negative preferences of users learned by a multi-behavior sequence encoder, and design contrastive learning tasks to decouple the positive and negative preferences of the user; the second part is to design contrastive learning tasks so that the intermediate states of the positive and negative preferences of users learned by the multi-behavior sequence encoder are always distinguishable; the third part is to fuse the positive and negative preferences of users to obtain user preferences, and combine the recommendation task and contrastive learning task to train a short video recommendation model.

[0051] like Figure 1As shown, in a preferred implementation of the present invention, the specific process of the short video recommendation method based on the contrastive learning framework is as follows: inputting the user history behavior sequence and the target short video to be recommended into the trained short video recommendation model, outputting the probability of the user clicking the target short video, and completing the recommendation of the short video; wherein the user history behavior sequence is composed of the user click behavior subsequence and the user skip behavior subsequence;

[0052] The short video recommendation model is trained by using a contrastive learning method. During the training of the short video recommendation model, the acquired user historical behavior sequence is input into a multi-behavior sequence encoder in the short video recommendation model, and the multi-behavior sequence encoder extracts the user's positive preference from the user's historical behavior sequence. and user negative preferences Calculate the pseudo labels corresponding to the user's positive preference and the user's negative preference The two designed comparison tasks are used to decouple the user's positive preference and the user's negative preference. The decoupling method is to make the user's positive preference and the user's negative preference closer to their corresponding pseudo labels. After fusing the user's positive preference and the user's negative preference to obtain the fused preference, the fused preference h is used as the input. u The target short video is input into the prediction layer to obtain the probability of the user clicking the target short video. The cross entropy loss between the probability of the user clicking the target short video and the true value of the probability of the user clicking the target short video is used as the recommendation task loss. The weighted sum of the recommendation task loss and the loss function of each comparison task is used as the total loss. The parameters of the short video recommendation model are updated based on minimizing the total loss.

[0053] In the first comparison task, the user's positive preference, the user's negative preference, the pseudo-label of the user's positive preference, and the pseudo-label of the user's negative preference are respectively passed through the first MLP layer to obtain the mapped user's positive preference. User negative preferences after mapping Pseudo-label representation of user positive preferences And pseudo-label representation of user negative preferences Calculate the loss function of the first contrast task based on the InfoNCE loss function and use it as the first contrast learning loss;

[0054] In the second comparison task, the hidden state output by each unit of the multi-behavior sequence encoder is passed through the second MLP layer, and each unit corresponds to a mapped hidden state (the hidden state after the mapping of the tth unit is represented as ), the user's positive preference and the user's negative preference are passed through the second MLP layer to obtain the projected user's positive preference and the projected user negative preference The loss function of the second contrastive task is calculated based on the InfoNCE loss function and used as the second contrastive learning loss.

[0055] It should be noted that in the short video platform of the present invention, users have two behaviors: click and skip. The multi-behavior sequence encoder Encoder multi For the user's historical behavior sequence S = {(v1,b1),(v2,b2),…,(v j ,b j ),…,(v |S| ,b |S| )} is used to model the user's positive preferences from the user's historical behavior sequence S. and user negative preferences

[0056]

[0057] Although the method of extracting both positive and negative preferences of users from a user's historical behavior sequence by a multi-behavior sequence encoder can capture the connection between different behaviors, it will reduce the distinguishability of the two preferences. To this end, the method of the present invention designs a contrastive learning task to increase the distinguishability of the two preferences of users. Contrastive learning is a kind of self-supervised learning, and its purpose is to make similar samples close in distance in the representation space and dissimilar samples far in distance in the representation space. Without the contrastive learning process, the positive and negative preferences of users extracted by the multi-behavior sequence encoder may not be accurate enough, because the learning of one preference may be affected by the other behavior that accounts for the majority. Taking the user historical behavior sequence S = {(v1, click), (v2, click), (v3, click), (v4, skip), (v5, click)} as an example, the learning of negative preferences of users may be greatly affected by positive feedback, resulting in similar negative and positive preferences of the user. Because the positive feedback of users accounts for the majority, when the negative preference is updated in v4, it absorbs the information of the previous positive preference. Therefore, self-supervised learning is very important, which can ensure that the two preferences learn their own subsequence information while also absorbing similar information in other behavior sequences.

[0058] Furthermore, the method of the present invention designs comparative learning tasks from two technical ideas to increase the distinction between the two preferences of users. Figure 2As shown in the figure, the contrastive learning task contains two contrastive tasks. The first contrastive task is to directly make the learned user positive preferences and user negative preferences distinguishable. However, the first contrastive task can only guarantee the distinguishability of the output results of the short video recommendation model, and cannot guarantee the distinguishability between positive and negative preferences during the learning process of the short video recommendation model. Therefore, the second contrastive task is designed so that in the process of changes in user positive and negative preferences, the distinguishability of the user's positive preferences before and after is less than the similarity of the positive and negative preferences before and after. Similarly, the distinguishability of the user's negative preferences before and after is also less than the similarity of the positive and negative preferences before and after.

[0059] The following is a detailed introduction to the process of the first comparison task. The first comparison task designs a distinguishing pseudo label to guide the decoupling of user positive preferences and user negative preferences. Specifically, the present invention uses the user click behavior subsequence S click and user skip behavior subsequence S skip Compute pseudo labels for user positive preferences and pseudo labels of users’ negative preferences Specifically, the user's click behavior subsequence is averaged and pooled to obtain the pseudo-label of the user's positive preference, and the user's skip behavior subsequence is averaged and pooled to obtain the pseudo-label of the user's negative preference:

[0060]

[0061] Among them, the MEAN() function is the average pooling operation.

[0062] Other ways of generating labels with positive emotions can also be used. For example, modeling the user click behavior subsequences, or comprehensively considering different types of user positive feedback to generate positive preference label representations. Of course, more complex sequence encoders can also be used to replace the average pooling operation to obtain better recommendation results.

[0063] Specifically, in this embodiment, if Figure 2 As shown, the user's click behavior subsequence is input into the trained click behavior subsequence encoder to obtain the user's positive preference pseudo label, and the user's skip behavior subsequence is input into the trained skip behavior subsequence encoder to obtain the user's negative preference pseudo label:

[0064]

[0065] Among them, Encode_sub click ,Encode_sub skip They represent the click behavior subsequence encoder and the skip behavior subsequence encoder respectively.

[0066] Based on user positive preference User negative preference and the corresponding pseudo labels The present invention designs a first comparison task to supervise the training of user positive and negative preferences. Specifically, any user preference among user positive preference and user negative preference is compared. And the corresponding tags As a positive sample pair, and another user preference And the corresponding tags As a negative sample pair, here p∈{+,-}. The optimization goal is to encourage the distance between positive sample pairs to be closer than the distance between negative sample pairs, as follows:

[0067]

[0068] Among them, s(·) represents the similarity.

[0069] Then, the user's positive preference and its corresponding pseudo-label as well as the user's negative preference and its corresponding pseudo-label are sent to an MLP layer to be mapped to the representation space of contrastive learning. After the MLP layer, the mapped user's positive preference is obtained. User negative preference And pseudo-label representation of user positive preferences and pseudo-label representation of user negative preferences Among them, the processing process of the MLP layer is as follows:

[0070]

[0071] Among them, W (1) ,W (2) and b (1) ,b (2) is a trainable parameter; φ is the RELU activation function; z is a placeholder, specifically representing Represents the output of the MLP layer, specifically

[0072] for There is only one positive sample and one negative sample. The specific form of the InfoNCE loss function is as follows:

[0073]

[0074] Among them, sim() represents the cosine similarity function, τ is the temperature hyperparameter, q,k + ,k - is the input of the InfoNCE loss function.

[0075] The InfoNCE loss function can make <q,k + > and <q,k- >There is a greater distinction between them. The InfoNCE expression here is consistent with the Bayesian personalized ranking algorithm with the temperature coefficient added.

[0076] Based on the InfoNCE loss function, the first contrastive learning loss is expressed as follows:

[0077]

[0078] It is worth noting that there is a large degree of similarity between the short videos that users have clicked and skipped. Therefore, the present invention uses a contrastive learning task to make positive and negative preferences close to their respective pseudo labels, rather than directly making the user's positive and negative preferences dissimilar.

[0079] The second contrast task is designed to make the intermediate states of the user's positive and negative preferences learned by the multi-behavior sequence encoder always distinguishable. The specific contrast task is as follows:

[0080]

[0081] in, and is the intermediate latent vector of the multi-behavior sequence encoder, representing the changes in the user's positive and negative preferences, t∈{1,2,…,|S|-1}.

[0082] Similarly, the second comparison task first uses an MLP layer to Map it to the representation space of contrastive learning, and then use the InfoNCE loss function to constrain the similarity of positive and negative samples. The specific processing process of the MLP layer here is:

[0083]

[0084] Among them, W (3) ,W (4) and b (3) ,b (4) is a trainable parameter; z is a placeholder, specifically representing Represents the output of the MLP layer, specifically

[0085] for There are multiple positive samples and negative samples. At this time, the contrast loss based on InfoNCE is:

[0086]

[0087] same, The InfoNCE-based contrast loss is:

[0088]

[0089] Thus, the second contrastive learning loss It is expressed as follows:

[0090]

[0091] in, Indicates the first InfoNCE loss; represents the second InfoNCE loss; |S| represents the number of user historical behavior sequences; They represent the user's positive preference after projection and the user's negative preference after projection respectively; Both represent the hidden state representation after the mapping of the t-th unit; H + yes Matrix representation of H - yes The matrix representation of .

[0092] It should be noted that the above multi-behavior sequence encoder Encoder multi It can be any multi-behavior model. In order to facilitate experimental verification of the effect of the method of the present invention, the present invention designs a multi-behavior sequence encoder based on the gated recurrent unit GRU network framework. During a cycle of the t-th unit of the multi-behavior sequence encoder, the hidden state of the t-1th unit is processed by the unit update function to obtain the hidden state of the t-th unit.

[0093] Specifically, the cycle process of the t-th unit of the multi-behavior sequence encoder is:

[0094]

[0095] Among them, p∈{+,-} is a placeholder, It is the logical NOT operation of p; represents the hidden state of the t-th unit; F(·) is the unit update function; represents the indicator function of the t-th unit; x t is the input short video representation at the t-th time step; They all represent the hidden state of the t-1th unit.

[0096] Furthermore, the indicator function and Used to indicate whether the current input behavior is "click" or "skip". , it means that the current input is the user skip behavior subsequence; Indicates that the current input is a user click behavior subsequence.

[0097] Furthermore, the unit update function F(·) absorbs the information of the current input and the previous input to update the hidden state of the tth unit When the indicator function of the tth unit When , the unit update function of the t-th unit is represented by the indicator function of the t-1-th unit, the output of the hidden layer of the t-th unit, the output of the update gate, and the candidate activation vector:

[0098]

[0099] Among them, h t-1 represents the output of the hidden layer of the t-1th unit; All represent the indicator function of the t-1th unit; p∈{+,-} is a placeholder; represents the hidden state of the t-1th unit; represents the output of the update gate; represents the output of the reset gate; represents the candidate activation vector; represents the hidden state of the t-th unit; T represents the vector transpose operator; σ is the sigmoid activation function; tanh represents the tanh activation function; ⊙ is the Hadamard product; Both represent the trainable parameters in the short video recommendation model; x t It is the input short video representation at the t-th time step.

[0100] It should be noted that in order to predict the user's response to the target short video v new The present invention first fuses the user's positive preference and the user's negative preference to obtain the fused preference h u , and then fuse the preference and target short video v new The vector representation x new The two layers are connected and input into the prediction layer formed by cascading two MLP layers in sequence to obtain the user's prediction of the target short video v new Click-through rate

[0101]

[0102] Among them, the Merge() function represents the weighted sum of vectors; W (5) ,W (6) ,b (5) ,b (6) is a trainable parameter; φ is the RELU activation function.

[0103] Finally, the cross entropy loss between the probability of the user clicking the target short video and the true value of the probability of the user clicking the target short video y∈{0,1} is used as the recommendation task loss

[0104]

[0105] The weighted sum of the recommendation task loss and the loss function of each comparison task is taken as the total loss:

[0106]

[0107] Among them, α1 and α2 are the weight coefficients controlling the two contrast tasks.

[0108] It should be noted that the short video recommendation model uses the Adam optimizer to update parameters.

[0109] It should also be noted that the short video recommendation method based on the contrastive learning framework in the above embodiment can essentially be executed by a computer program or module. Therefore, similarly, based on the same inventive concept, another preferred embodiment of the present invention also provides a short video recommendation system based on the contrastive learning framework corresponding to the short video recommendation method based on the contrastive learning framework provided in the above embodiment, such as Figure 3 As shown, it includes:

[0110] A data acquisition module is used to obtain the user's historical behavior sequence and target short video for short video recommendation;

[0111] The recommendation module is used to input the user's historical behavior sequence and the target short video to be recommended into the trained short video recommendation model, output the probability of the user clicking the target short video, and complete the recommendation of the short video; wherein the user's historical behavior sequence is composed of the user's click behavior subsequence and the user's skip behavior subsequence;

[0112] The short video recommendation model is trained by a contrastive learning method. In the training of the short video recommendation model, the acquired user historical behavior sequence is input into a multi-behavior sequence encoder in the short video recommendation model. The multi-behavior sequence encoder extracts user positive preferences and user negative preferences from the user historical behavior sequence, calculates pseudo labels corresponding to the user positive preferences and user negative preferences, and decouples the user positive preferences and user negative preferences by two designed contrast tasks. The decoupling method is to make the user positive preferences and user negative preferences closer to their corresponding pseudo labels. After the user positive preferences and user negative preferences are fused to obtain the fused preferences, the fused preferences and the target short video are input into the prediction layer to obtain the probability of the user clicking on the target short video. The cross entropy loss between the probability of the user clicking on the target short video and the true value of the probability of the user clicking on the target short video is used as the recommendation task loss. The weighted sum of the recommendation task loss and the loss function of each contrast task is used as the total loss. The parameters of the short video recommendation model are updated based on minimizing the total loss.

[0113] In the first comparison task, the user's positive preference, the user's negative preference, the pseudo-label of the user's positive preference, and the pseudo-label of the user's negative preference are respectively passed through the first MLP layer to obtain the mapped user's positive preference, the mapped user's negative preference, the pseudo-label representation of the user's positive preference, and the pseudo-label representation of the user's negative preference. The loss function of the first comparison task is calculated based on the InfoNCE loss function and used as the first comparison learning loss.

[0114] In the second contrast task, the hidden state output by each unit of the multi-behavior sequence encoder is passed through the second MLP layer, and each unit obtains a mapped hidden state. The user's positive preference and the user's negative preference are passed through the second MLP layer to obtain the projected user's positive preference and the projected user's negative preference. The loss function of the second contrast task is calculated based on the InfoNCE loss function and used as the second contrast learning loss.

[0115] The above-described embodiment is only a preferred solution of the present invention, but it is not intended to limit the present invention. A person skilled in the relevant technical field may make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, any technical solution obtained by equivalent replacement or equivalent transformation falls within the protection scope of the present invention.

Claims

1. A short video recommendation method based on contrastive learning framework, characterized in that: The following steps are involved: Input the user's historical behavior sequence and the target short video to be recommended into the trained short video recommendation model, output the probability of the user clicking the target short video, and complete the recommendation of the short video; wherein the user's historical behavior sequence is composed of the user's click behavior subsequence and the user's skip behavior subsequence; The short video recommendation model is trained by a contrastive learning method. In the training of the short video recommendation model, the acquired user historical behavior sequence is input into a multi-behavior sequence encoder in the short video recommendation model. The multi-behavior sequence encoder extracts user positive preferences and user negative preferences from the user historical behavior sequence, calculates pseudo labels corresponding to the user positive preferences and user negative preferences, and decouples the user positive preferences and user negative preferences by two designed contrast tasks. The decoupling method is to make the user positive preferences and user negative preferences closer to their corresponding pseudo labels. After the user positive preferences and user negative preferences are fused to obtain the fused preferences, the fused preferences and the target short video are input into the prediction layer to obtain the probability of the user clicking on the target short video. The cross entropy loss between the probability of the user clicking on the target short video and the true value of the probability of the user clicking on the target short video is used as the recommendation task loss. The weighted sum of the recommendation task loss and the loss function of each contrast task is used as the total loss. The parameters of the short video recommendation model are updated based on minimizing the total loss. In the first comparison task, the user's positive preference, the user's negative preference, the pseudo-label of the user's positive preference, and the pseudo-label of the user's negative preference are respectively passed through the first MLP layer to obtain the mapped user's positive preference, the mapped user's negative preference, the pseudo-label representation of the user's positive preference, and the pseudo-label representation of the user's negative preference. The loss function of the first comparison task is calculated based on the InfoNCE loss function and used as the first comparison learning loss. In the second contrast task, the hidden state output by each unit of the multi-behavior sequence encoder is passed through the second MLP layer, and each unit obtains a mapped hidden state. The user's positive preference and the user's negative preference are passed through the second MLP layer to obtain the projected user's positive preference and the projected user's negative preference. The loss function of the second contrast task is calculated based on the InfoNCE loss function and used as the second contrast learning loss.

2. A short video recommendation method based on a contrastive learning framework as claimed in claim 1, characterized in that: The specific calculation process of the pseudo-label representation corresponding to the user's positive preference and the user's negative preference is as follows: the user's click behavior subsequence is averaged and pooled to obtain the pseudo-label of the user's positive preference, and the user's skip behavior subsequence is averaged and pooled to obtain the pseudo-label of the user's negative preference.

3. A short video recommendation method based on contrastive learning framework as claimed in claim 1, characterized in that: The specific calculation process of the pseudo-label representation corresponding to the user's positive preference and the user's negative preference is as follows: the user's click behavior subsequence is input into the trained click behavior subsequence encoder to obtain the pseudo-label of the user's positive preference, and the user's skip behavior subsequence is input into the trained skip behavior subsequence encoder to obtain the pseudo-label of the user's negative preference.

4. A short video recommendation method based on contrastive learning framework as claimed in claim 1, characterized in that: The first contrastive learning loss The functional form is: in, represents the user's positive preference after mapping; Pseudo-label representations that represent users’ positive preferences; Represents the user's negative preference after mapping; Pseudo-label representations that represent users’ negative preferences; Represents the InfoNCE loss function, and its function form is: Among them, sim() represents the cosine similarity function; q, k + ,k - is the input of the InfoNCE loss function; τ is the temperature hyperparameter.

5. The short video recommendation method based on contrastive learning framework as claimed in claim 1, characterized in that: During one cycle of the t-th unit of the multi-behavior sequence encoder, the hidden state of the t-1-th unit is processed by the unit update function to obtain the hidden state of the t-th unit.

6. A short video recommendation method based on contrastive learning framework as claimed in claim 5, characterized in that: When the indicator function of the tth unit When , the unit update function of the t-th unit is represented by the indicator function of the t-1-th unit, the output of the hidden layer of the t-th unit, the output of the update gate, and the candidate activation vector.

7. A short video recommendation method based on contrastive learning framework as claimed in claim 4, characterized in that: The second contrastive learning loss The functional form is: in, Indicates the first InfoNCE loss; represents the second InfoNCE loss; |S| represents the number of user historical behavior sequences; They represent the user's positive preference after projection and the user's negative preference after projection respectively; Both represent the hidden state representation after the mapping of the t-th unit; H + yes Matrix representation of H - yes The matrix representation of .

8. The short video recommendation method based on contrastive learning framework as claimed in claim 1, characterized in that: The user's positive preference and the user's negative preference are fused by weighted summation, or by directly adding the user's positive preference and the user's negative preference to obtain a fused preference.

9. The short video recommendation method based on contrastive learning framework as claimed in claim 1, characterized in that: The prediction layer is formed by cascading two MLP layers in sequence.

10. A short video recommendation system based on contrastive learning framework, characterized in that: include: A data acquisition module is used to obtain the user's historical behavior sequence and target short video for short video recommendation; The recommendation module is used to input the user's historical behavior sequence and the target short video to be recommended into the trained short video recommendation model, output the probability of the user clicking the target short video, and complete the recommendation of the short video; wherein the user's historical behavior sequence is composed of the user's click behavior subsequence and the user's skip behavior subsequence; The short video recommendation model is trained by a contrastive learning method. In the training of the short video recommendation model, the acquired user historical behavior sequence is input into a multi-behavior sequence encoder in the short video recommendation model. The multi-behavior sequence encoder extracts user positive preferences and user negative preferences from the user historical behavior sequence, calculates pseudo labels corresponding to the user positive preferences and user negative preferences, and decouples the user positive preferences and user negative preferences by two designed contrast tasks. The decoupling method is to make the user positive preferences and user negative preferences closer to their corresponding pseudo labels. After the user positive preferences and user negative preferences are fused to obtain the fused preferences, the fused preferences and the target short video are input into the prediction layer to obtain the probability of the user clicking on the target short video. The cross entropy loss between the probability of the user clicking on the target short video and the true value of the probability of the user clicking on the target short video is used as the recommendation task loss. The weighted sum of the recommendation task loss and the loss function of each contrast task is used as the total loss. The parameters of the short video recommendation model are updated based on minimizing the total loss. In the first comparison task, the user's positive preference, the user's negative preference, the pseudo-label of the user's positive preference, and the pseudo-label of the user's negative preference are respectively passed through the first MLP layer to obtain the mapped user's positive preference, the mapped user's negative preference, the pseudo-label representation of the user's positive preference, and the pseudo-label representation of the user's negative preference. The loss function of the first comparison task is calculated based on the InfoNCE loss function and used as the first comparison learning loss. In the second contrast task, the hidden state output by each unit of the multi-behavior sequence encoder is passed through the second MLP layer, and each unit obtains a mapped hidden state. The user's positive preference and the user's negative preference are passed through the second MLP layer to obtain the projected user's positive preference and the projected user's negative preference. The loss function of the second contrast task is calculated based on the InfoNCE loss function and used as the second contrast learning loss.