Skip to content

fix(vllm-model): consume native Dynamo token metadata - #1963

Closed
jthomson04 wants to merge 4 commits into
NVIDIA-NeMo:mainfrom
jthomson04:codex/fix-dynamo-native-logprobs
Closed

fix(vllm-model): consume native Dynamo token metadata#1963
jthomson04 wants to merge 4 commits into
NVIDIA-NeMo:mainfrom
jthomson04:codex/fix-dynamo-native-logprobs

Conversation

@jthomson04

Copy link
Copy Markdown
Contributor

What changed

  • preserve Dynamo-native prompt and completion token IDs returned in nvext.engine_data
  • consume completion_logprobs from the same native engine payload instead of pairing native IDs with post-processed choice logprobs
  • retain the existing vLLM /tokenize fallback when native engine metadata is absent
  • tolerate Dynamo responses that omit choice-level logprobs after native metadata has been attached

Why

Dynamo can post-process an OpenAI-compatible choice differently from the native engine completion. In the V5 NeMo-RL workload, the native response contained 566 completion token IDs while the post-processed choice contained 565 logprobs. Combining those two sources caused rollout construction to fail. Dynamo also does not expose the vLLM /tokenize endpoint used by the fallback path.

Keeping token IDs and logprobs from the same native engine payload preserves one-to-one alignment and avoids unnecessary tokenization.

Validation

  • pytest responses_api_models/vllm_model/tests/test_app.py -k TokenIDInformation — 4 passed
  • pytest responses_api_models/vllm_model/tests/test_app.py — 75 passed
  • two-step NeMo-RL V5 GRPO run completed successfully with the native path

…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>
Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@jthomson04

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate of #1784. The native Dynamo logprob fixes are now on the existing PR branch, rebased onto current main.

@jthomson04 jthomson04 closed this Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant