feat(grpo): log per-optimizer step metrics#2452
Open
taivu1998 wants to merge 1 commit into
Open
Conversation
Signed-off-by: taivu1998 <46636857+taivu1998@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
train/optim/*withtrain/optim_step.train/rl_step,train/optim_step, andtrain/num_optim_steps_per_rl_stepto aggregate train logs.total_optim_stepsin GRPO checkpoints with fallback inference for older checkpoints.Root Cause
GRPO policy training can run multiple optimizer steps inside one RL step, but metrics were only aggregated and logged once per RL step. That hid per-step behavior and made off-policy PPO diagnostics hard to read.
Validation
uvx ruff check nemo_rl/algorithms/grpo.py nemo_rl/models/policy/lm_policy.py nemo_rl/models/policy/utils.py nemo_rl/models/policy/workers/dtensor_policy_worker.py nemo_rl/models/policy/workers/dtensor_policy_worker_v2.py nemo_rl/models/policy/workers/megatron_policy_worker.py nemo_rl/utils/logger.py tests/unit/algorithms/test_grpo.py tests/unit/models/policy/test_utils.py tests/unit/utils/test_logger.pyuvx ruff format --check nemo_rl/algorithms/grpo.py nemo_rl/models/policy/lm_policy.py nemo_rl/models/policy/utils.py nemo_rl/models/policy/workers/dtensor_policy_worker.py nemo_rl/models/policy/workers/dtensor_policy_worker_v2.py nemo_rl/models/policy/workers/megatron_policy_worker.py nemo_rl/utils/logger.py tests/unit/algorithms/test_grpo.py tests/unit/models/policy/test_utils.py tests/unit/utils/test_logger.py/usr/local/bin/python3.10source compile for all touched files/Users/vuductai/Documents/Projects/RL/.venv-dev/bin/python -m pytest tests/unit/models/policy/test_utils.py tests/unit/utils/test_logger.py -q -k "optim_step_metrics or aggregate_metric_dicts or unscale_loss_metrics or step_metric or gpu_monitoring"(13 passed, 69 deselected)Local Environment Notes
uv run pytest ...is blocked locally by a broken/usr/local/bin/python3.13install.tests/unit/algorithms/test_grpo.pycollection is blocked in the local venv by missing optionalsoundfileafter adding Megatron submodule paths.Closes #1435.