[RFC] Support Score Centering for GRPO training-inference mismatch correction
I maintainer di solito rispondono entro 1 giorno
@hjh0119 ci sta già lavorando.
Dal 30/9/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 16.2k
- Fork
- 1.8k
- Merge medio
- 1g 14h
- PR unite (30g)
- 68
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di modelscope/ms-swift
-
get_multimodal_target_regex(..., exclude_router=True) does not exclude shared_expert_gateForse già presa @KonnyakuMatcha l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
modelscope/ms-swift#10696 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] GRPO REAL loss crashes with beta>0 and kl_in_reward=True (NoneType * Tensor)Forse già presa @newcloud123 l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
modelscope/ms-swift#10690 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] GRPO REAL loss divides by all groups instead of valid groups, silently scaling gradientsForse già presa @newcloud123 l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
modelscope/ms-swift#10688 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 Mezza giornata Idoneità per principianti 62/100
modelscope/ms-swift#10621 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] `get_seed` consumes a draw from the shared RandomState even when decision augmentation is disabled, changing the train/val split and dataset shuffleForse già presa @ryznren l’ha presa 38 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
modelscope/ms-swift#10466 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di modelscope/ms-swift
Issue simili
-
Test: to_hijri() accepts datetime.datetime and uses only the date partForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertagood first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
omarelshamy25x/shamy-hijri#63 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
polish
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
521xueweihan/HelloGitHub#4729 ·
-
[Bug]: Score parser reads parts of scientific notation as valid scoresForse già presa @AshutoshSingh840 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
UKGovernmentBEIS/control-arena#992 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
mvalentsev/awesome-free-ai-coding#70 ·
I maintainer di solito rispondono entro 1 giorno