GraphChain: Large Language Models for Large-scale Graph Analysis via Tool Chaining

Chunyu Wei, Wenji Hu, Xingjia Hao, Xin Wang, Yifan Yang, Yunhai Wang, Yang Tian, Yueguo Chen

Abstract

Large Language Models (LLMs) face significant challenges when analyzing large-scale, complex graphs due to context window limitations and reasoning hallucinations. We present GraphChain, a framework that treats graph analysis as a sequential decision-making task. By utilizing progressive graph distillation via reinforcement learning and structure-aware test-time adaptation, GraphChain enables LLMs to chain specialized tools to navigate massive networks. Experimental results show that GraphChain outperforms existing methods by over 20% in accuracy and scales effectively to graphs with hundreds of thousands of nodes, maintaining performance where traditional LLM approaches fail.

1. Introduction

Analyzing large-scale graphs, such as financial transaction networks or social media structures, presents two primary obstacles for standard LLMs: context exhaustion and reasoning hallucination. Context exhaustion occurs when graph data exceeds the model's token limit, making it impossible to process massive subgraphs. Reasoning hallucination arises when models attempt to solve complex graph queries in a single step, leading to inaccurate tool calls or fabricated results. Furthermore, the structural diversity of graphs (e.g., molecular vs. traffic networks) necessitates an adaptive approach rather than a static strategy.

2. Methodology: The GraphChain Framework

GraphChain addresses these issues by decomposing complex queries into a sequence of tool calls, mimicking human expert exploration. The model manages a "memory state" of tensor-represented graph data, calling tools from a library (based on NetworkX) that return concise natural language summaries while updating the internal large-scale graph state.

2.1 Progressive Graph Distillation

The framework employs Proximal Policy Optimization (PPO) to train the model in selecting optimal tool sequences. The reward function is designed as an "information bottleneck," rewarding the model for reducing the Graph Description Length (GDL)—effectively compressing the data—while maximizing Task Relevance to ensure the distilled information remains useful for the final answer.

2.2 Structure-aware Test-Time Adaptation (STTA)

To account for varying graph topologies, GraphChain computes a "structural fingerprint" using spectral properties derived from the graph Laplacian's singular values. A lightweight adapter processes this signature to generate a "soft prompt," allowing the model to adapt its tool-selection strategy to the specific graph structure without full retraining.

The GraphChain architecture features a training phase focused on progressive distillation and a test-time adaptation phase using structural fingerprints.

3. Experimental Evaluation

The framework was evaluated across diverse scenarios, including citation graphs (Cora, PubMed), social networks (Facebook, Twitter), chemical molecules (QM9), traffic networks (METR-LA), and financial networks (Elliptic). Notably, the Elliptic dataset includes transaction networks with over 200,000 nodes, providing a rigorous test for scalability.

4. Results and Discussion

GraphChain achieved an average accuracy of 84.7%, representing a 20.7% relative improvement over prior state-of-the-art methods like GraphForge (70.2%).

4.1 Scalability and Efficiency

A key finding is GraphChain's robustness to graph size. While baseline performance typically degrades significantly as graphs grow beyond 100 nodes, GraphChain maintains high accuracy even on the 200,000-node financial network. Additionally, a GraphChain-tuned 7B parameter model (Qwen2.5-7B) outperformed much larger models like GPT-4o, highlighting the efficiency of the tool-chaining approach.

Performance comparison across domains and graph sizes, demonstrating GraphChain's superior accuracy and scalability compared to GPT-4 and GraphForge.

4.2 Ablation Study

Ablation tests confirmed that removing either the distillation or the adaptation components led to significant performance drops, proving both are critical for robust analysis across diverse graph topologies.

5. Conclusion

GraphChain demonstrates that iterative refinement and tool chaining are essential for large-scale graph analysis. By treating graph exploration as a sequential task and utilizing spectral fingerprints for adaptation, the framework overcomes the memory and reasoning limits of current LLMs. Future work will focus on extending the framework to dynamic, temporal graphs and expanding the tool library for specialized domains like bioinformatics.

Summary updated

BibTeX
@inproceedings{wei2025graphchain,
  author = {Chunyu Wei and Wenji Hu and Xingjia Hao and Xin Wang and Yifan Yang and Yunhai Wang and Yang Tian and Yueguo Chen},
  title = {{GraphChain: Large Language Models for Large-scale Graph Analysis via Tool Chaining}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=Rdz6ESQYkK},
}
Figure