verl icon indicating copy to clipboard operation
verl copied to clipboard

[megatron] feat: Support Megatron chunk entropy

Open ZLiao097 opened this issue 6 months ago • 1 comments

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.

Currently, chunk entropy is only available for the FSDP training backend in VERL and not yet implemented for Megatron. This feature significantly cuts peak GPU memory usage in long-sequence scenarios. In the Qwen3.5-35B Megatron test with sequence length expanding from 2k to 20k, peak memory consumption drops by 8.6GB. Before chunk entropy: image

After chunk entropy: image

Checklist Before Starting

  • [x] Search for similar PRs. Paste at least one query link here: ...
  • [x] 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, fully_async, one_step_off
    • 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.

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.

ZLiao097 avatar May 22 '26 10:05 ZLiao097

@ETOgaosion plz review again

ZLiao097 avatar May 29 '26 08:05 ZLiao097