{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/graphwiz-an-instruction-following-language","title":"GraphWiz: An Instruction-Following Language Model for Graph Problems","arxiv_id":"2402.16029","date":"2024-02-25","proceeding":null,"authors":["Nuo Chen","Yuhan Li","Jianheng Tang","Jia Li"],"abstract":"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.","url_abs":"https://arxiv.org/abs/2402.16029v5","url_pdf":"https://arxiv.org/pdf/2402.16029v5.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"graphwiz-an-instruction-following-language","repo_url":"https://github.com/nuochenpku/Graph-Reasoning-LLM","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"instruction-following","task_name":"Instruction Following"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"gpt-4","method_name":"GPT-4"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2402.16029","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.16029"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/nuochenpku/Graph-Reasoning-LLM","reach":{"status":"ok"}}],"summary":{"ran":13,"unverified":2},"by_repo_kind":{"official":{"samples":15,"ran":13,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"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"},"n_pointer_only_for_licence":15,"samples":[{"code_sha256_prefix":"396d434e88c64ffc","entry":"align_json_files","repo":"nuochenpku/Graph-Reasoning-LLM","repo_kind":"official","path":"find_paths/select_path_dpo.py","file_url":"https://github.com/nuochenpku/Graph-Reasoning-LLM/blob/HEAD/find_paths/select_path_dpo.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"396d434e88c64ffc"}},{"code_sha256_prefix":"c06da6a099b5ef5f","entry":"align_json_files","repo":"nuochenpku/Graph-Reasoning-LLM","repo_kind":"official","path":"find_paths/select_path_yh.py","file_url":"https://github.com/nuochenpku/Graph-Reasoning-LLM/blob/HEAD/find_paths/select_path_yh.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c06da6a099b5ef5f"}},{"code_sha256_prefix":"2af60a15ea79a591","entry":"check","repo":"nuochenpku/Graph-Reasoning-LLM","repo_kind":"official","path":"evaluation/evaluate_nlg.py","file_url":"https://github.com/nuochenpku/Graph-Reasoning-LLM/blob/HEAD/evaluation/evaluate_nlg.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2af60a15ea79a591"}},{"code_sha256_prefix":"01d7f77dee709047","entry":"create_random_bipartite_graph","repo":"nuochenpku/Graph-Reasoning-LLM","repo_kind":"official","path":"generation/gen_random_graph.py","file_url":"https://github.com/nuochenpku/Graph-Reasoning-LLM/blob/HEAD/generation/gen_random_graph.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"01d7f77dee709047"}},{"code_sha256_prefix":"00a3181d99df9811","entry":"create_random_graph","repo":"nuochenpku/Graph-Reasoning-LLM","repo_kind":"official","path":"generation/gen_random_graph.py","file_url":"https://github.com/nuochenpku/Graph-Reasoning-LLM/blob/HEAD/generation/gen_random_graph.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"00a3181d99df9811"}},{"code_sha256_prefix":"fadeeb767576498e","entry":"create_smaller_graph","repo":"nuochenpku/Graph-Reasoning-LLM","repo_kind":"official","path":"generation/gen_random_graph.py","file_url":"https://github.com/nuochenpku/Graph-Reasoning-LLM/blob/HEAD/generation/gen_random_graph.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fadeeb767576498e"}},{"code_sha256_prefix":"128d74a9420e639e","entry":"diameter","repo":"nuochenpku/Graph-Reasoning-LLM","repo_kind":"official","path":"generation/diameter.py","file_url":"https://github.com/nuochenpku/Graph-Reasoning-LLM/blob/HEAD/generation/diameter.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"128d74a9420e639e"}},{"code_sha256_prefix":"287846e257403143","entry":"extract_last_num","repo":"nuochenpku/Graph-Reasoning-LLM","repo_kind":"official","path":"evaluation/evaluate_nlg.py","file_url":"https://github.com/nuochenpku/Graph-Reasoning-LLM/blob/HEAD/evaluation/evaluate_nlg.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"287846e257403143"}},{"code_sha256_prefix":"520790f3ea83aab5","entry":"filter_string","repo":"nuochenpku/Graph-Reasoning-LLM","repo_kind":"official","path":"find_paths/methods.py","file_url":"https://github.com/nuochenpku/Graph-Reasoning-LLM/blob/HEAD/find_paths/methods.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"520790f3ea83aab5"}},{"code_sha256_prefix":"ebd39d23e9bced62","entry":"gsm8k_batch_gen","repo":"nuochenpku/Graph-Reasoning-LLM","repo_kind":"official","path":"evaluation/evaluate_nlg.py","file_url":"https://github.com/nuochenpku/Graph-Reasoning-LLM/blob/HEAD/evaluation/evaluate_nlg.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ebd39d23e9bced62"}},{"code_sha256_prefix":"a07494e561b93be7","entry":"if_bipartite","repo":"nuochenpku/Graph-Reasoning-LLM","repo_kind":"official","path":"generation/bipartite.py","file_url":"https://github.com/nuochenpku/Graph-Reasoning-LLM/blob/HEAD/generation/bipartite.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a07494e561b93be7"}},{"code_sha256_prefix":"ff7c2d373251f1de","entry":"if_connected","repo":"nuochenpku/Graph-Reasoning-LLM","repo_kind":"official","path":"generation/connectivity_.py","file_url":"https://github.com/nuochenpku/Graph-Reasoning-LLM/blob/HEAD/generation/connectivity_.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ff7c2d373251f1de"}},{"code_sha256_prefix":"d30c5f4f1d042115","entry":"if_cyclic","repo":"nuochenpku/Graph-Reasoning-LLM","repo_kind":"official","path":"generation/cycle_.py","file_url":"https://github.com/nuochenpku/Graph-Reasoning-LLM/blob/HEAD/generation/cycle_.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d30c5f4f1d042115"}},{"code_sha256_prefix":"6058690bab2d496f","entry":"get_lines_ranking","repo":"nuochenpku/Graph-Reasoning-LLM","repo_kind":"official","path":"find_paths/extract_rft.py","file_url":"https://github.com/nuochenpku/Graph-Reasoning-LLM/blob/HEAD/find_paths/extract_rft.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6058690bab2d496f"}},{"code_sha256_prefix":"fde5288fcc16fe36","entry":"kmeans","repo":"nuochenpku/Graph-Reasoning-LLM","repo_kind":"official","path":"find_paths/extract_rft.py","file_url":"https://github.com/nuochenpku/Graph-Reasoning-LLM/blob/HEAD/find_paths/extract_rft.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fde5288fcc16fe36"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}