Skip to content

feat(mm-routing): add Nemotron 3 Nano Omni image routing - #14564

Merged
krishung5 merged 7 commits into
mainfrom
feat/nemotron-omni-image-routing
Sep 15, 2026
Merged

krishung5 merged 7 commits into
mainfrom
feat/nemotron-omni-image-routing

Conversation

@krishung5

@krishung5 krishung5 commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Why

Exact multimodal KV routing requires the frontend routing sequence to match the image-token sequence stored by the backend. Nemotron 3 Nano Omni is not covered by the existing image-routing registry, and its vLLM processor differs from the existing model families in two important ways:

  • Dynamic resolution uses the remaining model-context budget shared across the complete image batch.
  • Image features are wrapped with model-specific <img> and </img> delimiters.

Without this support, requests with identical text but different images fall back to text-prefix routing.

What changed

  • Generalize the image-routing processor interface while preserving existing model-family support.
  • Add vLLM-compatible Nemotron dynamic-resolution geometry and post-pixel-shuffle image-token accounting.
  • Compute each image token count from the complete image batch, max_model_len, and rendered text length.
  • Validate the model-configured image context token and atomic <img>/</img> tokenizer controls before enabling exact routing.
  • Build the routing-only sequence with media-hash padding while leaving worker-bound request tokens unchanged.
  • Gate the Nemotron processor on the vLLM engine-native Generate capability. Other backends safely fall back to text-prefix routing.
  • Document Nemotron image-routing support and its current vLLM-only scope.

Routing contract

frontend routing: text + <img> + pad(mm_hash) x N + </img>
worker KV event:  text + <img> + img_context_token_id x N + </img>
normalization:    img_context_token_id x N -> pad(mm_hash) x N

worker-bound request tokens remain unchanged

N is computed for the full image batch under the remaining context budget.

Validation

  • cargo test -p dynamo-llm --features mm-routing mm_routing --lib — 29 passed
  • cargo test -p dynamo-llm --features mm-routing nemotron --lib — 8 passed
  • cargo clippy -p dynamo-llm --features mm-routing --lib -- -D warnings
  • cargo check -p dynamo-llm --example mm_token_count --features mm-routing
  • Focused pre-commit hooks and docs lint
  • Two-worker vLLM 0.28 E2E on two GB300 GPUs with the FP8 checkpoint: A and B seeded different workers; A/B replays returned to their respective workers with 1/2 router overlap and 2128 cached tokens each.

Extended from #13989

Closes DIS-2868

@krishung5
krishung5 requested review from a team as code owners September 9, 2026 22:52
@github-actions github-actions Bot added feat documentation Improvements or additions to documentation backend::vllm Relates to the vllm backend frontend `python -m dynamo.frontend` and `dynamo-run in=http|text|grpc` labels Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: feefaa41-3bed-4ade-b694-935863477d5a

📥 Commits

Reviewing files that changed from the base of the PR and between 7e33896 and bf326b6.

📒 Files selected for processing (10)
  • .github/codeowners/areas.yaml
  • CODEOWNERS
  • components/src/dynamo/vllm/main.py
  • docs/fern/pages/use-cases/multimodal-serving/multimodal-kv-routing.md
  • lib/bindings/python/rust/lib.rs
  • lib/llm/examples/mm_token_count.rs
  • lib/llm/src/preprocessor.rs
  • lib/llm/src/preprocessor/mm_routing/image.rs
  • lib/llm/src/preprocessor/mm_routing/mod.rs
  • lib/llm/src/preprocessor/mm_routing/nemotron.rs

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


Walkthrough

The change migrates image routing from Lightseek to ImageRoutingProcessor, adds Nemotron 3 Nano Omni support, introduces request-wide image budgeting, and gates exact routing by runtime and prompt-context availability.

Changes

Multimodal routing

Layer / File(s) Summary
Routing surface and migration
.github/codeowners/areas.yaml, CODEOWNERS, components/src/dynamo/vllm/main.py, docs/fern/pages/use-cases/multimodal-serving/multimodal-kv-routing.md, lib/bindings/python/rust/lib.rs, lib/llm/examples/mm_token_count.rs, lib/llm/src/preprocessor.rs, lib/llm/src/preprocessor/mm_routing/{mod.rs,image.rs}
Ownership paths, documentation, bindings, examples, and module exports now use the MM routing structure.
Nemotron token counter
lib/llm/src/preprocessor/mm_routing/nemotron.rs
Adds Nemotron configuration validation, image geometry processing, dynamic patch budgets, request-wide counting, and contract tests.
Image processor abstraction
lib/llm/src/preprocessor/mm_routing/image.rs
Replaces LightseekMmCounter with ImageRoutingProcessor, which selects registry-backed or Nemotron processing and resolves prompt and runtime requirements.
Exact routing integration
lib/llm/src/preprocessor.rs
Adds Nemotron layouts and wrapped image expansion, vLLM runtime checks, request-wide budgeting, prompt tokenization, and fail-closed exact-routing paths.
Routing validation coverage
lib/llm/src/preprocessor.rs, lib/llm/src/preprocessor/mm_routing/image.rs, lib/llm/src/preprocessor/mm_routing/nemotron.rs
Updates existing routing tests and adds coverage for Nemotron placeholders, token budgets, runtime restrictions, wrapped expansion, and failure cases.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Merge Risk: ⚪ Minimal · up to bf326

The routing migration and Nemotron integration include fail-closed behavior and targeted validation, with no actionable merge-blocking issue identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 72.31% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 65 functions across 7 files. (3 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: adding Nemotron 3 Nano Omni image routing. It is concise and specific.
Description check ✅ Passed The description explains the motivation, implementation, routing contract, scope limitations, related issue, and validation results. It does not use the template headings exactly and does not identify…
Full details: Docstring Coverage

Explanation

Docstring coverage is 72.31% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 65 functions across 7 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI

Comment @coderabbitai help to get the list of available commands.

Comment thread lib/llm/src/preprocessor.rs Resolved
Comment thread lib/llm/src/preprocessor.rs Resolved
@krishung5
krishung5 requested a review from GuanLuo September 11, 2026 18:02

@rmccorm4 rmccorm4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving docs/codeowners changes

@rmccorm4

Copy link
Copy Markdown
Contributor

Seems like this model has some issues with estimating token counts because it is text oriented?

P2 — Incorrect text budget. nemotron.rs (line 257) budgets against rendered text; vLLM’s token-input path uses image-only dummy text. Reproduced 1,296 versus 1,323 tokens/image, shifting subsequent routing blocks.

P2 — Processor-cache mismatch. nemotron.rs (line 132) recalculates the whole batch, while vLLM retains cached per-image counts. A later single-image request predicts 2,040 tokens while its cached expansion remains 1,323. vLLM source

However, it also looks like these are not simple to fix or require making some assumptions such as disabling certain caches on vllm backend side to accurately estimate - which is not ideal, so having this "estimate" seems best case for now. Let me know if that matches your understanding.

@krishung5

Copy link
Copy Markdown
Contributor Author

Seems like this model has some issues with estimating token counts because it is text oriented?

P2 — Incorrect text budget. nemotron.rs (line 257) budgets against rendered text; vLLM’s token-input path uses image-only dummy text. Reproduced 1,296 versus 1,323 tokens/image, shifting subsequent routing blocks.
P2 — Processor-cache mismatch. nemotron.rs (line 132) recalculates the whole batch, while vLLM retains cached per-image counts. A later single-image request predicts 2,040 tokens while its cached expansion remains 1,323. vLLM source

However, it also looks like these are not simple to fix or require making some assumptions such as disabling certain caches on vllm backend side to accurately estimate - which is not ideal, so having this "estimate" seems best case for now. Let me know if that matches your understanding.

I think the issue is Nemotron’s request-context-dependent dynamic resolution instead of the model being text-oriented.

Incorrect text budget - Fixed the rendered-text versus dummy-text budget mismatch in Dynamo in 5ab70a0

Processor-cache mismatch - This is my understanding as well. The cache case is harder because vLLM stores per-image results which token count was determined by an earlier batch. This makes the expansion depending on the worker history. Disabling the processor cache would avoid that but is not a good default. I think having this "estimate" seems to be the best case for now.

@krishung5
krishung5 enabled auto-merge (squash) September 15, 2026 17:15
@krishung5
krishung5 merged commit 7163b48 into main Sep 15, 2026
191 of 203 checks passed
@krishung5
krishung5 deleted the feat/nemotron-omni-image-routing branch September 15, 2026 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend::vllm Relates to the vllm backend documentation Improvements or additions to documentation feat frontend `python -m dynamo.frontend` and `dynamo-run in=http|text|grpc` size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants