GraphSOS: Graph Sampling and Order Selection to Help LLMs Understand Graphs Better
Xu Chu, Hanlin Xue, Zhijie Tan, Bingce Wang, Tong Mo, Weiping Li
TL;DR
GraphSOS tackles two core problems in Graph LLMs: sensitivity to input serialization and the use of potentially suboptimal random subgraphs under limited context. It introduces a Subgraph Sampling Module to form informative $2$-hop neighborhoods, an Order Selector Module to generate and select effective input orders, and Graph CoT distilled from GPT-4o via two-stage instruction tuning to enhance graph reasoning. Empirical results on text-attributed graph node classification and graph QA show strong supervised and zero-shot performance gains, with ablations confirming the contribution of each component. The work advances graph understanding in LLMs by combining structured input construction with explicit reasoning, offering practical benefits for scalable graph reasoning in real-world tasks.
Abstract
The success of Large Language Models (LLMs) in various domains has led researchers to apply them to graph-related problems by converting graph data into natural language text. However, unlike graph data, natural language inherently has sequential order. We observe a counter-intuitive fact that when the order of nodes or edges in the natural language description of a graph is shuffled, despite describing the same graph, model performance fluctuates between high performance and random guessing. Additionally, due to LLMs' limited input context length, current methods typically randomly sample neighbors of target nodes as representatives of their neighborhood, which may not always be effective for accurate reasoning. To address these gaps, we introduce GraphSOS (Graph Sampling and Order Selection). This novel model framework features an Order Selector Module to ensure proper serialization order of the graph and a Subgraph Sampling Module to sample subgraphs with better structure for better reasoning. Furthermore, we propose Graph CoT obtained through distillation, and enhance LLM's reasoning and zero-shot learning capabilities for graph tasks through instruction tuning. Experiments on multiple datasets for node classification and graph question-answering demonstrate that GraphSOS improves LLMs' performance and generalization ability on graph tasks.
