Cross-domain heterogeneous graph link prediction method based on structural perception and large language model

By employing structure-aware and large language model methods, a compact subgraph is constructed and combined with semantic-position encoding and cross-attention mechanisms. This addresses the issues of inefficiency and high cost in structural-semantic fusion in cross-domain heterogeneous graph link prediction, achieving efficient and robust cross-domain link prediction results.

CN121936555BActive Publication Date: 2026-05-26JIANGXI UNIVERSITY OF FINANCE AND ECONOMICS
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JIANGXI UNIVERSITY OF FINANCE AND ECONOMICS
Filing Date
2026-03-30
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively integrate structural topology and textual semantics in cross-domain heterogeneous graph link prediction, and suffer from insufficient adaptability to cross-domain distribution offsets, resulting in poor model generalization ability and high training costs.

Method used

We employ a structure-aware and large language model-based approach, constructing compact subgraphs through importance-aware sampling. We combine semantic-positional encoding and cross-attention mechanisms, fusing semantic matrices and topological positional features from the endpoint perspective. We then use a frozen large language model and a lightweight contextual cue attention module for link prediction.

Benefits of technology

It significantly improves the efficiency of utilizing structural semantic features in cross-domain scenarios, enhances the model's robustness to distribution shifts, reduces training and storage costs, and achieves efficient cross-domain heterogeneous graph link prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121936555B_ABST
    Figure CN121936555B_ABST
Patent Text Reader

Abstract

This invention proposes a cross-domain heterogeneous graph link prediction method based on structure awareness and a large language model. The method includes: constructing a text-attribute heterogeneous graph and defining the cross-domain inductive link prediction task; constructing a subgraph for target node pairs based on importance awareness, performing semantic encoding and topological position encoding from the endpoint perspective; injecting structural information into a frozen large language model using a contextual cue attention module to obtain hidden state features that fuse structure and semantics; optimizing the fused features using autoregressive cross-entropy loss to complete the cross-domain inductive heterogeneous graph link prediction. This invention designs awareness rules based on the topological structure of the heterogeneous graph and text semantics, making the link prediction decision traceable to specific graph structural and semantic features. This enhances the model's interpretability, provides an intuitive reasoning basis for graph analysis tasks, and addresses the shortcomings of traditional cross-domain link prediction models, such as poor generalization ability and inefficient structural-semantic fusion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of graph representation learning and natural language processing, and in particular to a method for predicting cross-domain heterogeneous graph links based on structure awareness and large language models. Background Technology

[0002] Heterogeneous graphs, composed of various types of nodes and edges, are widely found in real-world systems such as social networks, knowledge graphs, recommender systems, and biological networks. Heterogeneous graph link prediction, a fundamental task in graph analysis, aims to infer missing or potential edges between node pairs, providing support for downstream applications. Statistical data from relevant professional research shows that heterogeneous graph link prediction in cross-domain scenarios faces significant challenges in model generalization due to semantic and topological distribution shifts. With the increasing cross-domain propagation and heterogeneity of graph data, the need for cross-domain inductive heterogeneous graph link prediction models is becoming increasingly urgent. Cross-domain inductive link prediction capabilities are crucial for graph representation learning and the development of precise graph analysis solutions. Specifically, heterogeneous graphs from different domains exhibit significant differences in node types, edge distributions, and textual semantics, making it difficult to directly transfer and apply traditional graph neural network models.

[0003] In recent years, heterogeneous graph neural network models, such as Heterogeneous Graph Attention Networks (HAN) and Heterogeneous Graph Transformers (HGT), have been widely used in heterogeneous graph link prediction and have effectively improved prediction performance in this field to a certain extent. However, these heterogeneous graph neural network models still have significant limitations, primarily manifested in insufficient adaptability to cross-domain distribution shifts and a lack of ability to fuse graph structure with textual semantics. Specifically, the structural topology and node textual attributes in heterogeneous graphs are two complementary types of information. Traditional models mostly focus only on learning structural features or simply concatenating and fusing textual features, making it difficult to fully explore the potential intrinsic connections between structure and semantics. Furthermore, the graph distributions of the source and target domains differ significantly in cross-domain scenarios. The weights learned by traditional models based on source domain data are difficult to adapt to the topological and semantic patterns of the target domain, thus affecting the accuracy of cross-domain inductive link prediction.

[0004] In recent years, Large Language Models (LLMs) have become an important direction for solving cross-domain graph analysis problems due to their powerful cross-domain semantic understanding and knowledge transfer capabilities. Researchers have begun to explore the integration of LLMs with graph structure knowledge to improve the cross-domain generalization ability of heterogeneous graph link prediction. However, existing cross-domain inductive heterogeneous graph link prediction methods that fuse graphs and LLMs still have many shortcomings: graph-to-text serialization methods lack explicit and controllable topological location cues, making it difficult to characterize the topological features of target node pairs under distribution shifts; embedding graph tokens into LLMs can lead to representation mismatch and task-specific biases, affecting the fusion effect of structure and semantics; heavy fine-tuning of LLMs incurs high training and storage costs, limiting the scalability of the model. These problems make it difficult for existing methods to balance prediction accuracy and model efficiency in cross-domain inductive heterogeneous graph link prediction tasks, becoming a key bottleneck in the development of this field. Summary of the Invention

[0005] In view of the above situation, the main objective of this invention is to propose a cross-domain heterogeneous graph link prediction method based on structure awareness and large language model in order to solve the above-mentioned technical problems.

[0006] This invention proposes a cross-domain heterogeneous graph link prediction method based on structure awareness and large language models. The method includes the following steps:

[0007] Step 1: Construct a text attribute heterogeneous graph and define a cross-domain inductive heterogeneous graph link prediction task. Obtain node, edge, text attribute, and relation type information of the source domain heterogeneous graph and determine the link prediction query rules for the target domain heterogeneous graph. The link prediction query rules include the text descriptions of the source nodes and target nodes, as well as the relation types to be verified.

[0008] Step 2: Construct an importance-aware subgraph for the target node pairs, and sample shared neighbors by combining structural importance score and semantic relevance score to obtain a compact subgraph;

[0009] Step 3: Perform semantic-location encoding of endpoint perspective based on compact subgraph to generate enhanced text descriptions from the perspectives of source node and target node, and combine random walk location encoding and shortest path distance encoding to obtain endpoint perspective semantic matrix and topological location features.

[0010] Step 4: Integrate the link prediction query rules into the prompt template and input them into the frozen large language model to obtain the initial hidden state; input the endpoint perspective semantic matrix and topological location features into the context prompt attention module, and inject the endpoint perspective semantic matrix and topological location features into the initial hidden state through the cross-attention mechanism to obtain the final updated hidden state features.

[0011] Step 5: Input the final updated hidden state features into the frozen large language model decoder. By transforming the cross-domain inductive heterogeneous graph link prediction into a Boolean value generation task, the cross-domain inductive heterogeneous graph link prediction results of the target node pairs are obtained.

[0012] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0013] 1. This invention adopts a compact subgraph encoding centered on node pairs to encode the structural and semantic associations of heterogeneous graphs. By prioritizing the retention of shared evidence with information through importance-aware sampling, it breaks through the limitations of traditional models that rely solely on global graph structures or simple text splicing, and significantly improves the utilization efficiency of structural and semantic features in cross-domain scenarios.

[0014] 2. This invention, through the hybrid design of semantic-position encoding from the endpoint perspective and contextual cue attention module, can capture the semantic features and topological position features of nodes in heterogeneous graphs respectively. Compared with traditional heterogeneous graph neural networks, which can only capture structural features or single semantic features, this invention achieves deep fusion of structure and semantics through cross-attention mechanism, thereby improving the robustness of the model to cross-domain distribution shifts.

[0015] 3. This invention designs structure-aware rules based on the topological structure of heterogeneous graphs and textual semantics, making the decision basis for link prediction traceable to specific graph structure and semantic features. The model is more interpretable, providing an intuitive reasoning basis for graph analysis tasks and solving the pain points of poor generalization ability and inefficient structural semantic fusion of traditional cross-domain link prediction models.

[0016] 4. This invention adopts a strategy of freezing the large language model and sentence encoder, and optimizing only the lightweight contextual cue attention module, which greatly reduces the training and storage costs of the model. Compared with the traditional method of heavily fine-tuning the large language model, it only requires optimizing 2.35% of the model parameters, and achieves parameter-efficient cross-domain inductive heterogeneous graph link prediction.

[0017] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by means of embodiments of the invention. Attached Figure Description

[0018] Figure 1 This is a flowchart illustrating the steps of the cross-domain heterogeneous graph link prediction method based on structure awareness and large language model proposed in this invention.

[0019] Figure 2 This is an overall structural diagram of the cross-domain heterogeneous graph link prediction method based on structure awareness and large language model proposed in this invention. Detailed Implementation

[0020] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0021] These and other aspects of the embodiments of the present invention will become clear from the following description and accompanying drawings. In these descriptions and drawings, some specific embodiments of the present invention are specifically disclosed to illustrate some ways of implementing the principles of the embodiments of the present invention; however, it should be understood that the scope of the embodiments of the present invention is not limited thereto.

[0022] Please see Figure 1 This embodiment provides a method for predicting cross-domain heterogeneous graph links based on structure awareness and a large language model. The method includes the following steps:

[0023] Step 1: Construct a text attribute heterogeneous graph and define a cross-domain inductive heterogeneous graph link prediction task. Obtain node, edge, text attribute, and relation type information of the source domain heterogeneous graph, and determine the link prediction query rules for the target domain heterogeneous graph. The link prediction query rules include the text descriptions of the source node and the target node, as well as the relation types to be verified.

[0024] Please see Figure 2 In step 1, a text attribute heterogeneous graph is constructed, and a cross-domain inductive heterogeneous graph link prediction task is defined. The node, edge, text attribute, and relation type information of the source domain heterogeneous graph are obtained, and the link prediction query rules for the target domain heterogeneous graph are determined. The link prediction query rules include the text descriptions of the source and target nodes, as well as the relation types to be verified. Specifically, the following sub-steps are included:

[0025] Constructing a heterogeneous graph of text attributes and for each node Match the corresponding text description ;

[0026] in, Represents a heterogeneous graph of text attributes. Represents a set of nodes. Represents an edge set. Represents the adjacency matrix. Represents a set of node types. Represents a set of relation types. Represents the set of text attributes of a node;

[0027] Define a cross-domain inductive heterogeneous graph link prediction task, in a source domain heterogeneous graph atlas. Model training is completed on the target domain heterogeneous map with distribution offset. Link prediction is performed, with the goal of learning a scoring function. To infer node pairs Does an edge of the specified type exist between them?

[0028] Determine the link prediction query rules for the heterogeneous graph of the target domain, and transform link prediction into a binary classification task. The link prediction query rules include textual descriptions of source nodes and target nodes, as well as the relationship types to be verified.

[0029] Data preprocessing is performed on the heterogeneous graphs of the source and target domains. A node-level inductive partitioning strategy is used to divide the training, validation, and test sets. The associated edges of the test nodes are pruned to avoid data leakage. Negative samples are randomly drawn from the two-hop neighborhood of the source node to balance the dataset.

[0030] It should be noted that the construction of the text attribute heterogeneous graph must ensure the completeness and accuracy of the node text description. For nodes without text attributes, basic descriptions can be supplemented through domain knowledge to ensure the effectiveness of semantic encoding. The definition of cross-domain inductive task must strictly distinguish between the source domain and the target domain. The target domain heterogeneous graph is not visible during the model training phase to avoid model evaluation bias caused by data leakage.

[0031] Step 2: Construct an importance-aware subgraph for the target node pairs, and sample shared neighbors by combining structural importance score and semantic relevance score to obtain a compact subgraph.

[0032] In step 2, an importance-aware subgraph is constructed for the target node pairs, and shared neighbors are sampled by combining structural importance scores and semantic relevance scores to obtain a compact subgraph. This includes the following sub-steps:

[0033] Calculate target node pair of Jump to shared neighbor set And set a jump budget To control the number of nodes in each hop sampling;

[0034] in, To represent nodes of Jump to neighbor set, To represent nodes of Jump to the neighbor set;

[0035] Based on a shared neighbor set and combined with the Adamic–Adar heuristic, the weights of the center nodes of the height number are decayed to obtain the structural importance score. The following relationship exists in the corresponding process:

[0036] ;

[0037] in, The score represents the importance of the structure. Indicates an indicator function, Represents a node The degree, Indicates from node To the node of Path skipping count Indicates from node To the node of Path skipping count Indicates taking the logarithm;

[0038] Based on a shared neighbor set, a frozen text encoder (such as all-MiniLM-L6-v2) is used to transform the node text description into a semantic embedding. Cosine similarity is used to measure the semantic matching degree between the neighbor and target node pairs to obtain a semantic relevance score. The following relationship exists in the corresponding process:

[0039] ;

[0040] in, Indicates semantic relevance score, Represents the cosine similarity function. Represents a node semantic embedding, Represents a node semantic embedding, Represents a node semantic embedding;

[0041] The structural importance score and semantic relevance score are fused to obtain a unified sampling score. The following relationship exists in the corresponding process:

[0042] ;

[0043] in, Indicates the uniform sampling score. This represents the hyperparameters used to balance structure and semantics;

[0044] Jumping levels based on the unified sampling score Sampling is performed; if the number of shared neighbors is insufficient, samples are added from the pool of non-shared neighbors to obtain a compact subgraph centered on the target node pair. ;

[0045] in, Represents the set of nodes in a subgraph. This represents the edge set of the subgraph.

[0046] It should be noted that, in this embodiment, the hyperparameters used to balance structure and semantics... Setting it to 0.5, structural and semantic features are considered equally; importance-aware sampling can effectively preserve structural and semantic evidence related to the target node pair, significantly improving the information density of the subgraph compared to random sampling or sampling based solely on structure; the construction of compact subgraphs only retains the target node pair and its related neighbors, avoiding redundant information in the global graph structure and reducing the computational complexity of subsequent encoding and fusion.

[0047] Step 3: Perform semantic-location encoding of endpoint perspective based on compact subgraph to generate enhanced text descriptions from the perspectives of source node and target node, and combine random walk location encoding and shortest path distance encoding to obtain the endpoint perspective semantic matrix and topological location features.

[0048] In step 3, semantic-location encoding of the endpoint perspective is performed based on the compact subgraph to generate enhanced text descriptions from the source node perspective and the target node perspective, respectively. This is combined with random walk location encoding and shortest path distance encoding to obtain the endpoint perspective semantic matrix and topological location features. Specifically, this includes the following sub-steps:

[0049] Based on compact subgraph Construct two endpoint view subgraphs, one for the source node's view subgraph. and the target node's perspective subgraph ;

[0050] in, Indicates the source node The set of sampled neighbor nodes, Represents the target node The set of sampled neighbor nodes, Represents the source node's perspective subgraph edge set, Represents the target node's view subgraph edge set;

[0051] The text description of each sampling node is enhanced with a role-hop count prefix to generate an enhanced text description from the endpoint perspective. The following relationship exists in the corresponding process:

[0052] ;

[0053] in, Enhanced text descriptions representing endpoint perspectives. Indicates the source node role identifier. Represents a node The text description, Represents a node of Jump to neighbor set, Indicates the source node The role of hop neighbors - hop count joint identifier, This indicates a text concatenation operation. Indicates the maximum number of hops. Represents a node The original text description;

[0054] The enhanced text description is encoded using a frozen sentence encoder to obtain an endpoint-view semantic matrix. The following relationship exists in the correspondence process:

[0055] ;

[0056] in, Represents the endpoint perspective semantic matrix. This indicates that the sentence has been processed by the sentence encoder. Endpoints Nodes in view Enhanced text description, Endpoints The node set of the view subgraph Indicates endpoints;

[0057] Calculate the random walk position codes for each of the two endpoint view subgraphs to obtain the topological position feature matrix. The following relationship exists in the correspondence process:

[0058] ;

[0059] in, Represents the topological location feature matrix. This represents the random walk position encoding function. Endpoints Perspective subgraph;

[0060] The shortest path distance between target node pairs in the original heterogeneous graph is calculated and mapped to a learnable embedding vector to obtain pairwise topological location features. The following relationship exists in the mapping process:

[0061] ;

[0062] in, Representing paired topological location features, This represents the mapping function from distance to embedding. Indicates the shortest path length;

[0063] Endpoint perspective semantic matrix , and topological location features , , Together they constitute a set of structural perception features.

[0064] It should be noted that the endpoint-view encoding method can capture the bidirectional topological and semantic features of the target node pair. Compared with the single-view encoding, it is more in line with the bidirectional reasoning requirements of heterogeneous graph link prediction. Random walk position encoding and shortest path distance encoding provide local topological features at the node level and global topological features at the node pair level, respectively, realizing multi-level encoding of topological position information.

[0065] Step 4: Integrate the link prediction query rules into the prompt template and input them into the frozen large language model to obtain the initial hidden state; input the endpoint perspective semantic matrix and topological location features into the context prompt attention module, and inject the endpoint perspective semantic matrix and topological location features into the initial hidden state through the cross-attention mechanism to obtain the final updated hidden state features.

[0066] In step 4, the link prediction query rules are integrated into the prompt template and input into the frozen large language model to obtain the initial hidden state. The endpoint perspective semantic matrix and topological location features are input into the contextual prompt attention module, and the endpoint perspective semantic matrix and topological location features are injected into the initial hidden state through a cross-attention mechanism to obtain the final updated hidden state features. Specifically, this includes the following sub-steps:

[0067] The text descriptions of the source node and the target node, as well as the relationship type to be verified, are integrated into the natural language prompt template and input into the frozen large language model for processing to obtain the initial hidden state. The natural language prompt template includes three parts: system instructions, user queries, and assistant answers. The system instructions limit the task type and output format, and the user queries contain core node and relationship information.

[0068] Endpoint perspective semantic matrix is ​​learned through a projective layer. , and topological location features , Mapping to the hidden space of a large language model to obtain adapted semantic features. , and adapted node-level location features , ;

[0069] Semantic context alignment is performed based on a context-sensitive attention module, and the adapted semantic features are concatenated into semantic memory. By injecting semantic memory into the initial hidden state through multi-head cross-attention, the hidden state after the first update is obtained, and the following relationship exists:

[0070] ;

[0071] in, This indicates that the file is hidden after the first update. This indicates a semantic branching layer normalization operation. Indicates the initial hidden state. This indicates that the semantic alignment multi-head attention module has been used for processing. Represents semantic memory, The query matrix representing semantic branches, The key matrix representing semantic branches, The value matrix representing semantic branches;

[0072] Positional context alignment is performed based on a context-sensitive attention module, and the adapted node-level positional features are concatenated into a positional memory. By injecting memories into the hidden state after the first update through independent multi-head cross-attention, the hidden state after the second update is obtained, and the following relationship exists:

[0073] ;

[0074] in, This indicates that the file is hidden after the first update. This indicates the normalization operation for the positional branch layer. This indicates that the data has been processed by the position-aligned multi-head attention module. Indicates positional memory, The query matrix represents the positional branches. The key matrix representing the positional branches, The value matrix representing the positional branches;

[0075] The paired topological location features are broadcast to all token locations in the hidden state after the second update, completing the deep fusion of structure and semantics to obtain the final updated hidden state features; the paired topological location features provide global topological prior information for link prediction, improving the inference accuracy of the model;

[0076] The contextual cue attention module optimizes only the projection matrix and cross-attention parameters, while all parameters of the large language model and sentence encoder remain frozen.

[0077] It should be noted that the contextual cue attention module adopts a query-driven fusion approach, using the compact subgraph as external memory. Through a cross-attention mechanism, the large language model autonomously retrieves structural and semantic information related to link prediction. Compared with the traditional forced embedding injection method, this effectively alleviates the problem of mismatch between structural and semantic representations. The strategy of freezing the large language model retains its powerful cross-domain semantic understanding capabilities, and only optimizes the lightweight contextual cue attention module, achieving parameter-efficient model training.

[0078] Step 5: Input the final updated hidden state features into the frozen large language model decoder. By transforming the cross-domain inductive heterogeneous graph link prediction into a Boolean value generation task, the cross-domain inductive heterogeneous graph link prediction results of the target node pairs are obtained.

[0079] In step 5, the finally updated hidden state features are input into the frozen large language model decoder. By transforming the cross-domain inductive heterogeneous graph link prediction into a Boolean value generation task (the model output is "True" or "False", corresponding to the existence and non-existence of the link, respectively), the cross-domain inductive heterogeneous graph link prediction results of the target node pairs are obtained. The process also includes a training process, specifically:

[0080] We define an autoregressive cross-entropy loss function, which optimizes the loss only for the generation process of the answer token. Other token generation processes in the large language model are not included in the loss calculation. The following relationship exists in the corresponding process:

[0081] ;

[0082] in, This represents the autoregressive cross-entropy loss function. Indicates the length of the answer token sequence. express The conditional probability distribution, This represents the learnable parameters of the context-sensitive attention module. Indicates the first One answer token, Indicates the preceding A generated token, This represents the hidden state characteristics after the final update;

[0083] The AdamW optimizer is used for parameter updates, with the learning rate set to 1e-4 and the weight decay set to 1e-5. The cosine annealing learning rate scheduler is used to dynamically adjust the learning rate, with the minimum learning rate set to 1% of the initial learning rate. An early stopping strategy is set, and training is stopped when the validation set loss does not decrease for 16 consecutive epochs to avoid model overfitting.

[0084] A gradient accumulation strategy is adopted, with a batch size of 1 and a gradient accumulation step of 2, resulting in an equivalent batch size of 2. Training is completed on a single NVIDIA RTX 4090 GPU, reducing the requirements for hardware resources.

[0085] The model output Boolean values ​​are mapped to link prediction scores, with "True" corresponding to a score of 1 (link exists) and "False" corresponding to a score of 0 (link does not exist) to obtain the cross-domain inductive heterogeneous graph link prediction results for the target node pairs. The score threshold can be set according to actual needs to perform secondary filtering of the link prediction results.

[0086] It should be noted that the autoregressive cross-entropy loss only optimizes the generation process of the answer token, allowing the model to focus more on the core task of link prediction and improve training efficiency; the binary classification decision module based on the large language model makes full use of the reasoning ability of the large language model, and combines the fused structural and semantic features to achieve high-precision cross-domain inductive heterogeneous graph link prediction.

[0087] It should be understood that although the steps in the flowcharts of the various embodiments of the present invention are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the various embodiments may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the sub-steps or stages of other steps.

[0088] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0089] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0090] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.

Claims

1. A method for predicting cross-domain heterogeneous graph links based on structure awareness and large language models, characterized in that, The method includes the following steps: Step 1: Construct a text attribute heterogeneous graph and define a cross-domain inductive heterogeneous graph link prediction task. Obtain node, edge, text attribute, and relation type information of the source domain heterogeneous graph and determine the link prediction query rules for the target domain heterogeneous graph. The link prediction query rules include the text descriptions of the source nodes and target nodes, as well as the relation types to be verified. Step 2: Construct an importance-aware subgraph for the target node pairs, and sample shared neighbors by combining structural importance score and semantic relevance score to obtain a compact subgraph; Step 3: Perform semantic-location encoding of endpoint perspective based on compact subgraph to generate enhanced text descriptions from the perspectives of source node and target node, and combine random walk location encoding and shortest path distance encoding to obtain endpoint perspective semantic matrix and topological location features. Step 4: Integrate the link prediction query rules into the prompt template and input them into the frozen large language model to obtain the initial hidden state; The endpoint view semantic matrix and topological location features are input into the context cue attention module. The endpoint view semantic matrix and topological location features are injected into the initial hidden state through a cross-attention mechanism to obtain the final updated hidden state features. Step 5: Input the final updated hidden state features into the frozen large language model decoder. By transforming the cross-domain inductive heterogeneous graph link prediction into a Boolean value generation task, the cross-domain inductive heterogeneous graph link prediction results of the target node pairs are obtained. In step 2, an importance-aware subgraph is constructed for the target node pairs, and shared neighbors are sampled by combining structural importance scores and semantic relevance scores to obtain a compact subgraph. This process includes the following sub-steps: Calculate target node pair of Jump to shared neighbor set And set a jump budget To control the number of nodes in each hop sampling; in, Represents a node of Jump to neighbor set, Represents a node of Jump to the neighbor set; Based on a shared neighbor set and combined with the Adamic–Adar heuristic, the weight of the center node of the height number is reduced to obtain the structural importance score; Based on a shared neighbor set, a frozen text encoder is used to transform node text descriptions into semantic embeddings. Cosine similarity is used to measure the semantic matching degree between neighbor and target node pairs to obtain semantic relevance scores. The structural importance score and semantic relevance score are fused to obtain a unified sampling score; Jumping levels based on the unified sampling score Sampling is performed; if the number of shared neighbors is insufficient, samples are added from the pool of non-shared neighbors to obtain a compact subgraph centered on the target node pair. ; in, Represents the set of nodes in a subgraph. This represents the edge set of the subgraph.

2. The method for predicting cross-domain heterogeneous graph links based on structure awareness and large language models according to claim 1, characterized in that, In step 1, a text attribute heterogeneous graph is constructed, and a cross-domain inductive heterogeneous graph link prediction task is defined. The node, edge, text attribute, and relation type information of the source domain heterogeneous graph are obtained, and the link prediction query rules for the target domain heterogeneous graph are determined. The link prediction query rules include the text descriptions of the source and target nodes, as well as the relation types to be verified. Specifically, the following sub-steps are included: Constructing a heterogeneous graph of text attributes and for each node Match the corresponding text description ; in, Represents a heterogeneous graph of text attributes. Represents a set of nodes. Represents an edge set. Represents the adjacency matrix. Represents a set of node types. Represents a set of relation types. Represents the set of text attributes of a node; Define a cross-domain inductive heterogeneous graph link prediction task, in a source domain heterogeneous graph atlas. Model training is completed on the target domain heterogeneous map with distribution offset. Link prediction is performed, with the goal of learning a scoring function. To infer node pairs Does an edge of the specified type exist between them? Determine the link prediction query rules for the heterogeneous graph of the target domain, and transform link prediction into a binary classification task. The link prediction query rules include textual descriptions of source nodes and target nodes, as well as the relationship types to be verified. Data preprocessing is performed on the heterogeneous graphs of the source and target domains. A node-level inductive partitioning strategy is used to divide the training, validation, and test sets. The associated edges of the test nodes are pruned to avoid data leakage. Negative samples are randomly drawn from the two-hop neighborhood of the source node to balance the dataset.

3. The method for predicting cross-domain heterogeneous graph links based on structure awareness and large language models according to claim 2, characterized in that, In the step of obtaining the structural importance score by weight decay of the center nodes of the height number based on the shared neighbor set and combined with the Adamic-Adar heuristic, the following relationship exists: ; in, The score represents the importance of the structure. Indicates an indicator function, Represents a node The degree, Indicates from node To the node of Path skipping count Indicates from node To the node of Path skipping count Indicates taking the logarithm; In the steps of converting node text descriptions into semantic embeddings using a frozen text encoder based on a shared neighbor set, and measuring the semantic matching degree between neighbor and target node pairs using cosine similarity to obtain a semantic relevance score, the following relationship exists: ; in, Indicates semantic relevance score, Represents the cosine similarity function. Represents a node semantic embedding, Represents a node semantic embedding, Represents a node Semantic embedding; In the step of fusing structural importance scores and semantic relevance scores to obtain a unified sampling score, the following relationship exists: ; in, Indicates the uniform sampling score. This represents the hyperparameters used to balance structure and semantics.

4. The method for predicting cross-domain heterogeneous graph links based on structure awareness and large language models according to claim 3, characterized in that, In step 3, semantic-location encoding of the endpoint perspective is performed based on the compact subgraph to generate enhanced text descriptions from the source node perspective and the target node perspective, respectively. This is combined with random walk location encoding and shortest path distance encoding to obtain the endpoint perspective semantic matrix and topological location features. Specifically, this includes the following sub-steps: Based on compact subgraph Construct two endpoint view subgraphs, one for the source node's view subgraph. and target node perspective subgraph ; in, Indicates the source node The set of sampled neighbor nodes, Represents the target node The set of sampled neighbor nodes, Represents the source node's perspective subgraph edge set, Represents the target node's view subgraph edge set; The text description of each sampling node is enhanced with a role-hop count prefix to generate an enhanced text description from the endpoint perspective; The enhanced text description is encoded using a frozen sentence encoder to obtain an endpoint-view semantic matrix; Calculate the random walk position code for each of the two endpoint view subgraphs to obtain the topological position feature matrix; Calculate the shortest path distance between the target node pairs in the original heterogeneous graph and map it to a learnable embedding vector to obtain pairwise topological location features; Endpoint perspective semantic matrix , and topological location features , , Together they constitute a set of structural perception features.

5. The method for predicting cross-domain heterogeneous graph links based on structure awareness and large language models according to claim 4, characterized in that, In the step of performing role-hop count prefix enhancement on the text description of each sampled node to generate an enhanced text description from the endpoint perspective, the following relationship exists: ; in, Enhanced text descriptions representing endpoint perspectives. Indicates the source node role identifier. Represents a node The text description, Represents a node of Jump to neighbor set, Indicates the source node The role of hop neighbors - hop count joint identifier, Indicates the maximum number of hops. Represents a node The original text description; In the step of encoding the enhanced text description using a frozen sentence encoder to obtain the endpoint-view semantic matrix, the following relationship exists: ; in, Represents the endpoint perspective semantic matrix. This indicates that the sentence has been processed by the sentence encoder. Endpoints Nodes in view Enhanced text description, Endpoints The node set of the view subgraph Indicates endpoints; In the step of calculating the random walk position codes for the two endpoint view subgraphs to obtain the topological position feature matrix, the following relationship exists: ; in, Represents the topological location feature matrix. This represents the random walk position encoding function. Endpoints Perspective subgraph; In the step of calculating the shortest path distance between target node pairs in the original heterogeneous graph and mapping it to a learnable embedding vector to obtain pairwise topological location features, the following relationship exists: ; in, Representing paired topological location features, This represents the mapping function from distance to embedding. This represents the shortest path length.

6. The method for predicting cross-domain heterogeneous graph links based on structure awareness and large language models according to claim 5, characterized in that, In step 4, the link prediction query rules are integrated into the prompt template and input into the frozen large language model to obtain the initial hidden state; The endpoint-view semantic matrix and topological location features are input into the contextual cue attention module. The endpoint-view semantic matrix and topological location features are then injected into the initial hidden state through a cross-attention mechanism to obtain the final updated hidden state features. The specific steps include the following: The text descriptions of the source node and the target node, as well as the relationship type to be verified, are integrated into the natural language prompt template and input into the frozen large language model for processing to obtain the initial hidden state. The natural language prompt template consists of three parts: system instructions, user queries, and assistant responses. System instructions define the task type and output format, while user queries contain core node and relationship information. Endpoint perspective semantic matrix is ​​learned through a projective layer. , and topological location features , Mapping to the hidden space of a large language model to obtain adapted semantic features. , and adapted node-level location features , ; Semantic context alignment is performed based on a context-sensitive attention module, and the adapted semantic features are concatenated into semantic memory. Semantic memory is injected into the initial hidden state through multi-head cross-attention to obtain the hidden state after the first update; Positional context alignment is performed based on a context-sensitive attention module, and the adapted node-level positional features are concatenated into a positional memory. The memory is injected into the hidden state after the first update through independent multi-head cross-attention, so as to obtain the hidden state after the second update; The paired topological location features are broadcast to all token locations in the hidden state after the second update, completing the deep fusion of structure and semantics to obtain the final updated hidden state features; The contextual cue attention module optimizes only the projection matrix and cross-attention parameters, while all parameters of the large language model and sentence encoder remain frozen.

7. The method for predicting cross-domain heterogeneous graph links based on structure awareness and large language models according to claim 6, characterized in that, In the steps of semantic context alignment based on contextual cue attention module, concatenating the adapted semantic features into semantic memory, and injecting the semantic memory into the initial hidden state through multi-head cross-attention to obtain the hidden state after the first update, the following relationship exists: ; in, This indicates that the file is hidden after the first update. This indicates a semantic branching layer normalization operation. Indicates the initial hidden state. This indicates that the semantic alignment multi-head attention module has been used for processing. Represents semantic memory, The query matrix representing semantic branches, The key matrix representing semantic branches, The value matrix representing semantic branches; In the steps of performing position context alignment based on the context cue attention module, concatenating the adapted node-level position features into position memory, and injecting the memory into the hidden state after the first update through independent multi-head cross-attention to obtain the hidden state after the second update, the following relationship exists: ; in, This indicates that the file is hidden after the second update. This indicates the normalization operation for the positional branch layer. This indicates that the data has been processed by the position-aligned multi-head attention module. Indicates positional memory, The query matrix represents the positional branch. The key matrix representing the positional branches, The value matrix representing the positional branches.

Citation Information

Patent Citations

  • Intelligent marketing copywriting generation and effect evaluation method driven by large language model

    CN120509387A

  • Large language model training method and system based on knowledge graph enhancement

    CN120578770A