False news identification method combining knowledge graph and attention mechanism
By combining false news detection methods with knowledge graphs and attention mechanisms, extracting and aggregating entities, themes and sentence embedding representations in news, the problem of limited identification accuracy in the prior art is solved, and a more efficient false news detection effect is achieved.
Patent Information
- Application Number
- CN202411691328.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-02-28
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing fake news detection methods have limited recognition accuracy when dealing with complex and fuzzy entity references and fail to make full use of entity relationships and background knowledge in the knowledge graph.
A fake news recognition method combining knowledge graph and attention mechanism is used to extract entities, topics and sentences in the news, embedding representations are generated using the Transformer encoder, and a sentence-topic and sentence-entity attention mechanism is designed, and a weighted aggregation is combined with the entity embedding of knowledge graph, and finally a false news probability prediction is performed through the full connection layer and softmax function.
It realizes the fine comparison and aggregation of news content and knowledge base entity information, improves the accuracy and effectiveness of fake news detection, and can more effectively identify complex and vague entity references.
Smart Images

Figure CN119537609A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of natural language processing technology and automatic text authenticity verification, and specifically relates to a fake news identification method combining knowledge graph and attention mechanism. Background Art
[0002] Automatic fake news detection is an important branch of natural language processing research. It is of great significance and has broad application prospects for maintaining the authenticity of information and safeguarding the health of social public opinion. Traditional fake news detection methods mainly rely on the semantic features and contextual information of text content, but because they ignore the deep knowledge hierarchical relationship between news entities, such methods have limited recognition accuracy when facing complex and ambiguous entity references. In addition, although existing deep learning models have made significant progress in text understanding, they do not fully mobilize the support of external knowledge bases when processing news content, especially the entity relationships and background knowledge contained in the knowledge graph.
[0003] With the popularization of deep learning technology, the field of natural language processing has gradually begun to apply it to fake news detection. At the beginning, the academic community generally used the Transformer large model to extract text features from the text content of the article, so as to detect fake news; then the variational auto encoder VAE (Variational Auto Encoder) was used to self-encode text information to obtain the embedded representation of the news text, and the obtained news vector was subjected to multi-task learning, which improved the effect of the detection model. Then, based on the content style, it was found that fake news publishers usually have malicious intentions to spread distorted and misleading information and influence the masses. Therefore, a specific writing style is needed to attract and persuade a wide range of people, which is not seen in real news. Therefore, it is necessary to let machines learn to identify the writing style of fake news and enhance the recognition ability through adversarial learning. Then, there are also studies that use the user's posting history to identify the user's credibility, and at the same time detect the user's interaction index, and use the two for comprehensive judgment to jointly detect fake news. In 2018, Dr. Jing Ma of the Chinese University of Hong Kong modeled the rumor propagation process as a tree structure based on news dissemination behavior. This work constructed a bottom-up propagation tree and a top-down propagation tree, and used recursive neural networks to model the nodes in the tree to classify fake news. Later, some scholars proposed a concise and effective multi-domain fake news detection model, which improves the effect of fake news detection by using information such as user votes and comments on social media as a reference for collective wisdom, thereby using the feedback of user collective knowledge to construct a corresponding knowledge base.
[0004] Despite this, many existing technologies still have certain limitations. They usually process text fragments independently, ignoring the changes in the meaning of words in context and the complex semantic associations that may exist between two text fragments. They also fail to fully utilize the entity knowledge in the knowledge graph and the relationship network between entities to guide the identification process of fake news. Summary of the invention
[0005] In order to solve the problems existing in the above prior art, the present invention proposes a fake news identification method combining knowledge graph and attention mechanism, which is characterized by comprising the following steps: obtaining news data in real time and preprocessing the news data; inputting the preprocessed data into a trained fake news detection model to obtain the probability that the news is fake, and outputting the judgment result of the news being true or false according to the probability; the fake news detection model includes a knowledge graph entity comparison module and a multi-head attention mechanism module;
[0006] The process of training a fake news detection model involves:
[0007] S1: Obtain the original news data set, divide the original news data set into a training set and a test set; preprocess the data in the training set;
[0008] S2: Extract sentences, topics, and entities from the preprocessed data and input them into the Transformer encoder to generate embedded representation data for each sentence, topic, and entity in the news content;
[0009] S3: Design sentence-topic attention and sentence-entity attention mechanisms to calculate the semantic similarity between news sentences and topics and entities, respectively, so as to generate sentence-topic embedding vectors and sentence-entity embedding vectors of news;
[0010] S4: Extract entities and their entity context information from the knowledge graph, and use the gating mechanism to obtain entity embedding data based on the knowledge graph;
[0011] S5: Perform weighted aggregation on the knowledge graph-based entity embedding data obtained in S4 and the embedding data obtained in S3.
[0012] S6: Use the Relu nonlinear activation function to calculate the fake news probability score of the aggregated features; set the initial value of the number of iterations;
[0013] S7: Use cross entropy loss function to train the model;
[0014] S8: The Adam algorithm is used to optimize the model, that is, to adjust the parameters in the Transformer encoder and attention mechanism modules during training;
[0015] S9: Determine whether the number of iterations reaches the maximum number of iterations. If so, the training of the fake news detection model is completed. Otherwise, return to step S7 and increase the number of iterations by 1.
[0016] This fake news detection method based on knowledge graph and attention mechanism processes data in the following steps:
[0017] Extract entities from the text and obtain entity sequences:
[0018] E={e1,e2,··,e m}
[0019] Among them, E represents the set of entities, e i represents the segmented entity, and m is the number of entities.
[0020] Use LDA to mine latent topics from all sentences:
[0021] T={t1,t2,··,t k}
[0022] Where T represents the set of topics, t i represents the extracted topics, and k is the number of topics.
[0023] And divide the news into a set of sentences:
[0024] S={s1,s2,··,s n}
[0025] Among them, S represents the set of sentences, s i represents the divided sentences, and n is the number of sentences.
[0026] Furthermore, the extracted sentences, topics, and entities are encoded into text:
[0027] The calculation process of sentence content representation p is as follows:
[0028] Step 1: From the given sentence set S = {s1,s2,··,s n}, each sentence s i From the sentence embedding matrix M∈R V*d Projected to a fixed-length sentence embedding s′ i where V is the length of the sentence and d is the embedding dimension. Then, we get the sentence vector set S′={s′1,s′2,··,s′ n}, where S′∈R n*d .
[0029] Step 2: Use positional encoding combined with sentence embedding:
[0030] ut =w′ t +pos t
[0031] Among them, pos t is the position code of the t-th sentence in the sentence. The present invention sets u=u0,··,u n ∈R n*d Represented as the input encoding at the bottom of the Transformer encoder.
[0032] Step 3: Use a single-layer Transformer encoder to process the input encoding u:
[0033]
[0034] Among them, MultiHeadAttention(u) represents the multi-head attention mechanism, and the input u is first converted by the sub-layer of the multi-head self-attention mechanism The representation layer is normalized, and the output is a; FeedForwardNetwork(a) means that the output a is sent to the point-by-point feedforward neural network layer, and the result is Representation layer normalization, that is, the output of the feedforward network It is added to the vector a after the multi-head self-attention mechanism and normalization processing; finally, the sentence representation p is constructed.
[0035] The calculation process of the topic representation q′ is similar to the above steps 1, 2, and 3, except that the input is replaced by the topic set T = {t1, t2, ··, t k}.
[0036] The calculation process of the entity representation r′ is similar to the above steps 1, 2, and 3. The only difference is that the input is replaced by the entity set E = {e1, e2, ··, e m}.
[0037] Furthermore, the extracted sentence representation p, topic representation q′, and entity r′ are subjected to multi-layer attention perception:
[0038] The multi-head attention-based attention network designed by the present invention allows the model to consider information in different representation subspaces at different positions. The formula for calculating attention is as follows:
[0039]
[0040] MultiHead(Q,K,V)=Concat(Attn1,...,Attn H )
[0041] Where Q, K, and V are query, key, and value matrices, respectively. k is the dimension of the query and key matrix, where Concat(Attn1,...,Attn H ) represents the concatenation of each self-attention matrix, and H is the number of attention heads.
[0042] The present invention designs a part of the news content embedding representation as sentence-topic attention to measure the importance of each topic to the sentence content. In the sentence-topic attention mechanism, the corresponding query result is obtained through the sentence representation p and the key and value from the topic encoding q′. By calculating the semantic similarity between the sentence and its corresponding topic, each entity is assigned a weight α i To express its importance:
[0043] Q=W Q p
[0044] K=W K q′
[0045] V=W v Q′
[0046]
[0047] Where q is the subject representation, W Q , W K and W v is a parameter matrix, and α represents the attention distribution.
[0048] In addition, in order to consider the relative importance of entities, the present invention proposes a sentence-entity attention mechanism to measure the importance of each entity based on the relationship between the sentence and its entities. In the sentence-entity attention mechanism, the query comes from the sentence representation p, the key comes from the topic encoding q′, and the value comes from the entity encoding r′. By calculating the semantic similarity between the sentence and its corresponding entity, a weight β is assigned to each entity context according to the importance of the corresponding entity. i :
[0049] Q=W Q p
[0050] K=W K q′
[0051] V=W v r′
[0052]
[0053] In summary, we obtain the sentence content representation p, sentence-topic representation q, and sentence-entity representation r.
[0054] Furthermore, the knowledge graph embedding method is used to obtain structured entity embedding.
[0055] The present invention uses TransE to learn entity representation from triples of knowledge graphs. s ∈R M , and use LSTM to extract the entity sequence E = {e1, e2, ··, e m} is encoded to get the text embedding e d ∈R M .
[0056] At the same time, a learnable gating function is used to integrate the obtained structure embedding e s and text embedding d :
[0057] e KB =g e ⊙e s +(1-g e )⊙e d
[0058] where g e ∈R M is a gating vector used to weigh the information from the two embeddings, its value is in the interval [0,1], ⊙ represents element multiplication; the gating vector g e Indicates e s and e d Each dimension of is added by different weights. In addition, in order to constrain the value of the gate vector to be within the interval [0,1], the present invention uses the Sigmoid function to calculate the gate vector g e :
[0059]
[0060] in is a real-valued vector and is learned during training.
[0061] After fusing these two types of embeddings with the gating function, the present invention obtains the final knowledge graph-based entity embedding e KB ∈R M , the embedding encodes the structure of triples and textual information from entity descriptions in the knowledge graph.
[0062] Finally, all the embedded representations obtained above are connected to obtain the final representation z of the news.
[0063] The final representation z of the news can be obtained by concatenating the sentence content representation p, the sentence-topic representation q, the sentence-entity representation r and the entity embedding e KB To obtain.
[0064] After that, z is sent to a fully connected layer, and the softmax function is used to predict the distribution P of news labels on the target:
[0065] P = softmax(W o z+b o )
[0066] The training is performed to minimize the cross entropy loss function using the following formula:
[0067]
[0068] Where D represents the entire training corpus, c i represents the true label of news i, P i (c i ) represents the probability of the true label, Θ represents the parameters of the model, and λ is the coefficient of the L2 regularizer.
[0069] By combining knowledge graphs and attention mechanisms, the present invention solves the problem that previous methods only focus on the surface meaning of the text, and realizes the detailed comparison and aggregation of news content and knowledge base entity information; finally, based on the entity comparison results, the model derives a predicted score for the authenticity of the news, thereby accurately screening out potential false news reports. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 It is the overall flow chart of the present invention;
[0071] Figure 2 is a flow chart of the training process of the present invention;
[0072] Figure 3 This is a model structure diagram of the present invention. DETAILED DESCRIPTION
[0073] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0074] A fake news detection method based on knowledge graph and attention mechanism, such as Figure 1The method comprises: firstly extracting data from the target news text, identifying key entities and linking them to the knowledge graph, and obtaining an entity embedding vector based on the knowledge graph through a gating mechanism; then, taking the sentences, topics and entities in the target text as input vectors, and extracting their high-order knowledge representations using a Transformer encoder; then, obtaining a deeper text embedding through a multi-head attention mechanism, including sentence-entity and sentence-topic embedding representations; finally, comparing all the obtained high-level knowledge representations and inputting them into the model together to predict the authenticity score of the news, thereby effectively identifying potential false news reports.
[0075] like Figure 2 As mentioned above, the process of training a fake news detection model includes:
[0076] S1: Obtain the original news data set, divide the original news data set into a training set and a test set; preprocess the data in the training set;
[0077] S2: Extract sentences, topics, and entities from the preprocessed data and input them into the Transformer encoder to generate embedded representation data for each sentence, topic, and entity in the news content;
[0078] S3: Design sentence-topic attention and sentence-entity attention mechanisms to calculate the semantic similarity between news sentences and topics and entities, respectively, so as to generate sentence-topic embedding vectors and sentence-entity embedding vectors of news;
[0079] S4: Extract entities and their entity context information from the knowledge graph, and use the gating mechanism to obtain entity embedding data based on the knowledge graph;
[0080] S5: Perform weighted aggregation on the knowledge graph-based entity embedding data obtained in S4 and the embedding data obtained in S3.
[0081] S6: Use the Relu nonlinear activation function to calculate the fake news probability score of the aggregated features; set the initial value of the number of iterations;
[0082] S7: Use cross entropy loss function to train the model;
[0083] S8: The Adam algorithm is used to optimize the model, that is, to adjust the parameters in the Transformer encoder and attention mechanism modules during training;
[0084] S9: Determine whether the number of iterations reaches the maximum number of iterations. If so, the training of the fake news detection model is completed. Otherwise, return to step S7 and increase the number of iterations by 1.
[0085] The LUN dataset is used as the fake news dataset, which contains a total of 74,476 news documents. The dataset is divided into three parts, including 48,998 data in the training set, 21,188 data in the test set, and 4,290 data in the validation set.
[0086] like Figure 3 As shown, the process of processing data includes:
[0087] Extract entities from the text and obtain entity sequences:
[0088] E={e1,e2,··,e m}
[0089] Among them, E represents the set of entities, e i represents the segmented entity, and m is the number of entities.
[0090] Use LDA to mine latent topics from all sentences:
[0091] T={t1,t2,··,t k}
[0092] Where T represents the set of topics, t i represents the extracted topics, and k is the number of topics.
[0093] And divide the news into a set of sentences:
[0094] S={s1,s2,··,s n}
[0095] Among them, S represents the set of sentences, s i represents the divided sentences, and n is the number of sentences.
[0096] The extracted sentences, topics, and entities are text-encoded using the Transformer encoder, aiming to form sentence content representation p, topic representation q′, and entity representation r′.
[0097] The calculation process of sentence content representation p is as follows:
[0098] Step 1: From the given sentence set S = {s1,s2,··,s n}, each sentence s i From the sentence embedding matrix M∈R V*d Projected to a fixed-length sentence embedding s′ i where V is the length of the sentence and d is the embedding dimension. Then, we get the sentence vector set S′={s′1,s′2,··,s′ n}, where S′∈R n*d. Step 2: Use positional encoding combined with sentence embedding:
[0099] u t =w′ t +pos t
[0100] Among them, pos t is the position code of the t-th sentence in the sentence. The present invention sets u=u0,··,u n ∈R n*d Represented as the input encoding at the bottom of the Transformer encoder.
[0101] Step 3: Use a single-layer Transformer encoder to process the input encoding u:
[0102]
[0103] Among them, MultiHeadAttention(u) represents the multi-head attention mechanism, and the input u is first converted by the sub-layer of the multi-head self-attention mechanism The representation layer is normalized, and the output is a; FeedForwardNetwork(a) means that the output a is sent to the point-by-point feedforward neural network layer, and the result is Representation layer normalization, that is, the output of the feedforward network It is added to the vector a after the multi-head self-attention mechanism and normalization processing; finally, the sentence representation p is constructed.
[0104] The calculation process of the topic representation q′ is similar to the above steps 1, 2, and 3, except that the input is replaced by the topic set T = {t1, t2, ··, t k}.
[0105] The calculation process of the entity representation r′ is similar to the above steps 1, 2, and 3. The only difference is that the input is replaced by the entity set E = {e1, e2, ··, e m}.
[0106] Furthermore, the extracted sentences, topics, and entities are subjected to multi-layer attention perception, and part of the news content embedding representation is designed as sentence-topic attention to measure the importance of each topic to the sentence content. In the sentence-topic attention mechanism, the corresponding query result is obtained through the sentence representation p and the key and value from the topic encoding q′. By calculating the semantic similarity between the sentence and its corresponding topic, each entity is assigned a weight α i To express its importance:
[0107] Q=W Q p
[0108] K=W K q′
[0109] V=W v Q′
[0110]
[0111] Where q is the subject representation, W Q , W K and W v is a parameter matrix, and α represents the attention distribution.
[0112] In addition, in order to consider the relative importance of entities, the present invention proposes a sentence-entity attention mechanism to measure the importance of each entity based on the relationship between the sentence and its entities. In the sentence-entity attention mechanism, the query comes from the sentence representation p, the key comes from the topic encoding q′, and the value comes from the entity encoding r′. By calculating the semantic similarity between the sentence and its corresponding entity, a weight β is assigned to each entity context according to the importance of the corresponding entity. i :
[0113] Q=W Q p
[0114] K=W K q′
[0115] V=W v r′
[0116]
[0117] In summary, we obtain the sentence content representation p, sentence-topic representation q, and sentence-entity representation r.
[0118] TransE learns entity representations from triplets in knowledge graphs s ∈R M , and use LSTM to extract the entity sequence E = {e1, e2, ··, e m} is encoded to get the text embedding e d ∈R M .
[0119] At the same time, a learnable gating function is used to integrate the obtained structure embedding e s and text embedding d :
[0120] e KB =g e ⊙e s +(1-g e )⊙e d
[0121] where g e ∈R M is a gating vector used to weigh the information from the two embeddings, its value is in the interval [0,1], ⊙ represents element multiplication; the gating vector g e Indicates e s and e d Each dimension of is added by different weights. In addition, in order to constrain the value of the gate vector to be within the interval [0,1], the present invention uses the Sigmoid function to calculate the gate vector g e :
[0122]
[0123] in is a real-valued vector and is learned during training.
[0124] After fusing these two types of embeddings with the gating function, the present invention obtains the final knowledge graph-based entity embedding e KB ∈R M , the embedding encodes the structure of triples and textual information from entity descriptions in the knowledge graph.
[0125] The final representation z of the news can be obtained by concatenating the sentence content representation p, the sentence-topic representation q, the sentence-entity representation r and the entity embedding e KB To obtain.
[0126] After that, z is sent to a fully connected layer and the softmax function is used to predict the distribution P of news labels on the target:
[0127] P = softmax(W o z+b o )
[0128] The training is performed to minimize the cross entropy loss function using the following formula:
[0129]
[0130] Where D represents the entire training corpus, c i represents the true label of news i, P i (c i ) represents the probability of the true label, Θ represents the parameters of the model, and λ is the coefficient of the L2 regularizer.
[0131] The above embodiments further illustrate the purpose, technical solutions and advantages of the present invention in detail. It should be understood that the above embodiments are only preferred implementation modes of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made to the present invention within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A fake news detection method based on knowledge graph and attention mechanism, characterized in that: The method comprises the following steps: obtaining news data in real time and preprocessing the news data; inputting the preprocessed data into a trained fake news detection model to obtain the probability that the news is fake, and outputting the judgment result of whether the news is true or false according to the probability; The fake news detection model includes a knowledge graph entity comparison module, a multi-head attention mechanism module and a comparison aggregation layer; The process of training a fake news detection model involves: S1: Obtain the original news data set, divide the original news data set into a training set and a test set; preprocess the data in the training set; S2: Extract sentences, topics, and entities from the preprocessed data and input them into the Transformer encoder to generate embedded representation data for each sentence, topic, and entity in the news content; S3: Design sentence-topic attention and sentence-entity attention mechanisms to calculate the semantic similarity between news sentences and topics and entities, respectively, so as to generate sentence-topic embedding vectors and sentence-entity embedding vectors of news; S4: Extract entities and their entity context information from the knowledge graph, and use the gating mechanism to obtain entity embedding data based on the knowledge graph; S5: Perform weighted aggregation on the knowledge graph-based entity embedding data obtained in S4 and the embedding data obtained in S3. S6: Use the Relu nonlinear activation function to calculate the fake news probability score of the aggregated features; set the initial value of the number of iterations; S7: Use cross entropy loss function to train the model; S8: The Adam algorithm is used to optimize the model, that is, to adjust the parameters in the Transformer encoder and attention mechanism modules during training; S9: Determine whether the number of iterations reaches the maximum number of iterations. If so, the training of the fake news detection model is completed. Otherwise, return to step S7 and increase the number of iterations by 1.
2. According to claim 1, a method for detecting fake news based on knowledge graph and attention mechanism is characterized in that: The process of processing the data includes: Extract entities from the text and obtain entity sequences: E={e1,e2,··,e m } Among them, E represents the set of entities, e i represents the segmented entity, and m is the number of entities. Use LDA to mine latent topics from all sentences: T={t1,t2,··,t k } Where T represents the set of topics, t i represents the extracted topics, and k is the number of topics. And divide the news into a set of sentences: S={s1,s2,··,s n } Among them, S represents the set of sentences, s i represents the divided sentences, and n is the number of sentences.
3. According to claim 1, a method for detecting fake news based on knowledge graph and attention mechanism is characterized in that: The extracted sentences, topics, and entities are text-encoded using the Transformer encoder, aiming to form sentence content representation p, topic representation q′, and entity representation r′. The calculation process of sentence content representation p is as follows: Step 1: From the given sentence set S = {s1, s2, ··, s n }, each sentence s i From the sentence embedding matrix M∈R V*d Projected to a fixed-length sentence embedding s′ i where V is the length of the sentence and d is the embedding dimension. Then, we get the sentence vector set S′={s′1, s′2, ··, s′ n }, where S′∈R n*d . Step 2: Use positional encoding combined with sentence embedding: u t =w′ t +pos t Among them, pos t is the position code of the t-th sentence in the sentence. The present invention sets u=u0, ··, u n ∈R n*d Represented as the input encoding at the bottom of the Transformer encoder. Step 3: Use a single-layer Transformer encoder to process the input encoding u: Among them, MultiHeadAttention(u) represents the multi-head attention mechanism, and the input u is first converted by the sub-layer of the multi-head self-attention mechanism The representation layer is normalized, and the output is a; FeedForwardNetwork(a) means that the output a is sent to the point-by-point feedforward neural network layer, and the result is Representation layer normalization, that is, the output of the feedforward network It is added to the vector a after the multi-head self-attention mechanism and normalization processing; finally, the sentence representation p is constructed. The calculation process of the topic representation q′ is similar to the above steps 1, 2, and 3, except that the input is replaced by the topic set T = {t1, t2, ··, t k }. The calculation process of the entity representation r′ is similar to the above steps 1, 2, and 3. The only difference is that the input is replaced by the entity set E = {e1, e2, ··, e m }.
4. According to claim 1, a method for detecting fake news based on knowledge graph and attention mechanism is characterized in that: Perform multi-layer attention perception on the extracted sentences, topics, and entities: The multi-head attention network designed by the present invention allows the model to consider information of different representation subspaces at different positions. The formula for calculating attention is as follows: MultiHead(Q,K,V)=Concat(Attn1,……,Attn H ) Where Q, K, and V are query, key, and value matrices, respectively. k is the dimension of the query and key matrix, where Concat(Attn1,...,Attn H ) represents the concatenation of each self-attention matrix, and H is the number of attention heads. The present invention designs a part of the news content embedding representation as sentence-topic attention to measure the importance of each topic to the sentence content. In the sentence-topic attention mechanism, the corresponding query result is obtained through the sentence representation p and the key and value from the topic encoding q′. By calculating the semantic similarity between the sentence and its corresponding topic, each entity is assigned a weight α i To express its importance: Q=W Q p K=W K q′ V=W v q′ Where q is the subject representation, W Q , W K and W v is a parameter matrix, and α represents the attention distribution. In addition, in order to consider the relative importance of entities, the present invention proposes a sentence-entity attention mechanism to measure the importance of each entity based on the relationship between the sentence and its entities. In the sentence-entity attention mechanism, the query comes from the sentence representation p, the key comes from the topic encoding q′, and the value comes from the entity encoding r′. By calculating the semantic similarity between the sentence and its corresponding entity, a weight β is assigned to each entity context according to the importance of the corresponding entity. i : Q=W Q p K=W K q′ V=W v r′ In summary, we obtain the sentence content representation p, sentence-topic representation q, and sentence-entity representation r.
5. According to claim 1, a method for detecting fake news based on knowledge graph and attention mechanism is characterized in that: The entity representation is embedded into the structure of knowledge, that is, the knowledge graph embedding method is used to obtain structured entity embedding. The present invention uses TransE to learn entity representation from triples of knowledge graphs. s ∈R M , and use LSTM to extract the entity sequence E = {e1, e2, ··, e m } is encoded to get the text embedding e d ∈R M . At the same time, a learnable gating function is used to integrate the obtained structure embedding e s and text embedding d : yes KB =g e ⊙e s +(1-g e )⊙e d where g e ∈R M is a gating vector used to weigh the information from the two embeddings, its value is in the interval [0, 1], ⊙ represents element multiplication; the gating vector g e Indicates e s and e d Each dimension of is added by different weights. In addition, in order to constrain the value of the gate vector to be within the interval [0, 1], the present invention uses the Sigmoid function to calculate the gate vector g e : in is a real-valued vector and is learned during training. After fusing these two types of embeddings with the gating function, the present invention obtains the final knowledge graph-based entity embedding e KB ∈R M , the embedding encodes the structure of triples and textual information from entity descriptions in the knowledge graph.
6. The method for detecting fake news based on knowledge graph and attention mechanism according to claim 1, characterized in that: Connect all the embedding representations obtained above to get the final representation z of the news. The final representation z of the news can be obtained by concatenating the sentence content representation p, the sentence-topic representation q, the sentence-entity representation r and the entity embedding e KB To obtain. After that, z is sent to a fully connected layer and the softmax function is used to predict the distribution P of news labels on the target: P=softmax(W o z+b o ) The training is performed to minimize the cross entropy loss function using the following formula: Where D represents the entire training corpus, c i represents the true label of news i, P i (c i ) represents the probability of the true label, Θ represents the parameters of the model, and λ is the coefficient of the L2 regularizer.
Citation Information
Patent Citations
Knowledge graph guided false news detection method
CN111061843A
False news detection method based on knowledge perception attention network
CN112328859A
Relation extraction method based on prompt learning and external knowledge embedding
CN117725999A
Method for identifying named entities by fusing local context information and utilizing label semantics
CN117852540A
Event detection method and apparatus based on multi-layer graph attention network
WO2023050470A1
Cited By
Method for enhancing large language model by knowledge graph during testing
CN120492637A
A method for testing a knowledge graph enhanced large language model
CN120492637B