[recipe, tool] feat: support multi-turn and tool call for recipe/fully_async_policy
What does this PR do?
This PR supports multi-turn and tool call for recipe/fully_async_policy, referencing the implementation of recipe/retool and ToolAgentLoop.
This PR primarily implements the AsyncPartialToolAgentLoop for recipe/fully_async_policy, supporting pause during the GENERATING state or upon completion of other states.
Checklist Before Starting
- [x] Search for similar PRs. Paste at least one query link here: ...
- [x] Format the PR title as
[{modules}] {type}: {description}(This will be checked by the CI){modules}includefsdp,megatron,sglang,vllm,rollout,trainer,ci,training_utils,recipe,hardware,deployment,ray,worker,single_controller,misc,perf,model,algo,env,tool,ckpt,doc,data- If this PR involves multiple modules, separate them with
,like[megatron, fsdp, doc] {type}is infeat,fix,refactor,chore,test- If this PR breaks any API (CLI arguments, config, function signature, etc.), add
[BREAKING]to the beginning of the title. - Example:
[BREAKING][fsdp, megatron] feat: dynamic batching
Test
Following the recipe/retool, the SFT stage trained Qwen-2.5-7B-Instruct for 6 epochs on the ReTool-SFT dataset. For the RL phase, we conducted experiments on 32 H20 GPUs using BytedTsinghua-SIA/DAPO-Math-17k training dataset and yentinglin/aime_2025 test dataset.
Colocate mode used ppo_mini_batch_size=16 and train_batch_size=64; fully_async_policy mode used pop_mini_batch_size=16, trigger_parameter_sync_step=4 and staleness_threshold=1. Over 200 training steps, fully_async_policy was approximately 9 hours faster(1.65x) .
API and Usage Example
Refer to recipe/fully_async_policy/shell/dapo_7b_async_retool.sh as an example
Design & Code Changes
Demonstrate the high-level design if this PR is complex, and list the specific changes.
Checklist Before Submitting
[!IMPORTANT] Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review.
- [x] Read the Contribute Guide.
- [x] Apply pre-commit checks:
pre-commit install && pre-commit run --all-files --show-diff-on-failure --color=always - [x] Add / Update the documentation.
- [x] Add unit or end-to-end test(s) to the CI workflow to cover all the code. If not feasible, explain why: ...
- [ ] Once your PR is ready for CI, send a message in the
ci-requestchannel in theverlSlack workspace. (If not accessible, please try the Feishu group (飞书群).)
@sl-1314 Hi, the wandb link https://wandb.ai/hou-zg-meituan/fully-async-policy-multiturn-tool?nw=nwuserhouzg there seems not public.
@sl-1314 Hi, the wandb link https://wandb.ai/hou-zg-meituan/fully-async-policy-multiturn-tool?nw=nwuserhouzg there seems not public.
Thanks for the reminder, you can check it again.
@sl-1314 Hi, the wandb link https://wandb.ai/hou-zg-meituan/fully-async-policy-multiturn-tool?nw=nwuserhouzg there seems not public.
Thanks for the reminder, you can check it again.
@sl-1314 @ArronHZG Hi, I notices something that is abnormal in fully async multi-turn code. When fullyAsyncRollouter calls pause function try to pause every generation tasks, if one sample is in tool-call phase, the pause function may not be able to stop that sample since the sample is not generating in sglang instance at that moment, which causes the tool_agent_loop continue generation until its completion. I think this logic may be abnormal.
@sl-1314 @ArronHZG Hi, I notices something that is abnormal in fully async multi-turn code. When fullyAsyncRollouter calls pause function try to pause every generation tasks, if one sample is in tool-call phase, the pause function may not be able to stop that sample since the sample is not generating in sglang instance at that moment, which causes the tool_agent_loop continue generation until its completion. I think this logic may be abnormal.
Current implementation supports pause during the GENERATING state or upon completion of other states. So the agent loop will be paused after the tool-call ends, if one sample is in tool-call phase. Additionally, currently fully_async only supports vllm and does not yet support sglang.