Model training method and related equipment
Patent Information
- Application Number
- CN202280097659.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-30
- Publication Date
- 2025-02-25
AI Technical Summary
The existing technology cannot fully explain the degree of influence of edges between nodes in the graph on the node state, resulting in incomplete graph interpretation results.
By obtaining graph information, use neural networks to obtain feature representations of nodes and edges, and determine the degree of influence of nodes and edges through a weight update mechanism, and then construct a loss function to update the attention network and graph neural network to achieve node and edge an accurate representation of the extent of the impact.
A more complete graph interpretation result is obtained than the existing technology, which can accurately represent the degree of influence of nodes and edges, improving the accuracy of the network and the quality of interpretation.
Smart Images

Figure CN119522428A_ABST
Abstract
Description
A model training method and related equipment Technical Field
[0001] This application relates to the field of artificial intelligence, and in particular to a model training method and related equipment. Background Art
[0002] 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, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a branch of computer science that seeks to understand the essence of intelligence and develop new intelligent machines that can respond in a manner similar to human intelligence. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.
[0003] A graph is a data structure that includes at least one node and at least one edge. In some scenarios, the nodes in the graph can be mapped to objects (or entities), and the edges in the graph can be mapped to the relationships between entities. The graph can be a directed graph or an undirected graph. Of course, the graph can also include other data besides nodes and edges, such as node labels and edge labels. In an exemplary scenario, when applied to a friend recommendation scenario, each node in the graph can represent a user, and each edge in the graph can represent a social relationship between different users. The data of each node in the graph is the user's portrait data and the user's behavior data, such as the user's age, occupation, hobbies, education, etc. For another example, when applied to a product recommendation scenario, each node in the graph can represent a user or a product, and each edge in the graph can represent the interactive relationship between the user and the product, such as a purchase relationship, a collection relationship, etc. For another example, when applied to a financial risk control scenario, each node in the graph can represent an account, a transaction, or funds.
[0004] The graph interpreter is used to obtain the degree of influence of each node on the state of a certain node based on the graph information (such as node information and edge information). In existing implementations, graph interpretation is achieved through a perturbation-based interpretation method. The idea of this method is to input the graph information into a graph neural network (GNN) used to achieve the target task. The target task can be used to predict the state of a certain node. By perturbing the input graph information and observing the output of the GNN model, the effect of each node in the input graph information on the GNN model's prediction of the node state can be determined. This effect can be used as the degree of influence on the state of a certain node.
[0005] However, the above method can only obtain the degree of influence of a node on the state of a node, and the result of graph interpretation is incomplete (for example, the degree of influence of an edge between nodes on the state of a node cannot be obtained).
[0006] Summary of the Invention
[0007] This application provides a model training method that can obtain more complete graph interpretation results compared to existing technologies.
[0008] This application provides a model training method, which is applied to a cloud-side server or terminal device, and includes:
[0009] Obtaining graph information: A graph includes multiple nodes and edges between nodes. Graph information includes node information and edge information. Each node corresponds to an object. Node information includes object attributes, and edge information includes relationships between objects.
[0010] For example, the object corresponding to the node is a person, and the person's attributes can be at least one of gender, age, occupation, income, hobbies, and education level. Gender can be male or female, age can be a number between 0 and 100, occupation can be teacher, programmer, chef, etc., hobbies can be basketball, tennis, running, etc., and education level can be elementary school, junior high school, high school, college, etc. This application does not limit the specific types of object attributes. For example, the object corresponding to the node is an item, and the item can be a physical item or a virtual item, such as an application (APP), audio and video, web page, news information, etc. The item's attributes can be at least one of item name, developer, installation package size, category, and praise. For example, the item is an application, and the item's category can be chat, parkour games, office, etc., and the praise can be a score or comment on the item. This application does not limit the specific types of item attributes. For example, the object corresponding to the node is a person, and the relationship between objects can be kinship, economic relationship (such as equity relationship, trade relationship, etc.).
[0011] According to the information of the graph, a first feature representation of each node and a second feature representation of each edge are obtained; according to the first feature representation of each node, a first weight is obtained through a first neural network, and the first weight is the weight of the node; the first weight is used to fuse with the corresponding first feature representation to obtain a third feature representation; according to the second feature representation of each edge, a second weight is obtained through a second neural network, and the second weight is the weight of the edge; according to the third feature representation and the second weight, a first loss is obtained through a graph neural network GNN, and the first loss is used to determine the loss function; according to the loss function, the first attention network, the second attention network and the GNN are updated.
[0012] The first weight can be fused with the corresponding first feature representation, which is equivalent to applying a perturbation to the first feature representation. This is equivalent to the first neural network obtaining the magnitude of the perturbation based on the first feature representation. Since the input to the subsequent task network (e.g., GNN) is the feature after the perturbation (i.e., the third feature representation), as the model is updated, the perturbation will have a trend: for nodes with a greater impact on the accuracy of the network's task execution, their first weights will be assigned increasingly larger values (i.e., the perturbation will become increasingly smaller), while for nodes with a smaller impact on the accuracy of the network's task execution, their weights will be assigned increasingly smaller values (i.e., the perturbation will become increasingly larger). Thus, the first weight can characterize the degree of influence of the node. Similarly, the second weight can be input into the subsequent task network (e.g., GNN) as the weight applied to the edge by the task network when processing the information of the corresponding edge. For example, the task network will have parameters for setting the weight of each edge (usually, the weight of each edge is the same by default), and the parameters for setting the weight of each edge in the task network can be set to the corresponding second weight. Through the above method, it is equivalent to applying a disturbance to the second feature representation, which is equivalent to the role of the second neural network to obtain the size of the imposed disturbance according to the second feature representation. As the model is updated, the disturbance will have a trend: for the edge that has a greater impact on the accuracy of the network's task execution, its second weight will be assigned increasingly larger (that is, the interference will become smaller and smaller), and for the edge that has a smaller impact on the accuracy of the network's task execution, its second weight will be assigned increasingly smaller (that is, the interference will become increasingly larger), and then the second weight can characterize the degree of influence of the edge.
[0013] The first neural network and the second neural network trained in the above manner can be used as graph interpreters to determine the importance of each node and the relationship between nodes, which is equivalent to obtaining a more complete graph interpretation result compared to the existing technology.
[0014] In one possible implementation, the above-mentioned first weight can represent the degree of positive influence of the corresponding node on the GNN when performing the target task. However, in one implementation, when the first weight of the node is set to be larger, the processing accuracy of the network is higher, and when the first weight of the node is set to be smaller, the processing accuracy of the network is still high, or it decreases very little, then the degree of influence of the node is still very low. Therefore, only one dimension of weight (such as the degree of positive influence) cannot accurately characterize the actual degree of influence of the node. In an embodiment of the present application, the feedforward process of the parameter model is parameterized by weights of multiple dimensions to accurately characterize the actual degree of influence of the node.
[0015] In one possible implementation, a third weight can be obtained based on the first weight, where the third weight is the weight of the node, and the first weight indicates the degree of reverse influence of the corresponding node on the GNN when performing the target task; the third weight is used to fuse with the corresponding first feature representation to obtain a fourth feature representation; based on the fourth feature representation, a second loss is obtained through the graph neural network GNN, and the second loss is used to determine the loss function. For example, when the first weight is large and the third weight is small, the first loss can represent the accuracy of the corresponding model when the weight of the node is large, and the second loss can represent the accuracy of the corresponding model when the weight of the node is small. If the first weight of the node is set to be large, the processing accuracy of the network is high, and when the first weight of the node is set to be small, the processing accuracy of the network is still high, or decreases very little, then as the model is updated, the first weight will gradually become smaller, thereby more accurately describing the actual influence of the node and improving the accuracy of the network.
[0016] In a possible implementation, the first weight is expressed as a positive number less than 1, and the sum of the third weight and the corresponding first weight is 1. For example, the first weight is 0.9, and the third weight is 0.1.
[0017] In a possible implementation, the first weight may be referred to as a positive mask of the node, and the third weight may be referred to as a negative mask of the node.
[0018] Similarly, for edges, a loss function can also be constructed using the above-mentioned positive and negative mask method. For example, GNN is used to perform the target task, and the second weight indicates the positive influence of the corresponding edge on the GNN when performing the target task. Based on the second weight, a fourth weight can be obtained, and the fourth weight is the weight of the edge. The fourth weight indicates the negative influence of the corresponding edge on the GNN when performing the target task; based on the fourth weight, the third loss is obtained through the graph neural network GNN, and the third loss is used to determine the loss function.
[0019] In a possible implementation, the first weight is expressed as a positive number less than 1, and the sum of the fourth weight and the corresponding second weight is 1.
[0020] In a possible implementation, the embedded representation of each node and the node information may be fused (eg, concatenated to obtain a first feature representation), and the first feature representation may be used as the heterogeneous information of the node.
[0021] For each edge, the first feature representations of the nodes at both ends of the edge and the edge information itself can be fused to obtain the second feature representation of the edge (that is, the heterogeneous information of the edge).
[0022] In the above manner, in a heterogeneous graph containing different types of nodes, different types of nodes correspond to features of different dimensions, and the meanings of features of the same dimension may also be different. The edges in the heterogeneous graph also need to be represented differently due to their different types. For nodes: This embodiment can obtain features representing the heterogeneous information of nodes by fusing graph structure information (embedded representation of nodes) and original features (information of nodes). For edges: This embodiment can obtain features representing the heterogeneous information of edges by extracting the embedded representation of the head and tail nodes where the edge is located and the attributes of the edge itself (information of edges) for fusion representation. This thereby achieves accurate heterogeneous information representation of nodes and edges in the heterogeneous graph.
[0023] In a possible implementation, the first feature representation includes features of multiple dimensions, and the first weight includes a weight corresponding to the feature of each dimension; or,
[0024] The second feature representation includes features of multiple dimensions, and the second weight includes a weight corresponding to the feature of each dimension.
[0025] In one possible implementation, the first neural network or the second neural network is a neural network based on an attention mechanism.
[0026] In one possible implementation, the fusion includes:
[0027] Weighted.
[0028] In one possible implementation, the objects are people, different nodes correspond to different people, and edges indicate the kinship or economic relationship between people. GNN is used to predict whether at least one person has economic risks based on the information in the graph.
[0029] In a second aspect, an embodiment of the present application provides a data processing method, including:
[0030] Obtain graph information, which includes multiple nodes and edges between nodes. Graph information includes node information and edge information. Each node corresponds to an object. Node information includes object attributes, and edge information includes relationships between objects.
[0031] According to the information of the graph, the first feature representation of each node and the second feature representation of each edge are obtained;
[0032] According to the first feature representation of each node, a first weight is obtained through a first neural network, where the first weight is the weight of the node; the first weight is used to represent the importance of the corresponding node in the graph;
[0033] According to the second feature representation of each edge, a second weight is obtained through a second neural network, where the second weight is the weight of the edge; the second weight is used to represent the importance of the corresponding edge in the graph.
[0034] In one possible implementation, the first feature representation includes an embedding representation of a node obtained through a feature network and information about the corresponding node; or,
[0035] The second feature representation includes the first feature representations of the nodes at both ends of the edge and the corresponding edge information.
[0036] In a possible implementation, the first feature representation includes features of multiple dimensions, and the first weight includes a weight corresponding to the feature of each dimension; or,
[0037] The second feature representation includes features of multiple dimensions, and the second weight includes a weight corresponding to the feature of each dimension.
[0038] In one possible implementation, the first neural network or the second neural network is a neural network based on an attention mechanism.
[0039] In a third aspect, the present application provides a model training device, comprising:
[0040] An acquisition module is used to acquire graph information. The graph includes multiple nodes and edges between nodes. The graph information includes node information and edge information. Each node corresponds to an object. The node information includes the attributes of the object, and the edge information includes the relationship between objects.
[0041] A processing module, configured to obtain a first feature representation of each node and a second feature representation of each edge based on the information of the graph;
[0042] According to the first feature representation of each node, a first weight is obtained through a first neural network, where the first weight is the weight of the node; the first weight is used to be fused with the corresponding first feature representation to obtain a third feature representation;
[0043] Obtaining a second weight through a second neural network according to the second feature representation of each edge, where the second weight is the weight of the edge;
[0044] According to the third feature representation and the second weight, a first loss is obtained through the graph neural network GNN, and the first loss is used to determine the loss function;
[0045] The model update module is used to update the first attention network, the second attention network and the GNN according to the loss function.
[0046] The first neural network and the second neural network trained in the above manner can be used as graph interpreters to determine the importance of each node and the relationship between nodes, which is equivalent to obtaining a more complete graph interpretation result compared to the existing technology.
[0047] In one possible implementation, the GNN is used to perform a target task, the first weight indicates a positive influence of the corresponding node on the GNN in performing the target task, and the acquisition module is further used to:
[0048] According to the first weight, a third weight is obtained, where the third weight is the weight of the node, and the first weight indicates the degree of reverse influence of the corresponding node on the GNN when performing the target task; the third weight is used to fuse with the corresponding first feature representation to obtain a fourth feature representation;
[0049] The processing module is further used to: obtain a second loss through a graph neural network GNN according to the fourth feature representation, and the second loss is used to determine the loss function.
[0050] In a possible implementation, the first weight is expressed as a positive number less than 1, and the sum of the third weight and the corresponding first weight is 1.
[0051] In one possible implementation, the GNN is used to perform a target task, the second weight indicates a positive influence of the corresponding edge on the GNN in performing the target task, and the acquisition module is further used to:
[0052] According to the second weight, a fourth weight is obtained, where the fourth weight is the weight of the edge, and the fourth weight indicates the degree of reverse influence of the corresponding edge on the GNN when performing the target task;
[0053] The processing module is further used to: obtain a third loss through the graph neural network GNN according to the fourth weight, and the third loss is used to determine the loss function.
[0054] In a possible implementation, the first weight is expressed as a positive number less than 1, and the sum of the fourth weight and the corresponding second weight is 1.
[0055] In one possible implementation, the first feature representation includes an embedding representation of a node obtained through a feature network and information about the corresponding node; or,
[0056] The second feature representation includes the embedded representations of the nodes at both ends of the edge and the edge information.
[0057] In a possible implementation, the first feature representation includes features of multiple dimensions, and the first weight includes a weight corresponding to the feature of each dimension; or,
[0058] The second feature representation includes features of multiple dimensions, and the second weight includes a weight corresponding to the feature of each dimension.
[0059] In one possible implementation, the first neural network or the second neural network is a neural network based on an attention mechanism.
[0060] In one possible implementation, the fusion includes:
[0061] Weighted.
[0062] In one possible implementation, the objects are people, different nodes correspond to different people, and edges indicate the kinship or economic relationship between people. GNN is used to predict whether at least one person has economic risks based on the information in the graph.
[0063] In a fourth aspect, an embodiment of the present application provides a data processing method, including:
[0064] An acquisition module is used to acquire graph information, where the graph information includes multiple nodes and edges between nodes. The graph information includes node information and edge information. Each node corresponds to an object. The node information includes the attributes of the object, and the edge information includes the relationship between objects.
[0065] A processing module, configured to obtain a first feature representation of each node and a second feature representation of each edge based on the information of the graph;
[0066] According to the first feature representation of each node, a first weight is obtained through a first neural network, where the first weight is the weight of the node; the first weight is used to represent the importance of the corresponding node in the graph;
[0067] According to the second feature representation of each edge, a second weight is obtained through a second neural network, where the second weight is the weight of the edge; the second weight is used to represent the importance of the corresponding edge in the graph.
[0068] In one possible implementation, the first feature representation includes an embedding representation of a node obtained through a feature network and information about the corresponding node; or,
[0069] The second feature representation includes the first feature representations of the nodes at both ends of the edge and the corresponding edge information.
[0070] In a possible implementation, the first feature representation includes features of multiple dimensions, and the first weight includes a weight corresponding to the feature of each dimension; or,
[0071] The second feature representation includes features of multiple dimensions, and the second weight includes a weight corresponding to the feature of each dimension.
[0072] In one possible implementation, the first neural network or the second neural network is a neural network based on an attention mechanism.
[0073] In a fifth aspect, an embodiment of the present application provides a training device, which may include a memory, a processor, and a bus system, wherein the memory is used to store programs, and the processor is used to execute the programs in the memory to perform any optional method as described in the first aspect above.
[0074] In a fifth aspect, an embodiment of the present application provides an execution device, which may include a memory, a processor, and a bus system, wherein the memory is used to store programs, and the processor is used to execute the programs in the memory to execute any optional method as described in the second aspect above.
[0075] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the above-mentioned first aspect and any optional method, and the above-mentioned second aspect and any optional method.
[0076] In a seventh aspect, an embodiment of the present application provides a computer program product, comprising code, which, when executed, is used to implement the above-mentioned first aspect and any optional method, and the above-mentioned second aspect and any optional method.
[0077] In an eighth aspect, the present application provides a chip system comprising a processor for supporting an execution device or a training device in implementing the functions described in the aforementioned aspects, such as transmitting or processing data or information involved in the aforementioned methods. In one possible design, the chip system further comprises a memory for storing program instructions and data necessary for the execution device or the training device. The chip system may be comprised of a single chip or may include a chip and other discrete components. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] FIG1 is a schematic diagram of a system architecture provided in an embodiment of the present application;
[0079] FIG2 is a schematic diagram of a system architecture provided in an embodiment of the present application;
[0080] FIG3 is a schematic diagram of a system architecture provided in an embodiment of the present application;
[0081] FIG4 is a schematic diagram of a system architecture provided in an embodiment of the present application;
[0082] FIG5 is a schematic diagram of a system architecture provided in an embodiment of the present application;
[0083] FIG6 is a flow chart of a model training method provided in an embodiment of the present application;
[0084] Figure 7 is a schematic diagram of a loss function;
[0085] FIG8 is a schematic diagram of a process of a model training method;
[0086] FIG9 is a diagram showing the interpretation results of a graph structure;
[0087] FIG10 is a flow chart of a data processing method provided in an embodiment of the present application;
[0088] FIG11 is a schematic structural diagram of a model training device provided in an embodiment of the present application;
[0089] FIG12 is a schematic structural diagram of a data processing device provided in an embodiment of the present application;
[0090] FIG13 is a schematic diagram of an execution device provided in an embodiment of the present application;
[0091] FIG14 is a schematic diagram of a training device provided in an embodiment of the present application;
[0092] FIG15 is a schematic diagram of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0093] The following describes the embodiments of the present invention in conjunction with the accompanying drawings. The terms used in the embodiments of the present invention are only used to explain the specific embodiments of the present invention, and are not intended to limit the present invention.
[0094] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0095] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, and this is merely a way of distinguishing the objects of the same attributes when describing them in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0096] First, we will introduce the application scenarios of this application. This application can be applied to, but is not limited to, circuit design applications or cloud services provided by cloud-side servers. The following will introduce them separately:
[0097] 1. Graphics Interpretation Applications
[0098] The product form of the embodiment of the present application can be a diagram interpretation application. The diagram interpretation application can be run on a terminal device or a cloud-side server.
[0099] In one possible implementation, a graph interpretation application can generate the importance of nodes and the degree of association between nodes based on the input graph information (including node information and edge information). In an embodiment of the present application, the node information can be the attribute information of the object and the relationship between objects. There can be multiple types of attribute information. Taking the object as a person as an example, it can specifically include but not be limited to gender, age, occupation, hobbies, etc. The object can also be an item, such as an application (APP). For example, the object features extracted from the training sample of the APP market can be the name (logo), type, size, etc. of the APP; and the object features mentioned in the training sample of the e-commerce APP can be the name of the product, the category it belongs to, the price range, etc.; the relationship between objects can be kinship, economic relationship (such as equity relationship, trade relationship, etc.).
[0100] Next, the diagram interpretation application in the embodiment of this application will be introduced from the perspective of functional architecture and product architecture that implements the functions.
[0101] Referring to FIG. 1 , FIG. 1 is a diagram illustrating the functional architecture of an application program according to an embodiment of the present application:
[0102] In one possible implementation, an embodiment of the present application includes a system (e.g., a graph interpretation application) capable of generating the importance of nodes and the degree of association between nodes based on input graph information, wherein different parameter values input to the system can result in different graph interpretations being generated. As shown in FIG1 , a graph interpretation application 102 can receive input parameters 101 and generate a graph interpretation result 103. The graph interpretation application 102 can be executed on (for example) at least one computer system and includes computer code that, when executed by one or more computers, causes the computers to execute methods for performing graph interpretation-related operations.
[0103] In one possible implementation, the diagram interpretation design software may run on a terminal device on the end side or on a server on the cloud side.
[0104] For example, the terminal device may be installed with graphic interpretation design software, and actions including data input, data processing, and data output may be executed by the terminal device.
[0105] For example, the terminal device can be installed with a client of graphic interpretation design software, and the actions including data input and data output can be performed by the terminal device. That is to say, the terminal device can transmit the data required for data processing to the server on the cloud side. After the server on the cloud side completes the data processing action, it can return the data processing result to the terminal device on the end side, and the terminal device will output based on the processing result.
[0106] Next, the physical architecture for running circuit design applications in an embodiment of the present application is introduced.
[0107] Referring to FIG. 2 , FIG. 2 is a schematic diagram of the physical architecture for running a circuit design application in an embodiment of the present application:
[0108] Referring to Figure 2, a schematic diagram of a system architecture is shown. The system may include a terminal 100 and a server 200. The server 200 may include one or more servers (one server is used as an example in Figure 2), and the server 200 may provide a diagram interpretation service for one or more terminals.
[0109] Among them, the terminal 100 can be installed with a graphic explanation design application, or open a web page related to graphic explanation design. The above application and web page can provide a graphic explanation design interface. The terminal 100 can receive relevant parameters entered by the user on the graphic explanation design interface and send the above parameters to the server 200. The server 200 can obtain processing results based on the received parameters and return the processing results to the terminal 100.
[0110] It should be understood that in some optional implementations, the terminal 100 can also complete the action of obtaining the graph interpretation result based on the received parameters by itself without the need for cooperation from the server, and the embodiments of the present application are not limited thereto.
[0111] Next, the product form of the terminal 100 in FIG2 is described;
[0112] The terminal 100 in the embodiment of the present application can be a mobile phone, a tablet computer, a wearable device, an in-vehicle device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., and the embodiment of the present application does not impose any restrictions on this.
[0113] FIG3 shows a schematic diagram of an optional hardware structure of the terminal 100 .
[0114] 3 , the terminal 100 may include components such as a radio frequency unit 110, a memory 120, an input unit 130, a display unit 140, a camera 150 (optional), an audio circuit 160 (optional), a speaker 161 (optional), a microphone 162 (optional), a processor 170, an external interface 180, and a power supply 190. Those skilled in the art will appreciate that FIG3 is merely an example of a terminal or multi-function device and does not limit the terminal or multi-function device. The terminal or multi-function device may include more or fewer components than shown, or may combine certain components or have different components.
[0115] The input unit 130 can be used to receive input digital or character information and generate key signal input related to user settings and function control of the portable multifunction device. Specifically, the input unit 130 may include a touch screen 131 (optional) and / or other input devices 132. The touch screen 131 can detect user touch operations on or near it (for example, operations performed on or near the touch screen using a finger, joint, stylus, or any other suitable object) and drive corresponding connected devices according to pre-set programs. The touch screen can detect user touch actions on the touch screen, convert the touch actions into touch signals and transmit them to the processor 170. It can also receive and execute commands sent by the processor 170; the touch signals include at least touch point coordinate information. The touch screen 131 provides an input interface and an output interface between the terminal 100 and the user. Touch screens can be implemented using various types, including resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch screen 131, the input unit 130 may also include other input devices. Specifically, the other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control button 132 , a switch button 133 , etc.), a trackball, a mouse, a joystick, and the like.
[0116] The input device 132 may receive parameters related to the diagram interpretation, such as diagram information in the embodiment of the present application, and the like.
[0117] The display unit 140 may be used to display information input by or provided to the user, various menus of the terminal 100, interactive interfaces, file display, and / or playback of any multimedia file. In an embodiment of the present application, the display unit 140 may be used to display the interface of a graphic interpretation design application, a schematic diagram of graphic interpretation results, and the like.
[0118] Memory 120 can be used to store instructions and data. It primarily includes an instruction storage area and a data storage area. The data storage area can store various data, such as multimedia files and text. The instruction storage area can store software units such as the operating system, applications, and instructions required for at least one function, or subsets or extensions thereof. It may also include non-volatile random access memory (RAM). It provides processor 170 with management functions for the hardware, software, and data resources within the computing and processing device, supporting control software and applications. It is also used to store multimedia files and running programs and applications.
[0119] The processor 170 is the control center of the terminal 100. It connects all components of the terminal 100 using various interfaces and circuits. By executing instructions stored in the memory 120 and accessing data stored therein, it executes various functions of the terminal 100 and processes data, thereby providing overall control of the terminal device. Optionally, the processor 170 may include one or more processing units. Preferably, the processor 170 may integrate an application processor and a modem processor, with the application processor primarily processing the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into the processor 170. In some embodiments, the processor and memory may be implemented on a single chip; in other embodiments, they may be implemented on separate chips. The processor 170 may also generate corresponding operational control signals and send them to the corresponding components of the computing and processing device. It may also read and process data in the software, particularly the data and programs in the memory 120, to enable the various functional modules therein to perform their corresponding functions, thereby controlling the corresponding components to operate as instructed.
[0120] Among them, the memory 120 can be used to store software codes related to the image interpretation method, the processor 170 can execute the steps of the chip's image interpretation method, and can also schedule other units (such as the above-mentioned input unit 130 and display unit 140) to implement corresponding functions.
[0121] The RF unit 110 (optional) can be used to send and receive information or receive and send signals during a call. For example, after receiving downlink information from the base station, it is passed to the processor 170 for processing; in addition, it sends the designed uplink data to the base station. Generally, the RF circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF unit 110 can also communicate with network devices and other devices via wireless communication. This wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.
[0122] In the embodiment of the present application, the radio frequency unit 110 may send parameters such as image information to the server 200 and receive an image interpretation result sent by the server 200.
[0123] It should be understood that the radio frequency unit 110 is optional and can be replaced by other communication interfaces, such as a network port.
[0124] The terminal 100 also includes a power supply 190 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 170 through a power management system, thereby managing functions such as charging, discharging, and power consumption through the power management system.
[0125] The terminal 100 further includes an external interface 180 , which may be a standard Micro USB interface or a multi-pin connector, and may be used to connect the terminal 100 to other devices for communication, or to connect a charger to charge the terminal 100 .
[0126] Although not shown, the terminal 100 may also include a flash, a wireless fidelity (WiFi) module, a Bluetooth module, sensors with different functions, etc., which are not described in detail here. Some or all of the methods described below may be applied to the terminal 100 shown in FIG3 .
[0127] Next, the product form of the server 200 in FIG4 is described;
[0128] FIG4 is a schematic diagram of the structure of a server 200. As shown in FIG4, the server 200 includes a bus 201, a processor 202, a communication interface 203, and a memory 204. The processor 202, the memory 204, and the communication interface 203 communicate with each other via the bus 201.
[0129] Bus 201 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. Buses can be classified as address buses, data buses, control buses, etc. For ease of illustration, FIG4 shows only one thick line, but this does not mean that there is only one bus or only one type of bus.
[0130] The processor 202 may be any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0131] The memory 204 may include volatile memory, such as random access memory (RAM). The memory 204 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard drive (HDD), or solid state drive (SSD).
[0132] The memory 204 may be used to store software codes related to the graph interpretation method, and the processor 202 may execute the steps of the graph interpretation method of the chip, and may also schedule other units to implement corresponding functions.
[0133] It should be understood that the above-mentioned terminal 100 and server 200 can be centralized or distributed devices, and the processors in the above-mentioned terminal 100 and server 200 (such as processor 170 and processor 202) can be hardware circuits (such as application specific integrated circuit (ASIC), field-programmable gate array (FPGA), general-purpose processor, digital signal processor (DSP), microprocessor or microcontroller, etc.), or a combination of these hardware circuits. For example, the processor can be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.
[0134] It should be understood that the graph interpretation method in the embodiments of the present application involves AI-related operations. When performing AI operations, the instruction execution architecture of the terminal device and server is not limited to the processor-memory architecture shown in Figures 3 and 4. The system architecture provided in the embodiments of the present application is described in detail below with reference to Figure 5.
[0135] FIG5 is a schematic diagram of the system architecture provided by an embodiment of the present application. As shown in FIG5 , the system architecture 500 includes an execution device 510 , a training device 520 , a database 530 , a client device 540 , a data storage system 550 , and a data acquisition system 560 .
[0136] The execution device 510 includes a calculation module 511, an I / O interface 512, a pre-processing module 513, and a post-processing module 514. The calculation module 511 may include the target model / rule 501, and the pre-processing module 513 and the post-processing module 514 are optional.
[0137] The execution device 510 may be a terminal device or a server that runs the aforementioned circuit design application.
[0138] Data collection device 560 is used to collect training samples. Training samples can include attribute information of objects and relationships between objects. Attribute information can be diverse. For example, for people, this information can include, but is not limited to, gender, age, occupation, and hobbies. Objects can also be items, such as applications (APPs). For example, object features extracted from training samples in the APP market can include the APP's name (identifier), type, and size. Object features extracted from training samples in e-commerce apps can include the product's name, category, and price range. Relationships between objects can include kinship or economic relationships (e.g., equity or trade relationships). Label features are used to indicate whether a sample is a positive or negative example, such as whether a person poses an economic risk. After collecting training samples, data collection device 560 stores them in database 530.
[0139] The training device 520 can train the neural network to be trained (such as the first neural network, the second neural network, and the graph neural network in the embodiment of the present application, etc.) based on the training samples maintained in the database 530 to obtain the target model / rule 501.
[0140] It should be noted that, in actual applications, the training samples maintained in the database 530 may not all be collected by the data acquisition device 560, but may also be received from other devices. It should also be noted that the training device 520 may not train the target model / rule 501 entirely based on the training samples maintained in the database 530, but may also obtain training samples from the cloud or other places for model training. The above description should not be used as a limitation on the embodiments of the present application.
[0141] The target model / rule 501 obtained through training with the training device 520 can be applied to different systems or devices, such as the execution device 510 shown in FIG5 . The execution device 510 can be a terminal, such as a mobile phone terminal, a tablet computer, a laptop computer, an augmented reality (AR) / virtual reality (VR) device, an in-vehicle terminal, etc., or a server, etc.
[0142] Specifically, the training device 520 may transfer the trained model to the execution device 510 .
[0143] In Figure 5, the execution device 510 is configured with an input / output (I / O) interface 512 for data interaction with external devices. The user can input data (such as the information of the figure in the embodiment of the present application, etc.) to the I / O interface 512 through the client device 540.
[0144] Preprocessing module 513 and preprocessing module 514 are used to preprocess the input data received by I / O interface 512. It should be understood that preprocessing module 513 and preprocessing module 514 may be absent or only one preprocessing module may be present. If preprocessing module 513 and preprocessing module 514 are absent, computing module 511 may be used directly to process the input data.
[0145] When the execution device 510 preprocesses the input data, or when the computing module 511 of the execution device 510 performs calculations and other related processing, the execution device 510 can call the data, code, etc. in the data storage system 550 for corresponding processing, and can also store the data, instructions, etc. obtained from the corresponding processing in the data storage system 550.
[0146] Finally, the I / O interface 512 provides the processing results (such as the results explained in the figure in the embodiment of the present application) to the client device 540, and thus to the user.
[0147] In the scenario shown in FIG5 , the user can manually input data, and this "manual input data" can be operated through the interface provided by I / O interface 512. In another scenario, client device 540 can automatically send input data to I / O interface 512. If user authorization is required for client device 540 to automatically send input data, the user can set the corresponding permissions in client device 540. The user can view the results output by execution device 510 on client device 540, and the specific presentation form can be a display, sound, action, or other specific method. Client device 540 can also serve as a data acquisition terminal, collecting input data input into I / O interface 512 and output results from I / O interface 512 as new sample data and storing them in database 530. Of course, collection can also be performed without client device 540, and instead the I / O interface 512 directly stores the input data input into I / O interface 512 and output results from I / O interface 512 as new sample data in database 530.
[0148] It is worth noting that FIG5 is merely a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationships between the devices, components, modules, etc. shown in the figure do not constitute any limitation. For example, in FIG5 , the data storage system 550 is an external memory relative to the execution device 510. In other cases, the data storage system 550 can also be placed in the execution device 510. It should be understood that the execution device 510 can be deployed in the client device 540.
[0149] From the inference side of the model:
[0150] In the embodiment of the present application, the computing module 511 of the execution device 520 can obtain the code stored in the data storage system 550 to implement the graph interpretation method.
[0151] In an embodiment of the present application, the computing module 511 of the execution device 520 may include a hardware circuit (such as an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, etc.), or a combination of these hardware circuits. For example, the training device 520 can be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.
[0152] Specifically, the computing module 511 of the execution device 520 can be a hardware system with the function of executing instructions, and the connection relationship prediction method provided in the embodiment of the present application can be a software code stored in the memory. The computing module 511 of the execution device 520 can obtain the software code from the memory and execute the obtained software code to implement the graph interpretation method provided in the embodiment of the present application.
[0153] It should be understood that the computing module 511 of the execution device 520 can be a combination of a hardware system that does not have the function of executing instructions and a hardware system that has the function of executing instructions. Some steps of the graph interpretation method provided in the embodiment of the present application can also be implemented by the hardware system that does not have the function of executing instructions in the computing module 511 of the execution device 520, which is not limited here.
[0154] From the training side of the model:
[0155] In an embodiment of the present application, the above-mentioned training device 520 can obtain the code stored in the memory (not shown in Figure 5, which can be integrated into the training device 520 or deployed separately from the training device 520) to implement the steps related to model training in the embodiment of the present application.
[0156] In an embodiment of the present application, the training device 520 may include a hardware circuit (such as an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, etc.), or a combination of these hardware circuits. For example, the training device 520 may be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.
[0157] It should be understood that the training device 520 can be a combination of a hardware system that does not have the function of executing instructions and a hardware system that has the function of executing instructions. Some of the steps related to model training provided in the embodiments of the present application can also be implemented by the hardware system in the training device 520 that does not have the function of executing instructions, which is not limited here.
[0158] 2. Cloud services provided by the server:
[0159] In a possible implementation, the server may provide graph interpretation services to the client side through an application programming interface (API).
[0160] Among them, the terminal device can send relevant parameters (such as image information, etc.) to the server through the API provided by the cloud. The server can obtain processing results based on the received parameters and return the processing results (such as image interpretation results, etc.) to the terminal.
[0161] The description of the terminal and the server can be the same as that of the above embodiments, and will not be repeated here.
[0162] Since the embodiments of the present application involve the application of a large number of neural networks, in order to facilitate understanding, the relevant terms and related concepts such as neural networks involved in the embodiments of the present application are first introduced below.
[0163] (1) Neural Network
[0164] A neural network can be composed of neural units. A neural unit can refer to an operation unit that takes xs (i.e., input data) and intercept 1 as input. The output of the operation unit can be:
[0165]
[0166] Where s = 1, 2, ... n, n is a natural number greater than 1, Ws is the weight of xs, and b is the bias of the neural unit. f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal of the neural unit into the output signal. The output signal of the activation function can be used as the input of the next convolutional layer, and the activation function can be a sigmoid function. A neural network is a network formed by connecting multiple single neural units mentioned above, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field. The local receptive field can be an area composed of several neural units.
[0167] (2) Deep Neural Networks
[0168] Deep Neural Network (DNN), also known as multi-layer neural network, can be understood as a neural network with many hidden layers. There is no special metric for "many" here. Based on the position of different layers in DNN, the neural network inside DNN can be divided into three categories: input layer, hidden layer, and output layer. Generally speaking, the first layer is the input layer, the last layer is the output layer, and the layers in between are all hidden layers. The layers are fully connected, that is, any neuron in the i-th layer must be connected to any neuron in the i+1-th layer. Although DNN looks complicated, the work of each layer is actually not complicated. Simply put, it is the following linear relationship expression: in, is the input vector, is the output vector, is the offset vector, W is the weight matrix (also called coefficient), and α() is the activation function. Each layer is just an input vector After such a simple operation, the output vector Since there are many DNN layers, the coefficient W and the offset vector The definition of these parameters in DNN is as follows: Take the coefficient W as an example: Assume that in a three-layer DNN, the linear coefficient from the 4th neuron in the second layer to the 2nd neuron in the third layer is defined as The superscript 3 represents the layer number of the coefficient W, while the subscript corresponds to the output of the third layer index 2 and the input of the second layer index 4. In summary, the coefficient from the kth neuron in the L-1th layer to the jth neuron in the Lth layer is defined as It's important to note that the input layer has no W parameter. In deep neural networks, more hidden layers allow the network to better capture complex real-world situations. Theoretically, a model with more parameters has higher complexity and greater "capacity," meaning it can handle more complex learning tasks. Training a deep neural network is essentially the process of learning the weight matrix, with the ultimate goal of obtaining the weight matrices for all layers of a trained deep neural network (a weight matrix formed by the vectors W across many layers).
[0169] (3) Graph:
[0170] A graph is a data structure consisting of at least one node and at least one edge. In some scenarios, nodes in a graph can be mapped to entities, and edges can be mapped to relationships between entities. A graph can be directed or undirected. Of course, a graph can also include data other than nodes and edges, such as node and edge labels. In one exemplary scenario, applied to friend recommendations, each node in the graph can represent a user, and each edge in the graph can represent a social relationship between different users. The data contained in each node in the graph includes user profile data and user behavior data, such as age, occupation, hobbies, and educational background. For another example, in a product recommendation scenario, each node in the graph can represent a user or a product, and each edge in the graph can represent an interactive relationship between a user and a product, such as a purchase relationship or a favorite relationship. For another example, in a financial risk management scenario, each node in the graph can represent an account, a transaction, or funds. An edge in the graph can represent the flow of funds, for example, a loop in the graph can represent a circular transfer. For another example, in a scenario where the connection relationship between network elements in a network system is determined, each node in the graph can represent a network element, such as a router, a switch, a terminal, etc., and each edge in the graph can represent the connection relationship between different network elements.
[0171] (4) Graph neural network (GNN):
[0172] GNNs are a deep learning method that incorporates structural information and can be used to calculate the current state of a node. Graph neural networks transfer information according to a given graph structure, updating the state of each node based on adjacent nodes. Specifically, based on the current node's structural graph, using a neural network as a point information aggregation function, they transfer information from all adjacent nodes to the current node and then update it based on the current node's state.
[0173] (5) Loss function
[0174] During the training of a deep neural network, because we want the output of the deep neural network to be as close as possible to the desired predicted value, we can compare the current network's predicted value with the desired target value and then update the weight vector of each layer of the neural network based on the difference between the two. (Of course, before the first update, there is usually an initialization process, which pre-configures the parameters for each layer in the deep neural network.) For example, if the network's predicted value is too high, the weight vector is adjusted to make it predict a lower value. This adjustment is continued until the deep neural network can predict the desired target value or a value very close to the desired target value. Therefore, it is necessary to predefine "how to compare the difference between the predicted value and the target value." This is the loss function (or objective function), which is an important equation used to measure the difference between the predicted value and the target value. For example, the loss function output value (loss) indicates a greater difference, so training a deep neural network becomes a process of minimizing this loss.
[0175] (6) Backpropagation algorithm
[0176] Convolutional neural networks can use the back propagation (BP) algorithm to correct the size of the parameters in the initial super-resolution model during training, reducing the reconstruction error loss of the super-resolution model. Specifically, the forward propagation of the input signal to the output generates an error loss. This error loss information is then backpropagated to update the parameters of the initial super-resolution model, thereby converging the error loss. The BP algorithm is a backward propagation movement dominated by the error loss, aiming to obtain the optimal super-resolution model parameters, such as the weight matrix.
[0177] (7) Attention mechanism
[0178] The attention mechanism mimics the internal process of biological observation behavior, namely, a mechanism that aligns internal experience and external sensations to increase the observation precision of certain areas. It can quickly filter out high-value information from a large amount of information using limited attention resources. The attention mechanism can quickly extract important features from sparse data and is therefore widely used in natural language processing tasks, especially machine translation. The self-attention mechanism is an improvement on the attention mechanism, which reduces dependence on external information and is better at capturing the internal correlation of data or features. The essential idea of the attention mechanism can be rewritten as the following formula:
[0179] Here, Lx = ||Source|| represents the length of the Source. This formula implies that the elements in the Source are imagined to consist of a series of data pairs. Given a Query element in the target, the similarity or correlation between the Query and each Key is calculated to obtain the weight coefficient for each Key's corresponding Value. The weighted sum of the Values is then taken to obtain the final Attention value. Essentially, the Attention mechanism performs a weighted sum of the Values of the Source elements, with the Query and Key used to calculate the weight coefficient for the corresponding Value. Conceptually, Attention can be understood as selectively filtering out a small amount of important information from a large amount of information and focusing on this important information, while ignoring the majority of less important information. This focusing process is reflected in the calculation of the weight coefficients: the larger the weight, the more focus is placed on the corresponding Value. In other words, the weight represents the importance of the information, while the Value represents the corresponding information. The self-attention mechanism can be understood as internal attention. The attention mechanism occurs between the Query element of the Target and all elements of the Source. The self-attention mechanism refers to the attention mechanism that occurs between the internal elements of the Source or the internal elements of the Target. It can also be understood as the attention calculation mechanism in the special case of Target = Source. The specific calculation process is the same, only the calculation object has changed.
[0180] A graph is a data structure that includes at least one node and at least one edge. In some scenarios, the nodes in the graph can be mapped to objects (or entities), and the edges in the graph can be mapped to the relationships between entities. The graph can be a directed graph or an undirected graph. Of course, the graph can also include other data besides nodes and edges, such as node labels and edge labels. In an exemplary scenario, when applied to a friend recommendation scenario, each node in the graph can represent a user, and each edge in the graph can represent a social relationship between different users. The data of each node in the graph is the user's portrait data and the user's behavior data, such as the user's age, occupation, hobbies, education, etc. For another example, when applied to a product recommendation scenario, each node in the graph can represent a user or a product, and each edge in the graph can represent the interactive relationship between the user and the product, such as a purchase relationship, a collection relationship, etc. For another example, when applied to a financial risk control scenario, each node in the graph can represent an account, a transaction, or funds.
[0181] The graph interpreter is used to obtain the degree of influence of each node on the state of a certain node based on the graph information (such as node information and edge information). In existing implementations, graph interpretation is achieved through a perturbation-based interpretation method. The idea of this method is to input the graph information into a graph neural network (GNN) used to achieve the target task. The target task can be used to predict the state of a certain node. By perturbing the input graph information and observing the output of the GNN model, the effect of each node in the input graph information on the GNN model's prediction of the node state can be determined. This effect can be used as the degree of influence on the state of a certain node.
[0182] However, the above method can only obtain the degree of influence of a node on the state of a node, and the result of graph interpretation is incomplete (for example, the degree of influence of an edge between nodes on the state of a node cannot be obtained).
[0183] In order to solve the above problems, the present application provides a model training method. Referring to FIG6 , FIG6 is a schematic diagram of an embodiment of a model training method provided in an embodiment of the present application. As shown in FIG6 , a model training method provided in an embodiment of the present application includes:
[0184] 601. Obtain graph information, where the graph includes multiple nodes and edges between nodes. The graph information includes node information and edge information. Each node corresponds to an object. The node information includes attributes of the object, and the edge information includes relationships between objects.
[0185] In an embodiment of the present application, the execution entity of step 601 may be a server on the cloud side, and the server may receive the information of the graph sent from the terminal device, and then the server may obtain the information of the graph.
[0186] In an embodiment of the present application, the execution entity of step 601 may be a terminal device, which may be a portable mobile device, such as but not limited to a mobile or portable computing device (such as a smart phone), a personal computer, a server computer, a handheld device (such as a tablet) or a laptop device, a multi-processor system, a game console or controller, a microprocessor-based system, a set-top box, a programmable consumer electronic product, a mobile phone, a mobile computing and / or communication device with a wearable or accessory form factor (such as a watch, glasses, a headset or earbuds), a network PC, a minicomputer, a mainframe computer, a distributed computing environment including any of the above systems or devices, and the like.
[0187] For the convenience of description, the following does not distinguish the form of the execution subject and describes them all as training devices.
[0188] Among them, for the graph to be interpreted, the graph information can be obtained, and the graph information may include multiple nodes and edges between nodes. The graph information includes node information and edge information. Each node corresponds to an object, the node information includes the attributes of the object, and the edge information includes the relationship between objects.
[0189] Among them, taking the object corresponding to the node as a person as an example, the attributes of the person can be at least one of gender, age, occupation, income, hobbies and education level, among which gender can be male or female, age can be a number between 0-100, occupation can be teacher, programmer, chef, etc., hobbies can be basketball, tennis, running, etc., and education level can be elementary school, junior high school, high school, university, etc.; this application does not limit the specific type of attributes of the object.
[0190] Among them, taking the object corresponding to the node as an item as an example, the item can be a physical item or a virtual item, such as an application (APP), audio and video, web page, news information and other items. The attributes of the item can be at least one of the item name, developer, installation package size, category and praise. Among them, taking the item as an application as an example, the category of the item can be chat, parkour games, office, etc., and the praise degree can be a score, comment, etc. for the item; this application does not limit the specific type of the attribute of the item.
[0191] Taking the object corresponding to the node as a person as an example, the relationship between the objects can be a kinship relationship, an economic relationship (such as equity relationship, trade relationship, etc.).
[0192] During training, the information in the above graph can be used as input to the neural network to be trained. In addition, the label information used in the training process (or called groundtruth) can also be obtained, which can be related to the task to be achieved by the GNN in the neural network to be trained. For example, GNN can be used to predict the state of the object corresponding to the node (for example, perform a binary classification problem for the state). For example, GNN can predict whether the object corresponding to each node has economic risks (for example, whether there will be a problem of insufficient loan repayment ability). The label information can indicate whether the object corresponding to the node actually has economic risks.
[0193] 602. Obtain a first feature representation and a second feature representation based on the information of the graph, where the first feature representation is a feature representation of a node, and the second feature representation is a feature representation of an edge.
[0194] In one possible implementation, the information of the graph can be input into a feature extraction network (implemented in the feedforward process of training) to obtain a first feature representation of each node and a second feature representation of each edge.
[0195] For each node, information about the node itself and nearby nodes (e.g., information about each node's k-order subgraph, where k is greater than 1) can be input into a feature extraction network to obtain an embedding representation of each node. The node embedding can include features of multiple dimensions (or channels).
[0196] In a possible implementation, the embedded representation of each node and the node information may be fused (eg, concatenated to obtain a first feature representation), and the first feature representation may be used as the heterogeneous information of the node.
[0197] For each edge, the first feature representations of the nodes at both ends of the edge and the edge information itself can be fused to obtain the second feature representation of the edge (that is, the heterogeneous information of the edge).
[0198] In the above manner, in a heterogeneous graph containing different types of nodes, different types of nodes correspond to features of different dimensions, and the meanings of features of the same dimension may also be different. The edges in the heterogeneous graph also need to be represented differently due to their different types. For nodes: This embodiment can obtain features representing the heterogeneous information of nodes by fusing graph structure information (embedded representation of nodes) and original features (information of nodes). For edges: This embodiment can obtain features representing the heterogeneous information of edges by extracting the embedded representation of the head and tail nodes where the edge is located and the attributes of the edge itself (information of edges) for fusion representation. This thereby achieves accurate heterogeneous information representation of nodes and edges in the heterogeneous graph.
[0199] In a possible implementation, the feature extraction network may be, but is not limited to, a multi-layer pyramid model. The embedding representation may be in the form of a feature vector.
[0200] 603. According to the first feature representation of each node, a first weight is obtained through a first neural network, where the first weight is the weight of the node; the first weight is used to be fused with the corresponding first feature representation to obtain a third feature representation.
[0201] In one possible implementation, the first feature representation of each of the nodes can be input into a first neural network, wherein the first neural network can be a neural network based on an attention mechanism, and the first neural network can obtain a corresponding first weight based on the input feature representation (the weight gradually has a certain semantic meaning as the network is updated).
[0202] In one possible implementation, different neural networks (e.g., neural networks with different parameter values) can be used for different types of nodes. The above steps are performed on each node to obtain a feature mask of the node (the mask may include the first weight corresponding to each node).
[0203] The first weight can be fused with the corresponding first feature representation (for example, weighted, that is, a weighted product operation) to obtain a third feature representation. Weighting the first feature representation based on the first weight is equivalent to applying a disturbance to the first feature representation, which is equivalent to the role of the first neural network to obtain the size of the disturbance applied according to the first feature representation. Since the input to the subsequent task network (such as GNN) is the feature after the disturbance is applied (that is, the third feature representation), as the model is updated, the disturbance will have a trend: for nodes that have a greater impact on the accuracy of the network's task execution, their first weights will be assigned larger and larger (that is, the interference will become smaller and smaller), and for nodes that have a smaller impact on the accuracy of the network's task execution, their weights will be assigned smaller and smaller (that is, the interference will become larger and larger), and then the first weight can characterize the degree of influence of the node.
[0204] In one possible implementation, the first feature representation may include features of multiple dimensions, and the first weight may include a weight for the features of each dimension. During fusion, each weight may be weighted with the features of the corresponding dimension in the first feature representation.
[0205] 604. Obtain a second weight through a second neural network based on the second feature representation of each edge, where the second weight is the weight of the edge.
[0206] In one possible implementation, the second feature representation of each edge can be input into a second neural network, where the second neural network can be a neural network based on an attention mechanism. The second neural network can obtain a corresponding second weight based on the input feature representation (the weight gradually has a certain semantic meaning as the network is updated).
[0207] In one possible implementation, the second weight can be input into a subsequent task network (such as a GNN) as the weight that the task network applies to the edge when processing the information of the corresponding edge. For example, there will be parameters for setting the weight of each edge in the task network (usually, the weight of each edge is the same by default), and then the parameters for setting the weight of each edge in the task network can be set to the corresponding second weight. In the above manner, it is equivalent to applying a disturbance to the second feature representation, which is equivalent to the role of the second neural network to obtain the size of the disturbance imposed according to the second feature representation. As the model is updated, the disturbance will have a trend: for edges that have a greater impact on the accuracy of the network's task execution, their second weights will be assigned larger and larger (that is, the interference will become smaller and smaller), and for edges that have a smaller impact on the accuracy of the network's task execution, their second weights will be assigned smaller and smaller (that is, the interference will become larger and larger), and then the second weight can characterize the degree of influence of the edge.
[0208] 605. According to the third feature representation and the second weight, a first loss is obtained through a graph neural network (GNN), where the first loss is used to determine a loss function.
[0209] In one possible implementation, the third feature representation and the second weight obtained above can be input into a task network (e.g., GNN) to obtain an output result (e.g., if GNN is used to implement the target task, the output result is the execution result of the target task). For example, if the target task is to predict whether the person corresponding to each node has economic risks, the output result can be the prediction result of whether the person corresponding to each node has economic risks.
[0210] Based on the output result and the label information of the graph, a first loss (used to represent the difference between the output result and the label information) can be obtained, and then the loss function can be determined based on the first loss.
[0211] In one possible implementation, the above-mentioned first weight can represent the positive influence of the corresponding node on the GNN when performing the target task. However, in one implementation, when the first weight of the node is set to be larger, the processing accuracy of the network is higher, and when the first weight of the node is set to be smaller, the processing accuracy of the network is still high, or it decreases very little, then the influence of the node is still very low. Therefore, only one dimension of weight (such as the positive influence degree) cannot accurately characterize the actual influence of the node. In an embodiment of the present application, the feedforward process of the parameter model is parameterized by weights of multiple dimensions to accurately characterize the actual influence of the node.
[0212] In one possible implementation, a third weight can be obtained based on the first weight, wherein the third weight is the weight of the node, and the third weight is the degree of reverse influence of the corresponding node on the GNN when performing the target task; the third weight is used to fuse with the corresponding first feature representation to obtain a fourth feature representation; based on the fourth feature representation, a second loss is obtained through the graph neural network GNN, and the second loss is used to determine the loss function. For example, when the first weight is large and the third weight is small, the first loss can represent the accuracy of the corresponding model when the weight of the node is large, and the second loss can represent the accuracy of the corresponding model when the weight of the node is small. If the first weight of the node is set to be large, the processing accuracy of the network is high, and when the first weight of the node is set to be small, the processing accuracy of the network is still high, or decreases very little, then as the model is updated, the first weight will gradually become smaller, thereby more accurately describing the actual influence of the node and improving the accuracy of the network.
[0213] In a possible implementation, the first weight is expressed as a positive number less than 1, and the sum of the third weight and the corresponding first weight is 1. For example, the first weight is 0.9, and the third weight is 0.1.
[0214] In a possible implementation, the first weight may be referred to as a positive mask of the node, and the third weight may be referred to as a negative mask of the node.
[0215] Similarly, for edges, a loss function can also be constructed using the above-mentioned positive and negative mask method. For example, the GNN is used to perform a target task, and the second weight indicates the degree of positive influence of the corresponding edge on the GNN when performing the target task. Based on the second weight, a fourth weight can be obtained, and the fourth weight is the weight of the edge. The fourth weight indicates the degree of negative influence of the corresponding edge on the GNN when performing the target task; based on the fourth weight, a third loss is obtained through the graph neural network GNN, and the third loss is used to determine the loss function.
[0216] In a possible implementation, the first weight is expressed as a positive number less than 1, and the sum of the fourth weight and the corresponding second weight is 1.
[0217] Next, we introduce a specific example of a loss function: the loss function can include three parts:
[0218] (1) The impact of applying a mask on the classification accuracy of the model;
[0219] (2) The impact of applying negative masks on the classification accuracy of the model;
[0220] (3) Variance of the mask.
[0221] Among them, the combined effect of (1) and (2) makes the optimization move towards generating mask updates that are beneficial to the prediction of the GNN model. Important nodes and edges will be assigned more weights, the weights of irrelevant features and edges will continue to decrease, and the causal relationship will continue to increase.
[0222] The purpose of (3) is to increase the variance of the mask, so that the mask can better distinguish nodes and edges and improve the quality of interpretation. The specific representation of the loss function can be shown in Figure 7. pred Represents the prediction result of the GNN model after applying the mask. Represents the prediction result of the GNN model after applying the negative mask. var represents the function for finding the variance.
[0223] 606. Update the first attention network, the second attention network, and the GNN according to the loss function.
[0224] During training, the interpreter (first neural network, second neural grid) is updated by backpropagation by optimizing the loss function.
[0225] During inference, as shown in Figure 8, the k-order subgraph where the node to be explained is located can be input. Through feature extraction and forward calculation of the first neural network and the second neural network, the feature mask and edge mask can be obtained as the explanation of the node feature and the explanation of the edge, respectively.
[0226] Next, we will use simulation data from the risk control field to verify and explain the effects and performance of the embodiments of this application.
[0227] The main node types are legal entities and customers, and there are five edge types, including cardholders and equity relationships. The prediction model is a heterogeneous graph transformer (HGT), which predicts whether a customer is high-risk (i.e., whether there is debt default risk). The basic requirement is to provide explanations for the feature dimensions and relationship dimensions of high-risk customer predictions. During model training, the following steps can be performed:
[0228] (1) Extract the subgraph where the node is located and the corresponding label from the data as input
[0229] (2) Extract heterogeneous information and generate feature inputs and edge inputs.
[0230] (3) Input the feature inputs and edge inputs in (2) into the corresponding feature attention network and edge attention network, calculate the feature mask and edge mask, and then obtain new features based on the positive mask. Calculate the negative mask based on the positive mask to obtain the corresponding negative edge mask and new features.
[0231] (4) According to the output of (3), the HGT prediction model is input respectively to perform inference prediction. The loss is calculated according to the loss function, and the parameters of the interpreter are updated through back propagation.
[0232] Repeat (1) to (4) until the model converges or the number of cycles reaches the preset step size.
[0233] (5) Use the trained interpreter to perform reasoning and obtain explanations corresponding to high-risk customers.
[0234] Figure 9 shows the effect of the explanation of the above embodiment. Dark grey nodes represent customers predicted to be high risk, and light grey nodes represent normal customers.
[0235] As shown in Figure 9, explanations are provided for Customer 1, which is predicted to be high-risk, along both the feature and relationship dimensions. The feature-based explanation reveals that Customer 1's age, cumulative disbursement amount, and behavioral score are the most influential factors in predicting Customer 1's high-risk status. The relationship-based explanation reveals that the equity relationship between Customer 1 and high-risk legal entity 4 contributes to Customer 1's high-risk status. In terms of explanation efficiency, GNNexplainer takes 4-7 seconds to generate a single-sample explanation, while the present invention takes only 10 milliseconds.
[0236] As shown in Table 1, this embodiment of the present application designs a heterogeneous information extraction module. By configuring an attention network to generate feature masks and edge masks, and optimizing the interpreter using a loss function based on causal reinforcement, the interpreter is trained based on all training data, ensuring that the interpretation is both locally optimal and globally optimal. The trained interpreter does not require retraining when generating interpretations, resulting in efficient interpretations and reduced time consumption.
[0237] Table 1
[0238]
[0239] Table 2 shows a performance comparison between the proposed method and existing methods on public datasets. It can be seen that the proposed method achieves significantly higher interpretation accuracy than existing methods, and the average single-sample interpretation time is increased by 5 times.
[0240] Table 2
[0241]
[0242] An embodiment of the present application provides a model training method, the method comprising: obtaining information of a graph, the graph comprising multiple nodes and edges between the nodes, the graph information comprising node information and edge information, each node corresponding to an object, the node information comprising attributes of the object, and the edge information comprising relationships between objects; obtaining a first feature representation and a second feature representation based on the graph information, the first feature representation being the feature representation of the node, and the second feature representation being the feature representation of the edge; obtaining a first weight based on the first feature representation of each node through a first neural network, the first weight being the weight of the node; the first weight being used to fuse with the corresponding first feature representation to obtain a third feature representation; obtaining a second weight based on the second feature representation of each edge through a second neural network, the second weight being the weight of the edge; obtaining a first loss based on the third feature representation and the second weight through a graph neural network (GNN), the first loss being used to determine a loss function; updating the first attention network, the second attention network, and the GNN based on the loss function.
[0243] The first weight can be fused with the corresponding first feature representation, which is equivalent to applying a perturbation to the first feature representation. This is equivalent to the first neural network obtaining the magnitude of the perturbation based on the first feature representation. Since the input to the subsequent task network (e.g., GNN) is the feature after the perturbation (i.e., the third feature representation), as the model is updated, the perturbation will have a trend: for nodes with a greater impact on the accuracy of the network's task execution, their first weights will be assigned increasingly larger values (i.e., the perturbation will become increasingly smaller), while for nodes with a smaller impact on the accuracy of the network's task execution, their weights will be assigned increasingly smaller values (i.e., the perturbation will become increasingly larger). Thus, the first weight can characterize the degree of influence of the node. Similarly, the second weight can be input into the subsequent task network (e.g., GNN) as the weight applied to the edge by the task network when processing the information of the corresponding edge. For example, the task network will have parameters for setting the weight of each edge (usually, the weight of each edge is the same by default), and the parameters for setting the weight of each edge in the task network can be set to the corresponding second weight. Through the above method, it is equivalent to applying a disturbance to the second feature representation, which is equivalent to the role of the second neural network to obtain the size of the imposed disturbance according to the second feature representation. As the model is updated, the disturbance will have a trend: for the edge that has a greater impact on the accuracy of the network's task execution, its second weight will be assigned increasingly larger (that is, the interference will become smaller and smaller), and for the edge that has a smaller impact on the accuracy of the network's task execution, its second weight will be assigned increasingly smaller (that is, the interference will become increasingly larger), and then the second weight can characterize the degree of influence of the edge.
[0244] The first neural network and the second neural network trained in the above manner can be used as graph interpreters to determine the importance of each node and the relationship between nodes, which is equivalent to obtaining a more complete graph interpretation result compared to the existing technology.
[0245] The above describes the recommendation method from the perspective of model training. Next, a data processing method provided by an embodiment of the present application is introduced from the perspective of model reasoning:
[0246] Referring to FIG. 10 , FIG. 10 is a flow chart of a data processing method provided in an embodiment of the present application. As shown in FIG. 10 , a data processing method provided in an embodiment of the present application includes:
[0247] 1001. Obtain graph information, where the graph information includes multiple nodes and edges between the nodes. The graph information includes node information and edge information. Each node corresponds to an object. The node information includes attributes of the object, and the edge information includes relationships between objects.
[0248] For a detailed description of step 1001 , please refer to the introduction of step 601 in the above embodiment, which will not be repeated here.
[0249] 1002. Obtain a first feature representation and a second feature representation based on the graph information, where the first feature representation is a feature representation of a node, and the second feature representation is a feature representation of an edge;
[0250] For a detailed description of step 1002 , please refer to the introduction of step 602 in the above embodiment, which will not be repeated here.
[0251] 1003. Obtain a first weight through a first neural network based on the first feature representation of each node, where the first weight is the weight of the node; the first weight is used to represent the importance of the corresponding node in the graph;
[0252] The first neural network may be obtained through the model training method corresponding to FIG6 .
[0253] 1004. According to the second feature representation of each edge, a second weight is obtained through a second neural network, where the second weight is the weight of the edge; the second weight is used to represent the importance of the corresponding edge in the graph.
[0254] The second neural network may be obtained by the model training method corresponding to FIG6 .
[0255] In a possible implementation, the first feature representation includes an embedding representation of a node obtained through a feature network and information about the corresponding node; or,
[0256] The second feature representation includes the first feature representations of the nodes at both ends of the edge and the corresponding edge information.
[0257] In a possible implementation, the first feature representation includes features of multiple dimensions, and the first weight includes a weight corresponding to the features of each dimension; or,
[0258] The second feature representation includes features of multiple dimensions, and the second weight includes a weight corresponding to the feature of each dimension.
[0259] In a possible implementation, the first neural network or the second neural network is a neural network based on an attention mechanism.
[0260] Referring to FIG. 11 , FIG. 11 is a schematic diagram of the structure of a model training device provided in an embodiment of the present application. As shown in FIG. 11 , a model training device 1100 provided in an embodiment of the present application includes:
[0261] An acquisition module 1101 is configured to acquire graph information, wherein the graph includes a plurality of nodes and edges between the nodes, the graph information including node information and edge information, each node corresponding to an object, the node information including attributes of the object, and the edge information including relationships between objects;
[0262] For a detailed introduction to the acquisition module 1101 , please refer to the description of step 601 in the above embodiment, which will not be repeated here.
[0263] A processing module 1102 is configured to obtain a first feature representation and a second feature representation based on the information of the graph, wherein the first feature representation is a feature representation of a node, and the second feature representation is a feature representation of an edge;
[0264] For a detailed introduction to the processing module 1102 , reference may be made to the description of steps 602 to 605 in the above embodiment, which will not be repeated here.
[0265] According to the first feature representation of each node, a first weight is obtained through a first neural network, where the first weight is the weight of the node; the first weight is used to be fused with the corresponding first feature representation to obtain a third feature representation;
[0266] Obtaining a second weight through a second neural network according to the second feature representation of each edge, where the second weight is the weight of the edge;
[0267] Obtaining a first loss through a graph neural network (GNN) according to the third feature representation and the second weight, where the first loss is used to determine a loss function;
[0268] The model updating module 1103 is used to update the first attention network, the second attention network and the GNN according to the loss function.
[0269] The detailed introduction of the model updating module 1103 can be referred to the description of step 606 in the above embodiment, which will not be repeated here.
[0270] The first neural network and the second neural network trained in the above manner can be used as graph interpreters to determine the importance of each node and the relationship between nodes, which is equivalent to obtaining a more complete graph interpretation result compared to the existing technology.
[0271] In a possible implementation, the GNN is used to perform a target task, the first weight is a positive influence degree of the corresponding node on the GNN when performing the target task, and the acquisition module is further used to:
[0272] Obtaining a third weight based on the first weight, where the third weight is the weight of the node and the degree of reverse influence of the corresponding node on the GNN when performing the target task; the third weight is used to fuse with the corresponding first feature representation to obtain a fourth feature representation;
[0273] The processing module is further used to: obtain a second loss through a graph neural network GNN based on the fourth feature representation, and the second loss is used to determine the loss function.
[0274] In a possible implementation, the first weight is expressed as a positive number less than 1, and the sum of the third weight and the corresponding first weight is 1.
[0275] In one possible implementation, the GNN is used to perform a target task, the second weight indicates a positive influence of the corresponding edge on the GNN when performing the target task, and the acquisition module is further used to:
[0276] Obtaining a fourth weight according to the second weight, where the fourth weight is the weight of the edge, and the fourth weight indicates the degree of reverse influence of the corresponding edge on the GNN when performing the target task;
[0277] The processing module is further used to: obtain a third loss through a graph neural network GNN based on the fourth weight, and the third loss is used to determine the loss function.
[0278] In a possible implementation, the first weight is expressed as a positive number less than 1, and the sum of the fourth weight and the corresponding second weight is 1.
[0279] In a possible implementation, the first feature representation includes an embedding representation of a node obtained through a feature network and information about the corresponding node; or,
[0280] The second feature representation includes embedded representations of nodes at both ends of an edge and information about the edge.
[0281] In a possible implementation, the first feature representation includes features of multiple dimensions, and the first weight includes a weight corresponding to the features of each dimension; or,
[0282] The second feature representation includes features of multiple dimensions, and the second weight includes a weight corresponding to the feature of each dimension.
[0283] In a possible implementation, the first neural network or the second neural network is a neural network based on an attention mechanism.
[0284] In a possible implementation, the fusion includes:
[0285] Weighted.
[0286] In one possible implementation, the object is a person, different nodes correspond to different people, the edges indicate the kinship or economic relationship between the people, and the GNN is used to predict whether at least one of the people has an economic risk based on the information in the graph.
[0287] 12 , which is a schematic diagram of the structure of a data processing device according to an embodiment of the present application. As shown in FIG12 , a data processing device 1200 according to an embodiment of the present application includes:
[0288] An acquisition module 1201 is configured to acquire graph information, wherein the graph information includes multiple nodes and edges between the nodes. The graph information includes node information and edge information. Each node corresponds to an object. The node information includes attributes of the object. The edge information includes relationships between objects.
[0289] The specific description of the acquisition module 1201 can refer to the introduction of step 1001 in the above embodiment, which will not be repeated here.
[0290] A processing module 1202 is configured to obtain a first feature representation and a second feature representation based on the information of the graph, wherein the first feature representation is a feature representation of a node, and the second feature representation is a feature representation of an edge;
[0291] According to the first feature representation of each node, a first weight is obtained through a first neural network, where the first weight is the weight of the node; the first weight is used to represent the importance of the corresponding node in the graph;
[0292] According to the second feature representation of each edge, a second weight is obtained through a second neural network, where the second weight is the weight of the edge; the second weight is used to represent the importance of the corresponding edge in the graph.
[0293] The specific description of the acquisition module 1202 can refer to the introduction of steps 1002 to 1004 in the above embodiment, which will not be repeated here.
[0294] In a possible implementation, the first feature representation includes an embedding representation of a node obtained through a feature network and information about the corresponding node; or,
[0295] The second feature representation includes the first feature representations of the nodes at both ends of the edge and the corresponding edge information.
[0296] In a possible implementation, the first feature representation includes features of multiple dimensions, and the first weight includes a weight corresponding to the features of each dimension; or,
[0297] The second feature representation includes features of multiple dimensions, and the second weight includes a weight corresponding to the feature of each dimension.
[0298] In a possible implementation, the first neural network or the second neural network is a neural network based on an attention mechanism.
[0299] Next, an execution device provided in an embodiment of the present application is introduced. Please refer to Figure 13. Figure 13 is a structural schematic diagram of an execution device provided in an embodiment of the present application. The execution device 1300 can be specifically manifested as a mobile phone, a tablet, a laptop computer, a smart wearable device, a server, etc., which is not limited here. Among them, the execution device 1300 can be deployed with the recommendation device described in the embodiment corresponding to Figure 12 to implement the function of the recommendation method in the embodiment corresponding to Figure 10. Specifically, the execution device 1300 includes: a receiver 1301, a transmitter 1302, a processor 1303 and a memory 1304 (wherein the number of processors 1303 in the execution device 1300 can be one or more), wherein the processor 1303 may include an application processor 13031 and a communication processor 13032. In some embodiments of the present application, the receiver 1301, the transmitter 1302, the processor 1303 and the memory 1304 can be connected via a bus or other means.
[0300] Memory 1304 may include read-only memory and random access memory, and provides instructions and data to processor 1303. A portion of memory 1304 may also include non-volatile random access memory (NVRAM). Memory 1304 stores processor and operation instructions, executable modules, or data structures, or subsets or extended sets thereof. The operation instructions may include various operation instructions for implementing various operations.
[0301] Processor 1303 controls the operation of the execution device. In specific applications, the various components of the execution device are coupled together via a bus system. In addition to a data bus, the bus system may also include a power bus, a control bus, and a status signal bus. However, for clarity, all bus systems are referred to as a bus system in the figure.
[0302] The method disclosed in the above embodiment of the present application can be applied to the processor 1303, or implemented by the processor 1303. The processor 1303 can be an integrated circuit chip with signal processing capabilities. During the implementation process, the steps of the above method can be completed by the integrated logic circuit of the hardware in the processor 1303 or the instructions in the form of software. The above-mentioned processor 1303 can be a general-purpose processor, a digital signal processor (digital signal processing, DSP), a microprocessor or a microcontroller, and a vision processor (vision processing unit, VPU), a tensor processor (tensor processing unit, TPU) and other processors suitable for AI computing, and can further include an application specific integrated circuit (ASIC), a field programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The processor 1303 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of this application can be directly implemented as being executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in memory 1304, and processor 1303 reads the information in memory 1304 and, in conjunction with its hardware, completes steps 1001 to 1004 in the above embodiment.
[0303] Receiver 1301 can be used to receive input digital or character information and generate signal input related to executing device-related settings and function control. Transmitter 1302 can be used to output digital or character information through the first interface. Transmitter 1302 can also be used to send instructions to the disk pack through the first interface to modify data in the disk pack. Transmitter 1302 can also include a display device such as a display screen.
[0304] The present application also provides a training device. Please refer to FIG. 14 , which is a schematic diagram of a structure of a training device provided by an embodiment of the present application. Specifically, the training device 1400 is implemented by one or more servers. The training device 1400 may vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1414 (e.g., one or more processors), a memory 1432, and one or more storage media 1430 (e.g., one or more mass storage devices) storing application programs 1442 or data 1444. The memory 1432 and storage medium 1430 may be either ephemeral or persistent storage. The program stored in the storage medium 1430 may include one or more modules (not shown), each of which may include a series of instruction operations on the training device. Furthermore, the CPU 1414 may be configured to communicate with the storage medium 1430 to execute the series of instruction operations in the storage medium 1430 on the training device 1400.
[0305] The training device 1400 may also include one or more power supplies 1426, one or more wired or wireless network interfaces 1450, one or more input and output interfaces 1458; or, one or more operating systems 1441, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0306] Specifically, the training device may perform steps 601 to 606 in the above embodiment.
[0307] An embodiment of the present application also provides a computer program product, which, when running on a computer, enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.
[0308] A computer-readable storage medium is also provided in an embodiment of the present application, which stores a program for signal processing. When the computer-readable storage medium is run on a computer, it enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.
[0309] The execution device, training device or terminal device provided in the embodiments of the present application can specifically be a chip, and the chip includes: a processing unit and a communication unit, the processing unit can be, for example, a processor, and the communication unit can be, for example, an input / output interface, a pin or a circuit, etc. The processing unit can execute the computer execution instructions stored in the storage unit, so that the chip in the execution device executes the data processing method described in the above embodiment, or so that the chip in the training device executes the data processing method described in the above embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit can also be a storage unit located outside the chip in the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.
[0310] Specifically, see Figure 15 , which is a schematic diagram of the structure of a chip provided in an embodiment of the present application. The chip can be represented as a neural network processor NPU 1500. NPU 1500 is mounted on the host CPU (host CPU) as a coprocessor and is assigned tasks by the host CPU. The core of the NPU is arithmetic circuit 1503, which is controlled by controller 1504 to extract matrix data from memory and perform multiplication operations.
[0311] The NPU 1500 can implement the model training method provided in the embodiment described in FIG. 6 and the data processing method provided in the embodiment described in FIG. 10 through the mutual cooperation between various internal components.
[0312] More specifically, in some implementations, the arithmetic circuit 1503 in the NPU 1500 includes multiple processing units (PEs). In some implementations, the arithmetic circuit 1503 is a two-dimensional systolic array. The arithmetic circuit 1503 can also be a one-dimensional systolic array or other electronic circuitry capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit 1503 is a general-purpose matrix processor.
[0313] For example, assume there are input matrix A, weight matrix B, and output matrix C. The arithmetic circuit retrieves the corresponding data of matrix B from weight memory 1502 and caches it on each PE in the arithmetic circuit. The arithmetic circuit retrieves the data of matrix A from input memory 1501 and performs a matrix operation on matrix B. The partial or final matrix result is stored in accumulator 1508.
[0314] Unified memory 1506 is used to store input and output data. Weight data is directly transferred to weight memory 1502 through the Direct Memory Access Controller (DMAC) 1505. Input data is also transferred to unified memory 1506 through the DMAC.
[0315] BIU stands for Bus Interface Unit 1510 , which is used for interaction between the AXI bus, DMAC, and instruction fetch buffer (IFB) 1509 .
[0316] The bus interface unit 1510 (BIU) is used for the instruction fetch memory 1509 to obtain instructions from the external memory, and is also used for the storage unit access controller 1505 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
[0317] DMAC is mainly used to transfer input data in the external memory DDR to the unified memory 1506 or transfer weight data to the weight memory 1502 or transfer input data to the input memory 1501.
[0318] The vector calculation unit 1507 includes multiple operation processing units. When necessary, it further processes the output of the operation circuit 1503, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional / fully connected layer network calculations in neural networks, such as batch normalization, pixel-level summation, and upsampling of feature planes.
[0319] In some implementations, the vector calculation unit 1507 can store the processed output vector in the unified memory 1506. For example, the vector calculation unit 1507 can apply a linear function or a nonlinear function to the output of the operation circuit 1503, such as linear interpolation of the feature plane extracted by the convolution layer, or accumulate a vector of values to generate an activation value. In some implementations, the vector calculation unit 1507 generates a normalized value, a pixel-level summed value, or both. In some implementations, the processed output vector can be used as an activation input to the operation circuit 1503, for example, for use in subsequent layers in a neural network.
[0320] An instruction fetch buffer 1509 connected to the controller 1504 is used to store instructions used by the controller 1504;
[0321] Unified memory 1506, input memory 1501, weight memory 1502, and instruction fetch memory 1509 are all on-chip memories. External memories are private to the NPU hardware architecture.
[0322] The processor mentioned in any of the above places can be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the above program.
[0323] It should also be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the device embodiments provided in this application, the connection relationship between the modules indicates that there is a communication connection between them, which can be specifically implemented as one or more communication buses or signal lines.
[0324] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course can also be implemented by special hardware including application-specific integrated circuits, special CPUs, special memories, special components, etc. In general, all functions performed by computer programs can be easily implemented with corresponding hardware, and the specific hardware structures used to implement the same function can also be diverse, such as analog circuits, digital circuits or special circuits, etc. However, for the present application, software program implementation is a better implementation method in most cases. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer's floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., and includes a number of instructions to enable a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods described in each embodiment of the present application.
[0325] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0326] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, a computer, a training device or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website, a computer, a training device or a data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
Claims
1. A model training method, characterized in that: The method comprises: Obtaining graph information, the graph including multiple nodes and edges between the nodes, the graph information including node information and edge information, each node corresponding to an object, the node information including attributes of the object, and the edge information including relationships between objects; Obtaining a first feature representation and a second feature representation based on information of the graph, wherein the first feature representation is a feature representation of a node, and the second feature representation is a feature representation of an edge; According to the first feature representation of each node, a first weight is obtained through a first neural network, where the first weight is the weight of the node; the first weight is used to be fused with the corresponding first feature representation to obtain a third feature representation; Obtaining a second weight through a second neural network according to the second feature representation of each edge, where the second weight is the weight of the edge; Obtaining a first loss through a graph neural network (GNN) according to the third feature representation and the second weight, where the first loss is used to determine a loss function; According to the loss function, the first attention network, the second attention network and the GNN are updated.
2. The method according to claim 1, characterized in that The GNN is used to perform a target task, the first weight is a positive influence degree of the corresponding node on the GNN when performing the target task, and the method further includes: Obtaining a third weight based on the first weight, where the third weight is the weight of the node and the degree of reverse influence of the corresponding node on the GNN when performing the target task; the third weight is used to fuse with the corresponding first feature representation to obtain a fourth feature representation; According to the fourth characteristic representation, a second loss is obtained through a graph neural network GNN, and the second loss is used to determine the loss function.
3. The method according to claim 2, characterized in that The first weight is expressed as a positive number less than 1, and the sum of the third weight and the corresponding first weight is 1.
4. The method according to any one of claims 1 to 3, characterized in that: The GNN is used to perform a target task, the second weight indicates a positive influence of the corresponding edge on the GNN in performing the target task, and the method further includes: Obtaining a fourth weight according to the second weight, where the fourth weight is the weight of the edge, and the fourth weight indicates the degree of reverse influence of the corresponding edge on the GNN when performing the target task; According to the fourth weight, a third loss is obtained through the graph neural network GNN, and the third loss is used to determine the loss function.
5. The method according to claim 4, characterized in that The first weight is expressed as a positive number less than 1, and the sum of the fourth weight and the corresponding second weight is 1.
6. The method according to any one of claims 1 to 5, characterized in that: The first feature representation includes an embedding representation of a node obtained through a feature network and information about the corresponding node; or, The second feature representation includes the first feature representations of the nodes at both ends of the edge and the corresponding edge information.
7. The method according to any one of claims 1 to 6, characterized in that: The first feature representation includes features of multiple dimensions, and the first weight includes a weight corresponding to the features of each dimension; or The second feature representation includes features of multiple dimensions, and the second weight includes a weight corresponding to the feature of each dimension.
8. The method according to any one of claims 1 to 7, characterized in that: The first neural network or the second neural network is a neural network based on an attention mechanism.
9. The method according to any one of claims 1 to 8, characterized in that: The fusion comprises: Weighted.
10. The method according to any one of claims 1 to 9, characterized in that: The objects are people, different nodes correspond to different people, the edges indicate the kinship or economic relationship between the people, and the GNN is used to predict whether at least one of the people has an economic risk based on the information in the graph.
11. A model training device, characterized in that: The device comprises: An acquisition module is configured to acquire graph information, wherein the graph includes a plurality of nodes and edges between the nodes, the graph information includes node information and edge information, each node corresponds to an object, the node information includes attributes of the object, and the edge information includes relationships between objects; a processing module, configured to obtain a first feature representation and a second feature representation based on information of the graph, wherein the first feature representation is a feature representation of a node, and the second feature representation is a feature representation of an edge; According to the first feature representation of each node, a first weight is obtained through a first neural network, where the first weight is the weight of the node; the first weight is used to be fused with the corresponding first feature representation to obtain a third feature representation; According to the second feature representation of each edge, a second weight is obtained through a second neural network, where the second weight is the weight of the edge; Obtaining a first loss through a graph neural network (GNN) according to the third feature representation and the second weight, where the first loss is used to determine a loss function; A model update module is used to update the first attention network, the second attention network and the GNN according to the loss function.
12. The device according to claim 11, characterized in that The GNN is used to perform a target task, the first weight is a positive influence degree of the corresponding node on the GNN when performing the target task, and the acquisition module is further used to: Obtaining a third weight based on the first weight, where the third weight is the weight of the node and the degree of reverse influence of the corresponding node on the GNN when performing the target task; the third weight is used to fuse with the corresponding first feature representation to obtain a fourth feature representation; The processing module is further used to: obtain a second loss through a graph neural network GNN based on the fourth feature representation, and the second loss is used to determine the loss function.
13. The device according to claim 12, characterized in that The first weight is expressed as a positive number less than 1, and the sum of the third weight and the corresponding first weight is 1.
14. The device according to any one of claims 11 to 13, characterized in that The GNN is used to perform a target task, the second weight indicates a positive influence of the corresponding edge on the GNN when performing the target task, and the acquisition module is further used to: Obtaining a fourth weight according to the second weight, where the fourth weight is the weight of the edge, and the fourth weight indicates the degree of reverse influence of the corresponding edge on the GNN when performing the target task; The processing module is further used to: obtain a third loss through a graph neural network GNN based on the fourth weight, and the third loss is used to determine the loss function.
15. The device according to claim 14, characterized in that The first weight is expressed as a positive number less than 1, and the sum of the fourth weight and the corresponding second weight is 1.
16. The device according to any one of claims 11 to 15, characterized in that The first feature representation includes an embedding representation of a node obtained through a feature network and information about the corresponding node; or, The second feature representation includes embedded representations of nodes at both ends of an edge and information about the edge.
17. The device according to any one of claims 11 to 16, characterized in that The first feature representation includes features of multiple dimensions, and the first weight includes a weight corresponding to the features of each dimension; or The second feature representation includes features of multiple dimensions, and the second weight includes a weight corresponding to the feature of each dimension.
18. The device according to any one of claims 11 to 17, characterized in that The first neural network or the second neural network is a neural network based on an attention mechanism.
19. The device according to any one of claims 11 to 18, characterized in that The fusion comprises: Weighted.
20. The device according to any one of claims 11 to 19, characterized in that The objects are people, different nodes correspond to different people, the edges indicate the kinship or economic relationship between the people, and the GNN is used to predict whether at least one of the people has an economic risk based on the information in the graph.
21. A computing device, characterized in that The computing device includes a memory and a processor; the memory stores codes, and the processor is configured to obtain the codes and execute the method according to any one of claims 1 to 10.
22. A computer storage medium, characterized in that The computer storage medium stores one or more instructions, which, when executed by one or more computers, enable the one or more computers to implement the method according to any one of claims 1 to 10.
23. A computer program product comprising code, characterized in that When the code is executed, it is used to implement the method according to any one of claims 1 to 10.