fix(ppo): reject implicit partial group normalization - #1415
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for group-level normalization with unequal or partial groups by passing actual per-group row counts (group_sizes) through the PPO actor and normalization utilities. It replaces batched_call with explicit batch concatenation and splitting to recover trajectory group sizes, updates the normalization logic to resolve dynamic group boundaries, and adds comprehensive unit tests. The review feedback suggests adding a guard for empty input data in compute_advantages to prevent potential crashes, and validating that all elements in group_sizes are strictly positive to avoid runtime errors during tensor expansion.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
35b7b7b to
730acf9
Compare
|
Thanks for the review. Addressed:
Respectfully holding off on:
|
e461748 to
3e3ab94
Compare
|
@garrett4wade @sitabulaixizawaluduo @rchardx @fishcrap Could I get a quick review on this partial-group PPO normalization fix? It uses actual group sizes for under-filled rollout groups. |
3e3ab94 to
f947377
Compare
|
Retargeted this to the remaining non-duplicative guard on current |
Group-level normalization without explicit group_sizes uses fixed-size groups. Reject non-divisible batch sizes instead of leaving a partial tail with zero-filled normalization state. Signed-off-by: EazyReal <8047065+EazyReal@users.noreply.github.com>
f947377 to
a831901
Compare
|
This pull request has been automatically marked as stale because it has not had recent activity within the last 14 days. Please add a comment or push new commits to keep it active. Thank you for your contribution! |
|
The hazard this guards is still live on main (2ee4904): with |
Description
Current
mainalready includes variable-size group normalization through #1454. This PR keeps the remaining invariant: when group-levelNormalizationis called without explicitgroup_sizes, it is using fixed-size groups, so the batch size must be divisible bygroup_size.Before this guard, a direct fixed-stride call with a partial tail could leave tail rows with zero-filled normalization state. The PPO rollout path now passes
TrajBatchMeta.traj_group_sizes, so this is a small boundary hardening for direct callers and future refactors.Superseded Context
The original broader #1415 head was
3e3ab94b257acf1a77dc5a9fdecf7cfea2a6f7f1. That broader variable-group normalization change was superseded by #1454, merged tomainasbbc10f0e95bf350d71169efcb2facb9756f1238b(PR commit375cc12a4b91da50614aa9d2211ab9995475c942). This PR is now only the remaining non-duplicative guard.Validation
uv run pytest -q tests/test_reward_norm_variable_group.py tests/test_adv_norm_config.py(214 passed)uv run ruff check areal/utils/data.py tests/test_reward_norm_variable_group.pyuv run ruff format --check areal/utils/data.py tests/test_reward_norm_variable_group.pygit diff --check origin/main...HEADRelated Issue
Part of #1419.