Skip to content

XuShuwenn/GraphWalker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– GraphWalker: Agentic Knowledge Graph Question Answering via Synthetic Trajectory Curriculum

arXivΒ  HuggingFaceΒ  License


πŸ“’ News

Date Update
πŸš€ 2026.03 GraphWalker achieves SOTA on CWQ (79.6 EM) and WebQSP (91.5 EM) among all agentic KGQA methods
πŸ”— 2026.03 Implemented SFT with LLaMA-Factory and RL training with the Slime framework

πŸ“‘ Table of Contents


🧭 The Core Concept

Existing KGQA paradigms are limited by static reasoning scopes and a lack of autonomous, global-scale exploration, leading to poor generalization on complex structures. GraphWalker overcomes these by establishing a robust exploration and error-recovery prior through a two-stage synthetic curriculum, unlocking a superior reasoning ceiling via RL on global knowledge graphs.

Paradigm Comparison


✨ Key Innovations

1 Β· Synthetic Trajectory Synthesis

Component Role
GraphSynth Covers complex topological structures β€” Composition, Conjunction β€” to teach structured graph navigation
GraphRoll Equips the agent with self-correction and backtracking, conditioned on live environment feedback

2 Β· Agentic KG Interaction Loop

At each turn $t$, the agent emits a fully structured response:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  <think>         β”‚  Internal reasoning & strategy planning          β”‚
β”‚  <kg-query>      β”‚  Precise tool calls: get_relations, get_triples  β”‚
β”‚  <information>   β”‚  Real-time feedback from the Virtuoso KG server  β”‚
β”‚  <answer>        β”‚  Final grounded prediction                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”­ System Pipeline

GraphWalker Overview

Full Pipeline: Data Construction β†’ Two-Stage SFT β†’ RL Optimization


πŸ“Š Main Experimental Results

GraphWalker achieves SOTA across all agentic KGQA methods. Bold = best, underline = second-best.

Method Backbone CWQ EM CWQ F1 WebQSP EM WebQSP F1
πŸ”Ή Vanilla LLMs (IO Prompt)
IO PromptQwen2.5-3B-Instruct 22.017.744.630.3
IO PromptQwen2.5-7B-Instruct 25.720.750.933.2
IO PromptGPT-4o-mini 45.533.647.139.3
IO PromptDeepSeek-V3.2 50.143.563.855.7
πŸ”Ή Agentic KGQA Methods
RoGLLaMA-2-7B-Instruct 62.656.285.770.8
ToGGPT-4 69.5β€”81.9β€”
ToG-2.0GPT-3.5 68.965.877.874.5
GoGGPT-4 75.2β€”84.4β€”
KBQA-o1LLaMA3.1-8B-Instruct β€”β€”75.882.1
KG-AgentLLaMA2-7B-Instruct 72.269.883.381.0
†KG-R1Qwen2.5-3B-Instruct 66.861.782.178.9
πŸ”Έ GraphWalker (Our Method)
†Vanilla AgentQwen2.5-7B-Instruct 40.733.268.466.1
†Vanilla AgentGPT-4o-mini 63.460.379.670.6
†Vanilla AgentDeepSeek-V3.2 69.863.576.771.8
GraphWalker-7B-SFTQwen2.5-7B-Instruct 68.363.282.079.1
GraphWalker-3B-SFT-RLQwen2.5-3B-Instruct 70.965.283.581.7
GraphWalker-8B-SFT-RLLLaMA3.1-8B-Instruct 78.569.688.284.5
GraphWalker-7B-SFT-RLQwen2.5-7B-Instruct 79.674.291.588.6

† denotes models evaluated under our framework with full global KG access.


πŸ› οΈ Installation & Setup

1 Β· Environment

git clone https://github.com/GraphWalker/GraphWalker.git
cd GraphWalker
conda create -n graphwalker python=3.9 -y
conda activate graphwalker
pip install -r requirements.txt

2 Β· Virtuoso KG Server

Follow virtuoso-opensource/README.md to load Freebase and verify your SPARQL_ENDPOINT is accessible before running any evaluation.


πŸš€ Quick Start

1 Β· Evaluation (vLLM)

vllm serve "/path/to/GraphWalker-7B" \
    --host 0.0.0.0 --port 22240 \
    --served-model-name graphwalker-7b \
    --gpu-memory-utilization 0.9 --dtype auto \
    --chat-template "/path/to/chat_template.jinja"
bash run_eval_remote_vllm.sh

πŸ’‘ Download the pretrained model from πŸ€— HuggingFace

2 Β· Data Generation

# Step 1 β€” Random walk path generation
python kgqa_agent/scripts/random_walk.py \
    --config kgqa_agent/configs/random_walk/3-5hop/random_walk_10k.yaml

# Step 2 β€” QA / Info synthesis / Trajectory generation
bash pipeline_scripts/qa_gen.sh
bash pipeline_scripts/info_syn.sh
bash pipeline_scripts/traj_gen.sh

3 Β· Training

SFT β€” Use LLaMA-Factory for stage-wise fine-tuning.

RL (GRPO) β€” Run via the Slime framework:

cd slime/examples/graphwalker
bash examples/graphwalker/run_qwen2.5_7B_sft.sh

πŸ“¦ Data Formats

Trajectory Format

{
  "raw_question": "What state was Barack Obama born in?",
  "steps": [
    {
      "step_index": 0,
      "think": "I need to find where Barack Obama was born...",
      "action": "get_relations(\"Barack Obama\")",
      "information": ["people.person.place_of_birth", "..."]
    }
  ]
}

πŸ“„ Citation

If you find GraphWalker useful in your research, please consider citing:

@misc{xu2026graphwalkeragenticknowledgegraph,
      title={GraphWalker: Agentic Knowledge Graph Question Answering via Synthetic Trajectory Curriculum}, 
      author={Shuwen Xu and Yao Xu and Jiaxiang Liu and Chenhao Yuan and Wenshuo Peng and Jun Zhao and Kang Liu},
      year={2026},
      eprint={2603.28533},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2603.28533}, 
}

πŸ“– Preprint available on arXiv:2603.28533


Made with ❀️  ·  Paper  ·  Model

About

GraphWalker: Agentic Knowledge Graph Question Answering via Synthetic Trajectory Curriculum

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages