Skip to content

[TRTLLM-12417][feat] Exact multimodal cache hashing + EPD unlock for videos#13724

Closed
venkywonka wants to merge 27 commits into
NVIDIA:mainfrom
venkywonka:mm-cache-hash-span-contract-narrow-validated
Closed

[TRTLLM-12417][feat] Exact multimodal cache hashing + EPD unlock for videos#13724
venkywonka wants to merge 27 commits into
NVIDIA:mainfrom
venkywonka:mm-cache-hash-span-contract-narrow-validated

Conversation

@venkywonka

@venkywonka venkywonka commented May 4, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR makes multimodal prompt-layout bookkeeping exact for non-contiguous multimodal token layouts.
The PR also pipecleans metadata transport to enable video support for EPD disagg.

The legacy cache contract reduced each multimodal item
to a single approximate prompt span. That loses the real prompt geometry when an
item is represented by multiple prompt-token runs or when special wrapper tokens
belong to the multimodal layout but do not consume encoder-output rows.

The PR introduces multimodal_item_runs as the canonical internal layout. Each
multimodal item carries ordered contiguous prompt-token runs, plus local
non_embed_offsets for multimodal wrapper tokens.

Runtime code derives
embedding lengths, prompt lengths, cache-key spans, disaggregated prompt
expansion, and backend request metadata from that canonical layout.

Goals

  • Represent multimodal prompt layout as per-item contiguous runs instead of a
    lossy single start/length span.
  • Preserve item-run metadata through Python preprocessing, C++ request types,
    nanobind bindings, executor request construction, serialization, Triton
    backend request transport, and disaggregated handoff.
  • Generate multimodal KV-cache extra keys from exact item runs so text or
    framing gaps do not inherit multimodal content hashes, while later sparse
    multimodal islands still get the correct hash and item offset.
  • Expand Qwen2-VL and Qwen3-VL disaggregated prompt token IDs from item runs for
    video layouts where markers do not one-to-one map to contiguous embeddings. This unlocks EPD for videos.
  • Keep OpenAI JSON disaggregated parameters scoped to JSON-safe state for this
    PR; multimodal disaggregated JSON transport remains a follow-up.

Review Map

  • Core item-run contract and producers:
    tensorrt_llm/inputs/, multimodal modeling helpers, and focused input tests.
  • Runtime ABI and serialization:
    C++ executor/batch-manager request types, nanobind bindings, pyexecutor
    request plumbing, MultimodalInput serialization, and serialization tests.
  • Cache correctness:
    C++ block-key generation, KV-cache manager tests, Python V2 resource-manager
    cache-key estimation, cache-event tests, and item-run offset handling.
  • Disaggregated EPD propagation:
    DisaggregatedParams, LLM preprocessing, result handoff, Qwen VL prompt
    expansion, and disaggregated item-run tests.
  • Backend transport:
    Triton inflight batcher utilities and tests for validated item-run transport.
  • AutoDeploy boundary:
    Qwen3.5 MoE VLM custom model/shim paths and tests for single-run item staging
    plus explicit sparse same-item rejection.
  • Scope cleanup:
    OpenAI protocol/server paths now avoid exposing non-JSON-safe multimodal
    disaggregated state in this PR.
image

Test Coverage

  • C++ focused coverage:
    • blockKeyTest
    • kvCacheManagerTest
    • multimodalInputTest
    • serializeUtilsTest
    • Triton inflight batcher utilsTest
  • Python focused coverage:
    • multimodal input item-run validation and derived metadata
    • multimodal embedding length derivation
    • runtime and executor binding coverage
    • Python KV-cache estimation and V2 item-run cache keys
    • disaggregated item-run propagation and Qwen VL prompt expansion
    • LLM KV-cache event multimodal input coverage
    • AutoDeploy Qwen3.5 model/shim coverage
  • Validation already performed on this branch family before the final history
    rewrite:
    • Python focused gates: 101 passed, 158 deselected
    • Native focused gates: 9 passed
    • git diff --check passed
    • Qwen2-VL-2B MMMU smoke matched baseline: feature accuracy 40.0, baseline
      accuracy 40.0, mm_keys=654
    • Qwen3-VL EPD C/G service smoke on Lyris passed for both baseline and
      feature; both returned the same multimodal response

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why.

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

  • Test cases are provided for new code paths.

  • 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.

@venkywonka venkywonka changed the title [TRTLLM-12417][feat] Accurate Multimodal input layout handling for non-contiguous embeddings [TRTLLM-12417][feat] Exact cache block-hashing + EPD unlock for videos May 6, 2026
@venkywonka venkywonka changed the title [TRTLLM-12417][feat] Exact cache block-hashing + EPD unlock for videos [TRTLLM-12417][feat] Exact multimodal cache hashing + EPD unlock for videos May 6, 2026
venkywonka added 27 commits May 5, 2026 22:09
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Validation:

- Local rc13 feature container: pytest tests/unittest/inputs/test_inputs_multimodal_item_runs.py tests/unittest/_torch/executor/test_kv_cache_v2_multimodal_item_runs.py tests/unittest/disaggregated/test_disaggregated_multimodal_item_runs.py -q => 21 passed, 2 warnings.

- Lyris GB200 source-built feature env: post-build focused validation => 21 passed, 5 warnings; import-origin red_flags=[]; CUDA smoke saw NVIDIA GB200.

- Lyris binding probe: multimodal_item_runs=True and multimodal_hash_positions=False.

- Local Qwen2-VL-2B MMMU 30-image A/B smoke: upstream baseline 40.0, feature 40.0, delta 0.0.

Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
@venkywonka
venkywonka force-pushed the mm-cache-hash-span-contract-narrow-validated branch from d94c103 to bd07578 Compare May 6, 2026 05:16
@venkywonka

Copy link
Copy Markdown
Collaborator Author

closign this in favor of #13815 and #13864

@venkywonka venkywonka closed this May 11, 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