Skip to content

[None][modeling_v2] Multimodal mixin for modeling_v2 - #22164

Draft
2ez4bz wants to merge 3 commits into
NVIDIA:mainfrom
2ez4bz:dev-multimodal-v2
Draft

2ez4bz wants to merge 3 commits into
NVIDIA:mainfrom
2ez4bz:dev-multimodal-v2

Conversation

@2ez4bz

@2ez4bz 2ez4bz commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

@coderabbitai summary

Description

Test Coverage

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.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

* Why?
Multimodal execution contracts need a shared home that both model
implementations and the executor can reference consistently.

* What?
Relocate the mixin, encoder groups, cache contracts and prefetch helpers
to _torch/multimodal. Migrate model, executor and test imports while
preserving behavior, and assign shared runtime ownership.

Signed-off-by: William Zhang <133824995+2ez4bz@users.noreply.github.com>
* Why?
The Qwen V2 vision path repeats encoder work across prefill chunks and
bypasses the shared encoder cache and prefetch contracts.

* What?
Expose active encoder-row preparation independently of token fusion and
use it directly from the V2 decoder shell. Keep the target vision ops,
token splice and speculative hooks, with explicit item partitions and
stream-local attention scratch. Preserve legacy import compatibility.

Leave item scheduling disabled until its maximum profiling image fits
the target-certified per-frame patch bound.

Signed-off-by: William Zhang <133824995+2ez4bz@users.noreply.github.com>
* Why?

Modeling V2 targets run their own decoder, but MultimodalModelMixin also
carried the composite-model delegation to a separate language model.
Integrated targets had to shadow that delegation to avoid recursion, and
nothing required a target of a multimodal checkpoint to use the shared
runtime at all.

* What?

Split MultimodalRuntimeMixin, the executor capability contract and
encoder runtime, from MultimodalModelMixin, which keeps the composite
delegation, forward and default fusion. Executor gates use the runtime
base.

Pair active encoder rows with the executor's placeholder positions in
prepare_multimodal_embeddings. Add model-side declarations for the
largest encoder item, concurrent-stream encoding (required for
side-stream prefetch) and breakable prefill CUDA graph support, and apply
the item bound in encoder memory profiling and item scheduling.

Require every Modeling V2 target of a checkpoint whose input processor
accepts media to inherit MultimodalRuntimeMixin or the new TextOnlyTarget
marker; check it at route resolution and, for routed targets, in a CPU
source test. Check the declared embedding layout on constructed runtime
models. Mark the text-only Kimi K3 VL and MiniMax M3 targets, and move
the Qwen3.8 Flash Next target onto the runtime base.

Signed-off-by: William Zhang <133824995+2ez4bz@users.noreply.github.com>

This branch has not been deployed

No deployments
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