Abstract
Graph Neural Networks frequently exhibit significant performance degradation in the out-of-distribution test scenario. While test-time training (TTT) offers a promising solution, existing Parameter Finetuning (PaFT) paradigm suffer from catastrophic forgetting, hindering their real-world applicability. We propose TTReFT, a novel Test-Time Representation FineTuning framework that transitions the adaptation target from model parameters to latent representations. Specifically, TTReFT achieves this through three key innovations: (1) uncertainty-guided node selection for specific interventions, (2) low-rank representation interventions that preserve pre-trained knowledge, and (3) an intervention-aware masked autoencoder that dynamically adjust masking strategy to accommodate the node selection scheme. Theoretically, we establish guarantees for TTReFT in OOD settings. Empirically, extensive experiments across five benchmark datasets demonstrate that TTReFT achieves consistent and superior performance. Our work establishes representation finetuning as a new paradigm for graph TTT, offering both theoretical grounding and immediate practical utility for real-world deployment.
Introduction: The Challenge of OOD Shifts in Graphs
Graph Neural Networks (GNNs) are powerful tools for node classification, yet they remain sensitive to distribution shifts. When the data encountered at test time differs from the training distribution—a phenomenon known as Out-of-Distribution (OOD) shift—performance often plummets. These shifts can manifest as changes in node features (covariate shift) or changes in the underlying graph structure and label relationships (concept shift).
To mitigate this, Test-Time Training (TTT) has been proposed, where the model adapts to unlabeled test samples on the fly. However, the prevailing paradigm, Parameter Finetuning (PaFT), involves updating the model's weights. This approach is plagued by "catastrophic forgetting," where the model's performance on the original training distribution is severely compromised. Moreover, updating millions of parameters during inference is computationally prohibitive for many real-time applications.
The TTReFT Framework
We introduce TTReFT (Test-Time Representation FineTuning), a paradigm shift that keeps the pre-trained model weights frozen and instead applies surgical interventions to the latent representations. This approach ensures that the fundamental knowledge captured during pre-training remains intact while allowing for flexible adaptation to new data.
1. Uncertainty-Guided Node Selection
Not all nodes require intervention. TTReFT utilizes "predictive entropy" to measure the model's uncertainty for each node. By targeting only the most "confused" nodes—those typically most affected by distribution shifts—the framework avoids over-adaptation and maintains high efficiency.
2. Low-Rank Representation Intervention (LoReFT)
Inspired by efficient tuning methods in natural language processing, we apply a lightweight, low-rank linear transformation to the hidden states of selected nodes. By constraining the intervention to a low-rank space ($r \ll d$), the model is forced to focus on the most significant directions of the distribution shift, effectively filtering out noise while preserving the core semantic structure of the original features.
3. Intervention-Aware Masked Autoencoder (IAMAE)
To facilitate self-supervised learning without labels, we employ an Intervention-Aware Masked Autoencoder. Unlike standard MAEs, IAMAE uses a dynamic masking strategy. Nodes in neighborhoods with high intervention density are masked more frequently, compelling the model to learn robust representations from their surrounding context. The training objective combines a Scaled Cosine Error for reconstruction and a Self-Entropy loss to minimize predictive uncertainty.
Theoretical Grounding
Beyond empirical success, the paper establishes mathematical guarantees (Theorem 1) showing that representation-space interventions can strictly reduce classification risk under common types of distribution shifts, such as orthogonal shifts, providing a solid foundation for the proposed approach.
Experimental Evaluation
We evaluated TTReFT on five benchmark datasets: Cora, PubMed, CiteSeer, WikiCS, and ArXiv, using the GOOD benchmark splits to simulate diverse OOD scenarios.
Key Results
- Performance Gains: TTReFT consistently outperformed state-of-the-art OOD and TTT methods. For instance, on the CiteSeer dataset, TTReFT achieved 75.80% accuracy, a significant improvement over the 70.48% achieved by standard TTT.
- Elimination of Forgetting: While PaFT methods saw performance drops of up to 25% on original data, TTReFT maintained 100% of the pre-trained model's accuracy on the source distribution.
- Efficiency: On the PubMed dataset, TTReFT demonstrated a 5x to 6x speedup over traditional TTT methods while requiring only 1/3rd of the peak memory, highlighting its suitability for resource-constrained environments.
Conclusion and Future Directions
TTReFT demonstrates that representation-space refinement is a superior alternative to parameter finetuning for graph test-time adaptation. It provides a robust, efficient, and theoretically grounded solution to the OOD problem. Future research will focus on extending the theoretical proofs to non-linear GNN architectures and adapting the framework for streaming, dynamic graph environments where topological shifts are frequent.
Summary updated