[RFC] Support Score Centering for GRPO training-inference mismatch correction
Maintainers usually reply within 1 day
@hjh0119 is already working on this.
Since Sep 30, 2026.
Assessment
This issue has not been assessed yet.
Description
Motivation
I would like to propose adding Score Centering support to GRPO training in ms-swift.
Paper: Score Centering Stabilizes Off-policy Reinforcement Learning
Official implementation: martin-marek/score-centering
Score Centering removes the drift term caused by training-inference mismatch by subtracting the expected policy score under the rollout distribution. This is different from reward/advantage normalization (scale_rewards), TIS/MIS importance sampling, and Off-Policy Sequence Masking.
ms-swift already supports TIS/MIS (#6678) and Off-Policy Sequence Masking (#6978), but it does not currently implement Score Centering.
Related implementations
The following implementations provide useful references:
- slime #2405 and #2406
- verl RFC #8009 and PR #8010
- reef RFC #672 and PR #673
These implementations consistently treat Score Centering as an additive policy-gradient correction term rather than as reward normalization or a standalone loss family.
Proposed MVP
To keep the first contribution focused, I propose an opt-in initial implementation with:
- vLLM rollout support first;
- single-turn GRPO support;
top_p=1andtop_k=-1initially;- configurable sampler top-k log probabilities;
- a REINFORCE-compatible policy-gradient path;
- Score Centering disabled by default;
- strict failure when sampler top-k data is missing or misaligned;
- no TIS/MIS composition in the first PR unless maintainers prefer it.
The paper's top-k approximation requires the rollout to preserve, for every response token:
- the sampled-token log probability;
- sampler top-k token IDs;
- sampler top-k log probabilities.
The trainer then evaluates its own log probabilities at those sampler top-k IDs and applies the tail-mass correction. The implementation should use a chunked, memory-conscious computation rather than materializing the full [batch, sequence, vocabulary] log-probability tensor.
Proposed controls
For example:
--score_centering true
--score_centering_top_k 32
The default top-k and the interaction with vLLM's max_logprobs limit need to be decided. The paper uses 128, while smaller values such as 32 also performed well in the paper.
Design questions
- Should the first implementation introduce an explicit
loss_type=reinforce, or should Score Centering be attached to an existing ms-swift policy-gradient path? - Should Score Centering be modeled as a correction term or as a new loss type in ms-swift?
- Which rollout backends should be supported initially?
- Should TIS/MIS composition be included in the first PR or follow in a separate PR?
- What top-k value and vLLM configuration are practical for ms-swift's rollout modes?
Validation plan
- Compare the PyTorch implementation against the official implementation.
- Test matched distributions, where the correction should be zero.
- Test sampled tokens both inside and outside the retained top-k head.
- Test tail-mass clipping and malformed or missing rollout metadata.
- Test padding and multi-turn alignment if supported.
- Add a small GRPO smoke test and report memory and throughput overhead.
I would be happy to prepare an implementation PR after the supported objective, rollout backend, and top-k data contract are confirmed.
- Dominant language
- Python
- Stars
- 16.2k
- Forks
- 1.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 68
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelscope/ms-swift
-
get_multimodal_target_regex(..., exclude_router=True) does not exclude shared_expert_gatePossibly taken @KonnyakuMatcha claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
modelscope/ms-swift#10696 ·
Maintainers usually reply within 1 day
-
[BUG] GRPO REAL loss crashes with beta>0 and kl_in_reward=True (NoneType * Tensor)Possibly taken @newcloud123 claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
modelscope/ms-swift#10690 ·
Maintainers usually reply within 1 day
-
[BUG] GRPO REAL loss divides by all groups instead of valid groups, silently scaling gradientsPossibly taken @newcloud123 claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
modelscope/ms-swift#10688 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 Half a day Newbie friendliness 62/100
modelscope/ms-swift#10621 ·
Maintainers usually reply within 1 day
-
[Bug] `get_seed` consumes a draw from the shared RandomState even when decision augmentation is disabled, changing the train/val split and dataset shufflePossibly taken @ryznren claimed this 38 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
modelscope/ms-swift#10466 · 1 comment ·
Maintainers usually reply within 1 day
All issues in modelscope/ms-swift
Similar issues
-
Test: to_hijri() accepts datetime.datetime and uses only the date partPossibly taken A pull request linked to this issue is open or already merged. Opengood first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
omarelshamy25x/shamy-hijri#63 · 3 comments ·
Maintainers usually reply within 1 day
-
polish
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
521xueweihan/HelloGitHub#4729 ·
-
[Bug]: Score parser reads parts of scientific notation as valid scoresPossibly taken @AshutoshSingh840 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
UKGovernmentBEIS/control-arena#992 ·
Maintainers usually reply within 3 days
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
mvalentsev/awesome-free-ai-coding#70 ·
Maintainers usually reply within 1 day