verl icon indicating copy to clipboard operation
verl copied to clipboard

[FSDP] Include buffers for weight transfer

Open Luosuu opened this issue 8 months ago • 3 comments

Feature request

Currently we do not send buffers from FSDP to rollout engines, which could result mismatch if these buffers got updated during training, such as model.layers.{i}.mlp.gate.e_score_correction_bias in DeepSeek V3 (including Moonlight) model.

Motivation

As above

Your contribution

Can help on end-to-end verifification

Luosuu avatar Mar 20 '26 18:03 Luosuu

Thank you for raising this important issue.

You're correct that buffers (non-parameter tensors) in models like DeepSeek V3 (including Moonlight) need to be transferred alongside weights to ensure consistency during rollout.

Current Status: In the existing FSDP weight transfer mechanism, only model parameters (trainable weights) are synchronized to rollout engines. Buffers such as e_score_correction_bias in DeepSeek V3's MoE layers are indeed not included.

Impact: This can cause:

  1. Inference quality degradation if buffers are modified during training
  2. Incorrect expert routing in MoE models
  3. Mismatch between training and serving behavior

Implementation Considerations:

  • Buffer transfer needs to be added to the weight sync pipeline
  • Need to handle buffers that should NOT be transferred (e.g., running stats in BatchNorm if applicable)
  • Performance impact of additional tensor transfers

Would you be interested in contributing a PR for this? The key files would be:

  • verl/workers/rollout/vllm_rollout/utils.py - for vLLM backend
  • verl/workers/rollout/sglang_rollout/ - for SGLang backend
  • The bucketed weight transfer logic

This would be a valuable improvement for DeepSeek V3 / Moonlight model training support.

Kirrito-k423 avatar Mar 20 '26 20:03 Kirrito-k423

I opened a PR for this issue: #5801

The fix keeps parameter updates on the existing load_weights(...) path, applies registered buffer updates explicitly on the rollout model, and adds CPU tests for the rollout-side update behavior.

chenshui223 avatar Mar 30 '26 06:03 chenshui223

@chenshui223 Thanks for your contribution! @Luosuu May you use the implementation from @chenshui223 https://github.com/verl-project/verl/pull/5801 to run a verification?

Begunner avatar Mar 31 '26 04:03 Begunner