verl icon indicating copy to clipboard operation
verl copied to clipboard

[fully_async] feat: standalone log prob server (Model Engine Server) support

Open sl-1314 opened this issue 7 months ago • 3 comments

What does this PR do?

This PR introduces a standalone Model Engine Server for the fully_async training pipeline to compute log_probs. In the existing design, old_log_probs are recomputed by the actor training engine, which requires saving/restoring actor weights. This PR decouples that computation into a dedicated inference server(allocate additional GPUs for log_probs computation) that runs concurrently with rollout generation.

Currently, only support megatron backend.

The implementation follows the existing RolloutReplica / BaseRollout / CheckpointEngineWorker architecture:

Class Role
ModelEngineReplica RolloutReplica subclass — resource allocation, lifecycle, weight sync
ModelEngineWorker Ray Actor per GPU — CheckpointEngineWorker subclass, receives weights
ModelEngineServerAdapter BaseRollout adapter — wraps TrainingWorker for forward-only inference
ModelEngineServer Ray Actor — async batch scheduler with pause_serving/resume_serving protocol

To use Model Engine Server, you need to use mbridge and apply this PR: https://github.com/ISEEKYAN/mbridge/pull/117

Checklist Before Starting

  • [ ] Search for similar PRs. Paste at least one query link here: ...
  • [ ] Format the PR title as [{modules}] {type}: {description} (This will be checked by the CI)
    • {modules} include fsdp, megatron, veomni, sglang, vllm, rollout, trainer, ci, training_utils, recipe, hardware, deployment, ray, worker, single_controller, misc, perf, model, algo, env, tool, ckpt, doc, data, cfg, reward, fully_async, one_step_off
    • 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

Using Model Engine Server, will slightly increase timing_s/gen, but it can effectively eliminate timing_s/old_log_prob and reduce end-to-end time.

image image image

Compared to the original old_log_prob calculating method(16 gpus training and 16 gpus rollout), Model Engine Serve(8 gpus addition), resulting in an end-to-end time speedup of approximately 1.64x. Considering the increased resource consumption, the speedup ratio is about 1.09x.

API and Usage Example

Enable with:

model_engine_server.enable_standalone: True
model_engine_server.nnodes: nnodes
model_engine_server.n_gpus_per_node: n_gpus_per_node
# independent model_parallel config
model_engine_server.megatron.pipeline_model_parallel_size= pp_size
model_engine_server.megatron.tensor_model_parallel_size=tp_size
......

example script:

verl/experimental/fully_async_policy/shell/dapo_7b_math_megatron_16_16_8.sh

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 Apr 13 '26 09:04 sl-1314

In the experiment, even without rejection sampling correction, the rollout mismatch metric needs to be enabled to observe the results.

Additionally, the current implementation can display the Entropy metric.

ArronHZG avatar Apr 13 '26 10:04 ArronHZG

Related refactor: https://github.com/verl-project/verl/pull/6129

wuxibin89 avatar Apr 24 '26 02:04 wuxibin89

@wuxibin89 hi, can you help review and merge this pr?

sl-1314 avatar Jun 09 '26 13:06 sl-1314