{"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/arxiv-2603-02635","title":"SaFeR-ToolKit: Structured Reasoning via Virtual Tool Calling for Multimodal Safety","arxiv_id":"2603.02635","date":"2026-03-03","proceeding":null,"authors":["Zixuan Xu","Tiancheng He","Huahui Yi","Kun Wang","Xi Chen","Gongli Xi","Qiankun Li","Kang Li","Yang Liu","Zhigang Zeng"],"abstract":"Vision-language models remain susceptible to multimodal jailbreaks and over-refusal because safety hinges on both visual evidence and user intent, while many alignment pipelines supervise only the final response. To address this, we present SaFeR-ToolKit, which formalizes safety decision-making as a checkable protocol. Concretely, a planner specifies a persona, a Perception $\\to$ Reasoning $\\to$ Decision tool set, and a constrained transition graph, while a responder outputs a typed key-value tool trace before the final answer. To make the protocol reliably followed in practice, we train a single policy with a three-stage curriculum (SFT $\\to$ DPO $\\to$ GRPO), where GRPO directly supervises tool usage beyond answer-level feedback. Our contributions are two-fold: I. Dataset. The first tool-based safety reasoning dataset, comprising 31,654 examples (SFT 6k, DPO 18.6k, GRPO 6k) plus 1k held-out evaluation. II. Experiments. On Qwen2.5-VL, SaFeR-ToolKit significantly improves Safety/Helpfulness/Reasoning Rigor on 3B (29.39/45.04/4.98 $\\to$ 84.40/71.13/78.87) and 7B (53.21/52.92/19.26 $\\to$ 86.34/80.79/85.34), while preserving general capabilities (3B: 58.67 $\\to$ 59.21; 7B: 66.39 $\\to$ 66.81). Codes are available at https://github.com/Duebassx/SaFeR_ToolKit.","url_abs":"https://arxiv.org/abs/2603.02635","url_pdf":"https://arxiv.org/pdf/2603.02635","source":{"archive":null,"snapshot":"2025-07-28","note":"not in the Papers with Code archive (frozen at the snapshot)","row_kind":"graph","title_abstract_authors_date":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)"},"code_links":[],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2603.02635","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2603.02635"}},"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":[{"mentioned_in_github":null,"is_official":null,"provenance":"deterministic:regex_extraction","mentioned_in_paper":null,"url":"https://github.com/hiyouga/LlamaFactory","reach":null},{"mentioned_in_github":null,"is_official":null,"provenance":"deterministic:regex_extraction","mentioned_in_paper":null,"url":"https://github.com/hiyouga/EasyR1","reach":null}],"summary":{"ran":1,"unverified":14},"by_repo_kind":{"found_in_text":{"samples":15,"ran":1,"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":0,"samples":[{"code_sha256_prefix":"a91c18341292d50e","entry":"unpad_dataproto","repo":"hiyouga/EasyR1","repo_kind":"found_in_text","path":"verl/protocol.py","file_url":"https://github.com/hiyouga/EasyR1/blob/HEAD/verl/protocol.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"a91c18341292d50e"}},{"code_sha256_prefix":"6dabc7804e03b1d0","entry":"collate_fn","repo":"hiyouga/EasyR1","repo_kind":"found_in_text","path":"verl/utils/dataset.py","file_url":"https://github.com/hiyouga/EasyR1/blob/HEAD/verl/utils/dataset.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"6dabc7804e03b1d0"}},{"code_sha256_prefix":"61938c6bf9d13f84","entry":"compute_advantage_return","repo":"hiyouga/EasyR1","repo_kind":"found_in_text","path":"verl/trainer/core_algos.py","file_url":"https://github.com/hiyouga/EasyR1/blob/HEAD/verl/trainer/core_algos.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"61938c6bf9d13f84"}},{"code_sha256_prefix":"7688ceba543fa185","entry":"flash_attention_forward","repo":"hiyouga/EasyR1","repo_kind":"found_in_text","path":"verl/models/transformers/flash_attention_utils.py","file_url":"https://github.com/hiyouga/EasyR1/blob/HEAD/verl/models/transformers/flash_attention_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"7688ceba543fa185"}},{"code_sha256_prefix":"7633fd09bcf8972a","entry":"get_kl_controller","repo":"hiyouga/EasyR1","repo_kind":"found_in_text","path":"verl/trainer/core_algos.py","file_url":"https://github.com/hiyouga/EasyR1/blob/HEAD/verl/trainer/core_algos.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"7633fd09bcf8972a"}},{"code_sha256_prefix":"07ec6b020ddf3b01","entry":"get_rope_index","repo":"hiyouga/EasyR1","repo_kind":"found_in_text","path":"verl/models/transformers/qwen2_vl.py","file_url":"https://github.com/hiyouga/EasyR1/blob/HEAD/verl/models/transformers/qwen2_vl.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"07ec6b020ddf3b01"}},{"code_sha256_prefix":"0758af83dd12ea52","entry":"get_rope_index","repo":"hiyouga/EasyR1","repo_kind":"found_in_text","path":"verl/models/transformers/qwen3_vl.py","file_url":"https://github.com/hiyouga/EasyR1/blob/HEAD/verl/models/transformers/qwen3_vl.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"0758af83dd12ea52"}},{"code_sha256_prefix":"72f505c72eeef3e8","entry":"prepare_fa2_from_position_ids","repo":"hiyouga/EasyR1","repo_kind":"found_in_text","path":"verl/models/transformers/flash_attention_utils.py","file_url":"https://github.com/hiyouga/EasyR1/blob/HEAD/verl/models/transformers/flash_attention_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"72f505c72eeef3e8"}},{"code_sha256_prefix":"9a950b864d329f1c","entry":"process_image","repo":"hiyouga/EasyR1","repo_kind":"found_in_text","path":"verl/utils/dataset.py","file_url":"https://github.com/hiyouga/EasyR1/blob/HEAD/verl/utils/dataset.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"9a950b864d329f1c"}},{"code_sha256_prefix":"15cffd3e46d6bf67","entry":"qwen2_vl_base_forward","repo":"hiyouga/EasyR1","repo_kind":"found_in_text","path":"verl/models/transformers/qwen2_vl.py","file_url":"https://github.com/hiyouga/EasyR1/blob/HEAD/verl/models/transformers/qwen2_vl.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"15cffd3e46d6bf67"}},{"code_sha256_prefix":"c2c77f3bf52d2305","entry":"qwen2_vl_model_forward","repo":"hiyouga/EasyR1","repo_kind":"found_in_text","path":"verl/models/transformers/qwen2_vl.py","file_url":"https://github.com/hiyouga/EasyR1/blob/HEAD/verl/models/transformers/qwen2_vl.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c2c77f3bf52d2305"}},{"code_sha256_prefix":"75394a0b094d4a2f","entry":"qwen3_vl_base_forward","repo":"hiyouga/EasyR1","repo_kind":"found_in_text","path":"verl/models/transformers/qwen3_vl.py","file_url":"https://github.com/hiyouga/EasyR1/blob/HEAD/verl/models/transformers/qwen3_vl.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"75394a0b094d4a2f"}},{"code_sha256_prefix":"75bdeb21d651d4b5","entry":"qwen3_vl_model_forward","repo":"hiyouga/EasyR1","repo_kind":"found_in_text","path":"verl/models/transformers/qwen3_vl.py","file_url":"https://github.com/hiyouga/EasyR1/blob/HEAD/verl/models/transformers/qwen3_vl.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"75bdeb21d651d4b5"}},{"code_sha256_prefix":"c817845fd5e85ff7","entry":"reduce_metrics","repo":"hiyouga/EasyR1","repo_kind":"found_in_text","path":"verl/trainer/metrics.py","file_url":"https://github.com/hiyouga/EasyR1/blob/HEAD/verl/trainer/metrics.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c817845fd5e85ff7"}},{"code_sha256_prefix":"59499c9109dfcb5e","entry":"register_adv_estimator","repo":"hiyouga/EasyR1","repo_kind":"found_in_text","path":"verl/trainer/core_algos.py","file_url":"https://github.com/hiyouga/EasyR1/blob/HEAD/verl/trainer/core_algos.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"59499c9109dfcb5e"}}]},"arxiv_metadata":{"licence":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)","fields":["title","abstract","authors","date"],"primary_category":"cs.LG","source":"arxiv_2026.jsonl"},"syntology_extracted_results":null}