Repository navigation
fix(vllm_model): apply output-token limits under each endpoint's name - #5462
Conversation
|
/ok to test 1fc32cc |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM — no concerns found. I inspected both changed files and traced token-limit normalization, request/default precedence, and endpoint dispatch through the shared converters and outbound client. The regression tests assert concrete outbound limits and preserve request precedence over defaults.
This was a static review; I didn't execute tests.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
|
/ok to test 5156ab2 |
5156ab2 to
9cf97e2
Compare
|
/ok to test 9cf97e2 |
|
/ok to test 8cce3bb |
The output-token limit has three names: max_tokens and max_completion_tokens on Chat Completions (vLLM reads max_completion_tokens first), max_tokens on /v1/completions, and max_output_tokens on Responses. A limit set under one name could lose to a limit under another name, or be ignored: - A sampling_overrides pin lost to a request limit under the other Chat name, and a pin under a Chat name did nothing on the Responses-native path. - On the Chat path, an extra_body max_completion_tokens default overrode a smaller request limit sent as max_tokens, which is how the Responses-to-Chat conversion sends it. - On /v1/completions, an extra_body max_completion_tokens default was ignored, so generation stopped at vLLM's default of 16 tokens. A pin now replaces the request's limit under every name and is sent under the name the endpoint reads. A request limit wins over an extra_body limit under either name, and the completions path renames a Chat-spelled extra_body default to max_tokens. Signed-off-by: Zeyu Zhou <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ions path With both limits in extra_body, the completions path keeps extra_body's own max_tokens instead of the renamed max_completion_tokens. Nothing tested this: replacing setdefault with assignment kept every vllm_model test green. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Zeyu Zhou <[email protected]>
8cce3bb to
7c180b9
Compare
|
/ok to test 7c180b9 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42929222703 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42929372778 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42929796411 |
… task NeMo RL wrote policy.generation's temperature, top_p and max_new_tokens into each Gym row's responses_create_params. Harness agents reject those fields, CLI harnesses do not send them on every call, and multi-agent tasks have no single responses_create_params to write into (review item C4). RL's vLLM check also rejected every call that matched neither the train nor the validation values, including an untrained judge's call on the policy model. Rows now carry the values for the rollout's phase beside the unchanged task, as _ng_model_sampling, and Gym applies them to every model call of the trained agent. Gym's model server keeps a smaller output limit the call asks for, as the min() here did. - The NeMo-Gym actor sets Gym's model_call_sampling block, so a call that lost the values fails on policy_model, on servers that _copy it and on any the recipe lists, and it refuses sampling_overrides on policy_model. - The vLLM HTTP server skips its train/val check for calls that Gym marks with x-ng-sampling: null, which come from agents NeMo RL does not train. Bumps the Gym submodule to 77486408c, which has NVIDIA-NeMo/Gym#5462 and NVIDIA-NeMo/Gym#5463. uv.lock is regenerated with uv 0.13.6, the Dockerfile's version: the only resolution change is openai 2.44.0 -> 2.45.0, and the rest is uv's lock format moving to revision 5. Only calls Gym does not mark null are held to top_k and the policy's sampling. _spinup imports Gym's model_call_sampling block name, so a stale Gym fails at spinup; a test checks the names RL copies (row key, header, null) against Gym's. A spinup test checks that score centering's logprobs/top_logprobs pin on the required policy_model is accepted by Gym's VLLMModel. Signed-off-by: Zeyu Zhou <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
… task NeMo RL wrote policy.generation's temperature, top_p and max_new_tokens into each Gym row's responses_create_params. Harness agents reject those fields, CLI harnesses do not send them on every call, and multi-agent tasks have no single responses_create_params to write into (review item C4). RL's vLLM check also rejected every call that matched neither the train nor the validation values, including an untrained judge's call on the policy model. Rows now carry the values for the rollout's phase beside the unchanged task, as _ng_model_sampling, and Gym applies them to every model call of the trained agent. Gym's model server keeps a smaller output limit the call asks for, as the min() here did. - The NeMo-Gym actor sets Gym's model_call_sampling block, so a call that lost the values fails on policy_model, on servers that _copy it and on any the recipe lists, and it refuses sampling_overrides on policy_model. - The vLLM HTTP server skips its train/val check for calls that Gym marks with x-ng-sampling: null, which come from agents NeMo RL does not train. Bumps the Gym submodule to 77486408c, which has NVIDIA-NeMo/Gym#5462 and NVIDIA-NeMo/Gym#5463. uv.lock is updated with uv 0.11.28, which keeps main's lock format: openai 2.44.0 -> 2.45.0 and nemo-gym's own requirements from the new Gym. uv 0.13.6, the Dockerfile's version, accepts the file unchanged. Only calls Gym does not mark null are held to top_k and the policy's sampling. _spinup imports Gym's model_call_sampling block name, so a stale Gym fails at spinup; a test checks the names RL copies (row key, header, null) against Gym's. A spinup test checks that score centering's logprobs/top_logprobs pin on the required policy_model is accepted by Gym's VLLMModel. Signed-off-by: Zeyu Zhou <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merge main at fb91374, preserving both secrets-baseline entries. Align the replay budget override with the model-server output-token normalization from #5462 so the intended 8192-token cap is retained. No new features. Signed-off-by: Arnab Dhara <[email protected]>
What does this PR do?
The output-token limit has a different name on each vLLM endpoint:
max_tokensandmax_completion_tokens, and readsmax_completion_tokensfirst when both are sent./v1/completionsreads onlymax_tokens.max_output_tokens.vllm_modelmerged limits from the request,extra_bodyandsampling_overrideswithout accounting for this. A limit under one name could lose to a limit under another name, or be ignored:sampling_overrides: {max_tokens: 100}; the request sendsmax_completion_tokens: 500(Chat path)max_completion_tokenssampling_overrides: {max_tokens: 100},is_responses_native: true; the request sendsmax_output_tokens: 500max_tokensextra_body: {max_completion_tokens: 4096}; a/v1/responsesrequest sendsmax_output_tokens: 11(Chat-backed path)max_tokens: 11beside the default, and vLLM readsmax_completion_tokensextra_body: {max_completion_tokens: 1024},use_completions_api: true; the request sets no limit/v1/completionsignoresmax_completion_tokensand uses its own defaultAfter this PR:
sampling_overrideslimit replaces the request's limit under every name. It is sent under the name the endpoint reads; on the Chat path the pinned name is kept.extra_bodylimit under either name.use_completions_api: true, anextra_bodymax_completion_tokensis sent asmax_tokens, unlessextra_bodyalso setsmax_tokens. A request limit still wins.These fixes were split out of #4867 at review request (Ananth's comment, Responses-native gap). Yu's review caught a regression in an earlier version of the completions rename, where an
extra_bodydefault overwrote a smaller request limit. This version renames the default before the request is merged over it, and a regression test covers that case. The PR is independent of the sampling work that replaces #4867, so it has no linked issue of its own.Validation
pytest responses_api_models/vllm_model/tests/: 906 passed.TestSamplingOverridescover the cases above. Six fail onmain. The other two pass onmainand guard what must not change: a request limit still wins over the default, and the default still applies when the request sets none.pre-commit run --fileson the two changed files: passed.Rollouts
N/A. This changes only how
vllm_modelbuilds the request body. The tests check the body passed to the engine client; no model was run.🤖 Generated with Claude Code