Graph data alignment method based on label guidance
By employing a label-guided graph learning approach, which utilizes a large language model to extract node text keywords and generate virtual nodes, the problem of inconsistency and redundant information in graph datasets is solved, thereby improving the model's generalization ability on different datasets and its adaptability to zero-shot tasks.
Patent Information
- Application Number
- CN202510713616.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-10-17
AI Technical Summary
Inconsistency among existing graph datasets leads to insufficient generalization ability of graph models when faced with different datasets, especially in zero-shot tasks, and redundant information in node text attributes affects model performance.
By employing a label-guided graph learning approach, we extract keywords from node text using a large language model, assign weights to these keywords, and integrate them with label information to generate virtual nodes. This guides the message passing process and adaptively aggregates important information.
It improves the generalization ability of graph learning methods on unseen datasets, and enhances the model's zero-shot task adaptability and the accuracy of node representation.
Smart Images

Figure CN120808369A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of digital equipment, and particularly relates to a graph data alignment method based on label guidance. BACKGROUND
[0002] As an abstract data structure, graph data can effectively represent many things in the real world. In recent years, with the development of deep learning, GNN has been widely used in the field of digital equipment to process complex graph structure data. It learns the high-order representation of nodes through the message passing mechanism and can achieve excellent performance on a single data set. In the field of digital equipment, it is necessary to integrate multi-modal attributes such as text, time series data and images. For example, the semantic expression is enhanced by combining the adjacency list and the attribute matrix.
[0003] However, when facing completely new and unseen data, the performance of the GNN-based method will often decrease significantly. This is mainly because the data types, task requirements and data distribution characteristics of different graph data sets are different, so different methods are often used to encode node attribute information, such as bag-of-words, skip-gram or TF-IDF. Therefore, it is difficult to obtain a unified representation among different graph data sets, resulting in significant differences in node feature dimensions and semantics among different data sets. In addition, the number of classes contained in each data set is also different, and even if the number of classes is the same, the meanings contained are different, further increasing the difficulty of applying graph models to different data sets. These factors cause this kind of method to often fail to respond effectively and timely when facing the complex and changing scenes in the real world, hindering the further application of graph data.
[0004] Although in the field of natural language processing and computer vision, basic models such as large language models and visual language models have strong generalization ability, the development of similar models in the field of graphs is still in its infancy. The present application believes that the success in the fields of NLP and CV is largely due to the consistency between different text and image datasets, which makes it possible to pretrain models on large-scale data, thereby learning general and transferable representations, laying the foundation for today's large language models and multi-modal large models. The inconsistency between graph datasets, however, hinders similar success in the field of graph learning. In recent years, many methods have been proposed to address the above challenges. For example, MDGPT uses domain tokens and dual-prompt mechanisms to ensure efficient feature alignment and adaptation between different domains without text data. However, it cannot perform zero-shot tasks, which are very important in the real world because label truth values are often difficult to obtain. Other methods usually use Text-Attributed Graphs (TAGs), which use original text to describe the nodes of the graph, or leverage large language models. TEA-GLM pretrains a GNN and uses contrastive learning to align the node representations obtained by the GNN with the token embeddings of the LLM. GraphAdapter, on the other hand, uses a GNN as an adapter to combine the structural information in TAGs with the semantic capabilities of LLMs, thereby learning meaningful representations.
[0005] However, the present application believes that these methods still cannot effectively address the two main challenges of improving the generalization of graph models. On the one hand, the text attributes of nodes contain rich information, but there is also a lot of useless and redundant information. If the information contained in the nodes is not filtered and the useless and redundant information is not removed, it may affect the subsequent message passing process, causing the model to fail to learn robust representations and thus reducing the generalization performance of the model. On the other hand, depending on the dataset domain, node category, and edge information, the information that nodes want to aggregate from neighboring nodes also varies greatly. Existing graph learning methods are difficult to adaptively extract and aggregate the most important information according to different scenarios, so the relationships learned by the model between nodes cannot be generalized to different datasets. SUMMARY
[0006] Therefore, the label information guided graph learning method is used to improve the generalization performance. Since the label information is highly related to the task scene of the graph data, it can provide effective guidance for the model to extract node key information and the message passing process. Specifically, the label guided graph learning method is proposed, which mainly includes two parts: label guided information distillation and label guided message passing. Firstly, a pre-trained large language model is used to extract the keywords of the node text attributes, and the label information is used to assign a weight to each keyword, which reflects the importance of the keyword. The refined node representation is obtained by fusing all the keywords according to the importance. Then, the representation of each node and the representation of each label are fused to obtain a virtual node. In order to adaptively obtain the most useful information from the neighbor nodes, for each virtual node, the original center node is replaced by it to aggregate the relationships of the neighbor nodes. The aggregated node representation contains information about this class in the neighbor nodes, which can help the model better identify the class of the center node. Experiments are conducted on multiple datasets in different fields, and the results show that the model can still achieve excellent performance when encountering new and unseen data.
[0007] To achieve the above purpose, the label guided graph data alignment method is disclosed, which includes the following steps:
[0008] S1, a plurality of text attribute graphs are obtained, and the nodes and edges of the text attribute graphs include structure and text description;
[0009] S2, training: in the training process, the original text attribute graph is split into multiple subgraphs, and steps S3-S5 are performed on each subgraph;
[0010] S3, keyword extraction: keywords in the node text are extracted by a large language model;
[0011] S4, importance assignment: different weights are assigned to the keywords by label information, and the refined node representation is obtained by fusing them;
[0012] S5, fuse the label information and the node information to obtain a virtual node, aggregate the virtual node and the center node, and fuse the representation of the center node and the representation of all virtual nodes through the attention mechanism to enhance the representation ability of the center node;
[0013] S6, output the aligned text attribute graph.
[0014] Preferably, the keyword extraction includes:
[0015] A large language model is used to extract keywords in the node text, and the influence of redundant information is eliminated by using corresponding prompt words.
[0016] The node attributes and label descriptions are encoded using a pre-trained large language model to map them to the same semantic space.
[0017] Preferably, the encoding of the node attributes and label descriptions using a pre-trained language model to map them to the same semantic space comprises:
[0018] the text attribute of the i-th node, the text description of the j-th label category, which is encoded using a pre-trained language model as follows:
[0019]
[0020]
[0021] where h i and c j are the encoded node representation and label representation, respectively, m and n are the token lengths of the encoded node representation and label representation, respectively, d is the dimension of the last hidden layer of the language model, and LM represents the pre-trained model.
[0022] Preferably, the importance assignment comprises:
[0023] An importance coefficient is calculated for each text token in the node, which reflects the contribution of this token to accurately identifying the category of the node;
[0024] Each token embedding is multiplied by its corresponding importance coefficient, and the final node representation is obtained by weighted aggregation.
[0025] Preferably, the mathematical form of the importance assignment is as follows:
[0026] In order to improve the computational efficiency, the label information is compressed: the average value of all token embeddings of each label is taken, and only one single token is used to represent the label, which reduces the computational complexity while maintaining the core semantics of the label:
[0027]
[0028] The importance of each text token in the node is calculated by the following formula
[0029]
[0030] where W0 is a learnable parameter, represents the embedding of the j-th token of the i-th node, is the embedding of the k-th token of the i-th node, m is the total number of tokens in the node text attributes, is the average value for all label representations, C n is the number of label categories;
[0031] These coefficients are applied to a weighted aggregation process to generate a refined node representation that captures the most critical feature information of the node:
[0032]
[0033] Preferably, the fusing of the label information with the node information to obtain a virtual node comprises:
[0034] Fusing the information of each node with the label to obtain a virtual node, for each node, C virtual nodes are obtained, the representation of the j-th virtual node of the i-th node is calculated as follows:
[0035] e i,j = h i + αc j , j ∈ [1, C n ]
[0036] where α is a hyper-parameter, C n is the total number of labels, c j is the token of the j-th label;
[0037] The aggregation of the virtual nodes comprises: assigning a coefficient i,j to each virtual node e and its k-th neighbor node, which reflects the importance of the neighbor node to the virtual node, and the calculation formula is as follows:
[0038]
[0039] where represents the neighbor node of the node i, h k is the representation of the k-th node, and are learnable parameters; then, the is used to aggregate neighbor information to obtain the final representation of the virtual node, and the calculation is as follows:
[0040]
[0041] where β is a hyper-parameter, is a learnable parameter.
[0042] Preferably, the aggregating the virtual nodes comprises: for a subgraph with an adjacency matrix A, a degree matrix M and a feature matrix H processed by a pre-trained language model, adding a self-loop at each node in the graph, and then calculating a normalized adjacency matrix of the subgraph as follows:
[0043]
[0044] Using the normalized adjacency matrix, the application iteratively performs neighborhood aggregation, each iteration is denoted as:
[0045] h t+1 =A norm h t ,
[0046] Where h t is the feature matrix at the t-th iteration;
[0047] The fusion of the representation of the center node and the representation of all virtual nodes through the attention mechanism comprises: the fusion of the representation of the center node and the representation of all virtual nodes through the attention mechanism, so as to enhance the representation ability of the center node; the weight calculation formula between each virtual node j and the center node i is as follows:
[0048]
[0049] Where, ‖ represents a concatenation operation, is a learnable parameter, e i,k is the k-th virtual node of the i-th node;
[0050] Then, the final node representation is calculated as follows:
[0051]
[0052] Where γ is a hyperparameter.
[0053] Preferably, the training process further comprises subgraph sampling and similarity matching, and the subgraph sampling comprises:
[0054] For each data set, iteratively generate x-hop subgraphs using each node as the center;
[0055] According to the number of nodes contained in the subgraph and the number of categories of all nodes, only the subgraphs whose number of nodes and number of categories exceed a certain number are retained; specifically, for a subgraph s in a source data set v, the following condition is required to be met Where represents the number of different categories in the subgraph s, |C v | represents the total number of categories in the data set v.
[0056] Preferably, the nodes are classified by similarity matching:
[0057] The similarity between the node representation and each label embedding is calculated, where the label embedding with the highest similarity score to the node representation is predicted as the class of the node, in the form of:
[0058]
[0059] The optimization objective is to minimize the distance between the node representation and its label embedding, while maximizing the distance between the node representation and other label embeddings, and the loss function defining the optimization objective is defined as:
[0060]
[0061] Where j is the class of node i, τ is a temperature parameter, and sim represents the cosine similarity calculation.
[0062] The present application aims to improve the generalization ability of graph learning methods when faced with completely new, unseen data. It encodes node attributes and label descriptions using a language model to ensure consistency in feature dimensions and semantics between different datasets. By introducing a virtual node with cross-attention to node embedding, the present application compresses key information into a single token, capturing the most relevant node features. The virtual node also guides the message passing process, aggregating key information from neighboring nodes in the k-hop subgraph. Experimental results show that the present application improves the generalization ability on unseen datasets, highlighting its effectiveness in promoting zero-shot learning in graph learning. BRIEF DESCRIPTION OF DRAWINGS
[0063] Figure 1 The processing flow of the present application;
[0064] Figure 2 Text attributes of nodes and labels, as well as prompt words and extracted keywords;
[0065] Figure 3 t-SNE visualization results on the dataset. DETAILED DESCRIPTION
[0066] The present application will be further described below in conjunction with the accompanying drawings, but in no way limits the present application, any transformation or replacement based on the teaching of the present application belongs to the protection scope of the present application.
[0067] Artificial intelligence is the theory, method, technology and application system of using digital computer or digital computer controlled machine to simulate, extend and expand human intelligence, perceive environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology of computer science, which attempts to understand the essence of intelligence, and produces a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.
[0068] Natural language processing (NLP) is an important direction in the field of computer science and artificial intelligence. It studies various theories and methods that can realize effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science and mathematics. Therefore, the research in this field will involve natural language, i.e. the language used in daily life, so it is closely related to the study of linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question and answer, knowledge graph and other technologies.
[0069] The technical scheme provided by the embodiments of the present application relates to machine learning and natural language processing of artificial intelligence, and is specifically introduced and explained by the following embodiments.
[0070] Before introducing the embodiments of the present application, some terms related to the present application are explained.
[0071] 1. Distribution shift of graph: In many real-world scenarios, an important problem faced by graph models is distribution shift, i.e. the distribution of training data is inconsistent with that of test data, which may lead to a sharp decline in model performance. There are three forms of distribution shift of graph: distribution shift of node level, distribution shift of structure level and mixture of the two. Some methods focus on the average effect of the model in different environments, encouraging the model to maintain stable performance when facing distribution shift. However, they all need environment labels, which are often difficult to obtain in real scenarios. Therefore, some works learn the causality of features, eliminating the dependence on environment labels. However, they cannot be directly applied to new data in different fields without additional training, which limits their further application.
[0072] 2. Textual-Attributed Graphs: With the rapid development of large language models and their demonstrated generalization capabilities, some graph learning methods are moving away from datasets encoded using methods like TF-IDF. Instead, they use datasets in which the original text of nodes is used as their attributes, namely Textual-Attributed Graphs (TAGs). TAPE focuses on improving the expressive power of textual features in nodes. It leverages LLM to generate explanatory information about nodes, thereby improving the quality of initial node embeddings. LLMRec further applies similar ideas to recommender systems, significantly enhancing recommendation effectiveness by generating user and item features and interaction information. OFA focuses on task adaptation, incorporating task descriptions into the input graph to enable a single model to adapt to different tasks, achieving zero-shot and task-adaptive learning. While node text attributes can enrich node information and unify feature representations, they often contain redundant or irrelevant information. If left unfiltered, this can affect subsequent message passing and reduce model generalization performance. Therefore, effectively extracting and aggregating key textual information while maintaining semantic integrity and reducing irrelevant information interference is key to improving model generalization.
[0073] like Figure 1 As shown in the figure, this application proposes a label-guided graph data alignment method, LGL, which can achieve robust performance on different graph datasets. The model mainly consists of two parts: first, keyword extraction: extracting keywords from node text through a large language model; and importance assignment: assigning different weights to them based on label information and fusing them to obtain refined node representations. Then, this application fuses label information with node information to obtain virtual nodes, which are used to guide the message transmission process between nodes, enabling the model to adaptively aggregate the most important information according to different scenarios.
[0074] The label-guided graph learning method includes the following steps:
[0075] S1 obtains a text attribute graph of multiple digital equipment fields, wherein the nodes and edges in the text attribute graph include structure and text description; the nodes are physical entities or virtual mappings of digital equipment, etc., and the edges are connection relationships between physical entities or virtual mappings.
[0076] S2 training: During the training process, the original text attribute graph is split into multiple subgraphs, and steps S3-S5 are performed on each subgraph;
[0077] S3 keyword extraction: extract keywords from node text through a large language model;
[0078] S4 importance allocation: different weights are given to the label information, and a refined node representation is obtained by fusing them;
[0079] S5 fuse the label information with the node information to obtain a virtual node, aggregate the virtual node and the center node, and fuse the representation of the center node with the representation of all virtual nodes through an attention mechanism, thereby enhancing the representation ability of the center node;
[0080] S6 output the aligned text attribute graph.
[0081] In different fields of digital equipment, the meanings of nodes and edges are as follows: in digital equipment system modeling, nodes are defined as physical entities: such as sensor modules of numerical control machine tools, hardware units (such as PCL6045B motion control chips) of embedded controllers, or digital prototypes in weapon equipment test fields, or blue army equipment models; or virtual models: in digital twin systems, nodes can represent virtual mappings of physical equipment, such as digital twins of machine tools; edges are physical connections: such as electrical signal transmission paths between controllers and actuators, or real-time feedback channels between digital equipment and physical equipment in test fields; or data flow and control flow: such as instruction transmission edges between motion control cards and host computers, or data synchronization links between physical entities and virtual models in digital twin systems.
[0082] In the field of communication network and protocol optimization, nodes are communication devices: such as gateways, routers, and terminal devices in industrial Internet of Things, or bus nodes (such as CAN bus nodes) in numerical control systems; edges are communication links: representing wireless / wired transmission channels between devices, and weights can include bandwidth, delay, and other parameters or protocol interactions: such as in network optimization based on digital twin, edges can represent logical associations between layers of protocol stacks.
[0083] In testability and fault diagnosis, nodes are functional modules: such as sensors, actuators, and logic control units in complex equipment test systems; or fault modes: in testability modeling, nodes can represent potential fault points (such as capacitor failure of a circuit board); edges are signal transmission paths: such as input edges of sensor signals to controllers, or fault propagation paths (such as the logical relationship that a module failure causes the failure of adjacent modules) or test coverage relationships: edges can associate test points and functional modules under test, and weights reflect test effectiveness.
[0084] In the field of production process and resource scheduling, nodes are production units: such as machining workstations and quality inspection equipment in digital equipment production lines; or resource entities: including raw material inventory nodes and logistics robots; edges are process flows: representing the sequence of machining processes, and weights can include processing time or energy consumption; or resource dependencies: such as the dependency relationship of a certain workstation on a specific mold, or the material flow path in a supply chain.
[0085] In one embodiment, the label-guided information distillation includes keyword extraction, importance assignment.
[0086] In one embodiment, the keyword extraction includes:
[0087] Most traditional graph learning methods can only be trained and tested on the same dataset, because different datasets often use different methods to encode node attribute information, such as bag-of-words, skip-gram, or TF-IDF, which leads to significant differences in node feature dimensions and semantic information between different datasets (e.g., WikiCS has 300 dimensions, while PubMed has 500 dimensions). This misalignment of feature spaces makes it difficult for models to effectively pretrain on multiple graph datasets to obtain a universal and good representation. In addition, this misalignment also limits the effectiveness of applying the trained model on new datasets, because the knowledge learned by the model cannot be generalized across datasets, resulting in poor performance when processing unseen data.
[0088] To solve this problem, the present application introduces TAGs, which use raw text to describe the nodes of the graph. However, the present application does not directly use the raw text of the nodes for training, as it may contain useless or redundant information. Therefore, the present application first utilizes a large language model and designs a corresponding prompt to extract the keywords from the node text, eliminating the influence of redundant information. The text attributes of nodes and labels and the extracted keywords are as shown in Figure 2 .
[0089] Subsequently, the present application uses a pre-trained language model to encode the node attributes and label descriptions to map them to the same semantic space.
[0090] Specifically, represents the text attribute of the i-th node, represents the text description of the j-th label category, which is encoded using a pre-trained language model as follows:
[0091]
[0092]
[0093] where h i and c j are the encoded node representation and label representation, respectively, m and n are the token lengths of the encoded node representation and label representation, respectively, d is the dimension of the last hidden layer of the language model, and LM represents the pre-trained model.
[0094] In one embodiment, the importance assignment includes:
[0095] Although the key words extracted by the large model can eliminate the redundant information contained in the node text attribute to some extent, the information contained in each node of the graph is still complex, and if the most important information in each node cannot be extracted efficiently and accurately, it may affect the effectiveness of the subsequent message passing process, and thus reduce the generalization ability of the graph learning method. Then, how should the importance of the information in the node be defined. The classic graph node attribute encoding method TF-IDF calculates the importance of each word through frequency. Specifically, it evaluates the importance of each word by calculating the frequency of the word in the document and the inverse document frequency of the word in the entire corpus, that is, if a word frequently appears in a certain document and less frequently appears in other documents, then the importance of this word for the document is higher, and vice versa. However, unlike this, the present application judges the importance of the node information through the relevance of the label information and the node information. The present application first limits the research field to the node classification task, in which the correct identification of the category of the node is the ultimate goal of the present application, and among the information contained in the node, the part of the information that can help the present application achieve this goal is important information, and the information that cannot achieve this goal is redundant information. Specifically, the present application calculates an importance coefficient for each text token in the node using the label information, which reflects the contribution of this token to accurately identifying the category of the node. Then the present application multiplies each token embedding by its corresponding importance coefficient, and aggregates through weighting to obtain the final node representation, which the present application believes contains the most important information of each node.
[0096] First, in order to improve the computational efficiency, the present application compresses the label information. Because the content contained in the label is relatively simple, the present application takes the average of all token embeddings of each label, and only uses a single token to represent the label, which reduces the computational complexity while maintaining the core semantics of the label:
[0097]
[0098] The importance of each text token in the node is calculated by the following formula
[0099]
[0100] where W0 is a learnable parameter, represents the embedding of the jth token of the ith node, represents the embedding of the kth token of the ith node, and m is the total number of tokens in the node text attribute, is the average value represented by all labels, C n is the number of label categories.
[0101] Next, the application applies these coefficients to the weighted aggregation process, thereby generating a refined node representation that effectively captures the most critical feature information of the node:
[0102]
[0103] In this way, the application not only extracts the most discriminative parts of the node text, but also effectively avoids the negative impact of redundant information on node classification, thereby enhancing the expression ability and classification accuracy of the node representation.
[0104] Although encoding the TAG through the LM can map the node attributes of different data sets to the same semantic space, each data set may belong to a different field and thus contain different relationships, which results in different information aggregated from neighbor nodes for each node, which requires designing a flexible message passing mechanism that can adaptively aggregate the most useful information from neighbor nodes in different data sets. In one embodiment, the application proposes using label information to guide the message passing mechanism to aggregate the most needed information from neighbor nodes.
[0105] First, the application fuses the information of each node and label to obtain a virtual node. For each node, the application finally obtains C virtual nodes, and the representation calculation formula of the jth virtual node of the ith node is as follows:
[0106] Fusing the information of each node and label to obtain a virtual node, for each node, C virtual nodes are obtained, and the representation calculation formula of the jth virtual node of the ith node is as follows:
[0107] e i,j = h i + αc j , j ∈ [1, C n ]
[0108] Where α is a hyperparameter, C n is the total number of labels, and c j is the token of the jth label. The virtual node mixes the information of the center node and any label category. The application takes the neighbors of the center node as the neighbors of the virtual node and performs information aggregation on each virtual node. The application believes that this way can use the label information to help the node identify and aggregate the most relevant information for each class, thereby improving the classification accuracy of the node.
[0109] Specifically, the application assigns a coefficient to each virtual node and its neighbor node, which reflects the importance of the neighbor node to the virtual node, and the calculation formula is as follows:
[0110]
[0111] where denotes the neighbor nodes of node i, h k is the representation of the k-th node, and are learnable parameters. Then, the present application uses to aggregate neighbor information to get the final representation of the virtual node, which is computed as follows:
[0112]
[0113] where β is a hyper-parameter, is a learnable parameter.
[0114] In addition to aggregating virtual nodes, the present application also aggregates center nodes. Formally, consider a subgraph with adjacency matrix A, degree matrix M, and feature matrix H processed by a pre-trained language model (LM). Initially, the present application adds a self-loop on each node in the graph, and then the present application computes the normalized adjacency matrix of the subgraph as follows:
[0115]
[0116] Using the normalized adjacency matrix, the present application iteratively performs neighborhood aggregation, with each iteration denoted as:
[0117] h t+1 = A norm h t ,
[0118] where h t is the feature matrix at the t-th iteration.
[0119] Finally, the present application fuses the representation of the center node with the representation of all virtual nodes through an attention mechanism, thereby enhancing the representation ability of the center node. The weight between each virtual node j and the center node i is computed as follows:
[0120]
[0121] where || denotes the concatenation operation, and W4 is a learnable parameter. Then, the present application computes the final node representation as follows:
[0122]
[0123] where γ is a hyper-parameter. The present application replaces the dependence on the original node representation by introducing virtual nodes to amplify the expressive power of the representation, which guides the message passing mechanism to identify and aggregate relevant information from neighboring nodes.
[0124] In one embodiment, the training process of the present application includes subgraph sampling and similarity matching.
[0125] In the training process, the present application splits the original graph into multiple subgraphs and performs the above operations on each subgraph. However, different subgraphs often have significant differences in terms of graph size, density, node type, edge type, and overall structure topology, etc. Therefore, in one embodiment, the present application uses subgraph sampling techniques to filter out overly simple subgraphs, as they cannot provide sufficient structural and semantic information to support effective transfer learning.
[0126] For each dataset, the present application iteratively generates k-hop subgraphs using each node as the center. Subsequently, the present application filters out subgraphs that do not meet certain conditions based on the number of nodes and the number of classes contained in the subgraph. Specifically, for a subgraph s in the source dataset v, the present application requires that the following conditions be met where represents the number of different classes in the subgraph s, |C v represents the total number of classes in the dataset v. This subgraph sampling technique ensures that each subgraph can sufficiently capture the class diversity and topology of the dataset, allowing the model to learn the most basic information.
[0127] In one embodiment, after obtaining the final representation of the node, the present application classifies the nodes through similarity matching. The present application calculates the similarity between the node representation and each label embedding, where the label embedding with the highest similarity score to the node representation is used as the predicted class of the node. The specific form is:
[0128]
[0129] The optimization objective is to minimize the distance between the node representation and its corresponding label embedding, while maximizing the distance between the node representation and other label embeddings. The loss function is defined as:
[0130]
[0131] where j is the class to which node i belongs.
[0132] The present application conducts experiments on several public datasets in multiple fields. Each node in these datasets contains data of inner ring, outer ring, rolling body failure, and normal state, and the edges represent fault modes. For more information about these datasets, please refer to Table 1.
[0133] Table 1. Dataset details
[0134] Dataset Number of nodes Number of edges Number of classes CWRU 19717 88648 3 MEPT 3186 8450 6
[0135] The method of the present application is compared with a plurality of baseline methods, which can be divided into four categories: (1) MLP, which uses a multilayer perceptron to obtain node representation; (2) supervised learning methods such as GCN, GAT and GraphSAGE; (3) self-supervised methods including GraphCL and DGI, where GraphCL is a graph contrastive learning framework that learns invariant and transferable representations using graph augmentation techniques, and DGI learns useful representations by maximizing mutual information; (4) graph transformer networks including NodeFormer and DIFFormer; (5) large language model equipped graph base models such as OFA.
[0136] All experiments are implemented under the PyTorch framework and calculated using a single NVIDIA A6000 (48G) GPU. The accuracy results are shown in Table 2.
[0137] The results clearly show that LGL has significantly superior performance compared to all baseline models, achieving significant improvement and highlighting the strong advantage of LGL in generalization ability.
[0138] Table 2. Zero-shot accuracy and F1 scores of each dataset
[0139] CWRU MEPT MLP 0.0871 0.073 GCN 0.0336 0.205 GAT 0.1537 0.172 GraphSAGE 0.092 0.039 GraphCL 0.137 0.073 DGI 0.120 0.188 NodeFormer 0.132 0.048 DIFFormer 0.077 0.204 OFA 0.287 0.052 LGL 0.6548 0.452
[0140] In addition to quantitative analysis, the present application further analyzes the expressiveness of the method of the present application. The present application visualizes the changes in node representation before and after training on the dataset using t-SNE technology, as shown in Figure 3 As shown in Figure 3 , it can be observed that after training, the class boundaries are clearer and the intra-class structure is more compact, which indicates that the method of the present application has learned a representation with expressiveness.
[0141] The present application aims to improve the generalization ability of graph learning methods when faced with completely new, unseen data. The present application encodes node attributes and label descriptions using a language model to ensure consistency in feature dimensions and semantics between different datasets. By introducing a virtual node that performs cross-attention with node embeddings, the present application compresses key information into a single token, thereby capturing the most relevant node features. The virtual node also guides the message passing process, aggregating key information from neighboring nodes in the k-hop subgraph. Experimental results show that the present application improves the generalization ability on unseen datasets, highlighting its effectiveness in advancing zero-shot capability in graph learning.
[0142] As used herein, the word "preferred" is intended to serve as an example, instance, or illustration. Any aspect or design described herein as "preferred" is not necessarily to be construed as advantageous over other aspects or designs. Rather, the use of the word "preferred" is intended to present concepts in a concrete manner. As used in this application, the term "or" is intended to mean an inclusive "or" rather than an exclusive "or." That is, unless otherwise specified or clear from the context, "X employs A or B" is intended to mean any of the naturally inclusive permutations. That is, if X employs A; X employs B; or X employs both A and B, then "X employs A or B" is satisfied in any of the foregoing examples.
[0143] Moreover, although the present disclosure has been shown and described with respect to one or implementation, those skilled in the art will think of equivalent variations and modifications based on reading and understanding of this specification and the accompanying drawings. The present disclosure includes all such modifications and variations and is limited only by the scope of the appended claims. In particular, with respect to the various functions performed by the above-mentioned components (such as elements, etc.), the terms used to describe such components are intended to correspond to any component (unless otherwise indicated) that performs the specified function of the component (such as it is functionally equivalent), even if structurally different from the disclosed structure that performs the function in the exemplary implementation of the present disclosure shown herein. In addition, although the specific features of the present disclosure have been disclosed with respect to only one of several implementations, such features can be combined with one or other features of other implementations that can be desired and advantageous for a given or specific application. Moreover, insofar as the terms "including", "having", "containing" or their variations are used in specific embodiments or claims, such terms are intended to be included in a manner similar to the term "comprising".
[0144] The functional units in the embodiments of the present invention may be integrated into a single processing module, or each unit may exist physically separately, or multiple or more units may be integrated into a single module. The aforementioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. The aforementioned storage medium may be a read-only memory, a magnetic disk, or an optical disk, etc. The aforementioned devices or systems may execute the storage method in the corresponding method embodiment.
[0145] In summary, the above embodiment is one implementation method of the present invention, but the implementation method of the present invention is not limited to the described embodiment. Any other changes, modifications, substitutions, combinations, and simplifications that deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the scope of protection of the present invention.
Claims
1. A label-guided graph data alignment method, characterized by: The following steps are involved: S1 obtains a plurality of text attribute graphs, wherein the nodes and edges in the graphs of the text attribute graphs include structure and text description; S2 training: During the training process, the original text attribute graph is split into multiple subgraphs, and steps S3-S5 are performed on each subgraph; S3 keyword extraction: extract keywords from node text through a large language model; S4 Importance Assignment: Assign different weights to label information and fuse them to obtain refined node representations; S5 fuses label information with node information to obtain virtual nodes, aggregates virtual nodes and central nodes, and fuses the representation of the central node with the representation of all virtual nodes through the attention mechanism, thereby enhancing the representation ability of the central node; S6 outputs the aligned text attribute map.
2. The label-guided graph data alignment method according to claim 1, characterized in that: The keyword extraction includes: Utilize a large language model and use corresponding prompt words to extract keywords from node texts, eliminating the influence of redundant information. A pre-trained large language model is used to encode node attributes and label descriptions to map them into the same semantic space.
3. The label-guided graph data alignment method according to claim 2, characterized in that: The pre-trained language model is used to encode node attributes and label descriptions to map them into the same semantic space, including: Represents the text attribute of the i-th node, Represents the text description of the j-th label category, which is encoded using the pre-trained language model as follows: where h i and c j are the encoded node representation and label representation, m and n are the token lengths of the encoded node representation and label representation, d is the dimension of the last hidden layer of the language model, and LM represents the pre-trained model.
4. The label-guided graph data alignment method according to claim 2, characterized in that: The importance allocation includes: The importance coefficient is calculated for each text token in the node using the label information, which reflects the contribution of this token to the accurate identification of the node category; Each token embedding is multiplied by its corresponding importance coefficient and weighted aggregation is performed to obtain the final node representation.
5. The label-guided graph data alignment method according to claim 4, characterized in that: The mathematical form of the importance distribution is as follows: To improve computational efficiency, the tag information is compressed: the average of all token embeddings for each tag is taken, and only a single token is used to represent the tag, which reduces computational complexity while maintaining the core semantics of the tag: The importance of each text token in a node is calculated using the following formula Among them, W0 is a learnable parameter, represents the embedding of the jth token of the i-th node, represents the embedding of the kth token of the i-th node, m is the total number of tokens in the node text attribute, is the average value of all label representations, C n is the number of label categories; Generate a refined node representation that captures the most critical feature information of the node:
6. The label-guided graph data alignment method according to claim 5, characterized in that: The step of fusing the label information with the node information to obtain a virtual node includes: A virtual node is obtained by fusing the information of each node and the label. For each node, C virtual nodes are obtained. The formula for calculating the representation of the j-th virtual node of the i-th node is as follows: its i,j =h i +αc j ,j∈[1,C n ] Among them, α is a hyperparameter, C n is the total number of labels, c j is the token of the jth tag; Aggregating virtual nodes includes: for each virtual node e i,j and its kth neighbor node is assigned a coefficient It reflects the importance of neighbor nodes to the virtual node. The calculation formula is as follows: in represents the neighbor nodes of node i, h k is the representation of the kth node, and are learnable parameters; then, using To aggregate neighbor information to obtain the final representation of the virtual node, the calculation is as follows: where β is a hyperparameter, is a learnable parameter.
7. The label-guided graph data alignment method according to claim 6, characterized in that: The aggregating of virtual nodes includes: for a subgraph having an adjacency matrix A, a degree matrix M, and a feature matrix H processed by a pre-trained language model, adding self-loops to each node in the graph, and then calculating the normalized adjacency matrix of the subgraph as follows: Using this normalized adjacency matrix, neighborhood aggregation is performed iteratively, with each iteration being denoted as: h t+1 =A norm h t , where h t is the feature matrix at the tth iteration; The representation of the central node is fused with the representation of all virtual nodes through the attention mechanism, including: the representation of the central node is fused with the representation of all virtual nodes through the attention mechanism, thereby enhancing the representation ability of the central node; the weight calculation formula between each virtual node j and the central node i is as follows: Among them, ‖ represents the concatenation operation, is a learnable parameter, e i,k is the kth virtual node of the i-th node; The final node representation is then calculated as follows: Among them, γ is a hyperparameter.
8. The label-guided graph data alignment method according to claim 7, characterized in that: The training process also includes subgraph sampling and similarity matching. The subgraph sampling includes: For each dataset, iteratively generate x-hop subgraphs, using each node as the center; Filter the subgraphs based on the number of nodes and the number of categories of all nodes, and only retain the subgraphs with more than a certain number of nodes and categories; specifically, for the subgraph s in the source dataset v, the condition in represents the number of different categories in subgraph s, |C v | represents the total number of categories in the dataset v.
9. The label-guided graph data alignment method according to claim 8, characterized in that: Classify nodes by similarity matching: Calculate the similarity between the node representation and each label embedding, where the label embedding with the highest similarity score to the node representation is used as the node prediction category. The specific form is: The optimization goal is to minimize the distance between the node representation and its label embedding, while maximizing the distance between the node representation and other label embeddings. The loss function that defines the optimization goal is defined as: Among them, j is the category to which node i belongs, τ is the temperature parameter, sim represents the cosine similarity calculation, c j and c k are the tokens of the j-th and k-th tags.