Skip to content

Guard GRPO against non-finite Liger updates - #9839

Draft
taking-lying-flat wants to merge 1 commit into
modelscope:mainfrom
taking-lying-flat:agent/guard-liger-grpo
Draft

Guard GRPO against non-finite Liger updates#9839
taking-lying-flat wants to merge 1 commit into
modelscope:mainfrom
taking-lying-flat:agent/guard-liger-grpo

Conversation

@taking-lying-flat

Copy link
Copy Markdown
Contributor

Summary

  • require liger-kernel>=0.8.0 when GRPO enables the fused Liger loss
  • enforce the requirement both during argument validation and trainer initialization
  • reject non-finite LoRA parameters before they are merged into the base model or loaded into vLLM
  • cover full-model and adapter-only synchronization for DeepSpeed ZeRO-3 and FSDP2

Root cause

In the affected Qwen3.5 GRPO runs, the first rollout is healthy, but the first optimizer update can produce invalid LoRA parameters with the older Liger fused PPO/GRPO backward path. The next rollout synchronizes those adapter updates to vLLM, which exposes the corruption as degenerate completions such as repeated ! tokens.

Liger 0.8 rewrote this backward path to use selective log-probability computation and FP32 gradient accumulation instead of the older torch.func.grad_and_value implementation. Requiring that version prevents the known unsafe combination from running silently.

The finite check is a second line of defense: if any later numerical issue still corrupts LoRA parameters, synchronization now fails at the source with the affected parameter names instead of loading invalid weights into vLLM.

Addresses #9835 and is consistent with the reproduction findings in #9619.

Implementation notes

  • ZeRO-3 checks run inside the existing per-parameter-group gather context, without adding a whole-model gather.
  • FSDP2 checks use tensors already materialized by the existing state-dict path.
  • The healthy path reduces checks on-device and performs one host synchronization per device.

Validation

  • 14 targeted tests passed, covering version validation, real Liger 0.8 CUDA/BF16 fused backward, full-model sync, adapter-only sync, ZeRO-3 gather ordering, and FSDP2 tensor merge
  • an actual Liger 0.7 installation is rejected before fused-loss initialization
  • flake8, isort --check-only, and yapf --diff passed for all changed files
  • git diff --check passed

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant