Skip to content

[TRTLLM-15824][feat] Enable EVS handoff for Nemotron-H in EPD - #19702

Merged
eopXD merged 1 commit into
NVIDIA:mainfrom
eopXD:feat/nemotron-evs-handoff
Oct 2, 2026
Merged

eopXD merged 1 commit into
NVIDIA:mainfrom
eopXD:feat/nemotron-evs-handoff

Conversation

@eopXD

@eopXD eopXD commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Nemotron-H already supports EVS in aggregated inference, but its encoder-to-prefill handoff did not preserve the retained-token layout needed for EVS under EPD. This MR enables that handoff for video-only requests, including multiple videos per request; audio and mixed-modality handoff remain unsupported.

Other model families have separate support gaps:

  • Qwen2.5-VL: requires video handoff support and EVS implementation.
  • Qwen3-VL, Qwen3.5, and Cosmos3: share an image/video handoff path, but do not implement EVS.

These gaps can be addressed in follow-up MRs, keeping this MR’s EVS enablement scoped to Nemotron-H.

The shared changes forward video_pruning_rate to encoder preprocessing and transport optional per-item metadata through the runner, sampler, and embedding handles without interpreting its contents. Nemotron-H produces per-tubelet retained-token counts and uses them on prefill to validate and finalize the prompt layout before scheduling. Prefill then consumes the attached embeddings without repeating the EVS layout rewrite.

Validation:

  • test_handoff_rebuilds_pruned_video_layout covers prompt reconstruction; test_mm_encoder_handoff_preserves_per_item_metadata_in_sparse_batch covers the combined runner-to-handle transport.

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

Dev Engineer Review

The change passes per-video retained-token counts from the encoder through embedding handles to Nemotron-H disaggregated prefill. The prefill path uses those counts to rebuild the video prompt layout and avoids reapplying the EVS rewrite to attached embeddings. The metadata transport adds an optional argument to PyResult.append_mm_embeddings; calls without metadata retain the prior behavior.

The documented scope is video-only. Audio and mixed-modality handoff remain unsupported. Follow-up work is identified for Qwen2.5-VL, Qwen3-VL, Qwen3.5, and Cosmos3. Runtime validation remains pending; pytest collection was reported blocked by missing mpi4py. Current review findings were not provided.

QA Engineer Review

Two unit-test files changed. They cover sparse-batch metadata transport and Nemotron-H EVS handoff, including singleton and multiple videos, tokenized and text prompts, zero-token tubelets, invalid retained-count metadata, and chunked prefill. Neither test file appears in the searched test-db/ CI or qa/ manual-QA lists. The tests exercise the new handoff paths, but integration-list coverage and runtime validation need follow-up. Coverage verdict: needs follow-up.

Per-File QA Perspective

  • tensorrt_llm/_torch/models/modeling_nemotron_h_multimodal.py — Verify retained-count validation, prompt-layout reconstruction, and prefill with attached video embeddings. Confirm behavior for EVS-disabled requests and unsupported mixed-modality inputs.
  • tensorrt_llm/_torch/pyexecutor/engine/runners/mm_encoder.py — Verify metadata remains aligned with payload-bearing items in sparse encoder batches.
  • tensorrt_llm/_torch/pyexecutor/llm_request.py — Verify optional metadata is matched to embedding lengths and stored on the corresponding handles. The API change should preserve calls that omit metadata.
  • tensorrt_llm/_torch/pyexecutor/sampler/sampler.py — Verify batch-size validation and per-item metadata forwarding; confirm batches without metadata retain their existing behavior.
  • tensorrt_llm/llmapi/mm_encoder.py — Verify configured video_pruning_rate reaches input-processor creation, and that no keyword is passed when the value is None.
  • tests/unittest/_torch/executor/engine/test_runners.py — Covers sparse encoder batches, embedding serialization, and video metadata transport. No matching entry was found in the searched CI or manual-QA lists.
  • tests/unittest/_torch/modeling/test_modeling_nemotron_h_multimodal.py — Sets video_pruning_rate in the handoff fixture and removes the prior rejection test for EVS video embeddings. No matching entry was found in the searched CI or manual-QA lists.
  • tests/unittest/_torch/modeling/test_nemotron_h_multimodal_preprocessing.py — Adds EVS handoff layout and invalid-metadata checks, encoder metadata tests, and prefill tests for regular and chunked inputs. No matching entry was found in the searched CI or manual-QA lists.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: NVIDIA/TensorRT-LLM/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: df21dd4a-3510-4c4d-a035-cbee0dbbcfc0

📥 Commits

Reviewing files that changed from the base of the PR and between 560c87e and 87219cd.

📒 Files selected for processing (7)
  • tensorrt_llm/_torch/models/modeling_nemotron_h_multimodal.py
  • tensorrt_llm/_torch/pyexecutor/engine/runners/mm_encoder.py
  • tensorrt_llm/_torch/pyexecutor/llm_request.py
  • tensorrt_llm/_torch/pyexecutor/sampler/sampler.py
  • tensorrt_llm/llmapi/mm_encoder.py
  • tests/unittest/_torch/executor/engine/test_runners.py
  • tests/unittest/_torch/modeling/test_nemotron_h_multimodal_preprocessing.py

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


Walkthrough

The encoder records per-video retained-token counts, and the executor carries them with multimodal embedding handles. Disaggregated prefill validates those counts and uses them to rebuild video placeholder layouts. Attached embeddings bypass the raw-input EVS merge path.

Changes

EVS video embedding handoff

Layer / File(s) Summary
Configure video pruning and record counts
tensorrt_llm/llmapi/mm_encoder.py, tensorrt_llm/_torch/models/modeling_nemotron_h_multimodal.py, tests/unittest/_torch/modeling/test_nemotron_h_multimodal_preprocessing.py
The input processor receives video_pruning_rate when configured. The encoder records retained-token counts per video in embedding metadata. Tests check the metadata and embedding order.
Carry metadata through the executor
tensorrt_llm/_torch/pyexecutor/engine/runners/mm_encoder.py, tensorrt_llm/_torch/pyexecutor/sampler/sampler.py, tensorrt_llm/_torch/pyexecutor/llm_request.py, tests/unittest/_torch/executor/engine/test_runners.py
The runner returns aligned metadata, and the sampler passes each entry to PyResult. PyResult attaches metadata to embedding handles. Tests cover sparse batches and handle restoration.
Validate and consume video counts in prefill
tensorrt_llm/_torch/models/modeling_nemotron_h_multimodal.py, tests/unittest/_torch/modeling/test_nemotron_h_multimodal_preprocessing.py, tests/unittest/_torch/modeling/test_modeling_nemotron_h_multimodal.py
Disaggregated prefill validates retained counts against tubelets, embedding lengths, and placeholder layout. Attached embeddings remain outside the raw-input EVS merge path. Tests cover prompt layouts, count validation, and full and chunked prefill.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant NemotronHMultimodalEncoder
  participant MultimodalEncoderRunner
  participant MultimodalResult
  participant EarlyStopWithMMResult
  participant PyResult
  NemotronHMultimodalEncoder->>MultimodalEncoderRunner: Provide video embeddings with retained-count metadata
  MultimodalEncoderRunner->>MultimodalResult: Return embeddings and aligned metadata
  MultimodalResult->>EarlyStopWithMMResult: Validate metadata count against embeddings
  EarlyStopWithMMResult->>PyResult: Pass per-embedding metadata
  PyResult->>PyResult: Attach metadata to embedding handles
Loading

Suggested reviewers: juney-nvidia

Merge Risk: ⚪ Minimal · up to 87219

The video handoff preserves retained-token metadata and finalized prompt layouts. No actionable merge-blocking risk remains; end-to-end execution was not verified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 29.17% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the ticket, change type, and main change: enabling EVS handoff for Nemotron-H in EPD.
Description check ✅ Passed The description explains the problem, solution, scope limitations, implementation details, and relevant test coverage. It also includes the required PR checklist and marks the review confirmation as c…
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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

@eopXD eopXD changed the title [TRTLLM-12534][feat] Enable EVS handoff for Nemotron-H in EPD [TRTLLM-15824][feat] Enable EVS handoff for Nemotron-H in EPD Sep 29, 2026
Preserve per-tubelet retained-token counts in encoder results and carry
per-item metadata through the runner, sampler, and embedding handles.
Use those counts to finalize video prompt layouts before prefill scheduling
and consume attached embeddings without repeating the EVS layout rewrite.

Forward the configured pruning rate to encoder preprocessing and validate
handoff counts against tubelet and embedding sizes. Cover sparse result
batches, singleton and multiple videos, zero-token tubelets, malformed
metadata, and chunked prefill with CPU regression tests.

Signed-off-by: Yueh-Ting Chen <[email protected]>
@eopXD
eopXD force-pushed the feat/nemotron-evs-handoff branch from 560c87e to 87219cd Compare September 30, 2026 11:03
@eopXD

eopXD commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #75820 [ run ] triggered by Bot. Commit: 87219cd Link to invocation

@mikeiovine mikeiovine left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Stamp on behalf of runtime devs, delegating proper review to @NVIDIA/trt-llm-models-devs; please ping me if you think this is not accurate

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #75820 [ run ] completed with state SUCCESS. Commit: 87219cd
/LLM/main/L0_MergeRequest_PR pipeline #62514 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@yechank-nvidia yechank-nvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM on modeling-side.

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

Automatically added "ci: full pre-merge approved" because this PR has satisfied the required GitHub review approvals. Unresolved review conversations and other required checks remain independent merge requirements.

@trtllm-agent

This comment has been minimized.

@coderabbitai

This comment has been minimized.

@trtllm-agent

This comment has been minimized.

@coderabbitai

This comment has been minimized.

@eopXD

eopXD commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #75965 [ run ] triggered by Bot. Commit: 87219cd Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #75965 [ run ] completed with state SUCCESS. Commit: 87219cd
/LLM/main/L0_MergeRequest_PR pipeline #62636 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@trtllm-agent

This comment has been minimized.

@coderabbitai

This comment has been minimized.

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Semantic conflict review

The verdict of record is the Semantic conflict with target branch / PR #19702 commit status on the requested head commit. This summary updates on reply events and may lag between a new request and its reply.

Latest recorded state: No semantic conflict found (best effort) for head 87219cdec0f333296f05ad9e493ed7df313b87ce, target 5ce4cb57cb8eb0635cfd00be0820eead8f15e122, merge base abddfc99145681af60fd36d76cb3938b04f174f8 (request 44f983a5-4bff-47ea-b189-95cc58c62dba). CodeRabbit analysis.

Best-effort AI judgment for the recorded revisions. PASS, FAIL and INCONCLUSIVE may be incomplete or incorrect. PR authors and reviewers should independently verify the evidence and relevant behavior. This semantic review and its status/workflow are advisory, not required merge checks under current repository rules; other merge requirements still apply. Advisory status does not make a confirmed defect safe to ignore.

Requested (UTC) Head Target Verdict Comment
2026-10-02T02:46:30Z 87219cdec0f3 5ce4cb57cb8e PASS reply
2026-10-01T19:04:44Z 87219cdec0f3 28c5d5a5c560 PASS reply
2026-10-01T12:50:13Z 87219cdec0f3 ee510fc85d39 PASS reply
2026-10-01T04:49:08Z 87219cdec0f3 95cb50c35883 PASS reply

Processed request and reply comments are minimized to reduce timeline noise; they remain expandable for audit.

@trtllm-agent

This comment has been minimized.

@coderabbitai

This comment has been minimized.

@eopXD

eopXD commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator Author

/bot skip --comment "Skipping CI. Locally verifyied running EPD with EVS."

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #76057 [ skip ] triggered by Bot. Commit: 87219cd Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #76057 [ skip ] completed with state SUCCESS. Commit: 87219cd
Skipping testing for commit 87219cd

Link to invocation

@eopXD
eopXD merged commit 6096aa8 into NVIDIA:main Oct 2, 2026
16 of 17 checks passed
@eopXD
eopXD deleted the feat/nemotron-evs-handoff branch October 20, 2026 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants