verl icon indicating copy to clipboard operation
verl copied to clipboard

reward=0, loss=0, grad_norm=0 in GRPO on GSM8K with latest version of verl

Open szhou0202 opened this issue 9 months ago • 3 comments

System Info

----------Python Info---------- Version : 3.12.12 Compiler : GCC 14.3.0 Build : ('main', 'Jan 26 2026 23:51:32') Arch : ('64bit', 'ELF') ------------Pip Info----------- Version : 26.0 vllm : 0.11.0+cu129 sglang : 0.5.2 ray : 2.53.0 torch : 2.8.0 ----------Platform Info---------- Platform : Linux-4.18.0-553.87.1.el8_10.x86_64-x86_64-with-glibc2.28 system : Linux release : 4.18.0-553.87.1.el8_10.x86_64 version : #1 SMP Tue Nov 25 00:57:14 EST 2025 ----------Environment---------- CUDA 12.9 ----------verl Info----------- Version : 0.8.0.dev

Information

  • [x] The official example scripts
  • [ ] My own modified scripts

Tasks

  • [x] An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • [ ] My own task or dataset (give details below)

Reproduction

After installing dependencies (vllm 0.11.0) and building the lastest version of verl from the repo, with the MaxLoraRanks fix, I was running the run_qwen2_5-3b_gsm8k_grpo_lora.sh example script with slurm and was seeing 0 reward, 0 pg_loss, 0 kl_loss, and 0 grad_norm on my wandb charts. I did not change any configs except the model and dataset paths.

Expected behavior

I expect to see an increasing reward curve, a decreasing grad_norm curve, and nonzero loss. The author of this article mentioned they ran into the same error and switched to an old commit of verl, commit hash: d12d6b3ee86a4061ca51be0098acab4e773706d8, to get the GRPO training / reward tracking working. I set up my environment from this version of verl, and I started seeing values on my wandb charts.

Will there be a fix pushed soon? Does anyone know the source of this error?

szhou0202 avatar Feb 05 '26 17:02 szhou0202

I've reproduced this issue and found that the cause is:

some weights of the policy is random -> all model response is false (and fully random) -> reward and advantage is 0 -> no gradient

I suspect there might be something overlooked in the checkpoint loading of the LoRA model, cc @wuxibin89

yyDing1 avatar Feb 08 '26 17:02 yyDing1

I checked the logits in vLLM's sampler.py, and they are all either 0 or -inf. This causes the model output to be equivalent to random sampling over the vocabulary, so no correct answers can be extracted from the output. This seems to be what's resulting in a reward of 0.

asfdgdfg avatar Feb 09 '26 03:02 asfdgdfg

中文:

感谢报告。基于目前的公开证据,我不建议直接按已修复关闭这个 issue:#5211 中已有两个复现评论分别指出 policy 部分权重可能是随机的,以及 vLLM sampler logits 全为 0 或 -inf,这会导致 rollout 输出近似随机,进而 reward、advantage、loss 和 grad_norm 都为 0。

不过,main 分支之后已经合入了一些相关的 LoRA/vLLM rollout 修复,尤其是 PR #6688,它修复了 unmerged LoRA + vLLM rollout 中 add_lora 保留 IPC bucket tensor view 的生命周期问题。当前 main 代码也已经在 verl/workers/rollout/vllm_rollout/utils.py 中对 LoRA tensors 做 clone 后再传给 add_lora。另外,当前官方 GRPO+LoRA+vLLM GSM8K 示例已迁移到 examples/tuning/lora/run_qwen3_8b_fsdp.sh。

能否请你在最新 main 上复测,并补充以下最小信息?

  1. 完整但脱敏的启动命令和 config overrides;
  2. 是否使用 actor_rollout_ref.model.lora.merge=True/False、free_cache_engine、layered_summon;
  3. 第一个 rollout batch 的几条生成文本和对应 reward;
  4. 如果输出仍然随机,请补充 vLLM 版本,以及 sampler logits 是否仍然全为 0 或 -inf。

这些信息可以帮助判断 #5211 是否已经被 PR #6688 或后续 LoRA rollout 改动覆盖,还是仍然是 Qwen2.5 LoRA checkpoint/weight sync 的独立问题。

证据:

  • https://github.com/verl-project/verl/issues/5211#issuecomment-3867753374
  • https://github.com/verl-project/verl/issues/5211#issuecomment-3869085361
  • https://github.com/verl-project/verl/pull/6688
  • https://github.com/verl-project/verl/blob/e357354528c01fc992d9d9e10f5cb1a0301faaf0/verl/workers/rollout/vllm_rollout/utils.py#L331-L342
  • https://github.com/verl-project/verl/blob/e357354528c01fc992d9d9e10f5cb1a0301faaf0/examples/tuning/lora/run_qwen3_8b_fsdp.sh#L1-L100

English:

Thanks for the report. Based on the current public evidence, I would not close this as confirmed fixed yet. The two reproduction comments on #5211 point to the rollout output itself being broken: one reports that some policy weights appear random, and another reports vLLM sampler logits being only 0 or -inf. That would make generation effectively random and can explain zero reward, zero advantage, zero loss, and zero grad norm.

That said, several related LoRA/vLLM rollout changes have landed on main since then. In particular, PR #6688 fixed a lifetime issue where unmerged LoRA + vLLM rollout passed tensor views from the IPC bucket buffer into add_lora. Current main now clones the LoRA tensors in verl/workers/rollout/vllm_rollout/utils.py before passing them to add_lora. The current official GRPO+LoRA+vLLM GSM8K example is also now under examples/tuning/lora/run_qwen3_8b_fsdp.sh.

Could you please retest on the latest main branch and provide the minimal details below?

  1. The full but sanitized launch command and config overrides;
  2. Whether actor_rollout_ref.model.lora.merge=True/False, free_cache_engine, and layered_summon are enabled;
  3. A few generated samples from the first rollout batch and their rewards;
  4. If generation is still random, the vLLM version and whether sampler logits are still only 0 or -inf.

That should help determine whether #5211 is covered by PR #6688 or later LoRA rollout changes, or whether it is still an independent Qwen2.5 LoRA checkpoint/weight-sync bug.

Evidence:

  • https://github.com/verl-project/verl/issues/5211#issuecomment-3867753374
  • https://github.com/verl-project/verl/issues/5211#issuecomment-3869085361
  • https://github.com/verl-project/verl/pull/6688
  • https://github.com/verl-project/verl/blob/e357354528c01fc992d9d9e10f5cb1a0301faaf0/verl/workers/rollout/vllm_rollout/utils.py#L331-L342
  • https://github.com/verl-project/verl/blob/e357354528c01fc992d9d9e10f5cb1a0301faaf0/examples/tuning/lora/run_qwen3_8b_fsdp.sh#L1-L100

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

Kirrito-k423 avatar Aug 02 '26 01:08 Kirrito-k423