Repository navigation
fix(vllm_model): auto-derive required_prefix_token_ids on chat + toke… - #1294
Closed
jthomson04 wants to merge 3 commits into
Closed
jthomson04 wants to merge 3 commits into
jthomson04 wants to merge 3 commits into
Conversation
jthomson04
force-pushed
the
jthomson04/required-prefix-token-ids
branch
from
May 11, 2026 19:55
54c7416 to
d206a74
Compare
bxyu-nvidia
requested changes
May 11, 2026
| # template-tokenized prefix, preserving byte-level token continuity | ||
| # across multi-turn replays. The vLLM mixin auto-derives from | ||
| # per-message `prompt_token_ids` itself (see | ||
| # `nemo_rl/models/generation/vllm/vllm_worker_async.py` |
Contributor
There was a problem hiding this comment.
can we add a permalink for this?
| # `NeMoRLOpenAIChatRequestMixin.model_post_init`); Dynamo does not, | ||
| # so we set it server-agnostically here. When the vLLM mixin sees | ||
| # the field already populated, its auto-derive short-circuits. | ||
| if "required_prefix_token_ids" not in body_dict: |
Contributor
There was a problem hiding this comment.
can we gate this behind a config param so we don't send duplicate information? i.e. send_token_ids_via_required_prefix_token_ids which will add the "required_prefix_token_ids" and pop the prompt_token_ids and generation_token_ids?
Contributor
There was a problem hiding this comment.
Maybe the param can be send_required_prefix_token_ids_dynamo then?
Contributor
|
can you add tests? |
…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 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
jthomson04
force-pushed
the
jthomson04/required-prefix-token-ids
branch
from
June 9, 2026 03:24
58d941b to
feacd80
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.
…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.