Graph neural network fine tuning method combining graph prompt and adapter
By combining graph hints and adapter fine-tuning methods, the backbone network parameters of the pre-trained GNN model are frozen, node-specific hint vectors are generated, and hierarchical adapter optimization is performed. This solves the computational cost and adaptability problems of graph neural networks in low-data scenarios, and achieves efficient feature enhancement and task adaptation.
Patent Information
- Application Number
- CN202511935034.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-22
- Publication Date
- 2026-01-20
AI Technical Summary
Existing graph neural network fine-tuning methods struggle to achieve high performance adaptation to downstream tasks while reducing computational costs in low-data scenarios, especially due to insufficient adaptability to graph structures, leading to a bottleneck in generalization ability.
By combining graph hints and adapter fine-tuning methods, the backbone network parameters of the pre-trained GNN model are frozen, node-specific hint vectors are generated using the graph hint module, and feature enhancement and optimization are performed through a hierarchical adapter module, including node-level pre-adaptor, message passing operation, and graph-level adapter, to dynamically adjust feature representations to adapt to the needs of downstream tasks.
By retaining the pre-trained knowledge, only a few parameters need to be fine-tuned to achieve near-full parameter fine-tuning performance, which improves the model's parameter efficiency and feature generalization ability, making it suitable for fields such as bioinformatics and chemical molecular analysis.
Smart Images

Figure CN121365686A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of graph neural network fine-tuning, and particularly relates to a graph neural network fine-tuning method combining graph prompts and adapters. BACKGROUND
[0002] Graph structure data widely exists in nature and social production, such as molecular structure (nodes are atoms, and edges are chemical bonds) in bioinformatics, protein interaction network (nodes are proteins, and edges represent interaction), and social network, recommendation system and other scenarios. The core feature of such data is the hierarchical relationship of "node-edge-global", which requires the model to capture complex relationships, so the graph neural network becomes an important technology for processing such data. The core principle of the graph neural network is to aggregate the information of neighboring nodes through the "message passing" mechanism, so as to learn the local features of nodes and the overall structure of the graph. Common models include graph convolutional network, graph attention network, graph isomorphism network and Transformer-based graph model. For example, in the molecular task, the graph neural network can predict the properties of the molecule by learning the characteristics of the atom type and the chemical bond; in the protein task, the function of the protein can be predicted through the protein interaction network.
[0003] To solve the overfitting problem of the graph neural network in the low data scenario, pre-training and fine-tuning have become the mainstream technical framework. Pre-training learns general structural knowledge through large-scale unlabeled graph data, and then adapts to downstream tasks through fine-tuning, thereby reducing the labeling requirement and improving the model generalization ability. However, the current graph neural network fine-tuning methods mainly fall into two categories: one is full-parameter fine-tuning, which updates all parameters of the model to adapt to downstream tasks, but this method has high computational and storage costs and unstable training; the other is parameter-efficient fine-tuning, which only updates part of the parameters to reduce the computational cost, but the existing methods generally have the problem of insufficient adaptation to the graph structure. For example, the prompt-based fine-tuning method usually relies on the basic prompt vector for semantic prompting, but it is difficult to perform fine-grained feature enhancement for node-level differences; the adapter-based fine-tuning method only inserts a bottleneck structure in part of the layers, but it needs to reinitialize a large number of hierarchical parameters according to the task, and the adaptability to complex graph structures is still insufficient.
[0004] The core challenge of current GNN fine-tuning is how to reduce the fine-tuning cost, retain the knowledge in the pre-training stage, and achieve high performance adaptation to downstream tasks, especially in the low data scenario to break the generalization bottleneck. The existing mainstream fine-tuning methods often have difficulty in balancing the parameter efficiency and task performance. Full-parameter fine-tuning can fully adapt to downstream tasks, but requires large-scale parameter updates, high computational cost, and is easily limited by the amount of labeled data, leading to "difficulty in iteration". The partial parameter fine-tuning method can reduce the cost, but the optimization of the "node-edge-global" hierarchical structure of the graph neural network is insufficient, which may lead to performance difficult to match full fine-tuning. SUMMARY
[0005] The purpose of the present application is to solve the problems existing in the prior art and provide a graph neural network fine-tuning method combining graph prompts and adapters.
[0006] In order to achieve the above purpose, the technical scheme adopted by the present application is as follows:
[0007] A graph neural network fine-tuning method combining graph prompts and adapters, comprising the following steps:
[0008] S1. Initialize the pre-trained graph neural network GNN model and freeze its backbone network parameters, load the downstream task graph data, and obtain the original node feature matrix from the loaded data;
[0009] S2. Process the original node feature matrix based on the graph prompt feature enhancement to generate enhanced node features;
[0010] S3. In each layer of the GNN model, based on the enhanced node features, sequentially perform hierarchical adapter optimization, including node-level pre-adapter processing on the enhanced node features, performing message passing operations, and node-level post-adapter processing on the node features after message passing;
[0011] S4. After completing the node processing of all layers of the GNN model, perform graph pooling on the node features output by each GNN layer to obtain graph-level features, and perform bottleneck transformation and scaling on the graph-level features through the graph-level adapter to obtain optimized graph-level features;
[0012] S5. Obtain the composite loss function of the downstream task, use the optimized graph-level features as the input of the composite loss function to calculate the training loss, update the basic prompt matrix, attention parameter matrix and adapter parameters of each layer based on the calculated training loss, and judge whether the training process meets the convergence condition; when it is judged that it does not converge, return to step S2 for iteration.
[0013] Preferably, the step of processing the original node feature matrix based on the graph prompt feature enhancement to generate enhanced node features comprises:
[0014] obtaining an original node feature matrix;
[0015] initializing a learnable base hint matrix to obtain an initialized base hint matrix, the base hint matrix being generated by random initialization and being updated in training;
[0016] linearly mapping the original node feature matrix by using an attention parameter matrix, and obtaining an attention distribution matrix of each base hint vector in the initialized base hint matrix of the node pair by using a Softmax function;
[0017] generating a node hint vector matrix according to the attention distribution and the base hint matrix;
[0018] performing element-level addition on the node hint vector matrix and the original node feature matrix to obtain enhanced node features.
[0019] Preferably, a calculation formula for obtaining the attention distribution matrix of each base hint vector in the initialized base hint matrix of the node pair by using the Softmax function is:
[0020]
[0021] wherein, is the attention distribution matrix, is the original node feature matrix, is a transpose of the learnable attention parameter matrix.
[0022] Preferably, a calculation formula for generating the node hint vector matrix according to the attention distribution and the base hint matrix is:
[0023]
[0024] wherein, is the node hint vector matrix, is the attention distribution matrix, is the base hint matrix.
[0025] Preferably, a calculation formula for performing element-level addition on the node hint vector matrix and the original node feature matrix to obtain the enhanced node features is:
[0026]
[0027] wherein, is the original node feature matrix, is the node hint vector matrix, is the enhanced node feature, , is the number of nodes, node feature dimension.
[0028] Preferably, in each layer of the GNN model, the enhanced node features are sequentially subjected to hierarchical adapter optimization, including node-level pre-adapter processing, message passing operation, and node-level post-adapter processing of the enhanced node features, which comprises the following steps:
[0029] According to the number of layers of the GNN model, a dynamic bottleneck dimension is calculated for each layer;
[0030] Before message passing in each layer, the enhanced node features are input into the pre-adapter of the layer for dimension reduction, activation, dimension increase, and normalization processing, and the pre-processed features are obtained in combination with the learnable scaling factor in the pre-adapter of the layer.
[0031] The pre-processed features are subjected to message passing operation to obtain aggregated features.
[0032] After message passing, the aggregated features are subjected to dimension reduction, activation, dimension increase, and normalization processing by the post-adapter, and the output features of the layer are obtained in combination with the learnable scaling factor in the post-adapter of the layer.
[0033] Preferably, the calculation formula of the dynamic bottleneck dimension is as follows:
[0034]
[0035] wherein is the dynamic bottleneck dimension of the i-th layer, and are the specified minimum and maximum bottleneck dimensions, respectively, is the total number of layers of the GNN model. Preferably, the general structure of the pre-adapter and the post-adapter is defined as follows:
[0036]
[0037] wherein,
[0038] the input feature dimension is reduced to the dynamic bottleneck dimension ,the feature dimension is restored to the original dimension; represents batch normalization, represents the activation function Rectified Linear Unit, which sets negative values in the input to zero and keeps positive values unchanged to introduce non-linear transformation capability.
[0039] Before message passing at each layer, the enhanced node features are input into the pre-adapter of that layer for dimensionality reduction, activation, dimensionality increase, and normalization. The calculation formula for the preprocessed features is then obtained by combining the learnable scaling factor from the pre-adapter of that layer:
[0040]
[0041] in, For the first Augmented node features input to the layer GNN model. Through bottleneck transformation (dimensionality reduction → activation → dimensionality increase) from Extract significant features from them; It is a learnable scaling factor that adaptively adjusts the influence of the pre-adaptor during task-specific optimization.
[0042] Preferably, after message passing, the aggregated features are processed by a post-adaptor through dimensionality reduction, activation, dimensionality increase, and normalization, and combined with the learnable scaling factor in the post-adaptor of this layer, the calculation formula for the output features of this layer is as follows:
[0043]
[0044] in, This layer outputs features. This indicates a message passing operation, which propagates information by aggregating the characteristics of neighboring nodes. For multilayer perceptrons, The output is subjected to a nonlinear transformation; and They have the same bottleneck structure, but with aggregation characteristics. For input; As learnable parameters, the optimization intensity of the adapter is adjusted to balance the interaction between local and global features.
[0045] The beneficial effects of this invention are as follows:
[0046] This invention combines a graph hinting module with a hierarchical adapter module, enabling the model to achieve near-full-parameter fine-tuning performance by only fine-tuning a small number of model parameters while freezing the pre-trained GNN backbone network parameters. Without altering the main structure and parameter scale of the pre-trained model, this invention only updates the hint-related parameters and adapter parameters. By enhancing graph hint features, it preserves the general graph structure knowledge from the pre-training stage, allowing the model to maintain high parameter efficiency and good feature generalization ability across various mainstream fine-tuning strategies.
[0047] This invention utilizes the "dynamic node-specific cue vector generation" of the graph cue module to adaptively capture semantic differences in nodes within downstream task data such as molecules and proteins, thereby enhancing the task relevance of node features. Building upon this, the hierarchical adapter module employs "dynamic bottleneck dimension + hierarchical dual adaptation" to further match the feature processing needs of each GNN level. This allows different levels to adaptively select appropriate feature representation spaces based on their structural roles, thus improving the model's adaptability to multi-scale graph structural information.
[0048] The method of this invention relies on the collaborative design of a graph hint module and a hierarchical adapter module to achieve precise adaptation to downstream tasks while preserving the structure and knowledge of the pre-trained GNN model. The hint module dynamically generates hint vectors for different nodes through a learnable basic hint matrix and an attention mechanism; the adapter module, through the combined action of node-level pre-adaptors, node-level post-adaptors, and graph-level adapters, further optimizes feature representations through a dynamic bottleneck dimension, enabling the model to maintain effective adaptation to downstream task requirements with only a few parameter fine-tunings. This method constructs a "plug-and-play" fine-tuning framework that can be seamlessly integrated into various mainstream GNN models, requiring only a few parameter fine-tunings to complete task optimization.
[0049] In systematic experiments on biological datasets, this invention achieved stable performance in both the core graph classification task and low-data scenarios, and the effectiveness of different pre-training strategies in practical applications was verified. Experimental results show that this invention exhibits significant advantages in parameter efficiency, task performance, and robustness. It achieves near-full-parameter fine-tuning performance with only a small number of model parameters adjusted, while maintaining the high efficiency of the prompting and adapter modules. This method has promising application prospects and widespread value in fields such as bioinformatics and chemical molecular analysis. Attached Figure Description
[0050] Figure 1 This is a flowchart of a graph neural network fine-tuning method combining graph hints and adapters, as proposed in an embodiment of the present invention. Detailed Implementation
[0051] To provide a clearer understanding of the technical features, objectives, and beneficial effects of this invention, the technical solution of this invention is described in detail below, but this should not be construed as limiting the scope of implementation of this invention. Unless otherwise specified, the methods used in this invention are conventional methods in this technical field. In this invention, materials, reagents, or instruments whose manufacturers are not specified are all conventional products that can be purchased commercially.
[0052] The specific implementation of the present invention will be described in detail below with reference to specific embodiments.
[0053] In one embodiment, a graph neural network fine-tuning method combining graph hints and adapters includes the following steps: initializing a pre-trained graph neural network (GNN) model and freezing its backbone network parameters, loading downstream task graph data, and obtaining the original node feature matrix from the loaded data.
[0054] In this embodiment, the pre-trained GNN model may contain multiple GNN layers, each used for graph-structured message passing and feature updating of node features. By freezing the backbone network parameters, the existing structural expressive power in the pre-trained model can be preserved, and subsequent training updates can be focused on the cue matrix, attention parameter matrix, and adapter parameters, thereby achieving efficient fine-tuning of downstream tasks with small samples.
[0055] Subsequently, the graph data of downstream tasks is loaded into the system. This downstream task graph data can contain a set of nodes, a set of edges, and related attribute information of the nodes. The model constructs a graph structure based on the loaded graph data. In this embodiment, the input features of each node are extracted from the loaded graph data to form an original node feature matrix. This original node feature matrix represents the features of all nodes in the graph, where each row corresponds to a feature vector of a node, and each column corresponds to a feature dimension. This original node feature matrix serves as the input for subsequent graph cue feature enhancement processing, providing basic node information input for the cue enhancement module during fine-tuning.
[0056] In one embodiment, a graph neural network fine-tuning method combining graph hints and adapters further includes: processing the original node feature matrix based on graph hint feature enhancement to generate enhanced node features.
[0057] The steps involved in processing the original node feature matrix to generate enhanced node features based on graph cue feature enhancement include:
[0058] Obtain the original node feature matrix;
[0059] Initialize the learnable basic cue matrix to obtain the initialized basic cue matrix, which is generated through random initialization and updated during training;
[0060] The original node feature matrix is linearly mapped using the attention parameter matrix, and the attention distribution matrix of each basic cue vector in the initialized basic cue matrix of the node is obtained through the Softmax function;
[0061] Generate a node cue vector matrix based on the attention distribution and the basic cue matrix;
[0062] The enhanced node features are obtained by element-wise addition of the node cue vector matrix and the original node feature matrix.
[0063] The formula for calculating the attention distribution matrix of each basic cue vector in the initialized basic cue matrix of a node pair using the Softmax function is as follows:
[0064]
[0065] in, Here is the attention distribution matrix. This is the original node feature matrix. This is the transpose of the learnable attention parameter matrix.
[0066] Based on attention distribution matrix Combine it with the basic hint matrix Multiply to generate a node hint vector matrix. This enables the generation of a unique hint vector for each node, calculated using the following formula:
[0067]
[0068] For a single node Its hint vector It can be obtained through matrix multiplication expansion:
[0069]
[0070] Using node feature matrix Represent the characteristics of all nodes, where each row For the first The feature vector of each node For the number of nodes, For node feature dimensions. Define the learnable basic cue matrix. ,in The number of basic hint vectors, matrix each line Each vector represents a basic cue vector. These vectors are generated through random initialization and optimized during training via backpropagation to capture task-relevant feature patterns.
[0071] After generating node cue vectors, they are fused with the original node features to enhance feature representation: the node cue vector matrix and the original node feature matrix are added element-wise to obtain the enhanced node features. The formula for calculating the enhanced node features is as follows:
[0072]
[0073] in, The original node feature matrix, Provide a hint vector matrix for the nodes. For the enhanced node features, , For the number of nodes, For node feature dimensions.
[0074] This fusion strategy injects task-related prompts while preserving the semantic information of the original features. Since the prompt vectors are dynamically generated from node features, the enhanced features can more accurately reflect the structural role and semantic function of nodes in the graph, improving the model's ability to distinguish complex graph structures.
[0075] In one embodiment, a graph neural network fine-tuning method combining graph hints and adapters further includes: performing hierarchical adapter optimization sequentially based on enhanced node features in each layer of the GNN model, including performing node-level pre-adaptor processing on the enhanced node features, performing message passing operations, and performing node-level post-adaptor processing on the message-passed node features.
[0076] In each layer of the GNN model, hierarchical adapter optimization is performed sequentially based on the enhanced node features. This includes steps such as performing node-level pre-adaptor processing on the enhanced node features, performing message passing operations, and performing node-level post-adaptor processing on the message-passed node features.
[0077] The dynamic bottleneck dimension is calculated for each layer based on the number of layers in the GNN model.
[0078] Before message passing at each layer, the enhanced node features are input into the pre-adaptor of that layer for dimensionality reduction, activation, dimensionality increase and normalization, and the preprocessed features are obtained by combining the learnable scaling factor in the pre-adaptor of that layer.
[0079] Perform message passing operations on the preprocessed features to obtain aggregated features;
[0080] After message passing, the aggregated features are processed by the post-adaptor to perform dimensionality reduction, activation, dimensionality increase and normalization, and combined with the learnable scaling factor in the post-adaptor of this layer to obtain the output features of this layer.
[0081] To achieve efficient parameter fine-tuning of graph neural networks, a hierarchical adapter mechanism is proposed. This mechanism extends the traditional adapter structure by introducing a preprocessing adapter, a postprocessing adapter, and a graph-level enhancement adapter. It constructs a multi-granularity adaptation framework for node features and graph-level representations, enabling stepwise feature enhancement from local nodes to the global graph structure.
[0082] In the adapter, the bottleneck dimension of each layer The bottleneck dimension is adjusted based on its position in the network: It is calculated using linear interpolation, giving adapters closer to the output layer a higher bottleneck dimension. This design allows the model to retain more feature information in deeper networks, thereby improving feature representation capabilities. The formula for calculating the dynamic bottleneck dimension is:
[0083]
[0084] in For the first The dynamic bottleneck dimension of the layer, and These are the specified minimum and maximum bottleneck dimensions, respectively. This represents the total number of layers in the GNN model.
[0085] Each GNN layer contains a preprocessing adapter and a postprocessing adapter, which operate on the input and output stages of message passing, respectively, forming a bidirectional adjustment of the feature stream to ensure that the GNN layer can process adapted, high-quality features. The general structure of the preprocessor and postprocessor is defined as follows:
[0086]
[0087] in, Reduce the input feature dimension to the dynamic bottleneck dimension. , Restore the feature dimensions to their original dimensions; This refers to batch normalization, which improves training stability by standardizing the transformed output. This represents the activation function, the Rectified Linear Unit, which is used to zero out negative values in the input while keeping positive values unchanged, thereby introducing nonlinear transformation capabilities.
[0088] Before message passing at each layer, the enhanced node features are input into the pre-adapter of that layer for dimensionality reduction, activation, dimensionality increase, and normalization. The calculation formula for the preprocessed features is then obtained by combining the learnable scaling factor from the pre-adapter of that layer:
[0089]
[0090] in, For the first Augmented node features input to the layer GNN model. Through bottleneck transformation (dimensionality reduction → activation → dimensionality increase) from Extract significant features from them; The pre-adaptor is a learnable scaling factor that adaptively adjusts its influence during task-specific optimization. The pre-adaptor enhances the input features in a task-related way, enabling the GNN layers to receive more discriminative initial features.
[0091] After message passing, the aggregated features are processed by a post-adaptor through dimensionality reduction, activation, dimensionality increase, and normalization. Combined with the learnable scaling factor in the post-adaptor of this layer, the calculation formula for the output features of this layer is as follows:
[0092]
[0093] in, This layer outputs features. This indicates a message passing operation, which propagates information by aggregating the characteristics of neighboring nodes. For multilayer perceptrons, The output is subjected to a nonlinear transformation; and They have the same bottleneck structure, but with aggregation characteristics. For input; As learnable parameters, the optimization intensity of the adapter is adjusted to balance the interaction between local and global features.
[0094] In one embodiment, a graph neural network fine-tuning method combining graph hints and adapters further includes: after completing node processing of all layers of the GNN model, performing graph pooling on the node features output by each GNN layer to obtain graph-level features, and performing bottleneck transformation and scaling on the graph-level features through a graph-level adapter to obtain optimized graph-level features.
[0095] In this embodiment, a graph neural network fine-tuning method combining graph hints and adapters further includes the following processing: After processing the nodes of all layers of the GNN model, the node features output by each GNN layer are graph pooled to obtain graph-level features representing the overall graph structure. Graph pooling is used to aggregate all node features, so that the resulting graph-level features can reflect the global feature information in the graph. In this embodiment, the node features output by each layer can be denoted as... ,in Given the total number of layers in the GNN model, the graph-level features obtained by graph pooling are... It can be represented as:
[0096]
[0097] in, This represents the graph pooling operation, which extracts the overall structural features of the graph by aggregating the features of all nodes.
[0098] After obtaining the graph-level features, these features are input into the graph-level adapter for further task-related adjustments. The graph-level adapter uses the same bottleneck structure as the aforementioned node-level adapter to ensure computational efficiency. In this embodiment, the graph-level adapter generates graph-level adaptive features from the input graph-level features through dimensionality reduction, activation, re-dimensionality increase, and normalization. And combined with the learnable scaling factor in the graph-level adapter Linear scaling is applied to the graph-level features to obtain optimized graph-level features. Optimized graph-level features. It can be represented as follows:
[0099]
[0100] in, This is a learnable scaling factor used to adjust the degree of influence of the graph-level adapter output on the graph-level feature optimization process; As a graph-level adaptation feature, its structure is consistent with the bottleneck structure used by the node-level adapter. The graph-level features are adjusted to correspond to the task characteristics through dimensionality reduction, activation and dimensionality increase.
[0101] In each layer of the GNN model, the features processed by the adapter module and message passing mechanism are denoted as follows: To capture more complex feature interactions, The ReLU activation function is applied to introduce non-linearity, followed by a Dropout operation on the activated features to reduce overfitting risk and improve model robustness. The final output is... As input features for the next layer of GNN.
[0102] The model achieves task-relevant feature adjustments through the synergy of a graph cueing method and an adapter module. The graph cueing method enhances the original node features by introducing a base cue matrix, node cue vectors, and an attention mechanism, enabling the node features to reflect information relevant to downstream tasks. The adapter module processes the enhanced node features and the aggregated features after message passing at each layer of the GNN model. Through dimensionality reduction, activation, dimensionality increase, and batch normalization operations in the bottleneck structure, combined with learnable scaling factors in each layer's adapter, it further calibrates the feature representation.
[0103] The model is trained by iteratively minimizing the composite loss function. In each iteration, the base cue matrix, attention parameter matrix, and learnable parameters of each adapter layer are updated based on the backpropagation results of the loss values, enabling the graph cue features and adapter outputs to gradually adapt to the needs of downstream tasks. Once the training process meets the convergence condition, the model outputs the optimized cue-related parameters and adapter module parameters.
[0104] In one embodiment, a graph neural network fine-tuning method combining graph cues and adapters further includes: obtaining the composite loss function of the downstream task; calculating the training loss using the optimized graph-level features as input to the composite loss function; updating the base cue matrix, attention parameter matrix, and adapter parameters of each layer based on the calculated training loss; and determining whether the training process meets the convergence condition. If convergence is not achieved, the process returns to step S2 to continue iterating.
[0105] In this embodiment, the composite loss function matches graph-level features with task labels or supervision information according to the requirements of downstream tasks, thereby obtaining the training loss for the current training round. This training loss is used to evaluate the model's predictive performance under the current parameter configuration and provides a basis for subsequent parameter updates.
[0106] After obtaining the training loss, the parameters allowed to be updated in the model are adjusted based on the backpropagation results of the loss function. In this embodiment, the parameters involved in the update include the base cue matrix, the attention parameter matrix, and the adapter parameters set in each GNN layer, while the backbone network parameters of the pre-trained GNN model remain frozen and do not participate in training. By updating the above-mentioned learnable parameters, the model can continuously optimize the generation process of graph cue features and the adapter's ability to adjust node and graph-level features based on the loss feedback, thereby gradually improving the model's expressive performance on downstream tasks.
[0107] After updating the relevant parameters, the convergence condition of the training process is determined. In this embodiment, the convergence condition can be determined based on the change in training loss. When the training loss decreases to a stable range or meets the preset termination criterion, the training process is considered to have reached convergence, and iteration stops. If it is determined that the training process has not yet converged, the process returns to the step of performing graph cue feature enhancement on the original node feature matrix, and repeats the subsequent GNN layer processing, graph-level feature optimization, and training loss calculation and parameter update process. Through continuous iteration, the model eventually achieves the optimal feature representation that meets the task requirements under the supervision of the composite loss function.
[0108] In one alternative implementation, to verify the feasibility, parameter efficiency, and performance of the graph neural network fine-tuning method combining graph hints and adapters, experiments were conducted on a typical graph classification task—protein function prediction. The experiments used the PPI protein function prediction benchmark dataset, which contains 88K labeled protein self-network graph samples covering 40 classification tasks. Each sample is a protein working subgraph, where nodes represent proteins, edges represent protein-protein interactions, and the node feature dimension is 256.
[0109] In this implementation, the GIN model used was pre-trained based on 395,000 standard protein self-network data from approximately 50 species. The pre-training parameters were kept frozen, and only the cue-related parameters and adapter module parameters were updated during fine-tuning. In this embodiment, the cue-related parameters were set as follows: the number of basic cue vectors was... The minimum bottleneck dimension of the adapter is set to The biggest bottleneck dimension is .
[0110] To compare performance with existing technologies, Full-Fine-tune, LoRA, GPF, and AdapterGNN were selected as baseline methods. Ablation experiments were also conducted to verify the roles of different modules in our proposed method, including two ablation methods: retaining only the graph prompt module (without the adapter) and retaining only the adapter module (without the graph prompt). ROC-AUC was consistently used as the performance evaluation metric to reflect prediction performance in multi-task scenarios.
[0111] This embodiment, through the collaborative design of the graph hint module and the adapter modules at each layer, enables the model to maintain stable optimization capabilities even when pre-trained parameters are frozen, and also offers advantages in parameter efficiency. The model training process is conducted in a unified hardware environment. All experiments are performed on a server with an Intel(R)-Core(TM) i9-14900HX CPU and an NVIDIA GeForce RTX-4090 GPU, running Ubuntu 18.04.6. The GNN model used is a 5-layer GIN network structure.
[0112] Table 1 shows the ROC-AUC (%) performance of different fine-tuning strategies and pre-training methods on the PPI benchmark dataset:
[0113] Table 1
[0114]
[0115] The specific results of the ablation experiment are shown in Table 2:
[0116] Table 2
[0117]
[0118] Experimental results demonstrate that the method of the present invention is significantly superior to the traditional method.
[0119] The core idea of this invention lies in solving the problem of simultaneously achieving "parameter efficiency" and "task performance" during the fine-tuning of pre-trained GNNs. To address this, a highly efficient fine-tuning method combining graph hints and a dynamic bottleneck adapter is proposed. This method loads a pre-trained GNN model and freezes its backbone network parameters as a foundation. Based on this, an attention mechanism is used to generate node-specific hint vectors, enhancing node features with graph hints. This allows node features to adapt to the semantic and structural information required by downstream tasks. After node feature enhancement, hierarchical adapter optimization is performed on the enhanced node features. The adapter includes a node-level pre-adaptor, message passing operations, and a node-level post-adaptor. Features are calibrated layer by layer based on the dynamic bottleneck dimension to achieve gradual optimization from local nodes to the global graph structure. Finally, by calculating a composite loss function and updating only the parameters of the graph hints and adapters, a lightweight and efficient closed-loop fine-tuning process of "feature enhancement—adapter optimization—parameter update" is achieved until the model converges, outputting lightweight parameters adapted to downstream tasks.
[0120] For ease of understanding, the overall process proposed in this invention can be understood as follows: Figure 1 The execution sequence is as follows: First, the input data is loaded, the pre-trained GNN model is initialized, and its backbone network parameters are frozen. Then, node cue vectors required for graph cue feature enhancement are generated through an attention mechanism, enabling node features to capture task-related cue information. Next, hierarchical adapter optimization is performed on the enhanced node features, allowing them to adjust layer by layer under the constraints of a dynamic bottleneck structure and gradually integrate graph structure information. After completing the adapter optimization, the composite loss is calculated, and the base cue matrix, attention parameter matrix, and learnable parameters of each adapter layer are updated based on backpropagation. Finally, it is determined whether the convergence condition is met. If convergence is achieved, the trained parameters are output; if convergence is not achieved, the iteration returns to the graph cue feature enhancement step to continue iterating.
[0121] The graph cue feature enhancement method generates node cue vectors for each node that match its semantic and structural role, eliminating the need for manual cue pattern design. First, a set of learnable base cue matrices is initialized. The base cue vectors in this matrix are continuously updated during training to adapt to key feature patterns in downstream tasks. Then, for each node's original node features, an attention parameter matrix is used to linearly map the node features, and the Softmax function is used to calculate the attention distribution of each node to each base cue vector. Based on this attention distribution, the base cue matrices are weighted and combined to obtain the node cue vector for each node, ensuring that this vector reflects the node's semantic role in the graph structure. Finally, the node cue vector is element-wise added to the original node features to form the enhanced node features for further processing by the adapter.
[0122] The adapter optimization proceeds layer by layer according to the hierarchical structure of the GNN model, with a dynamic bottleneck dimension set for different layers. Layers closer to the input use a smaller bottleneck dimension for fine-grained local feature extraction, while layers closer to the output use a larger bottleneck dimension to retain important information about the global graph structure, avoiding insufficient representation due to processing only local features. Before message passing at each layer, the enhanced node features are input to a node-level pre-adaptor for dimensionality reduction, activation, dimensionality increase, and normalization, and combined with the learnable scaling factor in the corresponding layer's pre-adaptor to obtain preprocessed features. Then, message passing is performed on the preprocessed features to obtain aggregated features. After message passing, a node-level post-adaptor is used to perform dimensionality reduction, activation, dimensionality increase, and normalization on the aggregated features, and combined with the learnable scaling factor of the post-adaptor for that layer to obtain the output features of that layer. After processing all GNN layers, graph pooling is performed on the node features output by each layer to obtain graph-level features. A graph-level adapter is then used to perform bottleneck transformation and scaling on the graph-level features, further calibrating them under the adjustment of the learnable scaling factor, thus better adapting them to the requirements of downstream tasks. Finally, the optimized graph-level features are output for task prediction.
[0123] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A method for fine-tuning a graph neural network combining graph cues and adapters, characterized in that, The method comprises the following steps: S1. Initialize the pre-trained graph neural network GNN model and freeze its backbone network parameters, load the downstream task graph data, and obtain the original node feature matrix from the loaded data; S2. Process the original node feature matrix based on graph prompt feature enhancement to generate enhanced node features; S3. In each layer of the GNN model, based on the enhanced node features, sequentially perform hierarchical adapter optimization, including node-level pre-adapter processing on the enhanced node features, performing message passing operations, and node-level post-adapter processing on the node features after message passing; S4. After completing the node processing of all layers of the GNN model, perform graph pooling on the node features output by each GNN layer to obtain graph-level features, and perform bottleneck transformation and scaling on the graph-level features through a graph-level adapter to obtain optimized graph-level features; S5. Obtain a composite loss function for the downstream task, use the optimized graph-level features as the input of the composite loss function to calculate the training loss, update the basic prompt matrix, attention parameter matrix, and adapter parameters of each layer based on the calculated training loss, and determine whether the training process meets the convergence condition; When it is determined that it does not converge, return to step S2 to continue iteration.
2. The method of claim 1, wherein, The step of processing the original node feature matrix based on graph prompt feature enhancement to generate enhanced node features comprises: Obtaining the original node feature matrix; Initializing a learnable basic prompt matrix to obtain an initialized basic prompt matrix, wherein the basic prompt matrix is generated by random initialization and updated during training; Linearly mapping the original node feature matrix using an attention parameter matrix, and obtaining an attention distribution matrix of each basic prompt vector in the initialized basic prompt matrix through a Softmax function; Generating a node prompt vector matrix according to the attention distribution and the basic prompt matrix; Performing element-level addition on the node prompt vector matrix and the original node feature matrix to obtain enhanced node features.
3. The method of claim 2, wherein the method further comprises: The calculation formula of the attention distribution matrix of each basic prompt vector in the initialized basic prompt matrix through the Softmax function is: ; wherein, is an attention distribution matrix, is an original node feature matrix, is a transpose of a learnable attention parameter matrix.
4. The method of Claim 3, wherein, The calculation formula of the node prompt vector matrix generated according to the attention distribution and the basic prompt matrix is: ; wherein, is a matrix of node prompts, is a matrix of attention distributions, is a matrix of base prompts.
5. The method of claim 2, wherein, The calculation formula of the enhanced node features obtained by performing element-level addition on the node prompt vector matrix and the original node feature matrix is: ; wherein, is the original node feature matrix, is the node prompt vector matrix, is the enhanced node feature, , is the number of nodes, is the node feature dimension.
6. The method of claim 1, wherein, In each layer of the GNN model, based on the enhanced node features, sequentially perform hierarchical adapter optimization, including node-level pre-adapter processing on the enhanced node features, performing message passing operations, and node-level post-adapter processing on the node features after message passing, which comprises the following steps: Calculate the dynamic bottleneck dimension for each layer according to the number of layers of the GNN model; Before message passing in each layer, input the enhanced node features into the pre-adapter of the layer for dimension reduction, activation, dimension increase, and normalization processing, and combine the learnable scaling factor in the pre-adapter of the layer to obtain preprocessed features; Perform message passing operations on the preprocessed features to obtain aggregated features; After message passing, the aggregated features are processed by the post-adapter to reduce dimension, activate, increase dimension and normalize, and combined with the learnable scaling factor in the post-adapter to obtain the output features of the layer.
7. The method of claim 6, wherein the method further comprises: The calculation formula of the dynamic bottleneck dimension is: ; wherein is the first layer is a dynamic bottleneck dimension, and are specified minimum and maximum bottleneck dimensions, respectively, is the total number of layers of the GNN model.
8. The method of claim 6, wherein the method further comprises: The general structure of the pre-adapter and the post-adapter is defined as: ; wherein, reducing the input feature dimension to a dynamic bottleneck dimension , restoring the feature dimension to the original dimension; denotes batch normalization, denotes an activation function.
9. The method of claim 6, wherein the method further comprises: Before message passing of each layer, the enhanced node features are input into the pre-adapter of the layer to reduce dimension, activate, increase dimension and normalize, and combined with the learnable scaling factor in the pre-adapter to obtain the calculation formula of the pre-processed features: ; wherein, is the enhanced node feature input to the layer GNN model, significant features are extracted from the bottleneck transformation (dimension reduction → activation → dimension increase) from is a learnable scaling factor. 10. The method of Claim 9, wherein, After message passing, the aggregated features are processed by the post-adapter to reduce dimension, activate, increase dimension and normalize, and combined with the learnable scaling factor in the post-adapter to obtain the calculation formula of the output features of the layer. ; wherein, outputs features for the layer, represents a message passing operation; for a multi-layer perceptron, non-linearly transforms the output of; has the same bottleneck structure as but takes aggregated features as input; are learnable parameters.