Learning Task-Adaptive Connectivity for Graph Transformers
Abstract
Graph Transformers enable all-to-all interactions between nodes, but the connectivity pattern that best supports graph learning is often task-dependent. Some tasks benefit from sparse, topology-aligned message passing, while others require long-range or global interactions beyond the input adjacency. This mismatch limits the adaptability of Graph Transformers, especially in graph foundation models that must support diverse downstream tasks. We propose MaskGT, a Graph Transformer-agnostic module that learns a discrete sparse gate over attention edges. Rather than committing to either full attention or the observed graph topology, MaskGT learns which node pairs should communicate within self-attention, injecting a task-adaptive relational inductive bias into the model. Across synthetic and real-world benchmarks, MaskGT improves performance and robustness by suppressing spurious interactions under structural noise. It also enables parameter-efficient multi-task learning and transfer by localizing task-specific structure mask while reusing a shared backbone model. These results suggest that adaptive attention sparsification is a promising direction for building more general-purpose graph models.