Dual Prompt Adaptation for Zero-Shot Classification on Text-attributed Graphs
Abstract
Graph learning plays a crucial role in capturing valuable information from both graph structures and node attributes. Despite their success, existing methods struggle to generalize to unseen datasets or classes. To achieve robust generalization, we identify two essential capabilities a graph model should possess: (1) Zero-shot inference on unseen classes, and (2) Cross-dataset adaptation under distribution shifts. Recently, Text-attributed Graphs (TAGs) have shed light on the possibility of achieving zero-shot classification due to their rich semantic information in node textual attributes. However, current studies on TAGs rely on handcrafted prompts for adaptation, which is engineering-intensive and overlooks structure shifts across different datasets. To bridge this gap, we propose ZeroPA, a dual-prompt adaptation framework for TAG methods that perform zero-shot prediction by matching node representations with label-text representations. Specifically, the textual prompt is prepended to label descriptions to enhance zero-shot classification. The graph prompt, on the other hand, is constructed as a subgraph and inserted into the original graph to calibrate node representations, thereby addressing distribution shifts. The dual prompts are optimized in an alternating and iterative manner, where each reinforces the other during adaptation. We conduct extensive experiments to verify the effectiveness of ZeroPA. The results demonstrate that ZeroPA consistently boosts the generalizability of TAG methods across diverse datasets. Our code is available at https://github.com/liuyang-tian/ZeroPA.git.