Repository navigation
Use one full-window running baseline for BCO gradient accumulation - #7267
Closed
gss10282025 wants to merge 1 commit into
Closed
gss10282025 wants to merge 1 commit into
gss10282025 wants to merge 1 commit into
Conversation
Signed-off-by: sandel <326855337+gss10282025@users.noreply.github.com> Assisted-by: OpenAI Codex
Member
|
Closing in favour of #7136, which removes |
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.
What does this PR do?
Collect detached rewards for the whole optimizer window, update
RunningMomentsonce, and let every microbatch read the same updated mean. This keeps the unsplit BCO objective while allowing gradient accumulation.The pending microbatches are collected in
get_batch_samples, their rewards are computed without gradients, and running-statistic writes are suppressed during the loss calls. Evaluation stays read-only. Freezing the old mean and committing after backward would be a different objective, so that is not what this does.At TRL 1.12.0 the one-vs-four-microbatch parameter-update difference drops from
0.06736848relative L2 to zero; fixed-baseline and DPO controls agree across layouts; reproduced on a second host. The collection pass restores RNG state and registered model buffers. Full Trainer/GPU execution and multi-rank aggregation still need validation.Before submitting
AI writing disclosure
Who can review?
Anyone in the community is free to review the PR once the tests have passed.
Checks on this branch
Added
tests/experimental/test_bco_window.py. Its isolated CPU execution passed using the production prefetch/loss methods and RunningMoments: full, equal and uneven windows agree in baseline and gradient; the prepass restores buffers and RNG; evaluation does not update the running state. This isolates the window logic and does not run a complete Trainer job. Ruff, Python syntax andgit diff --checkpass.Fixes #7265. The separate removal proposal #7136 is still open; this draft addresses the behavior while BCO remains available.