Repository navigation
Description
Summary
vLLM resolves any unset sampling parameter on an incoming OpenAI request from the model's generation_config.json, not from neutral defaults. NeMo-RL never overrides this, so an omitted top_p / temperature / top_k / min_p / repetition_penalty silently picks up a model-specific value that differs from policy.generation.*.
For RL this is worse than ordinary drift: top-p/top-k truncate and renormalize the distribution, which changes the logprobs. NeMo-RL mirrors that into the training forward pass — dtensor_policy_worker builds TrainingSamplingParams from generation_cfg["top_p"/"top_k"] and _apply_top_k_top_p_filtering rescales the logits only when _need_top_p_filtering sees top_p != 1.0. If the engine actually samples at a different top_p than the config records, the train-side rescaling replicates the wrong distribution and the mismatch is invisible.
Mechanism
Against the pinned vllm==0.25.1:
top_p: float | None = None— an omitted field staysNone.if (top_p := self.top_p) is None: top_p = default_sampling_params.get("top_p", ...)— the neutral1.0is only the last fallback. Same pattern fortemperature,top_k,min_p,repetition_penalty.default_sampling_params = self.model_config.get_diff_sampling_param().config = {} if src == "vllm" else self.try_get_generation_config()— docstring: "vLLM's neutral defaults ifgeneration_config="vllm", the model's defaults ifgeneration_config="auto"".generation_config: str = "auto"is the default, and NeMo-RL passes neithergeneration_confignoroverride_generation_configintoAsyncEngineArgs(grep ofnemo_rl/→ 0 hits).
Concretely, Qwen/Qwen3-30B-A3B-Instruct-2507 (used by examples/nemo_gym/grpo_qwen3_30ba3b_instruct.yaml) ships top_p: 0.8, top_k: 20, temperature: 0.7, while the gym recipes set top_p: 1.0 / top_k: null / temperature: 1.0.
Not always the case — introduced by vLLM v0.8.0
| vLLM | ModelConfig.generation_config |
effect |
|---|---|---|
| ≤ v0.7.3 | Optional[str] = None |
get_diff_sampling_param returns {} — the model's file is ignored |
| ≥ v0.8.0 | str = "auto" |
the model's generation_config.json is read |
Current mitigation is partial
The async OpenAI server guard is what stands between this and a silent off-policy rollout, and it covers the parameters unevenly:
top_k— safe:request.top_k = -1explicitly pins it, so vLLM never consults the model default.temperature— safe: compared strictly, soNonetrips the assert.top_p— compared strictly onmain, but feat(grpo): validation-only sampling params and grouped pass@k validation #3401 coalesces an unset value to a literal1.0before comparing, which makes the omitted case pass. Being handled in that PR's review.min_p/repetition_penalty— not covered by the guard at all.
Note the guard only protects the async OpenAI-server path; it is not a general property of the engine.
Proposed fix
Pass generation_config="vllm" when constructing AsyncEngineArgs (and the sync engine equivalent), so unset parameters resolve to vLLM's neutral defaults instead of per-model values. That removes the whole class rather than patching one parameter at the guard, and makes policy.generation.* the single source of truth — which is what the train-side logprob rescaling already assumes.
Worth deciding explicitly whether any model-default behavior is wanted for validation rollouts before changing it globally.
(Surfaced during the review of #3401.)
Activity
benjamin05wilson commentedon Aug 5, 2026
Supporting data for the
repetition_penaltycase, and an argument that it makes the engine-level fix the only viable one rather than merely the cleaner one.How far off-policy it actually puts you
Measured on
Qwen/Qwen2.5-0.5B-Instruct, whosegeneration_config.jsonshipsrepetition_penalty: 1.1. Sampled with the penalty active and everything else neutral, then scored the same tokens two ways — plainlog_softmaxof the logits (what the trainer differentiates) andlog_softmaxaftertransformers' ownRepetitionPenaltyLogitsProcessor(what actually drew the token), so the sampling distribution is exactly the one generation used. 32 sequences, 8,209 completion tokens:The arithmetic mean is 1.0003, which is why it shouldn't be quoted alone — a thin right tail offsets a fat left one. The distortion is also signed rather than symmetric: the penalty suppresses tokens already in context, so the sampler systematically favours tokens the policy scores lower.
For scale against the numerical-mismatch literature, which the TIS/MIS machinery exists to correct: Thinking Machines report KL ~0.001 for corrected kernel nondeterminism, and Fang & Khazi measure KL 0.001 → 0.033 for Qwen3's shipped top_p/top_k/temperature. A single inherited
repetition_penaltysits well above the noise those corrections were built for.Why
repetition_penaltycan't be handled at the guardThe
top_p/top_kcases have a train-side escape hatch — they're truncate-and-renormalise, so_apply_top_k_top_p_filteringcan replicate the sampling distribution in the forward pass, which is what makes strict comparison at the guard sufficient.No equivalent exists for
repetition_penalty. It's stateful and history-dependent: the penalty applied to token t depends on which tokens already appear in that sequence's context, so reproducing it train-side would mean replaying per-sequence generation history through the logits at every position. That isn't a rescaling, and there's no mask to replay.So for this parameter specifically, extending the guard is a dead end and
generation_config="vllm"is the only fix that closes it. Same conclusion you reached, just with a mechanism that rules out the alternative rather than deprioritising it.Reproduction for both measurements: https://github.com/benjamin05wilson/rl-velocity —
scripts/measure_importance_ratio.pyandscripts/audit_vllm_config.py. Environment: vLLM 0.26.0, transformers 5.14.1, torch 2.11.0+cu130, sm_120.One adjacent note in case it's useful for the sync path:
transformershas the same inheritance behaviour, and v5 made it quieter — the v4 warning ("generation_config default values have been modified...") and theuse_model_defaults=Falseopt-out are both gone in 5.14.1, so an unset field onGenerationConfignow resolves against the checkpoint with no diagnostic.lonexreb commentedon Nov 30, 2026
#5006 fixed this on main.
generation_config="vllm"(vllm_worker.py#L243-L252). An unset sampling field therefore gets vLLM's neutral value, not the one from the model'sgeneration_config.json. Ageneration_configset invllm_kwargsis still respected.on_policy_sampling(chat_server.py#L907-L931).I'm closing my #3685, which this replaces. I think this issue can be closed too.