PKU-ML/GRASP-4B
📊 Overview
Integrating graph knowledge into Large Language Models (LLMs) via passive representation faces critical bottlenecks: limited context windows, unreliable numerical computation, and structural hallucinations.
To solve this, we propose GRASP (Graph Reasoning via Agentic Solving and Probing), shifting the paradigm from passive ingestion to proactive agentic exploration.
By interleaving Neighbor Retrieval for on-demand probing with Code Interpreter as a deterministic solver, GRASP enables LLMs to autonomously navigate and compute over complex topologies.
We employ a staged reinforcement learning strategy (GRPO) that transitions from visible tuning to a structure-blind environment, forcing the agent to develop genuine topological awareness.
Evaluated on multi-domain graph reasoning benchmarks, our 4B model achieves a 53.06% average performance boost, surpassing SOTA baselines like DeepSeek-V3.2 and successfully generalizing to unseen tasks,
with high potential for tackling sampling on million-node graphs and solving Hard-level LeetCode graph problems.
📌 Key Takeaways
1️⃣ Agentic Probing over Passive Ingestion.
We propose GRASP (Graph Reasoning via AgenticSolving and Probing), shifting the paradigm from passive ingestion to proactive agentic exploration. By interleaving Neighbor Retrieval (Eyes 👀) for on-demand probing with Code Interpreter (Hands 🙌) as a deterministic solver, GRASP enables LLMs to autonomously navigate and compute over complex topologies.
2️⃣ Structure-Blind RL Training.
We employ a staged reinforcement learning strategy (GRPO) that transitions from visible tuning to a structure-blind environment, forcing the agent to develop genuine topological awareness.
3️⃣ From Million-Node Graphs to Hard LeetCode.
Evaluated on multi-domain graph reasoning benchmarks, our 4B model achieves a 53.06% average performance boost, surpassing SOTA baselines like DeepSeek-V3.2 and successfully generalizing to unseen tasks, with high potential for tackling sampling on million-node graphs and solving Hard-level LeetCode graph problems.
🌊 Evaluation on Graph Reasoning Benchmarks
| Model | Arxiv | PubMed | Products | WikiCS | fb15k237 | wn18rr | TSG-Bench | ExplaGraphs | Erdős | RealErdős | Average |
|---|
| Qwen3-4B-Thinking | 51.00 | 25.00 | 21.00 | 29.00 | 16.00 | 13.00 | 62.00 | 45.00 | 38.80 | 7.11 | 30.79 |
| GPT-4o | 52.00 | 43.00 | 72.00 | 24.00 | 52.00 | 24.00 | 72.00 | 77.00 | 40.60 | 18.07 | 47.46 |
| DeepsSeek-V3.2 | 65.00 | 47.00 | 70.00 | 79.00 | 65.00 | 26.00 | 88.00 | 99.00 | 83.60 | 66.44 | 68.90 |
| GRASP-4B | 73.00 | 90.00 | 77.00 | 88.00 | 82.00 | 67.00 | 85.00 | 97.00 | 91.00 | 88.57 | 83.85 |
Quickstart
The code of Qwen3 has been in the latest Hugging Face transformers and we advise you to use the latest version of transformers.
With transformers<4.51.0, you will encounter the following error:
The following contains a code snippet illustrating how to use the model generate content based on given inputs.
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_name = "PKU-ML/GRASP-4B"
4
5# load the tokenizer and the model
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForCausalLM.from_pretrained(
8 model_name,
9 torch_dtype="auto",
10 device_map="auto"
11)
12
13# prepare the model input
14prompt = "Give me a short introduction to large language model."
15messages = [
16 {"role": "user", "content": prompt}
17]
18text = tokenizer.apply_chat_template(
19 messages,
20 tokenize=False,
21 add_generation_prompt=True,
22)
23model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
24
25# conduct text completion
26generated_ids = model.generate(
27 **model_inputs,
28 max_new_tokens=8192
29)
30output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
31
32# parsing thinking content
33try:
34 # rindex finding 151668 (</think>)
35 index = len(output_ids) - output_ids[::-1].index(151668)
36except ValueError:
37 index = 0
38
39thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
40content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")
41
42print("thinking content:", thinking_content) # no opening <think> tag
43print("content:", content)
44
Agentic Use
For the specific tool configuration and agentic usages of GRASP, please refer to our
example on Github.
Citation
If you find our work helpful, feel free to give us a cite.