Papers › GraphWiz: An Instruction-Following Language Model for Graph Problems

GraphWiz: An Instruction-Following Language Model for Graph Problems

25 Feb 2024arXiv:2402.16029archive 2025-07-28

Nuo Chen, Yuhan Li, Jianheng Tang, Jia Li

Large language models (LLMs) have achieved impressive success across several fields, but their proficiency in understanding and resolving complex graph problems is less explored. To bridge this gap, we introduce GraphInstruct, a novel and comprehensive instruction-tuning dataset designed to equip language models with the ability to tackle a broad spectrum of graph problems using explicit reasoning paths. Utilizing GraphInstruct, we build GraphWiz, an open-source language model capable of resolving various graph problem types while generating clear reasoning processes. To enhance the model's capability and reliability, we incorporate the Direct Preference Optimization (DPO) framework into the graph problem-solving context. The enhanced model, GraphWiz-DPO, achieves an average accuracy of 65% across nine tasks with different complexity levels, surpassing GPT-4 which has an average accuracy of 43.8%. Moreover, our research delves into the delicate balance between training data volume and model performance, highlighting the potential for overfitting with increased data. We also explore the transferability of the model's reasoning ability across different graph tasks, indicating the model's adaptability and practical application potential. Our investigation offers a new blueprint and valuable insights for developing LLMs specialized in graph reasoning and problem-solving.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2402.16029")

Code

Syntology Ran 13 of 15 code samples harvested from 1 repository linked to this paper; 2 have no recorded run. Of those that ran: 13 ran with no contract checked.

By repository: official repository: 15 samples from 1 repository, 13 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

nuochenpku/Graph-Reasoning-LLM officialmentioned in papermentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

15 samples harvested; 13 ran; 0 honoured the contract we drafted; 2 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

13ran
2unverified

Licence: 15 of the 15 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from nuochenpku/Graph-Reasoning-LLM. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

align_json_files nuochenpku/Graph-Reasoning-LLM/find_paths/select_path_dpo.py official repository ran no licence file found · pointer only · 396d434e88c64ffc · report
align_json_files nuochenpku/Graph-Reasoning-LLM/find_paths/select_path_yh.py official repository ran no licence file found · pointer only · c06da6a099b5ef5f · report
check nuochenpku/Graph-Reasoning-LLM/evaluation/evaluate_nlg.py official repository ran no licence file found · pointer only · 2af60a15ea79a591 · report
create_random_bipartite_graph nuochenpku/Graph-Reasoning-LLM/generation/gen_random_graph.py official repository ran no licence file found · pointer only · 01d7f77dee709047 · report
create_random_graph nuochenpku/Graph-Reasoning-LLM/generation/gen_random_graph.py official repository ran no licence file found · pointer only · 00a3181d99df9811 · report
create_smaller_graph nuochenpku/Graph-Reasoning-LLM/generation/gen_random_graph.py official repository ran no licence file found · pointer only · fadeeb767576498e · report
diameter nuochenpku/Graph-Reasoning-LLM/generation/diameter.py official repository ran no licence file found · pointer only · 128d74a9420e639e · report
extract_last_num nuochenpku/Graph-Reasoning-LLM/evaluation/evaluate_nlg.py official repository ran fingerprinted no licence file found · pointer only · 287846e257403143 · report
filter_string nuochenpku/Graph-Reasoning-LLM/find_paths/methods.py official repository ran fingerprinted no licence file found · pointer only · 520790f3ea83aab5 · report
gsm8k_batch_gen nuochenpku/Graph-Reasoning-LLM/evaluation/evaluate_nlg.py official repository ran no licence file found · pointer only · ebd39d23e9bced62 · report
if_bipartite nuochenpku/Graph-Reasoning-LLM/generation/bipartite.py official repository ran no licence file found · pointer only · a07494e561b93be7 · report
if_connected nuochenpku/Graph-Reasoning-LLM/generation/connectivity_.py official repository ran no licence file found · pointer only · ff7c2d373251f1de · report
if_cyclic nuochenpku/Graph-Reasoning-LLM/generation/cycle_.py official repository ran no licence file found · pointer only · d30c5f4f1d042115 · report
get_lines_ranking nuochenpku/Graph-Reasoning-LLM/find_paths/extract_rft.py official repository unverified no licence file found · pointer only · 6058690bab2d496f · report
kmeans nuochenpku/Graph-Reasoning-LLM/find_paths/extract_rft.py official repository unverified no licence file found · pointer only · fde5288fcc16fe36 · report

Tasks

Instruction FollowingLanguage ModelingLanguage Modelling

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutGPT-4Label SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections