Skip to content

[Bugfix] Hash zero multimodal limits into the model compile-cache key - #86

Merged
Leonccaa merged 1 commit into
mainfrom
fix/0.2-mm-limit-compute-hash-main
Nov 4, 2026
Merged

Leonccaa merged 1 commit into
mainfrom
fix/0.2-mm-limit-compute-hash-main

Conversation

@Leonccaa

@Leonccaa Leonccaa commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Change

ModelConfig.compute_hash ignored limit_mm_per_prompt. A zero limit changes the traced language-model graph (the vision tower is replaced when image and video are both zero; input IDs are fed instead of embeddings when every modality is zero and precomputed embeddings are off), so a text-only config and a multimodal config sharing one compile-cache root could load each other's compiled graphs.

Upstream vLLM #54642 hashes every limit value. Non-zero values do not change the graph, so this change hashes only the sorted set of zero-limit modalities together with enable_mm_embeds, and only when some limit is zero. Configs without a zero limit keep exactly the previous hash and their existing compile caches. A comment in mm_limit_hash_factors notes that a model which uses a non-zero limit value inside the compiled graph would have to be added there.

No new switch.

Risk and rollback: configs with a zero limit get a new compile-cache key once (one cold compile). Revert this commit to return to the previous key.

Validation

  • tests/config/test_mm_limit_compute_hash.py: 9 passed: factor helper cases, and ModelConfig hashes on a local Qwen2-VL config (no zero limit gives exactly the previous hash; text-only, image-off and embeds variants all differ).
  • The hash of a config without zero limits was compared byte for byte with the unpatched code.
  • GPU: part of the 0.2.0rc4 release (DFlash2 production configuration on 4x V100 with TP4, multimodal limits all non-zero, so its key is unchanged), now running in production.
  • pre-commit on the changed files, including mypy.

Attribution

Adapted from upstream vLLM #54642 (conditional on zero limits, see above); upstream authorship credited. AI-assisted change (Claude); the submitter reviewed every changed line. Commits are signed off.

🤖 Generated with Claude Code

ModelConfig.compute_hash ignored limit_mm_per_prompt. A zero limit changes
the traced language-model graph (vision tower replaced when image and video
are both zero; input IDs instead of embeddings when every modality is zero
and precomputed embeddings are off), so a text-only config and a multimodal
config sharing one cache root could load each other's compiled graphs.

Upstream vLLM #54642 hashes every limit value. Non-zero values do not change
the graph, so hash only the sorted set of zero-limit modalities together
with enable_mm_embeds, and only when some limit is zero. Configs without a
zero limit keep exactly the previous hash and existing compile caches.

CPU tests: factor helper cases, and ModelConfig hashes on a local Qwen2-VL
config (no zero limit equals the previous hash; text-only, image-off and
embeds variants all differ).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
@Leonccaa
Leonccaa merged commit 3aa4db2 into main Nov 4, 2026
4 checks passed
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