Text detection method and device based on artificial intelligence, equipment and storage medium
By constructing a topological graph of news texts and using the Transformer model to learn the contextual relationships of text sequences, the problem of low accuracy in fake news detection of existing models is solved, and more efficient fake news detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-09
- Publication Date
- 2026-04-07
AI Technical Summary
Existing sequence-to-sequence language models based on traditional BERT and fake news detection models based on graph neural networks have low detection accuracy in fake news detection and cannot effectively utilize the contextual semantic information and structural information of the text.
A topological graph of news texts is constructed, and a graph vector representation is generated by performing layer regularization, attention weight matrix processing, graph topology learning, and node updating through a language model based on the Transformer structure. Finally, a news detection model is trained.
It improves the accuracy of fake news detection, and can quickly and accurately output the prediction results of the news text to be processed, effectively improving the model's accuracy in fake news detection.
Smart Images

Figure CN117011874B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of artificial intelligence development technology and financial technology, and in particular to artificial intelligence-based text detection methods, devices, computer equipment and storage media. Background Technology
[0002] Fintech companies, such as insurance companies and banks, often have a need for fake news detection. The goal of fake news detection is to identify inaccurate news information from a large volume of news documents. By designing effective fake news detection methods, companies can quickly and accurately detect false news targeting them from the internet, enabling them to promptly develop appropriate countermeasures to minimize the financial damage caused by misinformation online.
[0003] Currently, the industry mainly uses two methods to detect fake news: method (1) based on traditional sequence-to-sequence language models such as BERT; and method (2) based on graph neural networks for fake news detection. However, these two existing technologies still have the following drawbacks: method (1) treats each word in a sentence independently, lacking consideration of the structural information of the text (such as syntactic structure, contextual structure, etc.), thus reducing the detection accuracy of the model in real-world environments. Method (2), although considering the structural information of the text, uses the local aggregation strategy of traditional graph neural networks, which means that this type of method can only characterize the semantic information between two words that are close in distance in the text, and cannot model the semantic information of long sequences of words in the text, causing the model to overfit or overcompress, thus reducing the accuracy of this type of method. Summary of the Invention
[0004] The purpose of this application is to propose a text detection method, apparatus, computer device, and storage medium based on artificial intelligence, in order to solve the technical problem that existing methods for detecting fake news, such as traditional sequence-to-sequence language models like BERT and fake information detection models based on graph neural networks, have low detection accuracy.
[0005] To address the aforementioned technical problems, this application provides an artificial intelligence-based text detection method, employing the following technical solution:
[0006] Obtain the news text and construct a topology graph corresponding to the news text;
[0007] The feature vectors of the nodes in the topology graph are subjected to layer regularization processing by the first regularization layer in the preset language model to obtain the corresponding first feature vector, and a first attention weight matrix corresponding to the first feature vector is generated by the attention layer in the language model; wherein, the language model is a model based on the Transformer structure.
[0008] The first attention weight matrix is processed by the graph topology learning layer within the language model to output the corresponding second attention weight matrix;
[0009] The second attention weight matrix is updated by the node update module within the language model to obtain the corresponding target node vector representation.
[0010] Generate a graph vector representation corresponding to the target node vector representation;
[0011] The language model is trained using the graph vector representation to obtain a trained news detection model;
[0012] The news detection model is used to predict the news text to be processed and outputs the prediction result corresponding to the news text to be processed.
[0013] Furthermore, the step of constructing the topology graph corresponding to the news text specifically includes:
[0014] The news text is processed by graph construction based on a preset sliding window mechanism to generate a corresponding topological structure graph.
[0015] Based on a preset model, vector representations corresponding to each word contained in the news text are generated;
[0016] A topology graph corresponding to the news text is generated based on the vector representation and the topology graph.
[0017] Furthermore, the step of processing the first attention weight matrix through the graph topology learning layer within the language model and outputting the corresponding second attention weight matrix specifically includes:
[0018] Obtain the preset adjacency matrix information and shortest path matrix information;
[0019] A matrix generation formula is constructed based on the adjacency matrix information and the shortest path matrix information;
[0020] The first attention weight matrix is processed using the matrix generation formula through the graph topology learning layer within the language model to obtain the corresponding second attention weight matrix.
[0021] Furthermore, the step of updating the second attention weight matrix through the node update module within the language model to obtain the corresponding target node vector representation specifically includes:
[0022] Obtain the preset nonlinear activation function and the vector update method corresponding to the node update module;
[0023] The second attention weight matrix is processed by the nonlinear activation function to obtain the corresponding first node vector representation;
[0024] The first node vector representation is updated based on the vector update method to obtain the corresponding second node vector representation.
[0025] The second node vector representation is used as the target node vector representation.
[0026] Furthermore, the step of updating the first node vector representation based on the vector update method to obtain the corresponding second node vector representation specifically includes:
[0027] The first node vector representation is processed by the second regularization layer within the language model to obtain the corresponding third node vector representation;
[0028] The third node vector representation is processed by the feedforward neural network in the language model to obtain the corresponding fourth node vector representation;
[0029] Obtain the residual information of the first node vector;
[0030] The second node vector representation is generated based on the fourth node vector representation and the residual information.
[0031] Furthermore, the step of generating the graph vector representation corresponding to the target node vector representation specifically includes:
[0032] Get the preset average pooling function;
[0033] The target node vector is pooled based on the average pooling function to obtain the corresponding vector data.
[0034] The vector data is used as the graph vector representation.
[0035] Furthermore, the step of training the language model using the graph vector representation to obtain a trained news detection model specifically includes:
[0036] The graph vector representation is non-linearly transformed by the fully connected layer within the language model to obtain the corresponding target graph vector representation.
[0037] The target graph vector representation is predicted by the softmax layer in the language model to obtain the corresponding predicted label.
[0038] Obtain the real tags of the news text corresponding to the target graph vector;
[0039] Calculate the cross-entropy loss based on the predicted label and the true label;
[0040] The language model is trained based on the cross-entropy loss to obtain a trained language model;
[0041] The trained language model is used as the news detection model.
[0042] To address the aforementioned technical problems, this application also provides an artificial intelligence-based text detection device, which employs the following technical solution:
[0043] The acquisition module is used to acquire news text and construct a topology graph corresponding to the news text;
[0044] The first processing module is used to perform layer regularization processing on the feature vectors of the nodes contained in the topology graph through a first regularization layer in a preset language model to obtain the corresponding first feature vector, and to generate a first attention weight matrix corresponding to the first feature vector through the attention layer in the language model; wherein, the language model is a model based on the Transformer structure.
[0045] The second processing module is used to process the first attention weight matrix through the graph topology learning layer in the language model and output the corresponding second attention weight matrix.
[0046] The third processing module is used to perform node update processing on the second attention weight matrix through the node update module in the language model to obtain the corresponding target node vector representation.
[0047] The generation module is used to generate a graph vector representation corresponding to the target node vector representation;
[0048] The training module is used to train the language model using the graph vector representation to obtain a trained news detection model.
[0049] The prediction module is used to predict the news text to be processed using the news detection model and output the prediction result corresponding to the news text to be processed.
[0050] To address the aforementioned technical problems, this application also provides a computer device that employs the following technical solution:
[0051] Obtain the news text and construct a topology graph corresponding to the news text;
[0052] The feature vectors of the nodes in the topology graph are subjected to layer regularization processing by the first regularization layer in the preset language model to obtain the corresponding first feature vector, and a first attention weight matrix corresponding to the first feature vector is generated by the attention layer in the language model; wherein, the language model is a model based on the Transformer structure.
[0053] The first attention weight matrix is processed by the graph topology learning layer within the language model to output the corresponding second attention weight matrix;
[0054] The second attention weight matrix is updated by the node update module within the language model to obtain the corresponding target node vector representation.
[0055] Generate a graph vector representation corresponding to the target node vector representation;
[0056] The language model is trained using the graph vector representation to obtain a trained news detection model;
[0057] The news detection model is used to predict the news text to be processed and outputs the prediction result corresponding to the news text to be processed.
[0058] To address the aforementioned technical problems, this application also provides a computer-readable storage medium, employing the technical solution described below:
[0059] Obtain the news text and construct a topology graph corresponding to the news text;
[0060] The feature vectors of the nodes in the topology graph are subjected to layer regularization processing by the first regularization layer in the preset language model to obtain the corresponding first feature vector, and a first attention weight matrix corresponding to the first feature vector is generated by the attention layer in the language model; wherein, the language model is a model based on the Transformer structure.
[0061] The first attention weight matrix is processed by the graph topology learning layer within the language model to output the corresponding second attention weight matrix;
[0062] The second attention weight matrix is updated by the node update module within the language model to obtain the corresponding target node vector representation.
[0063] Generate a graph vector representation corresponding to the target node vector representation;
[0064] The language model is trained using the graph vector representation to obtain a trained news detection model;
[0065] The news detection model is used to predict the news text to be processed and outputs the prediction result corresponding to the news text to be processed.
[0066] Compared with the prior art, the embodiments of this application have the following main advantages:
[0067] This application first acquires news text and constructs a topology graph corresponding to the news text. Then, it performs layer regularization processing on the feature vectors of the nodes contained in the topology graph through a first regularization layer in a preset language model to obtain the corresponding first feature vector. A first attention weight matrix corresponding to the first feature vector is then generated through an attention layer in the language model. Next, the first attention weight matrix is processed through a graph topology learning layer in the language model to output a corresponding second attention weight matrix. Subsequently, the second attention weight matrix is updated through a node update module in the language model to obtain the corresponding target node vector representation. A graph vector representation corresponding to the target node vector representation is further generated. Finally, the language model is trained using the graph vector representation to obtain a trained news detection model. The news detection model then predicts the news text to be processed and outputs a prediction result corresponding to the news text. After acquiring the news text, this application first models the text as a graph structure, and then uses a Transformer model to learn the contextual relationships of the text sequence, thereby learning the semantic information of long word sequences in the text. Meanwhile, a graph topology learning module is introduced into the traditional Transformer model, enabling the model to learn semantic structure information in the text. This solves the problem that existing methods struggle to simultaneously utilize both contextual semantic information and textual structural information. Subsequently, the trained news detection model is used to predict the news text being processed, quickly and accurately outputting the prediction result corresponding to the news text, effectively improving the accuracy of the news detection model in detecting fake news. Attached Figure Description
[0068] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0069] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;
[0070] Figure 2 A flowchart of an embodiment of the AI-based text detection method according to this application;
[0071] Figure 3 This is a schematic diagram of the structure of an embodiment of the AI-based text detection device according to this application;
[0072] Figure 4 This is a schematic diagram of the structure of one embodiment of the computer device according to this application. Detailed Implementation
[0073] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0074] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0075] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0076] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0077] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.
[0078] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.
[0079] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.
[0080] It should be noted that the AI-based text detection method provided in this application is generally executed by a server / terminal device, and correspondingly, the AI-based text detection device is generally installed in the server / terminal device.
[0081] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0082] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0083] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0084] Continue to refer to Figure 2This document illustrates a flowchart of an embodiment of the AI-based text detection method according to this application. The order of steps in the flowchart can be changed, and some steps can be omitted, depending on different requirements. The AI-based text detection method provided in this application can be applied to any scenario requiring fake news detection, and thus can be applied to products in these scenarios, such as fake news detection in the financial and insurance fields. The AI-based text detection method includes the following steps:
[0085] Step S201: Obtain the news text and construct a topology graph corresponding to the news text.
[0086] In this embodiment, the AI-based text detection method runs on an electronic device (e.g., Figure 1 The server / terminal device shown can acquire news text via wired or wireless connection. It should be noted that the aforementioned wireless connection methods may include, but are not limited to, 3G / 4G / 5G connections, WiFi connections, Bluetooth connections, WiMAX connections, Zigbee connections, UWB (ultra-wideband) connections, and other currently known or future-developed wireless connection methods. In financial application scenarios, the aforementioned news text may refer to news text from financial companies, such as insurance companies or banks, obtained from the internet. The specific implementation process of constructing the topology corresponding to the news text will be further described in detail in subsequent specific embodiments of this application, and will not be elaborated upon here.
[0087] Step S202: The feature vectors of the nodes contained in the topology graph are subjected to layer regularization processing through the first regularization layer in the preset language model to obtain the corresponding first feature vector, and the first attention weight matrix corresponding to the first feature vector is generated through the attention layer in the language model.
[0088] In this embodiment, the language model is a Transformer-based model. The data layers within the language model involved in S202-S204 can be collectively referred to as encoder layers. Specifically, this application requires stacking 8 encoder layers, i.e., executing S202, S203, and S204 8 times. This step aims to learn the attention weights between any two nodes in the topology graph. Specifically, the topology graph is subjected to layer normalization using the first regularization layer within the language model, as shown in formula (1): H l =LN(H l (1); where LN(H) l ) indicates that for H lLayer regularization is performed. Subsequently, the learning process of generating the attention weights corresponding to the first attention weight matrix corresponding to the first feature vector through the attention layer in the language model is as shown in formulas (2) and (3): Q = H l W Q K = H l W K V = H l WV(2); (3); where H l Let X be the input to the self-attention layer in the l-th encoder. For the topology graph Gi, let X be the initial input in the l-th encoder. i That is, let H 0 =X i W Q W K and W V For H l Three different learnable transformation matrices are used to generate the query matrix Q, the key matrix K, and the value matrix V. K Let A be the dimension of the node features after attention transformation. Let A be the attention weight matrix between nodes. The element value A in the i-th row and j-th column of A is... ij This represents the attention weight between the two corresponding nodes in the row and column.
[0089] Step S203: The first attention weight matrix is processed by the graph topology learning layer in the language model to output the corresponding second attention weight matrix.
[0090] In this embodiment, the specific implementation process of processing the first attention weight matrix through the graph topology learning layer in the language model to output the corresponding second attention weight matrix will be further described in detail in subsequent specific embodiments of this application, and will not be elaborated on here.
[0091] Step S204: The second attention weight matrix is updated by the node update module in the language model to obtain the corresponding target node vector representation.
[0092] In this embodiment, the specific implementation process of updating the second attention weight matrix through the node update module in the language model to obtain the corresponding target node vector representation will be further described in detail in subsequent specific embodiments of this application, and will not be elaborated on here.
[0093] Step S205: Generate a graph vector representation corresponding to the target node vector representation.
[0094] In this embodiment, the specific implementation process of generating the graph vector representation corresponding to the target node vector representation will be further described in detail in subsequent specific embodiments of this application, and will not be elaborated on here.
[0095] Step S206: Train the language model using the graph vector representation to obtain a trained news detection model.
[0096] In this embodiment, the specific implementation process of training the language model using the graph vector representation to obtain the trained news detection model will be further described in detail in subsequent specific embodiments of this application, and will not be elaborated on here.
[0097] Step S207: The news detection model is used to predict the news text to be processed, and the prediction result corresponding to the news text to be processed is output.
[0098] In this embodiment, the news text to be processed is input into a news detection model to predict its label (i.e., the prediction result, including whether it is real news or fake news). Specifically, the news text to be processed is input into a pre-trained news detection model, which outputs the label of the news text. in w represents the number of news texts to be processed. Label 0 represents real news, and label 1 represents fake news. By applying the text detection method proposed in this application to detect fake news in fintech companies, such as insurance companies and banks, an effective technical means can be provided for companies to quickly detect false news about them on the Internet, and the accuracy of fake news detection can be significantly improved.
[0099] The most common semantic structural features of text include syntactic structural features. For example, sentences typically contain parts of speech such as nouns, verbs, and adjectives, and these parts of speech in text exhibit a well-organized structure. Therefore, modeling this latent textual structural information is crucial for improving the accuracy of models in fake news detection tasks. Furthermore, the semantic information of long sequences of words in text refers to the information between two words that are geographically distant. Currently, existing graph neural network-based methods can only model the semantic relationship between two closely spaced words, failing to capture the semantic information between two distant nodes (for example, in a sentence, the subject noun and the object noun are often far apart, but they have a strong semantic relationship), thus failing to characterize the long sequence semantic information of the text.
[0100] This application first acquires news text and constructs a topology graph corresponding to the news text. Then, it performs layer regularization processing on the feature vectors of the nodes contained in the topology graph through a first regularization layer within a preset language model to obtain the corresponding first feature vector. A first attention weight matrix corresponding to the first feature vector is then generated through an attention layer within the language model. Next, the first attention weight matrix is processed through a graph topology learning layer within the language model to output a corresponding second attention weight matrix. Subsequently, the second attention weight matrix is updated through a node update module within the language model to obtain the corresponding target node vector representation. A graph vector representation corresponding to the target node vector representation is further generated. Finally, the language model is trained using the graph vector representation to obtain a trained news detection model. The news detection model then predicts the news text to be processed and outputs a prediction result corresponding to the news text. After acquiring the news text, this application first models the text as a graph structure and then uses a Transformer model to learn the contextual relationships of the text sequence, thereby learning the semantic information of long word sequences in the text. Meanwhile, a graph topology learning module is introduced into the traditional Transformer model, enabling the model to learn semantic structure information in the text. This solves the problem that existing methods struggle to simultaneously utilize both contextual semantic information and textual structural information. Subsequently, the trained news detection model is used to predict the news text being processed, quickly and accurately outputting the prediction result corresponding to the news text, effectively improving the accuracy of the news detection model in detecting fake news.
[0101] In some alternative implementations, step S201 includes the following steps:
[0102] The news text is processed using a preset sliding window mechanism to generate a corresponding topological structure graph.
[0103] In this embodiment, a topology graph can be established using an existing sliding window mechanism. Specifically, for each news text, each word in the news text is considered a node, and edges are established between every pair of nodes located within the same sliding window. The size of the sliding window is set to 3. Based on this, a separate topology graph based on semantic information can be established for each news text.
[0104] Vector representations corresponding to each word in the news text are generated based on a preset model.
[0105] In this embodiment, the aforementioned preset model can specifically be the BERT model. By inputting the news text into the BERT model, the BERT model generates vector representations corresponding to each word contained in the news text, and uses these as the feature vectors for each node.
[0106] A topology graph corresponding to the news text is generated based on the vector representation and the topology graph.
[0107] In this embodiment, after obtaining the vector representations of each word in the news text, these are used as the feature vectors of each node in the topology graph. Based on this, a topology graph can be constructed for each news text, and the semantic information of the text can be represented by the topology graph. Specifically, for news text D = {d1, d2, ..., dp}, a topology graph Gi = {Vi, Ei, Xi} is built for each news text di. Vi is the set of nodes in graph Gi, and Ei is the set of edges in graph Gi. Xi is the feature matrix of graph Gi, where each row represents the feature vector of a node in graph Gi. Words in the news text are considered as nodes, and a sliding window mechanism is used to establish edges between nodes (words). Specifically, the sliding window size can be set to 3, and edges can be established between every pair of nodes within the window. For the construction of the feature matrix Xi, the initial feature vector representation of each node (i.e., each row in Xi) can be obtained by inputting the news text di into the BERT model. Furthermore, the network topology can also be constructed from the adjacency matrix A. adj Let A represent this, where each element in its matrix takes the value 0 or 1. If A adj An element in the array takes a value of 1, which means there is an edge connecting the nodes in the row and column containing that element. If A adj If an element in the array has a value of 0, then the opposite applies.
[0108] This application performs graph construction processing on the news text using a preset sliding window mechanism to generate a corresponding topology graph. Then, it generates vector representations corresponding to each word in the news text based on a preset model. Subsequently, it generates a topology graph corresponding to the news text based on these vector representations and the topology graph. This application, by processing the news text using a sliding window mechanism and a preset model, can quickly generate a topology graph corresponding to the news text, thus improving the efficiency of topology graph generation.
[0109] In some optional implementations of this embodiment, step S203 includes the following steps:
[0110] Obtain the preset adjacency matrix information and shortest path matrix information.
[0111] In this embodiment, the adjacency matrix A of the topology graph adjThe adjacency matrix and the shortest path matrix S represent structural information at different levels of the graph. This application introduces both adjacency matrix information and shortest path matrix information as bias terms and models them into the attention weight matrix to construct the corresponding matrix generation formula.
[0112] A matrix generation formula is constructed based on the adjacency matrix information and the shortest path matrix information.
[0113] In this embodiment, the matrix generation formula includes: A = A + A adj W A +SW S , where S is the shortest path matrix, and each element represents the shortest path between two corresponding nodes. W A and W S These represent the learnable weight matrices. Based on this, since the adjacency matrix A of the graph... adj The shortest path matrix S represents the structural information at different levels of the graph, so the final attention weight matrix A effectively characterizes the structural information of the topological graph, i.e., the semantic structural information of the text. Based on the unified modeling of S202 and S203, this application is able to simultaneously model the semantic relationship between any two nodes and the semantic structural information of the text, solving the problem that existing methods are unable to simultaneously capture the semantic information of long sequences of words and complex semantic structures in the text.
[0114] The first attention weight matrix is processed using the matrix generation formula through the graph topology learning layer within the language model to obtain the corresponding second attention weight matrix.
[0115] This application obtains preset adjacency matrix information and shortest path matrix information; then, it constructs a matrix generation formula based on the adjacency matrix information and shortest path matrix information; subsequently, through the graph topology learning layer within the language model, it processes the first attention weight matrix using the matrix generation formula to obtain the corresponding second attention weight matrix. This application, by using the graph topology learning layer within the language model and utilizing the matrix generation formula constructed based on the adjacency matrix information and shortest path matrix information to process the first attention weight matrix, can quickly and accurately construct the required second attention weight matrix. By simultaneously introducing adjacency matrix and shortest path matrix information, this application enables the language model to effectively characterize the network's structural information, in addition to depicting the long-sequence semantic information of the text, and effectively outputs node vector representations that consider both long-sequence and structural information.
[0116] In some alternative implementations, step S204 includes the following steps:
[0117] Obtain the preset nonlinear activation function and the vector update method corresponding to the node update module.
[0118] In this embodiment, the aforementioned nonlinear activation function includes: H tem l =softmax(A)V+H l-1 , where softmax() represents the nonlinear activation function. V is the value matrix obtained from formula (2) above. H l-1 This is the input to the (l-1)th layer encoder (the language model in this application has a total of 8 layers). H tem l This is the updated node vector representation.
[0119] The second attention weight matrix is processed by the nonlinear activation function to obtain the corresponding first node vector representation.
[0120] In this embodiment, the corresponding first node vector representation can be obtained by substituting the second attention weight matrix into the nonlinear activation function for calculation.
[0121] The vector representation of the first node is updated based on the vector update method to obtain the corresponding vector representation of the second node.
[0122] In this embodiment, the specific implementation process of updating the first node vector representation based on the vector update method to obtain the corresponding second node vector representation will be further described in detail in subsequent specific embodiments of this application, and will not be elaborated on here.
[0123] The second node vector representation is used as the target node vector representation.
[0124] This application obtains a preset nonlinear activation function and a vector update method corresponding to the node update module; then, it processes the second attention weight matrix using the nonlinear activation function to obtain a corresponding first node vector representation; subsequently, it updates the first node vector representation based on the vector update method to obtain a corresponding second node vector representation, and uses the second node vector representation as the target node vector representation. This application, by processing the second attention weights using a nonlinear activation function and a vector update method, can quickly generate the required target node vector representation, improving the generation efficiency and accuracy of the target node vector representation.
[0125] In some optional implementations, updating the first node vector representation based on the vector update method to obtain the corresponding second node vector representation includes the following steps:
[0126] The first node vector representation is processed by the second regularization layer within the language model to obtain the corresponding third node vector representation.
[0127] In this embodiment, the obtained node vector can be represented as H tem l The input is further fed into a layer normalization layer (LN) within the language model, then into a feed-forward neural network (FFN) within the language model, and finally, residual information is added to output the final node vector representation, as shown in formula H. l =FFN(LN(H tem l ))+H tem l As shown.
[0128] The third node vector representation is processed by the feedforward neural network within the language model to obtain the corresponding fourth node vector representation.
[0129] In this embodiment, the feedforward neural network refers to the aforementioned FFN (feed-forward blocks).
[0130] Obtain the residual information of the first node vector.
[0131] The second node vector representation is generated based on the fourth node vector representation and the residual information.
[0132] In this embodiment, the second node vector representation can be obtained by calculating the sum between the fourth node vector representation and the residual information.
[0133] This application processes the first node vector representation through a second regularization layer within the language model to obtain a corresponding third node vector representation; then, it processes the third node vector representation through a feedforward neural network within the language model to obtain a corresponding fourth node vector representation; subsequently, it obtains the residual information of the first node vector; and finally, it generates the second node vector representation based on the fourth node vector representation and the residual information. This application, by processing the second attention weights using a vector update method, can quickly generate the required second node vector representation, improving the generation efficiency and accuracy of the second node vector representation.
[0134] In some optional implementations of this embodiment, step S205 includes the following steps:
[0135] Get the preset average pooling function.
[0136] In this embodiment, after executing the encoder through 8 layers (i.e., steps S202-S204), the output of the last layer is set to H. l (At this point, l = 7). The above average pooling function is specifically h. Gi =MeanPooling(H l ), where h Gi This represents the vector representation of graph Gi. `MeanPooling()` represents the average pooling function.
[0137] The target node vector is pooled using the average pooling function to obtain the corresponding vector data.
[0138] The vector data is used as the graph vector representation.
[0139] This application obtains a preset average pooling function; then, based on the average pooling function, it performs pooling processing on the target node vector to obtain the corresponding vector data; subsequently, it uses the vector data as the graph vector representation. By using the average pooling function to pool the target node vector, this application can achieve fast and accurate output of the graph vector representation corresponding to the target node vector representation, improving the generation efficiency and accuracy of the graph vector representation.
[0140] In some optional implementations of this embodiment, step S206 includes the following steps:
[0141] The graph vector representation is nonlinearly transformed by the fully connected layer within the language model to obtain the corresponding target graph vector representation.
[0142] In this embodiment, the obtained graph vector is represented as h Gi The input is fed into a fully connected layer (MLP) within the language model for non-linear transformation.
[0143] The target graph vector representation is predicted by the softmax layer within the language model to obtain the corresponding predicted label.
[0144] In this embodiment, the softmax layer includes: Among them, W Y represents the learnable weight matrix, and b is the learnable bias vector. This represents the predicted label for graph Gi.
[0145] Obtain the real tags of the news text corresponding to the target graph vector.
[0146] The cross-entropy loss is calculated based on the predicted label and the true label.
[0147] In this embodiment, it can be achieved through the formula Calculate the cross-entropy loss between the predicted label and the true label. Where y Gi This is the true label for image Gi. Gi and Label 0 represents real news, and label 1 represents fake news.
[0148] The language model is trained based on the cross-entropy loss to obtain a trained language model.
[0149] In this embodiment, the language model can be trained by minimizing the cross-entropy loss. Specifically, iteration stops and model training is complete when the difference between the loss values of two iterations is less than m, or the number of iterations is greater than q. The values of m and q are not specifically limited and can be set according to actual training needs.
[0150] The trained language model is used as the news detection model.
[0151] This application performs a non-linear transformation on the graph vector representation using a fully connected layer within the language model to obtain the corresponding target graph vector representation. Then, a softmax layer within the language model is used to predict the target graph vector representation, yielding the corresponding predicted labels. Next, the ground truth labels of the news text corresponding to the target graph vector are obtained. Subsequently, a cross-entropy loss is calculated based on the predicted labels and the ground truth labels. Finally, the language model is trained based on the cross-entropy loss to obtain a trained language model, which is then used as the news detection model. This application improves the efficiency of news detection model construction by processing the graph vectors using fully connected and softmax layers within the language model to obtain predicted labels, calculating cross-entropy loss based on the predicted labels and the ground truth labels of the target graph vector, and then training the language model based on the cross-entropy loss.
[0152] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0153] It should be emphasized that, to further ensure the privacy and security of the above prediction results, the prediction results can also be stored in a blockchain node.
[0154] The blockchain referred to in this application is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0155] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0156] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0157] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware with computer-readable instructions. These computer-readable instructions can be stored in a computer-readable storage medium. When executed, the program can include the processes of the embodiments of the above methods. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0158] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0159] Further reference Figure 3 As a response to the above Figure 2 To implement the method shown, this application provides an embodiment of an artificial intelligence-based text detection device, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0160] like Figure 3 As shown, the AI-based text detection device 300 described in this embodiment includes: an acquisition module 301, a first processing module 302, a second processing module 303, a third processing module 304, a generation module 305, a training module 306, and a prediction module 307. Wherein:
[0161] The acquisition module 301 is used to acquire news text and construct a topology graph corresponding to the news text;
[0162] The first processing module 302 is used to perform layer regularization processing on the feature vectors of the nodes contained in the topology graph through a first regularization layer in a preset language model to obtain the corresponding first feature vector, and generate a first attention weight matrix corresponding to the first feature vector through the attention layer in the language model; wherein, the language model is a model based on the Transformer structure.
[0163] The second processing module 303 is used to process the first attention weight matrix through the graph topology learning layer in the language model and output the corresponding second attention weight matrix.
[0164] The third processing module 304 is used to perform node update processing on the second attention weight matrix through the node update module in the language model to obtain the corresponding target node vector representation.
[0165] The generation module 305 is used to generate a graph vector representation corresponding to the target node vector representation;
[0166] Training module 306 is used to train the language model using the graph vector representation to obtain a trained news detection model;
[0167] The prediction module 307 is used to predict the news text to be processed using the news detection model and output the prediction result corresponding to the news text to be processed.
[0168] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the artificial intelligence-based text detection method in the aforementioned embodiments, and will not be repeated here.
[0169] In some optional implementations of this embodiment, the acquisition module 301 includes:
[0170] The first processing submodule is used to perform graph construction processing on the news text based on a preset sliding window mechanism to generate a corresponding topological structure graph.
[0171] The first generation submodule is used to generate vector representations corresponding to each word contained in the news text based on a preset model;
[0172] The second generation submodule is used to generate a topology graph corresponding to the news text based on the vector representation and the topology graph.
[0173] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the artificial intelligence-based text detection method in the aforementioned embodiments, and will not be repeated here.
[0174] In some optional implementations of this embodiment, the second processing module 303 includes:
[0175] The first acquisition submodule is used to acquire preset adjacency matrix information and shortest path matrix information;
[0176] A submodule is constructed to build a matrix generation formula based on the adjacency matrix information and the shortest path matrix information;
[0177] The second processing submodule is used to process the first attention weight matrix using the matrix generation formula through the graph topology learning layer in the language model to obtain the corresponding second attention weight matrix.
[0178] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the artificial intelligence-based text detection method in the aforementioned implementation method, and will not be repeated here.
[0179] In some optional implementations of this embodiment, the third processing module 304 includes:
[0180] The second acquisition submodule is used to acquire a preset nonlinear activation function and a vector update method corresponding to the node update module;
[0181] The third processing submodule is used to process the second attention weight matrix through the nonlinear activation function to obtain the corresponding first node vector representation;
[0182] The fourth processing submodule is used to update the first node vector representation based on the vector update method to obtain the corresponding second node vector representation;
[0183] The first determining submodule is used to use the second node vector representation as the target node vector representation.
[0184] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the artificial intelligence-based text detection method in the aforementioned embodiments, and will not be repeated here.
[0185] In some optional implementations of this embodiment, the fourth processing submodule includes:
[0186] The first processing unit is used to process the first node vector representation through the second regularization layer in the language model to obtain the corresponding third node vector representation;
[0187] The second processing unit is used to process the third node vector representation through the feedforward neural network in the language model to obtain the corresponding fourth node vector representation;
[0188] The acquisition unit is used to acquire the residual information of the first node vector;
[0189] The processing unit is configured to generate the second node vector representation based on the fourth node vector representation and the residual information.
[0190] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the artificial intelligence-based text detection method in the aforementioned embodiments, and will not be repeated here.
[0191] In some optional implementations of this embodiment, the generation module 305 includes:
[0192] The third submodule is used to obtain the preset average pooling function;
[0193] The fifth processing submodule is used to perform pooling processing on the target node vector based on the average pooling function to obtain the corresponding vector data;
[0194] The second determining submodule is used to treat the vector data as the graph vector representation.
[0195] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the artificial intelligence-based text detection method in the aforementioned embodiments, and will not be repeated here.
[0196] In some optional implementations of this embodiment, the training module 306 includes:
[0197] The transformation submodule is used to perform a non-linear transformation on the graph vector representation through the fully connected layer in the language model to obtain the corresponding target graph vector representation.
[0198] The prediction submodule is used to perform prediction processing on the target graph vector representation through the softmax layer in the language model to obtain the corresponding predicted label;
[0199] The fourth acquisition submodule is used to acquire the real tags of the news text corresponding to the target graph vector;
[0200] The calculation submodule is used to calculate the cross-entropy loss based on the predicted label and the true label;
[0201] The training submodule is used to train the language model based on the cross-entropy loss to obtain a trained language model.
[0202] The third determining submodule is used to use the trained language model as the news detection model.
[0203] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the artificial intelligence-based text detection method in the aforementioned embodiments, and will not be repeated here.
[0204] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.
[0205] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected via a system bus. It should be noted that only the computer device 4 with components 41-43 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0206] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0207] The memory 41 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as the hard disk or memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 4. Of course, the memory 41 may also include both the internal storage unit and its external storage device of the computer device 4. In this embodiment, the memory 41 is typically used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions for text detection methods based on artificial intelligence. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or will be output.
[0208] In some embodiments, the processor 42 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to execute computer-readable instructions stored in the memory 41 or to process data, for example, to execute computer-readable instructions of the AI-based text detection method.
[0209] The network interface 43 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 4 and other electronic devices.
[0210] Compared with the prior art, the embodiments of this application have the following main advantages:
[0211] In this embodiment, after obtaining the news text, the application first models the text as a graph structure, and then uses a Transformer model to learn the contextual relationships of the text sequence, thereby learning the semantic information of long word sequences in the text. Simultaneously, a graph topology learning module is introduced into the traditional Transformer model, enabling the model to learn the semantic structure information in the text, solving the problem that existing methods struggle to simultaneously utilize both the contextual semantic information and the text structure information. Subsequently, the trained news detection model is used to predict the news text to be processed, quickly and accurately outputting the prediction result corresponding to the news text, effectively improving the accuracy of the news detection model in detecting fake news.
[0212] This application also provides another embodiment, namely, providing a computer-readable storage medium storing computer-readable instructions that can be executed by at least one processor to cause the at least one processor to perform the steps of the artificial intelligence-based text detection method described above.
[0213] Compared with the prior art, the embodiments of this application have the following main advantages:
[0214] In this embodiment, after obtaining the news text, the application first models the text as a graph structure, and then uses a Transformer model to learn the contextual relationships of the text sequence, thereby learning the semantic information of long word sequences in the text. Simultaneously, a graph topology learning module is introduced into the traditional Transformer model, enabling the model to learn the semantic structure information in the text, solving the problem that existing methods struggle to simultaneously utilize both the contextual semantic information and the text structure information. Subsequently, the trained news detection model is used to predict the news text to be processed, quickly and accurately outputting the prediction result corresponding to the news text, effectively improving the accuracy of the news detection model in detecting fake news.
[0215] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0216] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.
Claims
1. A text detection method based on artificial intelligence, characterized in that, Includes the following steps: Obtain the news text and construct a topology graph corresponding to the news text; The feature vectors of the nodes in the topology graph are subjected to layer regularization processing by the first regularization layer in the preset language model to obtain the corresponding first feature vector, and a first attention weight matrix corresponding to the first feature vector is generated by the attention layer in the language model; wherein, the language model is a model based on the Transformer structure. The first attention weight matrix is processed by the graph topology learning layer within the language model to output the corresponding second attention weight matrix; The second attention weight matrix is updated by the node update module within the language model to obtain the corresponding target node vector representation. Generate a graph vector representation corresponding to the target node vector representation; The language model is trained using the graph vector representation to obtain a trained news detection model; The news detection model is used to predict the news text to be processed, and the prediction result corresponding to the news text to be processed is output. The step of processing the first attention weight matrix through the graph topology learning layer within the language model and outputting the corresponding second attention weight matrix specifically includes: Obtain the preset adjacency matrix information and shortest path matrix information; A matrix generation formula is constructed based on the adjacency matrix information and the shortest path matrix information; The first attention weight matrix is processed using the matrix generation formula through the graph topology learning layer within the language model to obtain the corresponding second attention weight matrix.
2. The text detection method based on artificial intelligence according to claim 1, characterized in that, The step of constructing the topology graph corresponding to the news text specifically includes: The news text is processed by graph construction based on a preset sliding window mechanism to generate a corresponding topological structure graph. Based on a preset model, vector representations corresponding to each word contained in the news text are generated; A topology graph corresponding to the news text is generated based on the vector representation and the topology graph.
3. The text detection method based on artificial intelligence according to claim 1, characterized in that, The step of updating the second attention weight matrix through the node update module within the language model to obtain the corresponding target node vector representation specifically includes: Obtain the preset nonlinear activation function and the vector update method corresponding to the node update module; The second attention weight matrix is processed by the nonlinear activation function to obtain the corresponding first node vector representation; The first node vector representation is updated based on the vector update method to obtain the corresponding second node vector representation. The second node vector representation is used as the target node vector representation.
4. The text detection method based on artificial intelligence according to claim 3, characterized in that, The step of updating the first node vector representation based on the vector update method to obtain the corresponding second node vector representation specifically includes: The first node vector representation is processed by the second regularization layer within the language model to obtain the corresponding third node vector representation; The third node vector representation is processed by the feedforward neural network in the language model to obtain the corresponding fourth node vector representation; Obtain the residual information of the first node vector; The second node vector representation is generated based on the fourth node vector representation and the residual information.
5. The text detection method based on artificial intelligence according to claim 1, characterized in that, The step of generating the graph vector representation corresponding to the target node vector representation specifically includes: Get the preset average pooling function; The target node vector is pooled based on the average pooling function to obtain the corresponding vector data. The vector data is used as the graph vector representation.
6. The text detection method based on artificial intelligence according to claim 1, characterized in that, The step of training the language model using the graph vector representation to obtain a trained news detection model specifically includes: The graph vector representation is non-linearly transformed by the fully connected layer within the language model to obtain the corresponding target graph vector representation. The target graph vector representation is predicted by the softmax layer in the language model to obtain the corresponding predicted label. Obtain the real tags of the news text corresponding to the target graph vector; Calculate the cross-entropy loss based on the predicted label and the true label; The language model is trained based on the cross-entropy loss to obtain a trained language model; The trained language model is used as the news detection model.
7. A text detection device based on artificial intelligence, characterized in that, include: The acquisition module is used to acquire news text and construct a topology graph corresponding to the news text; The first processing module is used to perform layer regularization processing on the feature vectors of the nodes contained in the topology graph through a first regularization layer in a preset language model to obtain the corresponding first feature vector, and to generate a first attention weight matrix corresponding to the first feature vector through the attention layer in the language model; wherein, the language model is a model based on the Transformer structure. The second processing module is used to process the first attention weight matrix through the graph topology learning layer in the language model and output the corresponding second attention weight matrix. The third processing module is used to perform node update processing on the second attention weight matrix through the node update module in the language model to obtain the corresponding target node vector representation. The generation module is used to generate a graph vector representation corresponding to the target node vector representation; The training module is used to train the language model using the graph vector representation to obtain a trained news detection model. The prediction module is used to predict the news text to be processed using the news detection model and output the prediction result corresponding to the news text to be processed. The second processing module includes: The first acquisition submodule is used to acquire preset adjacency matrix information and shortest path matrix information; A submodule is constructed to build a matrix generation formula based on the adjacency matrix information and the shortest path matrix information; The second processing submodule is used to process the first attention weight matrix using the matrix generation formula through the graph topology learning layer in the language model to obtain the corresponding second attention weight matrix.
8. A computer device comprising a memory and a processor, the memory storing computer-readable instructions, wherein the processor, when executing the computer-readable instructions, implements the steps of the artificial intelligence-based text detection method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the artificial intelligence-based text detection method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
False news detection method and system based on entity identification and relation extraction
CN114969269A
False news identification method based on heterogeneous graph convolutional network
CN115438274A