Skip to content

Conversation

@kip-cxj
Copy link

@kip-cxj kip-cxj commented Dec 18, 2025

What does this PR do?

Implement the checkpoint engine as a standalone update weights module for hybrid mode.

Currently, the inference backend does not support vllm. Adaptation for the vLLM module requires separating actor and rollout into separate processes:#4280

Checklist Before Starting

Test

For changes that can not be tested by CI (e.g., algorithm implementation, new model support), validate by experiment(s) and show results like training curve plots, evaluation results, etc.

API and Usage Example

Demonstrate how the API changes if any, and provide usage example(s) if possible.

# Add code snippet or script demonstrating how to use this

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.

@CLAassistant
Copy link

CLAassistant commented Dec 18, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a checkpoint_engine to handle weight synchronization in hybrid mode, with changes across FSDP and Megatron workers, as well as vLLM and SGLang rollouts. The implementation adds new configuration flags and logic to conditionally use this new engine.

My review has identified a few critical issues:

  1. A potential bug in fsdp_workers.py where incorrect weights might be updated due to a variable mix-up. This is coupled with significant code duplication that should be refactored.
  2. Unsafe access to environment variables in vllm_rollout.py which could lead to worker crashes if the environment is not perfectly configured.

I've provided code suggestions to address these critical issues for improved correctness and robustness.

Comment on lines +137 to +138
rank = int(os.environ["RANK"])
local_world_size = int(os.environ["RAY_LOCAL_WORLD_SIZE"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Accessing environment variables using os.environ["KEY"] is unsafe as it will raise a KeyError if the variable is not set, causing the worker to crash. It's much safer to use os.getenv("KEY", default_value).

This is a critical issue that can lead to runtime crashes if the environment is not perfectly configured.

Suggested change
rank = int(os.environ["RANK"])
local_world_size = int(os.environ["RAY_LOCAL_WORLD_SIZE"])
rank = int(os.getenv("RANK", "0"))
local_world_size = int(os.getenv("RAY_LOCAL_WORLD_SIZE", "1"))

@Cesilina
Copy link

98A147E3-D89E-46df-925D-6BBEBB1BC80F

Timeout error?

@kip-cxj
Copy link
Author

kip-cxj commented Dec 23, 2025

98A147E3-D89E-46df-925D-6BBEBB1BC80F Timeout error?

What backend is used for rollout? For vLLM, it's not supported because the actor and rollout still share the same process.

@Cesilina
Copy link

98A147E3-D89E-46df-925D-6BBEBB1BC80F Timeout error?

What backend is used for rollout? For vLLM, it's not supported because the actor and rollout still share the same process.

Oo.Get it.Thanks

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.

3 participants