verl icon indicating copy to clipboard operation
verl copied to clipboard

[recipe, tool] feat: support multi-turn and tool call for recipe/fully_async_policy

Open sl-1314 opened this issue 1 year ago • 1 comments

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} include fsdp, 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 in feat, 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) .

image

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.

sl-1314 avatar Nov 10 '25 07:11 sl-1314

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Nov 10 '25 07:11 CLAassistant

@sl-1314 Hi, the wandb link https://wandb.ai/hou-zg-meituan/fully-async-policy-multiturn-tool?nw=nwuserhouzg there seems not public.

Zhangmj0621 avatar Nov 17 '25 13:11 Zhangmj0621

@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.

ArronHZG avatar Nov 17 '25 14:11 ArronHZG

@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.

ArronHZG avatar Nov 17 '25 14:11 ArronHZG

@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.

Zhangmj0621 avatar Nov 23 '25 09:11 Zhangmj0621

@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.

sl-1314 avatar Nov 23 '25 09:11 sl-1314