A news recommendation method based on contrastive learning
Through contrastive learning and multi-layer graph attention network, the problem of fine-grained differences between user interests and news content in the news recommendation system is solved, and a more accurate news recommendation effect is achieved.
Patent Information
- Application Number
- CN202210404048.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-18
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2042-04-18
AI Technical Summary
Existing news recommendation systems ignore the connection between news and users when their recommendations are not accurate enough, and it is difficult for traditional methods to effectively capture the fine-grained differences in user interests and news content.
Using a method based on contrastive learning, through the user interest encoder and news content understanding module, data enhancement technology is introduced to make the user interest vector and news representation close under similar conditions and far away under heterogeneous conditions, using a multi-layer graph attention network. Hierarchical modeling of interests and content.
It improves the granularity and accuracy of user interest modeling, enhances the robustness of news content understanding, and achieves more accurate news recommendations.
Smart Images

Figure CN114840747B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer application technology, in particular to the field of data mining and machine learning, and in particular to a news recommendation method based on contrastive learning. Background Art
[0002] Online news platforms, such as Tencent News and Toutiao, have attracted a large number of users to read digital news. However, a large number of news articles emerge every day, and it is unrealistic for users to find news of interest from a large number of online news articles. Therefore, personalized news recommendations based on user interests are an important task for online news platforms, which can help users find news articles of interest to them and alleviate the problem of information overload.
[0003] Recently, news recommendation has attracted attention in both industry and academia, and many methods have been proposed. Unlike general product recommendations, news articles are time-sensitive and will become outdated quickly. Therefore, those traditional ID-based recommendation methods are affected by the cold start problem. In addition, news articles contain rich text information, such as news titles, entity words in news, etc., which should be better modeled for recommendation. Most existing methods use deep learning techniques to learn news features and model interests based on users' recent historical click records. For example, some early works used autoencoders to extract news semantic features, and then used GRU (Gated Recurrent Unit) networks to capture user interests from historically clicked news sequences. Later, some scholars proposed to integrate knowledge graphs into news representation learning through multi-channel CNN (convolutional neural network) and use news-level attention to aggregate historically clicked news. In addition, a multi-head self-attention network is used to capture user interests, and an attention network is used to obtain a unified user representation.
[0004] However, the above methods only focus on how to model news and users more accurately but ignore the connections between news and users.
[0005] Contrastive learning has achieved many results in the fields of natural language processing and computer vision. Taking the SimCLR model as an example, the author proposed 10 different image enhancement operations, such as rotation, hue conversion, cropping, zooming in and out, etc. During training, two schemes are randomly selected and applied to the original image respectively to form two enhanced new images, which are positive examples of each other. During training, any other image in the batch can be used as its negative example. During training, the distance between positive examples in the vector space is shortened and the distance between negative examples is extended. Contrastive learning has achieved very good results in multiple tasks. Summary of the invention
[0006] The main purpose of the present invention is to combine the idea of contrastive learning with the task specificity of the news recommendation system, and propose a news recommendation method based on contrastive learning to solve the technical problem that the existing news recommendation system is not accurate enough.
[0007] To achieve the above object, the present invention proposes the following technical solutions:
[0008] A news recommendation method based on contrastive learning includes a user interest extraction step based on contrastive learning; the user interest extraction step includes: providing a user interest encoder, the user interest encoder is configured to encode a news sequence browsed by a user to obtain an interest vector; encoding the news sequence browsed by the user to obtain a first interest vector; performing data enhancement on the news sequence browsed by the user, and then encoding the data-enhanced news sequence to obtain a second interest vector; training the user interest encoder, and during the training process, introducing an interest contrastive learning loss that makes the first interest vector and the second interest vector close to each other and makes the first interest vector far away from the interest vectors of other users.
[0009] In a further technical solution, the news recommendation method based on contrastive learning also includes a news content understanding step based on contrastive learning; the news content understanding step includes: providing a news encoding module, which is configured to encode the news browsed by the user to obtain a news representation; encoding the news browsed by the user to obtain an original news representation; performing a third data enhancement on the news browsed by the user, and then encoding the news after the third data enhancement to obtain an enhanced news representation; training the news encoding module, introducing content contrastive learning loss during the training process, and the content contrastive learning loss is used to make the original news representation of the user close to the enhanced news representation, and to make the original news representation of the user away from the news representations of other users.
[0010] On the other hand, the present invention also proposes the following technical solution:
[0011] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the aforementioned news recommendation method based on contrastive learning.
[0012] The beneficial effects of the present invention are: using a hierarchical user interest modeling method to make the granularity of user interests finer and the interest modeling ability of sub-topics stronger. Comparative learning at the user interest modeling level makes the topic interest vectors of users with similar browsing records at a certain topic level more similar, while the similarity of the interest vectors of users with dissimilar browsing records becomes smaller. Compared with the existing news recommendation algorithm, it can capture user interests more effectively and accurately and make more accurate news recommendations.
[0013] In a further technical solution of the present invention, comparative learning is also performed at the level of news content understanding, which effectively improves the encoding ability of the news content understanding module, so that news with similar content but different expressions have greater similarity in representation, and the similarity between different news becomes smaller, so as to improve the robustness of the model in understanding news content, thereby accurately pushing news of interest to users based on accurate modeling of user interests. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 This is an example of understanding news content in an embodiment of the present invention;
[0015] Figure 2 This is an example of user interest extraction according to an embodiment of the present invention;
[0016] Figure 3 is a schematic diagram of news content understanding based on contrastive learning in an embodiment of the present invention;
[0017] Figure 4 It is a schematic diagram of multi-layer user interest encoding based on contrastive learning according to an embodiment of the present invention. DETAILED DESCRIPTION
[0018] The present invention will be further described below in conjunction with the accompanying drawings and specific implementation methods.
[0019] Different authors may have different descriptions of the same event. Figure 1 As shown in the figure, both news stories are describing the event "Chinese women's curling defeated British", but there are differences in the text and entities of the two stories. Here, the text is the title of the news, and the entity is the entity word extracted from the news title. Entity extraction can be done by simple text matching and named entity recognition based on deep learning. We can see that the two news stories, which are different in text description, convey essentially the same event content. Therefore, when encoding the text, the model should make the encoded vector representations of the two news stories close to each other, and keep dissimilar news stories away from each other. Figure 2 This is an example of user interest extraction. User 1 browsed three news in the order of "News 1", "News 2", and "News 3", while User 2 browsed the same three news in the order of "News 3", "News 1", and "News 2". The news content browsed by the two is the same, but the browsing order is different. If the linear encoding model is used for interest modeling, the difference between the two is relatively large.
[0020] Therefore, the embodiment of the present invention combines the idea of contrastive learning with the task specificity of the news recommendation system, and proposes an interest-layered news recommendation method based on contrastive learning, which performs multi-level interest modeling when extracting user interests to more accurately model user interests. In addition, news content understanding is performed based on contrastive learning to improve the robustness of the model in understanding news content. Specifically, since a large number of journalists report on hot social events at the same time, their texts are mostly similar, which requires that the model should have roughly similar content encodings for news with little difference in textual expressions. Similarly, when extracting user interests, users with roughly similar news browsing histories should also have similar interest encodings, and the model should reduce the order of news browsing and the impact of individual news.
[0021] In the text encoding part, we used four data enhancement methods: text replacement, text deletion, entity deletion, and entity order swap. In order to model user interests in a more fine-grained manner, the embodiment of the present invention stratifies user interests according to three levels: sub-topic level, topic level, and user level. Sub-topic level interests include football and basketball; topic level interests include sports, which contain multiple sub-topic level interests (such as football and basketball); user level interests are a collection of topics that users are interested in. In the user interest extraction part, the embodiment of the present invention uses two data enhancement methods for sub-topic level interests: disrupting the order of news browsing and randomly deleting browsed news. The news is modeled from news with news categories of specific sub-topics in the user's browsing history. When generating topic-level interests and user-level interests, a two-layer graph attention network is used for aggregation, that is, the sub-topic level interest vectors are aggregated into topic-level interest vectors, and the topic-level interest vectors are aggregated into user-level interest vectors.
[0022] like Figure 3 As shown in the figure, for the news content understanding part, the framework is divided into data enhancement of text and data enhancement of entity. In the data enhancement part of text, two data enhancement methods are adopted: random word deletion and random word replacement. First, the input news text is converted into the corresponding text index. During data enhancement, the text index is randomly converted to 0 with a probability of 7.5%. The word vectors corresponding to the 0 index are all 0. The text index is randomly replaced with a random index with a probability of 7.5% to obtain enhanced text. In the data enhancement part of entity, two data enhancement methods are adopted: random deletion of entity words and swapping the order of entity words. The entities in the news are mapped to entity indexes, and the entity index is converted to 0 with a probability of 7.5%. At the same time, the order of entities in the news is shuffled with a probability of 30% to obtain enhanced entities.
[0023] Continue to refer Figure 3, after the data enhancement operation, the news encoding module is used to encode and model the news. It first applies a text embedding layer to enrich the semantic information, converts the text and entities before and after data enhancement into pre-trained word vectors and entity vectors, and then further applies the self-attention network of text and entity to capture the correlation between news text and the correlation between entities. Next, the text and entity attention networks are used respectively to learn the text representation of news by aggregating news text, and to aggregate the entity representation of news by aggregating entities in the news. Finally, the text representation vector and the entity representation vector are concatenated as the representation vector of the corresponding news. Specifically, first, the text before data enhancement is mapped to the original word vector, and the enhanced text is mapped to the enhanced word vector; the entity before data enhancement is mapped to the original entity vector, and the enhanced entity is mapped to the enhanced entity vector. Then, the original word vector is sequentially used with the text self-attention mechanism and the text attention mechanism to obtain the original representation of the text. t , the enhanced word vector is sequentially used with the text self-attention mechanism and the text attention mechanism to obtain the enhanced representation of the text n t '. The original entity vector is sequentially used with the entity self-attention mechanism and the entity attention mechanism to obtain the original representation of the entity n e , the enhanced entity vector is sequentially subjected to the entity self-attention mechanism and the entity attention mechanism to obtain the enhanced entity representation n e '. Next, the original representation of the text n t With the original representation of the entity n e spliced into the original representation of the news (original news representation) (i.e. the original text encoding) n, and the enhanced representation of the text n t 'Enhanced representation with entities e 'Splicing into the enhanced representation of news (enhanced news representation) (i.e. data augmented text encoding) n'. Finally, contrastive learning is used to make the original representation and enhanced representation of the same news close, while the representations of different news are far away. Here, contrastive learning uses Euclidean distance as a similarity metric and constructs a loss function for contrastive learning, so that the similarity between the original representation and the enhanced representation of the same news becomes greater, and the similarity between the original representation of the news and the enhanced representation of other news becomes smaller.
[0024] In a specific embodiment, the title of news A is used as the text of the news, denoted as T:
[0025] T=[w1,w2,w3,…,w n ] (1)
[0026] Formula (1) indicates that the news text T contains n words;
[0027] There are two ways to perform data augmentation on the text, and one of them can be randomly selected. The first is to randomly delete several words in the text to obtain the augmented text T1:
[0028] T1 = [w1, w3, …, w n (2)
[0029] Equation (2) indicates that the word w2 is deleted. Taking the Figure 1 news as an example, for instance, the word "8:4" in the text is deleted.
[0030] Another way to perform data augmentation on the text is to randomly replace the words in the text to obtain the augmented text T2:
[0031] T2 = [w1, w t , w3, …, w n (3)
[0032] Equation (3) indicates that the word w2 in text T is replaced with a random word w t , for example, replacing the character "壶" with a random character "氢".
[0033] For the entity set of the aforementioned news A, denoted as E:
[0034] E = [e1, e2, e3, …, e m (4)
[0035] Equation (4) indicates that the entity of news A contains m words.
[0036] As Figure 3 shown, for entities, a data augmentation method of randomly deleting entity words can be adopted, or a data augmentation method of swapping the order of entity words can be used. The entity after data augmentation by deleting entity words is, for example, E1, and the entity after data augmentation by swapping the order of entity words is, for example, E2:
[0037] E1 = [e2, e3, …, e m (5)
[0038] E2 = [e i , e j , …, e k (6)
[0039] In Equation (6), the subscripts i, j, and k respectively represent entities at different index positions. For example, Figure 1 in the news example, randomly delete the entity word "UK" from the entity word set, or swap the occurrence order of the entity words from "Chinese Women's Curling UK" to "UK Women's Curling China".
[0040] The present invention uses a text encoder to encode news models. It first applies a word embedding layer to enrich the semantic information of the model:
[0041] Emb t =F t (T) (7)
[0042] Emb e =F e (E) (8)
[0043] Among them, Emb t 、Emb e are the text embedding and entity embedding of news respectively; F t is the representation function of word embedding, using the pre-trained GloVe as the initialization parameter of the word embedding layer; F e is the representation function of entity embedding, using TransE entity embedding as its initialization parameter;
[0044] Next, we use a text self-attention network to learn word representations from the context of news text. Then, we use a text attention network to learn text representations by aggregating word representations. t In addition, an entity encoder is applied to learn the entity representation of news. First, the entity embedding layer is used to incorporate the information of the entity into the model, and the entity self-attention network is further applied to capture the correlation between entities. Next, an entity attention network is used to learn the entity representation of news by aggregating entities. e Finally, the text information and entity information are concatenated as news representation (also called "news representation"): n = [n t ,n e The same processing is applied to the enhanced text and entity, and the enhanced news representation n'=[n t ',n e '].
[0045] The news representation obtained for the text and entity of the original news is n, and the news representation obtained for the text and entity of the news after data enhancement is n'. In order to make the news representations of the same news before and after data enhancement closer, and the news representations of different news farther apart, the embodiment of the present invention uses Euclidean distance to measure the similarity of news representations before and after data enhancement, as well as the similarity of news representations between different users, thereby constructing the following comparative learning loss function for news content understanding:
[0046]
[0047] Among them, sim represents the vector similarity calculation function, τ is an adjustable hyperparameter, N is the number of news items, and ni represents the original news representation of the i-th news, n i ' represents the enhanced news representation of the i-th news after data enhancement. The above loss function makes the news representation after data enhancement n i 'With original news characterization i Close to, and random other news such as the enhanced news representation n of the jth news j ' and n i keep away.
[0048] For the user interest extraction part of news, similar contrastive learning is also introduced. User interest extraction based on contrastive learning includes: providing Figure 4 The user interest encoder shown is configured to encode the news sequence browsed by the user to obtain an interest vector; encode the news sequence browsed by the user to obtain a first interest vector; perform data enhancement on the news sequence browsed by the user, and then encode the data enhanced news sequence to obtain a second interest vector; train the user interest encoder, and during the training process, introduce interest contrast learning loss on the basis of the original click-through rate estimation loss, and the interest contrast learning loss is used to make the representation of the first interest vector and the second interest vector close, and to make the first interest vector away from the interest vectors of other users. Here, data enhancement of the news sequence browsed by the user includes first data enhancement and second data enhancement, which will be described in detail later.
[0049] The embodiment of the present invention utilizes Figure 4 The user interest encoder shown models the user interest in a hierarchical manner from the news sequence browsed by the user, namely, it is divided into sub-topic level interests, topic level interests and user-level interests. The sub-topic level interests are modeled from the news whose news category is a specific sub-topic (such as "football") in the user's browsing history. When encoding and modeling the sub-topic level interests, the embodiment of the present invention adopts the first data enhancement, that is, a data enhancement method of randomly deleting several news in the news sequence and / or disrupting the order of news browsing. At the same time, the sub-topic level interests are hierarchically aggregated by using a graph attention network, and the second data enhancement is adopted during aggregation, that is, a data enhancement method of deleting points or edges of the graph attention network. The user-level interests are obtained by summarizing the topic-level interests, and one user corresponds to only one user-level interest.
[0050] Users browsing news may be interested in multiple different topics at the same time, such as movies, finance, and sports. The embodiment of the present invention classifies the news browsed by the user, and independently models each sub-topic to extract the user's more fine-grained interests, and then uses the interest aggregation method based on the graph attention network to obtain the interest vector of the large category (theme-level interest). Figure 4 As shown, use Figure 3 The news encoding module in the encoding of news in the , obtains the representation of each news, and uses the attention network to aggregate the interest of the sub-topic news that the user has clicked, and the obtained interest vector is added to the category embedding of the sub-topic to obtain the final user's interest representation under the sub-topic. When obtaining the interest vector at the sub-topic level, the contrastive learning method is adopted, in which the first data enhancement is used, which mainly includes two information enhancement methods. The first is to randomly delete the news, such as Figure 4 As shown in the lower left corner, randomly deleting a certain percentage of news has little effect on the user's interest vector. Another way is to Figure 4 As shown in the lower right corner, the order of browsing news is disrupted, and the user's interests after the disruption should be consistent with those before the disruption.
[0051] Secondly, the present invention learns topic-level interest vectors to simulate coarse-grained user interests in major news topics (such as sports and finance). Figure 4 The graph attention network contains three layers of nodes, in which some white nodes are users' sub-topic-level interests, such as users' interest in football; light gray nodes are users' topic-level interests, such as users' interest in sports; dark gray nodes correspond to user-level interests, which are the aggregation of topic-level interests, and each user corresponds to a user-level interest. Since the number of news clicks on different sub-topics reflects the importance of sub-topic user interests to a certain extent, the vector corresponding to the number of news clicks is added on the basis of the sub-topic interest embedding. For the three-layer interest network, the outermost sub-topic-level interest is the aggregated vector, while the middle-layer topic-level interest and the innermost user-level interest are initialized as vectors of all zeros. The model uses a graph attention network to allow its interest vectors to flow from fine-grained to coarse-grained. At the same time, the second data enhancement is adopted to delete some edges or points in the graph attention network. Finally, the loss function of contrastive learning is used to improve the encoding of sub-topic-level interests, topic-level interests, and user-level interests.
[0052] For users who browse news, they may be interested in multiple different topics of news at the same time, such as movies, finance, and sports. In addition, users who are interested in sports may only be interested in a few small categories under the general category of sports, which are called sub-topic news. For each sub-topic news, such as football, the user may only be interested in a certain team. If the entire sports category or all news is modeled uniformly, it will be difficult to extract the user's interest in the sub-topic of football. Therefore, an embodiment of the present invention classifies the news that the user has browsed, and independently models each sub-topic, so as to extract the user's more fine-grained interests, and then use interest aggregation to obtain a coarse-grained interest vector. That is to say, for the user's news browsing sequence M={t i|i=1,2,…,l}, l is the number of news visited by the user. According to the category of the news, all the news with topic k and subtopic b in M are grouped into one group, denoted as
[0053]
[0054] Where d is the number of news with topic k and subtopic b in the news sequence browsed by the user. Figure 4 China News Indicates the n news items of subtopic 1 under topic 1 that the user has browsed. Indicates the n news items of subtopic 1 under topic 2 that the user has browsed. Indicates the news with subtopics o, p, and q under topic 2 that the user has browsed. In addition, Figure 4 middle Represents the category vector representation of topic 1 and subtopic 1, The user interest representation of the unfused category vector representing topic 1 and subtopic 1, It represents the user interest representation of topic 1 and subtopic 1 after random deletion of news without integrating the category vector. Indicates user interest in topic 1 and subtopic 1 and the category vector The sum is the complete user interest of Topic 1 and Sub-topic 1. Indicates user interest after the news of topic 1 and subtopic 1 is deleted and the category vector The user interests after adding up the complete data enhancement, Represents the category vector of topic 2 and subtopic 1, The user interest representation of the unfused category vector representing topic 2 and subtopic 1, The news of topic 2 and subtopic 1 are randomly swapped and the unfused category vector represents the user interest. Indicates user interest in Topic 2 and Sub-Topic 1 and the number of news The sum is the complete user interest of Topic 2 and Sub-Topic 1. Indicates user interest after the news of topic 2 and subtopic 1 is deleted and the number of news The user interests after the complete data augmentation are summed up.
[0055] In the interest extraction part, we first use the news encoding module News en Get news representation of every news
[0056]
[0057] Since clicked news may have different amounts of information for modeling user interests, the attention network is used to set higher weights for clicked news with high amounts of information:
[0058]
[0059] in, represents the interest vector with topic k and subtopic b; w j express The jth clicked news The attention weight, is the jth clicked news The news shows that S represents a fully connected network. In addition, in order to allow the model to distinguish different topics, the model uses a topic embedding for identification. is the topic embedding of topic k and subtopic b. Finally, and The sum of the subtopic-level interest vector Right now Similarly, the model also learns corresponding interest vectors for other sub-topics clicked by users.
[0060] The present invention also adopts the idea of contrastive learning when encoding sub-topic level interests, in which two user-side data enhancement methods are mainly used. The first is to randomly delete news, such as Figure 4 As shown in the lower left corner, randomly deleting a certain percentage of news has little effect on the user's interest vector. Another way is to Figure 4 As shown in the lower right corner, the order of browsing news is disrupted, and the user interest after the disruption should be consistent with that before the disruption. Therefore, the embodiment of the present invention uses the similarity of the sub-topic level interest vectors before and after data enhancement to construct the sub-topic level loss function
[0061]
[0062] Among them, K is the topic contained in the data set, |K| is the number of topics contained in the data set; B k is the subtopic contained in topic k, |B k | is the number of subtopics contained in topic k. represents the interest vector of the corresponding user in the subtopic b under topic k, is the user interest of topic k and subtopic b after data enhancement, represents the user interest of subtopic j of topic h after data augmentation. τ is an adjustable hyperparameter that controls the importance of contrastive learning and is set to 0.07 here.
[0063] Secondly, the embodiment of the present invention learns the topic-level interest vector to simulate the coarse-grained user interest in major news topics (such as sports and finance). Figure 4 The graph attention network shown in the figure contains three layers of nodes, namely, the sub-topic level interest vector Topic-level interest vector u k As well as the user-level interest vector u. Since the number of news clicks on different sub-topics reflects the importance of the sub-topic user interest to a certain extent, the sub-topic level interest vector is obtained After that, the embedding vector corresponding to the number of news clicks is added to obtain the final sub-topic level interest vector F n Represents the mapping function between the number of news and the embedding vector, Indicates the number of news with news topic k and sub-topic b. Figure 4 As shown, the final sub-topic level interest vector of news with news topic k and sub-topic i is Initialize the nodes of sub-topic-level interest in the graph attention network. For topic-level interest nodes and user-level interest nodes, they are initialized to 0. Represents the sub-topic-level interest vector of news topic 1, sub-topic 1 and the number of news visits embedded, Represents the sub-topic-level interest vector of news topic 1 and sub-topic 1 after data enhancement, plus the number of news visits embedded, Represents the sub-topic-level interest vector of news topic 1, sub-topic 1 and the number of news visits embedded, The sub-topic-level interest vector of news topic 2 and sub-topic 1 after data enhancement plus the number of news visits is embedded. In the embodiment of the present invention, all nodes corresponding to sub-topic-level interests, topic-level interests, and user-level interests in the graph attention network are collectively referred to as X, where the i-th node vector is referred to as x i . A graph attention network is constructed based on the inclusion relationship between subtopics and topics. in Represents other nodes connected to the i-th node, which are aggregated using the graph attention network. The formula is as follows:
[0064]
[0065]
[0066] Among them, α i,j represents the attention coefficient between node i and node j, α i,i represents the self-attention coefficient of node i, LeakyReLU is the activation function; a is a vector with a vector length of x iTwice the length; x j Represents the vector representation of the jth node in the graph attention network, x k represents the vector representation of the kth node in the graph attention network; || represents matrix concatenation; Θ is a weight matrix used to linearly map the nodes of the graph attention network; x j ' is the next layer of the graph attention network.
[0067] When aggregating sub-topic-level interests into topic-level interests, the contrastive learning method is also applied. A small number of edges are randomly deleted in the graph attention network. After deleting a small number of edges, the topic-level interest and user-level interest obtained by using the graph attention network are set as x t ' and x u ', and then use the similarity of the topic-level interest vectors before and after data enhancement to construct the topic-level loss function And the user-level loss function constructed by using the similarity of user-level interest vectors before and after data enhancement as follows:
[0068]
[0069]
[0070] in, Contrastive learning loss function representing topic-level interest, Contrastive learning loss function to represent user-level interests; is the number of topics in the dataset, x t represents the aggregated topic-level interest vector, x u Represents the aggregated user-level interest vector.
[0071] Since the model models user interests in three layers, news matching is also performed in three layers. For user c and news y with topic k and subtopic b, the news encoding module obtains the news representation n of news y. y , and obtain the interest vector of user c, which includes the sub-topic level interest vector Topic-level interest vector u k As well as the user-level interest vector u. As mentioned above, users should be modeled separately on each sub-topic, which makes it easier to grasp the user's current interests. Therefore, the embodiment of the present invention only uses the interest vectors of the sub-topics of the corresponding category of news when matching interests at the sub-topic level, that is, score s Indicates the matching score between the user's sub-topic interest and the candidate news. This interest matching method also works on the interest matching at the topic level, that is, scoret =u k ·n y , score t Indicates the matching score between the user's topic interest and the candidate news. Finally, there is the user-level interest matching, score u =u·n y , score u represents the matching score between the user's user-level interest and the candidate news. The final model gives the degree of interest of user c in news y as:
[0072] score=λ s score s +λ t score t +(1-λ s -λ t )score u (18)
[0073] in, is a hyperparameter used to control the relative importance of interest scores at different levels. In this embodiment of the present invention, s ,λ t Set to 0.7 and 0.15 respectively.
[0074] That is, the news in the candidate set is matched with the user's interests to obtain the user's interest score for each news, sort them, and recommend news with high scores (such as Top 20) to the user.
[0075] The embodiment of the present invention uses noise contrast to estimate the loss For model optimization, noise contrast estimation loss is a type of click-through rate estimation loss. For a given training dataset D, it contains positive samples clicked by users and K negative samples that are displayed to users but not clicked by users. The model aims to assign a higher interest score to the positive samples than to other negative samples, which is expressed as follows:
[0076]
[0077] Among them, |D| is the number of training samples in the dataset, is the interest score estimated by the user click sample model, K is the number of news that the sampled user did not click, The interest score estimated by the model for samples that the user did not click.
[0078] The loss function of the entire recommendation model It consists of two parts: the loss function of contrastive learning and the loss function of news matching, in the following form:
[0079]
[0080] Among them, α is the importance of controlling contrastive learning loss, η1, η2, η3, η4 are hyperparameters for controlling the importance of contrastive learning loss, which are set to 0.2, 0.4, 0.2, 0.2 respectively in the experiment.
[0081] Another embodiment of the present invention further proposes a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the news recommendation method based on contrastive learning proposed in the aforementioned embodiment can be implemented.
[0082] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art of the present invention, several equivalent substitutions or obvious variations can be made without departing from the concept of the present invention, and the performance or use is the same, which should be regarded as belonging to the protection scope of the present invention.
Claims
1. A news recommendation method based on contrastive learning, characterized in that: The method comprises a user interest extraction step based on contrastive learning; the user interest extraction step comprises: A user interest encoder is provided, wherein the user interest encoder is configured to encode a news sequence browsed by a user to obtain an interest vector; Encoding the news sequence browsed by the user to obtain a first interest vector; Performing data enhancement on the news sequence browsed by the user, and then encoding the data enhanced news sequence to obtain a second interest vector; the data enhancement includes first data enhancement, and the first data enhancement includes: randomly deleting news in the news sequence, and / or disrupting the order of browsing news in the news sequence; The user interest encoder is trained. During the training process, an interest contrast learning loss is introduced to make the first interest vector and the second interest vector close to each other and to make the first interest vector far away from interest vectors of other users.
2. The news recommendation method based on contrastive learning as claimed in claim 1, characterized in that: When encoding the news sequence browsed by the user, the user interest encoder performs hierarchical modeling of the interest of the news sequence browsed by the user according to three levels of category granularity from fine to coarse, namely, subject level, topic level, and user level; The finer-grained interest vectors are then aggregated to obtain coarser-grained interest vectors.
3. The news recommendation method based on contrastive learning as claimed in claim 2, characterized in that: Also includes: The vector of the number of news browsing times of the user at the same sub-topic level is embedded into the interest vector of the user at the sub-topic level.
4. The news recommendation method based on contrastive learning as claimed in claim 2, characterized in that: The interest contrast learning loss includes: a sub-topic level loss function constructed using the similarity of the sub-topic level interest vectors before and after the first data enhancement.
5. The news recommendation method based on contrastive learning as claimed in claim 2, characterized in that: When aggregating finer-grained interest vectors to obtain coarser-grained interest vectors, a graph attention network is used for aggregation; and during aggregation, a second data enhancement is used to randomly delete points or edges on the graph attention network; The interest contrastive learning loss also includes: a topic-level loss function constructed using the similarity of the topic-level interest vectors before and after the second data enhancement, and a user-level loss function constructed using the similarity of the user-level interest vectors before and after the second data enhancement.
6. The news recommendation method based on contrastive learning as claimed in claim 1, characterized in that: Also includes: The news is matched for the user at three levels: sub-topic level, topic level, and user level. For each news in the candidate set, the user's interest score for the news is calculated based on the interest vector of each level, and then news with a score higher than a preset value is recommended to the user.
7. The news recommendation method based on contrastive learning as claimed in claim 1, characterized in that: The method also includes a news content understanding step based on contrastive learning; the news content understanding step includes: Providing a news encoding module, the news encoding module is configured to encode the news browsed by the user to obtain a news representation; Encoding the news browsed by the user to obtain original news representation; Performing third data enhancement on the news browsed by the user, and then encoding the news after the third data enhancement to obtain enhanced news representation; The news encoding module is trained, and content contrastive learning loss is introduced during the training process. The content contrastive learning loss is used to make the original news representation of the user close to the enhanced news representation, and to make the original news representation of the user far away from the news representations of other users.
8. The news recommendation method based on contrastive learning as claimed in claim 7, characterized in that: The third data enhancement includes text enhancement and entity enhancement; The text enhancement includes: randomly deleting and / or randomly replacing words in the news text to obtain enhanced text; the entity enhancement includes: randomly deleting entity words in the news entities and / or exchanging the order of appearance of entity words to obtain enhanced entities.
9. The news recommendation method based on contrastive learning as claimed in claim 8, characterized in that: The news encoding module encodes the news to obtain news representation, including: The original word vector is sequentially used with the text self-attention mechanism and the text attention mechanism to obtain the original representation of the text, and the enhanced word vector is sequentially used with the text self-attention mechanism and the text attention mechanism to obtain the enhanced representation of the text; the original entity vector is sequentially used with the entity self-attention mechanism and the entity attention mechanism to obtain the original representation of the entity, and the enhanced entity vector is sequentially used with the entity self-attention mechanism and the entity attention mechanism to obtain the enhanced representation of the entity; The original word vector and the enhanced word vector are mapped from the text before and after text enhancement, respectively, and the original entity vector and the enhanced entity vector are mapped from the entity before and after entity enhancement, respectively; The original representation of the text and the original representation of the entity are concatenated to obtain the original news representation, and the enhanced representation of the text and the enhanced representation of the entity are concatenated to obtain the enhanced news representation.
10. The news recommendation method based on contrastive learning according to claim 7, characterized in that: The content contrastive learning loss includes: a news loss function constructed using the similarity of the news representations before and after the third data enhancement, and the similarity between the news representations of the user and other users.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the news recommendation method based on contrastive learning described in any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
Fine-grained multi-modal false news detection method
CN113934882A
Conversation news recommendation method and recommendation system based on user implicit feedback
CN114117233A
Apparatus and method for recommending news of user interest using user-defined topic modeling
KR102368043B1
