Skip to content

Conversation

@Shangwei-Li
Copy link
Contributor

@Shangwei-Li Shangwei-Li commented Jan 23, 2026

What does this PR do?

Add concise overview of what this PR aims to achieve or accomplish. Reference related GitHub issues and PRs that help with the review.

Refactor fully-async training to support multiple checkpoint engine backends

Checklist Before Starting

  • Search for similar PRs. Paste at least one query link here: ...
  • Format the PR title as [{modules}] {type}: {description} (This will be checked by the CI)
    • {modules} include fsdp, megatron, veomni, sglang, vllm, rollout, trainer, ci, training_utils, recipe, hardware, deployment, ray, worker, single_controller, misc, perf, model, algo, env, tool, ckpt, doc, data, cfg, reward
    • If this PR involves multiple modules, separate them with , like [megatron, fsdp, doc]
    • {type} is in feat, fix, refactor, chore, test
    • If this PR breaks any API (CLI arguments, config, function signature, etc.), add [BREAKING] to the beginning of the title.
    • Example: [BREAKING][fsdp, megatron] feat: dynamic batching

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.
Tested wtih 8+8 H20 on Qwen3-14B model:


| Trainig backend | Vanilla cost | Current cost |

| FSDP2 | 2.64s | 0.06s |

| FSDP | TBA | TBA |

| Megatron | TBA | TBA |

API and Usage Example

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

graphviz (4)
# 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.

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 refactors the fully-async training to support multiple checkpoint engine backends, such as NCCL and HCCL. The changes introduce a more modular CheckpointEngineRegistry approach, updating the initialization and preparation of the checkpoint engine and its process groups. The weight synchronization logic has also been updated to be asynchronous, which is a significant architectural improvement. However, there are a few areas that could be improved for maintainability and robustness, such as making hardcoded values configurable and removing commented-out code.

"cuda": "nccl",
"npu": "hccl",
}
checkpoint_backend = backends_candi[get_device_name()]
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The checkpoint_backend is retrieved from backends_candi using get_device_name(). If get_device_name() returns a value not present as a key in backends_candi, this will result in a KeyError. It would be more robust to handle this case, perhaps by raising a more informative error or falling back to a default if applicable.

}
checkpoint_backend = backends_candi[get_device_name()]
checkpoint_kwargs = {
"bucket_size": 2 * 1024 * 1024 * 1024, # 2GB
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The bucket_size is hardcoded to 2GB. While this might be a reasonable default, it limits flexibility. Consider making this value configurable through the config object, similar to other parameters, to allow for optimization in different environments or with varying model sizes.

async def sync_rollout_weights_by_checkpoint(self, sync_group_name="actor_rollout"):
assert (self._is_actor or self._is_rollout) and not self.config.hybrid_engine
assert hasattr(self, "_weights_info") and self._weights_info is not None
do_prof = True
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The do_prof flag is hardcoded to True. This means profiling will always be enabled. For production environments, profiling should typically be controlled by a configuration setting or an environment variable to avoid unnecessary overhead. Please make this configurable or remove it if it's only for temporary debugging.

)
if do_prof:
prof.stop()
prof.export_chrome_trace(f"/home/tiger/ckpt_engine_prof_{torch.distributed.get_rank()}.json")
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The profiling trace file path /home/tiger/ckpt_engine_prof_{torch.distributed.get_rank()}.json is hardcoded. This path is specific to a user's home directory and is not suitable for general deployment. Please make this path configurable (e.g., via a config object or environment variable) or ensure it's written to a temporary or designated logging directory.

@tardis-key
Copy link
Collaborator

#5056

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.

2 participants