THUDM / THUDM/slime

【BUG】wrong implementation of zero-centered mean when normalizing advantages

Open
#1,369 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.5k
Forks
1.3k
Avg merge
5h 36m
Merged PRs (30d)
22

Description

In slime/utils/distributed_utils.py,

def distributed_masked_whiten(...),

when shift_mean = False, 'whitened_values += global_mean' may be wrong?

I think the correct implementation may be 'whitened_values = values * torch.rsqrt(global_var + epsilon)', am I right?

while the original implementation is 'whitened_values = (values - global_mean) * torch.rsqrt(global_var + epsilon) + global_mean', it's inequal to the above implementation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in slime/utils/distributed_utils.py and inspect distributed_masked_whiten, focusing on the shift_mean=False branch and the two normalization formulas described in the issue. Compare the expected zero-centered behavior with the current global_mean handling, then add or update regression coverage so the selected behavior is verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.