verl icon indicating copy to clipboard operation
verl copied to clipboard

[Bug] SGLang Rollout is very slow after the first step when training Qwen2.5-7B.

Open Lin-xs opened this issue 1 year ago • 3 comments

I am currently using SGLang and Megatron to train Qwen2.5-7B. After the first training step, I noticed that the rollout stage becomes significantly longer compared to the initial step.

Attached are the GPU power and TensorCore usage metrics during training. In the first rollout stage, the GPU power consumption is around 600W, but it drops to approximately 300W in subsequent steps. A similar drop is observed in TensorCore usage, indicating a potential performance issue.

Image

Here is the TensorBoard log for reference. The mean response length does not increase noticeably, which suggests that the slowdown is not caused by KV cache eviction.

Image Image

image: verl:app-verl0.5-sglang0.4.8-mcore0.12.2-te2.2 repo tag: v0.5.0 scripts:

set -x
export CUDA_DEVICE_MAX_CONNECTIONS=1 

math_train_path=/path/to/verl-050/logs/boba.parquet
math_test_path=/path/to/verl-050/logs/test_mini.parquet


model_size=7B
hf_model_path=/path/to/hf_models/DeepSeek-R1-Distill-Qwen-7B
dist_ckpt_path=/path/to/mg_ckpts/DeepSeek-R1-Distill-Qwen-7B-verl/

megatron_tp_size=4
megatron_pp_size=1

rollout_tp_size=2

attn_backend=flashinfer
nnodes=16
group_size=32

redirect_path=./logs/megatron-verl/verl-qwen${model_size}-${nnodes}node-${attn_backend}_megatron.log


python3 -u -m verl.trainer.main_ppo --config-path=config \
    --config-name='ppo_megatron_trainer.yaml'\
    algorithm.adv_estimator=grpo \
    data.train_files="$math_train_path" \
    data.val_files="$math_test_path" \
    data.train_batch_size=512 \
    data.max_prompt_length=1024 \
    data.max_response_length=27648 \
    data.filter_overlong_prompts=True \
    data.truncation='error' \
    actor_rollout_ref.model.path=${hf_model_path} \
    actor_rollout_ref.actor.megatron.use_dist_checkpointing=True \
    actor_rollout_ref.actor.megatron.dist_checkpointing_path=${dist_ckpt_path} \
    actor_rollout_ref.actor.optim.lr=1e-6 \
    actor_rollout_ref.actor.ppo_mini_batch_size=128 \
    actor_rollout_ref.actor.megatron.pipeline_model_parallel_size=${megatron_pp_size} \
    actor_rollout_ref.actor.megatron.tensor_model_parallel_size=${megatron_tp_size} \
    actor_rollout_ref.actor.megatron.sequence_parallel=True \
    +actor_rollout_ref.actor.megatron.override_transformer_config.sequence_parallel=True \
    +actor_rollout_ref.actor.megatron.override_transformer_config.recompute_method=block \
    +actor_rollout_ref.actor.megatron.override_transformer_config.recompute_granularity=full \
    +actor_rollout_ref.actor.megatron.override_transformer_config.recompute_num_layers=20 \
    actor_rollout_ref.nccl_timeout=3600 \
    actor_rollout_ref.actor.megatron.param_offload=True \
    actor_rollout_ref.actor.megatron.optimizer_offload=True \
    actor_rollout_ref.actor.megatron.grad_offload=True \
    actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=1 \
    actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=1 \
    actor_rollout_ref.actor.use_dynamic_bsz=True \
    actor_rollout_ref.actor.ppo_max_token_len_per_gpu=28672 \
    actor_rollout_ref.rollout.log_prob_use_dynamic_bsz=True \
    actor_rollout_ref.rollout.log_prob_max_token_len_per_gpu=28672 \
    actor_rollout_ref.actor.use_kl_loss=False \
    actor_rollout_ref.actor.kl_loss_coef=0.001 \
    actor_rollout_ref.actor.kl_loss_type=low_var_kl \
    actor_rollout_ref.actor.entropy_coeff=0 \
    actor_rollout_ref.rollout.tensor_model_parallel_size=${rollout_tp_size} \
    actor_rollout_ref.rollout.name=sglang \
    actor_rollout_ref.rollout.gpu_memory_utilization=0.65 \
    actor_rollout_ref.rollout.n=${group_size} \
    actor_rollout_ref.rollout.temperature=1.0 \
    actor_rollout_ref.rollout.max_num_batched_tokens=28672 \
    actor_rollout_ref.rollout.top_k=-1 \
    actor_rollout_ref.rollout.top_p=1.0 \
    actor_rollout_ref.rollout.engine_kwargs.sglang.attention_backend=${attn_backend} \
    algorithm.use_kl_in_reward=False \
    trainer.critic_warmup=0 \
    trainer.logger='["console","tensorboard"]' \
    trainer.project_name='verl_megatron' \
    trainer.experiment_name="ds_${model_size}_megatron_${nnodes}node_${attn_backend}" \
    trainer.n_gpus_per_node=8 \
    trainer.nnodes=${nnodes} \
    trainer.val_before_train=False \
    trainer.save_freq=50 \
    trainer.test_freq=-1 \
    trainer.total_epochs=5 2>&1 > ${redirect_path}

Lin-xs avatar Sep 09 '25 13:09 Lin-xs

same problem..

saldfj1921 avatar Sep 23 '25 10:09 saldfj1921

We experienced the same issue in much larger models. It seems to only happen with max response len > 2k, though we haven't figure out the exact range to reproduce this issue.

KivenChen avatar Sep 26 '25 10:09 KivenChen

定时清理检查结论:本 issue 最近一次非当前运行账号(Kirrito-k423)的公开回复或公开引用是 2025-09-26T10:42:23Z(actor: KivenChen),早于 2026-01-19T00:00:00Z,已经超过 6 个月。根据项目的定时 issue 清理规则,本轮先发布说明并关闭。

可追溯证据:

  • Issue: https://github.com/verl-project/verl/issues/3426
  • Latest non-self public reply/reference: https://github.com/verl-project/verl/issues/3426#issuecomment-3338066145
  • Comments API: https://api.github.com/repos/verl-project/verl/issues/3426/comments
  • Timeline API: https://api.github.com/repos/verl-project/verl/issues/3426/timeline

如果作者或社区成员仍能提供新的复现、证据或需求背景,请继续评论请求重开,或创建一个包含当前版本信息和最小复现的新 issue。


Scheduled cleanup conclusion: the latest public reply or public reference by an account other than the current automation account (Kirrito-k423) was 2025-09-26T10:42:23Z (actor: KivenChen), which is earlier than 2026-01-19T00:00:00Z and therefore more than 6 months old. Under the scheduled issue cleanup rule, this task is posting the explanation first and then closing the issue.

Traceable evidence:

  • Issue: https://github.com/verl-project/verl/issues/3426
  • Latest non-self public reply/reference: https://github.com/verl-project/verl/issues/3426#issuecomment-3338066145
  • Comments API: https://api.github.com/repos/verl-project/verl/issues/3426/comments
  • Timeline API: https://api.github.com/repos/verl-project/verl/issues/3426/timeline

If the author or community can still provide a fresh reproduction, evidence, or requirement context, please comment to request reopening, or open a new issue with current version details and a minimal reproduction.

This response was generated by a scheduled Codex GPT5.5 issue processing task.

Kirrito-k423 avatar Jul 19 '26 01:07 Kirrito-k423