Repository navigation
feat(vllm_model): opt-in refit of the output budget to the prompt - #5864
AdamRajfer merged 1 commit into
Conversation
A call whose output budget fits the context window but whose prompt and budget together overflow it was refused for length on every request once the prompt passed the window minus the budget (for example a 131072-token budget in a 262144-token window), and an agent that reads the empty length reply as the end of its episode stopped there. refit_output_budget_to_prompt (default off) sends such a call once more with the budget lowered to the window minus the prompt minus the margin refit_output_budget_to_window uses, and records it in the same output_budget_refit capture event. A prompt that alone fills the window leaves no output token and keeps the context_length_exceeded refusal, as does a refusal that names no window. Signed-off-by: Adam Rajfer <[email protected]>
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP — LGTM — no concerns found.
I reviewed the refit logic and generation paths, affected refusal and capture handling, the regression tests, and the configuration documentation. I found no qualifying introduced defects.
This was a static review. I didn't execute tests or validate against a live vLLM engine.
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.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42853064093 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42855502584 |
Merge main at 330c461 into the agentic CritPt branch. Where main has since added its own handling for something this branch also changed, the merge keeps main's version: - responses_api_models/vllm_model is identical to main. The exact completion fitting is dropped; main's refit_output_budget_to_prompt (NVIDIA-NeMo#5864) covers what the agentic recipe needs. - Stirrup compaction failure uses main's handling (NVIDIA-NeMo#5822) and its max_turns stop reason (NVIDIA-NeMo#5937). In finish_tool mode the grader scores an agent_invalid_output response zero as candidate_no_answer. - Context-overflow recovery becomes the opt-in Stirrup option context_overflow_recovery (default false). The runner reports the model server's own rejection. - The grader's execution sessions use ResourcesSessionLocks and ResourcesSessionFences (NVIDIA-NeMo#5083); agentic_execution refuses several workers (NVIDIA-NeMo#4790). - A semantic validator failure or timeout stays unscorable with score_comparator_uncertain_as_incorrect (NVIDIA-NeMo#5416). - nemo_gym/ is unchanged. Two fixes found while validating the merge: - Since NVIDIA-NeMo#5128 the single_agent_turn environment servers and the agents that verify through verify_agent_response send failure_report with every /verify request. The grader read it as an unknown task field and answered task_invalid for every such rollout; it is now a framework field. - tests/test_runner_remote.py built ExecutionPolicy with four arguments the policy does not have and expected a 2 GiB address-space limit it never set, so nine of its tests failed; both are corrected. Also included: fixes from a review of the merged diff (session glossary wording, main's lost-session body on /code_exec, tighter execution limits, a stopped session releasing its capacity slot, route tests, and a local end-to-end grade of a semantic-validator task). Signed-off-by: Erik Arakelyan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
What
Adds
refit_output_budget_to_promptto the vLLM model client. It is off by default, so no existing config changes behaviour.Why
refit_output_budget_to_windowonly acts when the requested output budget by itself exceeds the context window. It deliberately leaves the other length refusal alone: the budget fits the window, but prompt plus budget do not. That keeps thecontext_length_exceededrefusal as a cue for harnesses that compact their history.That choice is wrong for a harness that does not compact. Take a 262144-token window and a benchmark that asks for 131072 output tokens. Once the prompt passes 131072 tokens, the engine refuses every request while half the window is still empty. The call returns an empty
lengthcompletion, an agent that reads that as the end of its episode stops, and the world state is scored as it stands. In a 2400-rollout run of such a benchmark, 105 rollouts (4.4%) ended this way, with prompts of 126k to 177k tokens. The failure is in the evaluation setup, not in the model's answer, and shrinking the benchmark's output budget would change the benchmark. The client should send what the window leaves.Behaviour
With
refit_output_budget_to_prompt: true, a length refusal that names the context window and whose budget fits that window is retried once with the budget set towindow - prompt - 16. The margin, the prompt-length source (the refusal text, else one/tokenizecall) and the single-retry rule are the onesrefit_output_budget_to_windowalready uses.requested_max_tokens,applied_max_tokens,output_budget_refit), so the run health facts and inspect count it.context_length_exceededrefusal (or propagated error). So does a refusal that names no window.refit_output_budget_to_windowcovers a budget above the window,refit_output_budget_to_promptcovers a budget within it. They do not depend on each other./v1/completionspaths are both covered.Enable it only for a benchmark whose agent does not compact its history. The docs on the vLLM model page say so.
Tests
New unit tests in
responses_api_models/vllm_model/tests/test_app.py, run on chat and completions:/tokenizewhen the refusal has none;25 of these fail without the change. The whole
vllm_modeltest directory,test_public_api_facades.py, the refit gate-facts tests and the docs link test pass, andruff checkandruff formatare clean.Not verified
No cluster or real-engine run. The refusal texts in the tests are the formats the existing refit tests already use for vLLM. I have not confirmed the behaviour against a live server on a long-context agent benchmark, or that the affected benchmark then completes those rollouts.