feat(vllm-model): consume native dynamo token data#1784
Draft
jthomson04 wants to merge 2 commits into
Draft
Conversation
…nize When per-message prompt_token_ids/generation_token_ids are attached to assistant messages (training mode), populate the top-level required_prefix_token_ids field on both the chat-completion request and the separate tokenize request. Mirrors NeMoRLOpenAIChatRequestMixin auto-derive in nemo-rl's custom vLLM serving (vllm_worker_async.py). Without this, Dynamo - which has the splice machinery server-side but no auto-derive - re-tokenizes the chat history each turn, breaking the byte-level token-contiguity invariant on multi-turn rollouts. The fix must apply to BOTH endpoints because the contiguity assert in nemo_rl/environments/nemo_gym.py reads prompt_token_ids from the tokenize response, not the chat response. Patching only chat fails at the tokenize step. Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
683aa26 to
0be56ef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
response.nvext.engine_datawhen a chat-completion response includes themprompt_token_ids,generation_token_ids, andgeneration_log_probsfrom the native response data without calling/tokenize/tokenizefallback only for normal vLLM-style responses that do not includeengine_dataengine_datainstead of silently falling back to/tokenizeThe NeMo-RL Dynamo wrapper is responsible for requesting
nvext.engine_dataand supplying Dynamonvext.token_data; this Gym change only consumes the response-side native token data.Companion NeMo-RL PR: jthomson04/RL#9
Validation
uv run pytest responses_api_models/vllm_model/tests/test_app.py -q -k TokenIDInformation-> 3 passed, 66 deselecteduv run ruff check responses_api_models/vllm_model/app.py responses_api_models/vllm_model/tests/test_app.py