{"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/steptool-a-step-grained-reinforcement","title":"StepTool: A Step-grained Reinforcement Learning Framework for Tool Learning in LLMs","arxiv_id":"2410.07745","date":"2024-10-10","proceeding":null,"authors":["Yuanqing Yu","Zhefan Wang","Weizhi Ma","Zhicheng Guo","Jingtao Zhan","Shuai Wang","Chuhan Wu","Zhiqiang Guo","Min Zhang"],"abstract":"Despite having powerful reasoning and inference capabilities, Large Language Models (LLMs) still need external tools to acquire real-time information retrieval or domain-specific expertise to solve complex tasks, which is referred to as tool learning. Existing tool learning methods primarily rely on tuning with expert trajectories, focusing on token-sequence learning from a linguistic perspective. However, there are several challenges: 1) imitating static trajectories limits their ability to generalize to new tasks. 2) even expert trajectories can be suboptimal, and better solution paths may exist. In this work, we introduce StepTool, a novel step-grained reinforcement learning framework to improve tool learning in LLMs. It consists of two components: Step-grained Reward Shaping, which assigns rewards at each tool interaction based on tool invocation success and its contribution to the task, and Step-grained Optimization, which uses policy gradient methods to optimize the model in a multi-step manner. Experimental results demonstrate that StepTool significantly outperforms existing methods in multi-step, tool-based tasks, providing a robust solution for complex task environments. Codes are available at https://github.com/yuyq18/StepTool.","url_abs":"https://arxiv.org/abs/2410.07745v2","url_pdf":"https://arxiv.org/pdf/2410.07745v2.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":"steptool-a-step-grained-reinforcement","repo_url":"https://github.com/yuyq18/steptool","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"information-retrieval","task_name":"Information Retrieval"},{"task_slug":"policy-gradient-methods","task_name":"Policy Gradient Methods"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2410.07745","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2410.07745"}},"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/yuyq18/steptool","reach":{"status":"ok"}}],"summary":{"ran":1,"ran_draft_wrong":1,"unverified":5},"by_repo_kind":{"official":{"samples":7,"ran":2,"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":7,"samples":[{"code_sha256_prefix":"33a3ba20815329dd","entry":"batch_interact_environment","repo":"yuyq18/steptool","repo_kind":"official","path":"src/baseline-archer/archer_environment.py","file_url":"https://github.com/yuyq18/steptool/blob/HEAD/src/baseline-archer/archer_environment.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":"33a3ba20815329dd"}},{"code_sha256_prefix":"e154ffa50c4434d1","entry":"dict_mean","repo":"yuyq18/steptool","repo_kind":"official","path":"src/baseline-archer/archer_trainer.py","file_url":"https://github.com/yuyq18/steptool/blob/HEAD/src/baseline-archer/archer_trainer.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e154ffa50c4434d1"}},{"code_sha256_prefix":"6bc27263e082aea0","entry":"add_mc_return","repo":"yuyq18/steptool","repo_kind":"official","path":"src/baseline-archer/archer_environment.py","file_url":"https://github.com/yuyq18/steptool/blob/HEAD/src/baseline-archer/archer_environment.py","link_basis":"harvester_set","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":"6bc27263e082aea0"}},{"code_sha256_prefix":"31a5caa2d17b76d5","entry":"add_trajectory_reward","repo":"yuyq18/steptool","repo_kind":"official","path":"src/baseline-archer/archer_environment.py","file_url":"https://github.com/yuyq18/steptool/blob/HEAD/src/baseline-archer/archer_environment.py","link_basis":"harvester_set","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":"31a5caa2d17b76d5"}},{"code_sha256_prefix":"a822c97372b609f0","entry":"get_conv_template","repo":"yuyq18/steptool","repo_kind":"official","path":"src/baseline-rft/rft.py","file_url":"https://github.com/yuyq18/steptool/blob/HEAD/src/baseline-rft/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":"a822c97372b609f0"}},{"code_sha256_prefix":"097b794353bef9ba","entry":"get_conversation_template","repo":"yuyq18/steptool","repo_kind":"official","path":"src/baseline-rft/rft.py","file_url":"https://github.com/yuyq18/steptool/blob/HEAD/src/baseline-rft/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":"097b794353bef9ba"}},{"code_sha256_prefix":"c01f568fceb061b6","entry":"get_model_adapter","repo":"yuyq18/steptool","repo_kind":"official","path":"src/baseline-rft/rft.py","file_url":"https://github.com/yuyq18/steptool/blob/HEAD/src/baseline-rft/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":"c01f568fceb061b6"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}