A method and system for representation fine-tuning in graph data node classification test training
By employing the representation fine-tuning method (TTReFT) during test-time training of graph neural networks, selecting high-entropy nodes for low-rank representation intervention, and utilizing the intervention-aware masking autoencoder IAMAE to optimize parameters, the out-of-distribution problem in graph data node classification is solved, achieving efficient adaptation and improved accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NAT UNIV OF DEFENSE TECH
- Filing Date
- 2026-01-27
- Publication Date
- 2026-04-21
AI Technical Summary
Existing graph neural networks suffer from out-of-distribution problems in graph data node classification, leading to performance degradation. Traditional training methods are prone to catastrophic forgetting during testing, and relying on artificial augmentation strategies is insufficient to reflect actual distribution changes.
The representation fine-tuning method (TTReFT) is adopted. During testing, high-entropy nodes are selected for low-rank representation intervention. The low-rank representation intervention function is optimized using the intervention-aware masking autoencoder IAMAE and a preset loss function, keeping the pre-trained parameters unchanged and only adjusting the node representation.
It effectively avoids catastrophic forgetting, achieves efficient self-adaptation, improves the accuracy and stability of graph data node classification, and has the advantages of knowledge preservation and flexible adaptation.
Smart Images

Figure CN121599043B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing (NLP) technology, specifically to a method and system for fine-tuning representations during training for graph data node classification testing. Background Technology
[0002] Graph neural networks (Graph Neural Networks) are a successful extension of deep neural networks to graph data, achieving significant breakthroughs in graph-related applications such as social network analysis and recommender systems. Similar to traditional deep neural networks, most Graph Neural Networks are built upon the assumption of independent and identically distributed (IID) relationships between training and testing data. However, the IID assumption often fails in practical applications. Specifically, changes in the distribution of node features (such as attribute variations) or the graph structure (such as homogeneity changes) in graph data can lead to a significant performance degradation, thus limiting their application in real-world scenarios. To address the out-of-distribution (OOD) problem, numerous studies have proposed various solutions, including diversifying the training distribution through data augmentation, improving robustness to perturbations through adversarial training, and ensuring the model's sensitivity to invariance through causal feature learning. These methods typically require training data from multiple domains or rely on strong assumptions to synthesize training samples that simulate test data. Some methods even require model adaptation to a portion of the test data and labels. However, these requirements and assumptions are often impractical in practice, limiting their widespread application. Furthermore, these methods often fail to fully explore and utilize the distribution characteristics of the test data. To partially address these issues, Test-Time Training (TTT) has emerged as a new paradigm in recent years. TTT dynamically adjusts a subset of model parameters through unsupervised learning, enabling the model to better adapt to the distribution of test data. Numerous studies have demonstrated the significant potential of TTT in tackling out-of-distribution challenges. However, current mainstream TTT methods primarily rely on parameter space optimization (such as PaFT), which presents challenges in ensuring stable performance and may even lead to catastrophic forgetting. Recent advances in representation learning offer new insights into this problem. Particularly in Natural Language Processing (NLP), the successful application of ReFT (Representation Fine-Tuning) demonstrates that targeted intervention in representations can achieve performance comparable to full fine-tuning with modifications to less than 1% of the representation. Furthermore, theoretical research indicates that neural networks naturally organize hierarchical semantic information within their representation space, and traditional parameter updates can disrupt these inherent representational patterns. Unlike traditional PaFT, ReFT does not update only a subset of model parameters but freezes all model parameters to preserve the knowledge gained during pre-training. Meanwhile, it avoids catastrophic forgetting and achieves efficient test-time adaptation by selectively intervening in the hidden layer representations and performing node-by-node adaptation. Key challenges facing ReFT (Representation Fine-tuning) methods include how to select nodes to intervene in and how to effectively guide the representation adaptation of these nodes without labeled supervision. Current self-supervised graph learning methods typically rely on contrastive learning, and their effectiveness often depends on carefully designed reinforcement strategies.However, artificially enhanced graphics may not fully reflect the distribution changes during actual testing. Summary of the Invention
[0003] The technical problem to be solved by this invention is to provide a representation fine-tuning method and system for test-time training of graph data node classification, which addresses the above-mentioned problems in the prior art. This invention aims to transform the traditional parameter update paradigm of test-time training (TTT) for graph data node classification into representation intervention, thereby avoiding the catastrophic forgetting problem and achieving efficient test-time adaptation in a plug-and-play manner, thus improving the accuracy of graph data node classification.
[0004] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:
[0005] A method for fine-tuning representations during training for graph data node classification testing includes the following steps:
[0006] S101, during the pre-training phase, utilizes labeled source domain data. Complete the pre-training of the graph data node classification model to obtain the pre-trained parameters of the graph data node classification model. ;
[0007] S102, during the representation fine-tuning phase of training at test time, for unlabeled target domain data. Select high-entropy nodes as the set of nodes that need intervention. For the set of nodes that require intervention The nodes that need intervention are intervened using a low-rank representation intervention function. The parameters of the low-rank representation intervention function are iteratively optimized using the Intervention-Aware Masking Autoencoder (IAMAE) and a preset loss function to finally obtain the optimal low-rank representation intervention function.
[0008] S103, During the inference phase, for the input unlabeled target domain data... The nodes in the set are categorized based on whether they belong to the set of nodes requiring intervention. The original node features or the node features after intervention through the optimal low-rank representation function are selected as input features for the graph data node classification model, so as to utilize the graph data node classification model based on pre-trained parameters. To obtain the paper classification results; the target domain data and source domain data All data are graph data in text format, where nodes represent papers and edges represent citation relationships within those papers.
[0009] Optionally, in step S102, high-entropy nodes are selected as the set of nodes that need intervention. include:
[0010] S201, for unlabeled target domain data Calculate the prediction entropy for each graph data node:
[0011] ;
[0012] in, For graph data nodes Predicted entropy, For a set of categories, Indicates the data nodes in the graph Features Get output For category The probability of;
[0013] S202, calculate the intervention probability for each graph data node according to the smoothing threshold mechanism in the following formula:
[0014] ;
[0015] in, For graph data nodes The probability of intervention, For the Sigmoid function, This is a sharpness parameter used to control the threshold. To predict the entropy threshold;
[0016] S203, for each graph data node Intervention probability From the perspective of intervention probability Bernoulli distribution Sampling data nodes in the graph Interference mask The intervention mask The value can be 0 or 1 to represent a graph data node. Whether intervention is needed is determined by obtaining a set of all graph data nodes that require intervention. .
[0017] Optionally, the low-rank representation of the intervention function in step S102 is expressed as follows:
[0018] ;
[0019] in, The low-rank representation represents the node features after intervention. The low-rank representation represents the intervention function. For nodes original features The node features after processing the output of a layer of neural network. , and These represent the matrix, weights, and biases of the intervention function, respectively, in low-rank form. , , , ,in The dimension is , The dimension is , The dimension is , Dimensions of node features. The dimension of the low-rank adaptive space.
[0020] Optionally, the intervention-aware masking autoencoder (IAMAE) includes an intervention-aware masking module, an encoder, and a decoder based on a graph convolutional network (GCN). The intervention-aware masking module is used to generate a node feature matrix composed of node features from all graph data nodes. Intervention-based perceptual masking generates a masked feature matrix. The encoder is used to transform the masked feature matrix Encoding yields the adjusted node representation. The decoder based on the graph convolutional network (GCN) is used to modify the node representations after intervention. The node feature matrix is extracted using a graph convolutional network (GCN). Reconstruction results .
[0021] Optionally, in step S102, when iteratively optimizing the parameters of the low-rank representation intervention function using the intervention-aware masking autoencoder (IAMAE) and a preset loss function, the intervention-aware masking module uses the node feature matrix composed of the node features of all graph data nodes. Intervention-based perceptual masking generates a masked feature matrix. include:
[0022] S301, the set of nodes to be intervened upon as needed. Calculate each graph data node Local intervention density :
[0023] ;
[0024] in, For graph data nodes The set of k-hop neighbor nodes, Indicates simultaneously belonging to and the set of nodes that need intervention. nodes Quantity;
[0025] S302, combined with local intervention density The adaptive masking probability is calculated according to the following formula. :
[0026] ;
[0027] in, and It is an adjustable hyperparameter;
[0028] S303, based on adaptive masking probability Given the probability distribution, select a subset of nodes. Perform masking and replace the original node features with a learnable mask vector. This generates the masked feature matrix. ;
[0029] The encoder consists of a pre-trained GNN network and a low-rank representation intervention function concatenated together. The encoder converts the masked feature matrix... Encoding yields the adjusted node representation. The function expression is:
[0030] ;
[0031] in, For pre-trained GNN networks, The adjacency matrix of the graph data. This is a function composition operator, indicating that the output of the previous function is used as the input of the next function; The low-rank representation represents the intervention function;
[0032] The decoder includes a secondary masking module and a two-layer GCN network. The secondary masking module is used to represent the nodes after intervention and adjustment. The middle belongs to the node subset Partial secondary masking is performed to generate a secondary masked node representation. The two-layer GCN network is used for the node representation after secondary masking of the input. Adjacency matrix of graph data Decode to generate node feature matrix Reconstruction results .
[0033] Optionally, in step S102, when iteratively optimizing the parameters of the low-rank representation intervention function using the intervention-aware masking autoencoder (IAMAE) and a preset loss function, the function expression of the loss function is as follows:
[0034] ;
[0035] ;
[0036] ;
[0037] in, The default loss function is... To address the reconstruction masking feature loss of the IAMAE perceptual masking autoencoder, For weight parameters, For self-entropy loss, For a set of nodes Size, For nodes The original characteristics, for transpose, for norm, For nodes The reconstruction features, for norm, Scaling factor For a set of categories, To belong to category The probability of.
[0038] Optionally, in step S103, the decision is made based on whether the node belongs to the set of nodes requiring intervention. We select either the original node features or the node features after low-rank representation intervention as input features for the graph data node classification model, so as to utilize the graph data node classification model based on pre-trained parameters. The function expression for obtaining the paper classification results is:
[0039] ;
[0040] in, For nodes The paper classification results For nodes The original characteristics, To make nodes original features First input based on pre-trained parameters Graph data node classification model Calculations are performed, and then the intervention function is represented by the optimal low-rank representation. The output obtained from the processing; This is a function compounding operator, indicating that the output of the previous function is the input of the next function.
[0041] The present invention also provides a representation fine-tuning system for training during graph data node classification testing, comprising a microprocessor and a memory interconnected thereto, wherein the microprocessor is programmed or configured to execute the representation fine-tuning method for training during graph data node classification testing.
[0042] The present invention also provides a computer-readable storage medium storing a computer program or instructions that are programmed or configured to execute, via a processor, a representation fine-tuning method during training for the graph data node classification test.
[0043] The present invention also provides a computer program product, including a computer program or instructions that are programmed or configured to execute, via a processor, a representation fine-tuning method during training for the graph data node classification test.
[0044] Compared with existing technologies, the present invention can achieve the following beneficial effects: The method of the present invention (TTReFT) adopts a graph data node classification model as a self-supervised strategy, directly models node features without relying on artificial enhancement, and creates a robust self-supervised signal by intervening in the representation and reconstructing masking features, thereby effectively supporting the adaptation of the model. Specifically, the method of the present invention (TTReFT) realizes the fine-tuning of the representation at test time through three coordination mechanisms: (1) Uncertainty-guided node selection, which prioritizes high-entropy nodes for intervention, targets areas with high model uncertainty, and maintains high confidence prediction of the model in other areas; (2) After selecting nodes, low-order transformations are applied to adaptively adjust the node representation without modifying the pre-trained parameters; (3) Finally, intervention-aware reconstruction is implemented, which prioritizes masking nodes with high neighbor intervention density. By associating the masking probability with the neighbor intervention density, a closed-loop adaptation system is created. Through principled intervention in the representation space, TTReFT successfully solves the fundamental contradiction between adaptability and preserving prior knowledge. By combining the above mechanisms, the traditional parameter update paradigm of test-time training (TTT) for graph data node classification is transformed into representation intervention, thereby avoiding the catastrophic forgetting problem and achieving efficient test-time adaptation in a plug-and-play manner, improving the accuracy of paper classification and achieving a balance between paper classification performance and efficiency. Attached Figure Description
[0045] Figure 1 This is a schematic diagram of the basic process of the method in an embodiment of the present invention.
[0046] Figure 2 This is a schematic diagram of the three stages in an embodiment of the present invention.
[0047] Figure 3This is a schematic diagram of the node intervention and masking selection mechanism in this embodiment, where (a) is an example of the node intervention selection process based on prediction entropy; and (b) is the set of intervention nodes selected. Example; (c) is an example of the process for calculating the masking probability of the intervention perception masking mechanism based on the local intervention density.
[0048] Figure 4 This is a comparison of different self-supervised tasks in the embodiments of the present invention.
[0049] Figure 5 The results of sensitivity analysis are shown for different node selection ratios (PP) in the embodiments of the present invention.
[0050] Figure 6 The results are sensitivity analysis results for different target layer numbers LL in the embodiments of the present invention. Detailed Implementation
[0051] The representation fine-tuning method for training during test-time classification of graph data nodes in this invention (TTReFT) aims to transform the traditional parameter update paradigm into representation intervention, thereby avoiding the catastrophic forgetting problem and achieving efficient test-time adaptation in a plug-and-play manner. To enable those skilled in the art to better understand the technical solution of this invention, the technical solution will be further described in detail below with reference to the accompanying drawings of the embodiments of this invention.
[0052] Test-Time Training (TTT) aims to dynamically adapt the model to the test data during inference. A graph-based data node classification model is designed. Depend on Layer composition, parameters are Traditional training processes generally include the following three steps: (pre-fixation) Layer parameters In test data Above, through self-monitoring of losses Update subsequent layer parameters Deploy the updated model To reason, among which While this method can mitigate the performance degradation caused by out-of-distribution data to some extent, it often leads to catastrophic forgetting due to direct updates to model parameters, thus destroying the knowledge acquired during pre-training. To overcome the limitations of traditional parameter fine-tuning (PaFT) in Test-Time Trial (TTT), this example proposes a test-time representation fine-tuning method, TTReFT. Unlike PaFT, TTReFT does not directly update model parameters. Instead, it intervenes in the representation space to selectively adjust the representations of some nodes, achieving better out-of-distribution adaptability during inference. Consider a graph data node classification model... No. The nodes of a layer GNN are represented as The TTReFT intervention process is defined as a triplet. ,in: For those with learnable parameters Intervention function; This represents the set of nodes that require intervention. Indicates the network layer where the intervention operation takes place. The update rule for the node representation is:
[0053] ;
[0054] in, This is an indicator function used to distinguish between target nodes and non-target nodes. The TTReFT test-time fine-tuning process includes the following steps: in the test set... Calculate self-supervised loss Only update the parameters of the intervention function. Maintain the parameters of the pre-trained model Fix; apply the learned intervention during the inference phase while freezing the pre-trained model. This differs from directly updating parameters. Compared to traditional TTT, TTReFT operates only in the representation space, not the weight space, and its intervention is limited to certain nodes and levels. This mechanism effectively reduces the risk of catastrophic forgetting and achieves more efficient and robust out-of-distribution adaptation.
[0055] like Figure 1 and Figure 2 As shown, the representation fine-tuning method during training for graph data node classification testing in this embodiment includes the following steps:
[0056] S101, during the pre-training phase, utilizes labeled source domain data. Complete the pre-training of the graph data node classification model to obtain the pre-trained parameters of the graph data node classification model. ;
[0057] S102, during the representation fine-tuning phase of training at test time, for unlabeled target domain data. Select high-entropy nodes as the set of nodes that need intervention. For the set of nodes that require intervention The nodes that need intervention are intervened using a low-rank representation intervention function. The parameters of the low-rank representation intervention function are iteratively optimized using the Intervention-Aware Masking Autoencoder (IAMAE) and a preset loss function to finally obtain the optimal low-rank representation intervention function.
[0058] S103, During the inference phase, for the input unlabeled target domain data... The nodes in the set are categorized based on whether they belong to the set of nodes requiring intervention. The original node features or the node features after intervention through the optimal low-rank representation function are selected as input features for the graph data node classification model, so as to utilize the graph data node classification model based on pre-trained parameters. To obtain the paper classification results, target domain data and source domain data All data are graph data in text format, where nodes represent papers and edges represent citation relationships within those papers. The classification result is specifically the technical field category of the paper, thus enabling a classification service for the technical field category of the paper.
[0059] The core idea of the representation fine-tuning method (TTReFT) in this embodiment is to introduce targeted intervention operations into the representation space to achieve adaptive capability to out-of-distribution data. It consists of three key stages: (1) standard pre-training based on source domain data; (2) representation fine-tuning through uncertainty-guided representation intervention at test time; and (3) integrating the pre-trained model and intervention mechanism during inference to obtain coordinated prediction results. A significant feature of the representation fine-tuning method (TTReFT) in this embodiment is that it keeps the pre-training parameters completely frozen, effectively avoiding catastrophic forgetting. At the same time, the representation fine-tuning method (TTReFT) in this embodiment can respond to distribution changes by selectively adjusting node representations. Compared with traditional test-time training methods, the representation fine-tuning method (TTReFT) in this embodiment has the advantages of both knowledge preservation and flexible adaptation.
[0060] The node classification task of a graph data node classification model can be formulated as follows: In graph data The above formal node classification task, in which Represents a set of nodes. The total number of nodes; It is an adjacency matrix; The input is the node feature matrix. As an optional implementation, the graph data in this embodiment is text data, where nodes represent papers and edges represent citation relationships within those papers. Under this setting, the task objective is to learn a model based on the graph structure and its feature information that can accurately predict the domain categories of the papers associated with the nodes. In out-of-distribution (OOD) scenarios, the training set is assumed to be labeled data. The test set consists of unlabeled data. The research objective is to learn a graph data node classification model based on a graph neural network (GNN). This model maintains robust generalization performance even when the training and test sets have different distributions. Specifically, the model minimizes the supervised loss during the training phase. Optimization is performed to achieve effective predictions under distribution shift conditions. The main objective during the pre-training phase is to utilize labeled source domain data. Train a high-performance classification model. Optimize parameters through a standard supervised learning process. This enables the model to make accurate predictions on the training distribution. It is important to emphasize that these parameters remain fixed during subsequent test-time training, serving as a stable foundation for the adaptation mechanism. This design ensures that knowledge gained during the pre-training phase is not lost in later stages, and that adaptive performance depends entirely on representation space intervention, rather than parameter updates. Notably, the representation fine-tuning method (TTReFT) in this embodiment is model-independent; its test-time adaptation relies solely on the frozen pre-training parameters. Compared with unlabeled test data Therefore, it can be widely adapted to graph neural networks with different architectures.
[0061] This embodiment of the method implements "uncertainty guidance" based on the node intervention selection process of prediction entropy. The steps include: calculating the prediction entropy of each node. Calculate the intervention probability using a smoothing threshold mechanism. Bernoulli sampling generates intervention masks Forming a set of intervention nodes . Figure 3 The values "0.9, 0.2, 0.4" shown in (a) represent the intervention probabilities for different nodes. The final sampling result is a set (such as the selected node). Figure 3 The output of the node intervention selection process based on prediction entropy, shown in (b) above, is based on... Figure 3(a) shows the probability calculated for the subset of nodes that were actually intervened. This is an example of the intervention-aware masking mechanism's masking probability calculation process based on local intervention density ("intervention density sensing"), the flow of which is: based on the selected set of intervention nodes... -> Calculate the local intervention density for each node -> Combining hyperparameters and Calculate adaptive masking probability . Figure 3 The numbers within the node shown in (c) can represent its local intervention density. Or it could be the masking probability directly. A higher value means that the node is more likely to be masked in a self-supervised task. Figure 3 As can be seen, the method in this embodiment achieves the precise selection of the most critical subset for model adaptation from all test nodes through a two-level linkage mechanism of "uncertainty guidance" and "intervention density perception" for representation intervention and self-supervised learning. This enhances the model's adaptability to distribution offset regions while efficiently utilizing test data.
[0062] During the test-time training phase, this embodiment employs a representation fine-tuning method (TTReFT) to address distribution shifts through representation intervention strategies. When processing unlabeled test samples, the framework first identifies nodes requiring intervention based on prediction uncertainty, and then imposes constrained adjustments on their representations. This process begins with uncertainty quantification, where nodes with high information content are labeled as intervention candidates. For these node sets... The framework employs low-rank representation intervention, making adjustments in a controlled subspace to maintain overall structural stability while allowing necessary corrections.
[0063] Traditional test-time training methods rely on direct parameter modification, often leading to catastrophic forgetting. In contrast, the representation fine-tuning method (TTReFT) in this embodiment proposes a novel adaptive paradigm for the representation space, based on the principles of "uncertainty guidance" and "low-rank intervention." This design not only completely avoids catastrophic forgetting but also possesses modularity and pluggability, allowing application without modifying the original model structure and parameters. Experimental results show that treating all nodes equally with intervention leads to reduced computational efficiency and weakens prediction reliability. Therefore, the representation fine-tuning method (TTReFT) in this embodiment introduces a dynamic node selection mechanism, prioritizing nodes with higher prediction uncertainty. Specifically, in step S102 of this embodiment, high-entropy nodes are selected as the set of nodes requiring intervention. include:
[0064] S201, for unlabeled target domain data Calculate the prediction entropy for each graph data node:
[0065] ;
[0066] in, For graph data nodes Predicted entropy, For a set of categories, Indicates the data nodes in the graph Features Get output For category The probability of;
[0067] S202, calculate the intervention probability for each graph data node according to the smoothing threshold mechanism in the following formula:
[0068] ;
[0069] in, For graph data nodes The probability of intervention, For the Sigmoid function, This is a sharpness parameter used to control the threshold. To predict the entropy threshold;
[0070] S203, for each graph data node Intervention probability From the perspective of intervention probability Bernoulli distribution Sampling data nodes in the graph Interference mask The intervention mask The value can be 0 or 1 to represent a graph data node. Whether intervention is needed is determined by obtaining a set of all graph data nodes that require intervention. The set of nodes that require intervention This highlights the nodes with the most significant distribution shift.
[0071] For the selected intervention node, the representation fine-tuning method (TTReFT) in this embodiment employs low-rank linear subspace representation fine-tuning (LoReFT), which maintains the structure of the original representation while allowing for targeted modifications. Specifically, the function expression of the low-rank representation intervention function in step S102 of this embodiment is as follows:
[0072] ;
[0073] in, The low-rank representation represents the node features after intervention. The low-rank representation represents the intervention function. For nodes original features The node features after processing the output of a layer of neural network. , and These represent the matrix, weights, and biases of the intervention function, respectively, in low-rank form. , , , ,in The dimension is , The dimension is , The dimension is , Dimensions of node features. The dimension of the low-rank adaptive space. Matrix Orthogonalization constraints are imposed to ensure that interventions remain within a strictly defined subspace, avoiding excessive shifts. Adaptive parameters are optimized using an autoencoder-like objective function to simultaneously maintain representation quality and adaptability to distribution shifts. Compared to full-parameter fine-tuning, this method significantly reduces the number of trainable parameters while still achieving efficient adaptation.
[0074] To optimize the intervention process under unlabeled target data conditions, this embodiment further designs an Intervention-Aware Masked Autoencoder (IAMAE) within the Characterization Fine-tuning Method (TTReFT). This method is based on a core assumption: the intervened node and its neighbors contain crucial information about distribution drift, and therefore should be given higher weight during reconstruction. Traditional graph masking autoencoders typically employ random masking, failing to capture the correlation between intervention location and distribution changes. This embodiment's Characterization Fine-tuning Method (TTReFT) adjusts the masking probability based on local intervention density, allowing the model to focus more on learning features of the most significant distribution shift. Specifically, the IAMAE in this embodiment includes an intervention-aware masking module, an encoder, and a decoder based on a graph convolutional network (GCN). The intervention-aware masking module is used to process the node feature matrix composed of node features from all graph data nodes. Intervention-based perceptual masking generates a masked feature matrix. The encoder is used to transform the masked feature matrix Encoding yields the adjusted node representation. The decoder based on the graph convolutional network (GCN) is used to modify the node representations after intervention. The node feature matrix is extracted using a graph convolutional network (GCN). Reconstruction results .
[0075] In step S102 of this embodiment, when iteratively optimizing the parameters of the low-rank representation intervention function using the Intervention-Aware Masking Autoencoder (IAMAE) and a preset loss function, the intervention-aware masking module constructs a node feature matrix from the node features of all graph data nodes. Intervention-based perceptual masking generates a masked feature matrix. include:
[0076] S301, the set of nodes to be intervened upon as needed. Calculate each graph data node Local intervention density :
[0077] ;
[0078] in, For graph data nodes The set of k-hop neighbor nodes, Indicates simultaneously belonging to and the set of nodes that need intervention. nodes Quantity;
[0079] S302, combined with local intervention density The adaptive masking probability is calculated according to the following formula. :
[0080] ;
[0081] in, and As adjustable hyperparameters, this strategy systematically increases the masking probability in high-intervention regions, thereby forcing the model to achieve stronger reconstruction capabilities in these regions;
[0082] S303, based on adaptive masking probability Given the probability distribution, select a subset of nodes. Perform masking and replace the original node features with a learnable mask vector. This generates the masked feature matrix. .
[0083] In this embodiment, the encoder consists of a pre-trained GNN network and a low-rank representation intervention function concatenated together. The encoder then transmits the masked feature matrix... Encoding yields the adjusted node representation. The function expression is:
[0084] ;
[0085] in, For pre-trained GNN networks, The adjacency matrix of the graph data. This is a function composition operator, indicating that the output of the previous function is used as the input of the next function; The low-rank representation is the intervention function; the core objective of the pre-trained GNN network is to reconstruct the input graph through the decoding process, obtaining the intervention-adjusted node representation. The dimension is .
[0086] In this embodiment, the decoder includes a secondary masking module and a two-layer GCN network. The secondary masking module is used to represent the nodes after intervention and adjustment. The middle belongs to the node subset Partial secondary masking is performed to generate a secondary masked node representation. The two-layer GCN network is used for the node representation after secondary masking of the input. Adjacency matrix of graph data Decode to generate node feature matrix Reconstruction results , can be represented as:
[0087] ;
[0088] in, The reconstruction result, i.e., the reconstructed graph data, can correspond to structural reconstruction, feature reconstruction, or a combination of both. This task provides theoretical and experimental support for understanding the mechanism of graph representation learning.
[0089] In step S102 of this embodiment, when iteratively optimizing the parameters of the low-rank representation intervention function using the Intervention-Aware Masking Autoencoder (IAMAE) and a preset loss function, the function expression of the loss function is as follows:
[0090] ;
[0091] ;
[0092] in, The default loss function is... To address the reconstruction masking feature loss of the IAMAE perceptual masking autoencoder, , which are weighting parameters (used to balance the self-entropy loss and the loss of reconstructing masking features). For self-entropy loss, For a set of categories, To belong to category The probability of this composite optimization objective effectively guides the model to achieve reliable adaptation under distribution drift. The reconstruction masking feature loss of the intervention-aware masking autoencoder (IAMAE) uses scaled cosine error, and its functional expression is:
[0093] ;
[0094] in, For a set of nodes Size, For nodes The original characteristics, for transpose, for norm, For nodes The reconstruction features, for norm, This is the scaling factor.
[0095] During the inference phase, this embodiment's representation fine-tuning method (TTReFT) fully combines the advantages of the pre-trained model and the intervention mechanism. For most nodes, the model uses the original inference path for prediction; however, for nodes identified as high-risk in the uncertainty assessment, the intervention module is activated to adjust their representation. Specifically, in step S103 of this embodiment, the model determines whether a node belongs to the set requiring intervention. We select either the original node features or the node features after low-rank representation intervention as input features for the graph data node classification model, so as to utilize the graph data node classification model based on pre-trained parameters. The function expression for obtaining the paper classification results is:
[0096] ;
[0097] in, For nodes The paper classification results For nodes The original characteristics, To make nodes original features First input based on pre-trained parameters Graph data node classification model Calculations are performed, and then the intervention function is represented by the optimal low-rank representation. The output obtained from the processing; This is a function composition operator, indicating that the output of the previous function becomes the input of the next function. Wherein, for In addition to other situations, this design ensures that the knowledge of the pre-trained model continues to play a role in confident predictions, while providing targeted adaptations where necessary, thus achieving a balance between performance and robustness.
[0098] To verify the effectiveness of the characterization fine-tuning method (TTReFT) in this embodiment, experiments were conducted on five classic node classification datasets: Cora, PubMed, Citeseer, WikiCS, and Arxiv. To evaluate OOD generalization ability, various data partitioning methods were designed, with clear distinctions between covariate shifts (e.g., word distribution changes) and concept shifts (e.g., degree distribution-based changes). Model performance was measured by classification accuracy. All experiments were run independently under five different random seeds, and the average value was reported to ensure result stability. This experimental framework can be applied to any GNN model; this experiment primarily uses the most widely used GCN, but GAT and GraphSAGE can also be used. The baselines for comparison with the characterization fine-tuning methods in this embodiment include: EERM: a graph structure OOD generalization method based on environment regularization; Tent: a test-time adaptive method originally used in computer vision; GTrans: a graph transformation method for test-time node classification; and HomoTTT: a fully test-time training method based on self-supervision for GNNs. The final results are shown in Table 1.
[0099] Table 1: Comparison of test data between TTReFT and baseline under concept splitting
[0100]
[0101] Table 1 shows that the characterization fine-tuning method in this embodiment outperforms traditional methods in most scenarios, and achieves performance comparable to or even better than a fully fine-tuned model with limited node-level intervention. This indicates that targeted parameter tuning can effectively compensate for distribution shifts without requiring full parameter optimization. Although EERM outperforms Tent in some scenarios, its high computational cost limits its practical application. Post-processing methods such as the characterization fine-tuning method in this embodiment can achieve plug-and-play adaptation advantages at a lower cost, without requiring additional pre-training overhead.
[0102] To evaluate the stability of the characterization fine-tuning method in this embodiment, after training was completed during testing, the performance degradation of the characterization fine-tuning method with zero catastrophic forgetting and the training data baseline relative to the pre-trained model was measured. The results are shown in Table 2.
[0103] Table 2: Stability Test Results
[0104]
[0105] Table 2 shows that the fine-tuning method in this embodiment maintains the same accuracy as the pre-trained model across all datasets, thus avoiding catastrophic forgetting. This contrasts sharply with traditional parameter fine-tuning methods, which often experience performance degradation of up to 15–20% in experiments.
[0106] Figure 4 The comparison results of different self-supervised tasks in this embodiment are shown below. The four curves represent: IAMAE (Intervention-Aware Masked Autoencoder), MAE (Traditional Masked Autoencoder), Contrastive (Contrastive Learning Method), and Entropy (Self-Entropy Minimization Method). In this embodiment, the IAMAE combines an intervention-aware masking module with a low-rank representation intervention function to focus on reconstructing nodes with high intervention density, thus more effectively adapting to distribution shifts. The traditional MAE does not introduce an intervention-aware mechanism; its masking strategy is random masking, contrasting with the intervention-aware masking mechanism proposed in the characterization fine-tuning method of this embodiment. Contrastive represents a self-supervised method based on contrastive learning, which typically relies on data augmentation strategies, fundamentally different in task design from the intervention-aware reconstruction task proposed in the characterization fine-tuning method of this embodiment. Entropy represents a self-entropy minimization method, aiming to reduce model prediction uncertainty, which differs from the self-entropy loss in the characterization fine-tuning method of this embodiment. The design concept is consistent, but it does not integrate reconstruction tasks with intervention mechanisms. See also Figure 4 It can be seen that the Intervention-Aware Masked Autoencoder (IAMAE) in this embodiment performs better than the traditional Masked Autoencoder (MAE) in intervention scenarios guided by uncertainty. This is due to its adaptive masking mechanism, which can more effectively maintain the distribution pattern. Generative methods generally outperform contrastive learning and self-entropy minimization in OOD scenarios, indicating that the reconstruction-based objective function has a greater advantage in capturing invariant features. The overall performance improvement of the fine-tuning method in this embodiment is mainly attributed to two complementary mechanisms: (a) the intervention-aware masking strategy provides stronger robustness during the adaptation process; (b) the combination of reconstruction loss ensures that task discriminability is maintained during intervention.
[0107] In this embodiment, the optimization of the overall performance of the fine-tuning method mainly relies on two key hyperparameters: the node selection ratio PP and the target layer number LL. The node selection ratio PP corresponds to the high-entropy node selection mechanism described in step S102, which dynamically determines the set of nodes to be intervened through a predictive entropy and smoothing threshold mechanism. This parameter controls the intervention range and affects the model's adaptability to distribution shifts; the target layer number LL corresponds to the low-rank representation intervention function in step S102. At the intervention level within the network, this parameter determines the position of the intervention operation within the GNN network, influencing the depth and effectiveness of the adjustment. These two hyperparameters together determine the intervention strategy and adaptability of the characterization fine-tuning method during the training phase of testing in this embodiment; a balance between performance and efficiency can be achieved through reasonable settings. Figure 5 This document presents the sensitivity analysis results for different node selection ratios (PP) on the Cora and Citeseer datasets in this embodiment. Figure 6 The results are the sensitivity analysis results for different target layer numbers LL in this embodiment. Figure 5 This indicates that GNNs of different depths are sensitive to the number of intervention layers differently: a two-layer GCN on the Cora dataset achieves optimal performance with a single-layer intervention, while a four-layer model on the Citeseer dataset requires two layers of intervention. This suggests that the greater the model depth, the more necessary it is to have appropriate multi-layer interventions. Figure 6 This demonstrates that intervention on only 10% of the high-uncertainty nodes achieves performance comparable to or better than intervention on all nodes. This strategy significantly reduces computational overhead while maintaining high accuracy. Therefore, the practical deployment of this fine-tuning method, as shown in this embodiment, requires flexible selection of intervention strategies based on model depth and node uncertainty to achieve a balance between performance and efficiency.
[0108] In summary, to address the catastrophic forgetting problem prevalent in Test-Time Training (TTT), this embodiment's representation fine-tuning method, unlike traditional adaptation methods that rely on direct parameter updates, utilizes representation intervention as an alternative. This approach ensures robust generalization to disseminated data while fully preserving knowledge of the original task. The key mechanism of this representation fine-tuning method lies in the uncertainty-driven intervention strategy and the intervention-aware masked autoencoder loss function, providing a fundamental solution for test-time training. This framework is highly modular, can be embedded as an independent component into existing systems, and can run without modifying the underlying model architecture. Experimental results on multiple benchmark tasks and theoretical analyses demonstrate that the representation-centric paradigm proposed in this embodiment has significant advantages in test-time adaptation. This representation fine-tuning method not only advances the development of test-time training techniques for graph-structured data but also lays the foundation for future exploration of adaptive methods in dynamic graph scenarios.
[0109] Furthermore, this embodiment also provides a representation fine-tuning system for training during graph data node classification testing, including a microprocessor and a memory interconnected, wherein the microprocessor is programmed or configured to execute the representation fine-tuning method for training during graph data node classification testing. This embodiment also provides a computer-readable storage medium storing a computer program or instructions programmed or configured to execute the representation fine-tuning method for training during graph data node classification testing via a processor. This embodiment also provides a computer program product including a computer program or instructions programmed or configured to execute the representation fine-tuning method for training during graph data node classification testing via a processor.
[0110] Those skilled in the art will understand that the technical solutions provided by this invention may take the form of a method, system, or computer program product. Therefore, this invention may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this invention may take the form of a computer program product embodied on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, produce an implementation of the flowchart... Figure 1 One or more processes and / or boxes Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0111] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A method for fine-tuning representations during training in graph data node classification testing, characterized in that, Includes the following steps: S101, during the pre-training phase, utilizes labeled source domain data. Complete the pre-training of the graph data node classification model to obtain the pre-trained parameters of the graph data node classification model. ; S102, during the representation fine-tuning phase of training at test time, for unlabeled target domain data. Select high-entropy nodes as the set of nodes that need intervention. For the set of nodes that require intervention The nodes that need intervention are intervened using a low-rank representation intervention function. The parameters of the low-rank representation intervention function are iteratively optimized using the Intervention-Aware Masking Autoencoder (IAMAE) and a preset loss function to finally obtain the optimal low-rank representation intervention function. S103, During the inference phase, for the input unlabeled target domain data... The nodes in the set are categorized based on whether they belong to the set of nodes requiring intervention. The original node features or the node features after intervention through the optimal low-rank representation function are selected as input features for the graph data node classification model, so as to utilize the graph data node classification model based on pre-trained parameters. To obtain the paper classification results; the target domain data and source domain data All graph data are in text format, where nodes represent papers and edges represent citation relationships within those papers. In step S102, high-entropy nodes are selected as the set of nodes that need intervention. include: S201, for unlabeled target domain data Calculate the prediction entropy for each graph data node: ; in, For graph data nodes Predicted entropy, For a set of categories, Indicates the data nodes in the graph Features Get output For category The probability of; S202, calculate the intervention probability for each graph data node according to the smoothing threshold mechanism in the following formula: ; in, For graph data nodes The probability of intervention, For the Sigmoid function, This is a sharpness parameter used to control the threshold. To predict the entropy threshold; S203, for each graph data node Intervention probability From the perspective of intervention probability Bernoulli distribution Sampling data nodes in the graph Interference mask The intervention mask The value can be 0 or 1 to represent a graph data node. Whether intervention is needed is determined by obtaining a set of all graph data nodes that require intervention. ; In step S102, the low-rank representation of the intervention function has the following functional expression: ; in, The low-rank representation represents the node features after intervention. The low-rank representation represents the intervention function. For nodes original features The node features after processing the output of a layer of neural network. , and These represent the matrix, weights, and biases of the intervention function, respectively, in low-rank form. , , , ,in The dimension is , The dimension is , The dimension is , Dimensions of node features. The dimension of the low-rank adaptive space.
2. The representation fine-tuning method during training for graph data node classification testing according to claim 1, characterized in that, The Intervention-Aware Masking Autoencoder (IAMAE) includes an intervention-aware masking module, an encoder, and a decoder based on a graph convolutional network (GCN). The intervention-aware masking module is used to generate a node feature matrix from the node features of all graph data nodes. Intervention-based perceptual masking generates a masked feature matrix. The encoder is used to transform the masked feature matrix Encoding yields the adjusted node representation. The decoder based on the graph convolutional network (GCN) is used to modify the node representations after intervention. The node feature matrix is extracted using a graph convolutional network (GCN). Reconstruction results .
3. The representation fine-tuning method during training for graph data node classification testing according to claim 2, characterized in that, In step S102, when iteratively optimizing the parameters of the low-rank representation intervention function using the intervention-aware masking autoencoder (IAMAE) and a preset loss function, the intervention-aware masking module constructs a node feature matrix from the node features of all graph data nodes. Intervention-based perceptual masking generates a masked feature matrix. include: S301, the set of nodes to be intervened upon as needed. Calculate each graph data node Local intervention density : ; in, For graph data nodes The set of k-hop neighbor nodes, Indicates simultaneously belonging to and the set of nodes that need intervention. nodes Quantity; S302, combined with local intervention density The adaptive masking probability is calculated according to the following formula. : ; in, and It is an adjustable hyperparameter; S303, based on adaptive masking probability Given the probability distribution, select a subset of nodes. Perform masking and replace the original node features with a learnable mask vector. This generates the masked feature matrix. ; The encoder consists of a pre-trained GNN network and a low-rank representation intervention function concatenated together. The encoder converts the masked feature matrix... Encoding yields the adjusted node representation. The function expression is: ; in, For pre-trained GNN networks, The adjacency matrix of the graph data. This is a function composition operator, indicating that the output of the previous function is used as the input of the next function; The low-rank representation represents the intervention function; The decoder includes a secondary masking module and a two-layer GCN network. The secondary masking module is used to represent the nodes after intervention and adjustment. The middle belongs to the node subset Partial secondary masking is performed to generate a secondary masked node representation. The two-layer GCN network is used for the node representation after secondary masking of the input. Adjacency matrix of graph data Decode to generate node feature matrix Reconstruction results .
4. The representation fine-tuning method during training for graph data node classification testing according to claim 3, characterized in that, In step S102, when iteratively optimizing the parameters of the low-rank representation intervention function using the intervention-aware masking autoencoder (IAMAE) and a preset loss function, the function expression of the loss function is as follows: ; ; ; in, The default loss function is... To address the reconstruction masking feature loss of the IAMAE perceptual masking autoencoder, For weight parameters, For self-entropy loss, For a set of nodes Size, For nodes The original characteristics, for transpose, for norm, For nodes The reconstruction features, for norm, Scaling factor For a set of categories, To belong to category The probability of.
5. The representation fine-tuning method during training for graph data node classification testing according to claim 1, characterized in that, In step S103, the decision is made based on whether the node belongs to the set of nodes requiring intervention. We select either the original node features or the node features after low-rank representation intervention as input features for the graph data node classification model, so as to utilize the graph data node classification model based on pre-trained parameters. The function expression for obtaining the paper classification results is: ; in, For nodes The paper classification results For nodes The original characteristics, To make nodes original features First input based on pre-trained parameters Graph data node classification model Calculations are performed, and then the intervention function is represented by the optimal low-rank representation. The output obtained from the processing; This is a function compounding operator, indicating that the output of the previous function is the input of the next function.
6. A representation fine-tuning system for training during graph data node classification testing, comprising a microprocessor and a memory interconnected, characterized in that, The microprocessor is programmed or configured to execute the representation fine-tuning method during training for graph data node classification testing as described in any one of claims 1 to 5.
7. A computer-readable storage medium storing a computer program or instructions, characterized in that, The computer program or instructions are programmed or configured to execute, via a processor, the representation fine-tuning method during training for graph data node classification testing as described in any one of claims 1 to 5.
8. A computer program product, comprising a computer program or instructions, characterized in that, The computer program or instructions are programmed or configured to execute, via a processor, the representation fine-tuning method during training for graph data node classification testing as described in any one of claims 1 to 5.