Skip to content

fix(metrics): count each rollout once in raw reward mean - #2545

Open
shx815 wants to merge 1 commit into
THUDM:mainfrom
shx815:codex/fix-rollout-raw-reward-mean
Open

shx815 wants to merge 1 commit into
THUDM:mainfrom
shx815:codex/fix-rollout-raw-reward-mean

Conversation

@shx815

@shx815 shx815 commented Nov 13, 2026

Copy link
Copy Markdown

Summary

When context compaction splits an episode into multiple training rows, rollout/raw_reward gives that episode extra weight. For example, four episodes with rewards [1, 0, 0, 0] report a mean of 0.25. Splitting the first and last episodes into two rows each raises the logged mean to 0.3333, even though the episode rewards are identical.

Compute the mean over episodes before data-parallel partitioning. Each episode contributes equally, including when its segments land on different ranks. In the example above, the logged mean stays at 0.25 after splitting.

Validation

51 tests passed on macOS CPU, including a regression with segments split across two simulated DP ranks and transport coverage for object-store, NIXL, and Straw. GPU integration was not run.

Related to #2445.

This branch has not been deployed

No deployments
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.

1 participant