Repository navigation
feat(models): add Molmo v1 (molmo-7b) VLM architecture - #41
Merged
Merged
Conversation
Add support for the Molmo v1 vision-language model (`molmo-7b`). The architecture pairs a CLIP-style ViT image encoder with attention pooling and a connector into an OLMo-style text decoder, loaded through the VLM special path. The multi-crop image processor emits pixel values, per-crop masks, and the `image_input_idx` mapping; the VLM runtime uses that mapping to expand the `<im_patch>` placeholders and additively scatter the pooled image features onto the text embeddings at the named positions before the forward pass. Wiring spans the full model flow rather than a standalone module: `molmo` model-type detection, the `ModelType::MolmoVLM` registry entry (enum variant, `metadata()` arm, `ALL_MODEL_TYPES`, capabilities), the loader in `loading/vlm_special.rs`, the VLM runtime merge path, and `generate_vlm`. Real-model parity tests in `tests/molmo_parity.rs` cover model-type detection, the processor's crop/token/`image_input_idx` shapes, and finite logits on both the text-only and image-conditioned forward passes; they are gated on a local `models/molmo-7b` checkout and stay inert without it. This batch also restores `ModelType::InternVLChatVLM` to `ALL_MODEL_TYPES`. The variant was already present in the enum and in `metadata()`, but its absence from the slice meant InternVL never appeared in `mlxcel list`, and because the slice is not compile-enforced for completeness no existing test caught the gap. Both InternVL and Molmo now show up in `mlxcel list`. The M5 Max benchmark tables flip `molmo-7b` from FAIL to a passing row (text-only 78.74 tok/s decode, VLM 84.99 tok/s decode), raise the pass count to 93, and drop it from the known-issues list.
inureyes
added a commit
that referenced
this pull request
May 23, 2026
Bump version to 0.0.30. Highlights: unified pre-load memory estimator with the new mlxcel inspect subcommand and --estimate-memory preflight (#64, #65, #66, #67), Molmo v1 and InternVL VLM architectures (#41, #37), Gemma 3n / Phi-3.5 / Gemma / Jamba decode performance work (#42, #43, #44, #60, #62), and server --ctx-size as a shared parallel context budget (#57).
be-free-snowboy
pushed a commit
to freestylejs/snowbrain-mlxcel
that referenced
this pull request
Oct 27, 2026
Add support for the Molmo v1 vision-language model (`molmo-7b`). The architecture pairs a CLIP-style ViT image encoder with attention pooling and a connector into an OLMo-style text decoder, loaded through the VLM special path. The multi-crop image processor emits pixel values, per-crop masks, and the `image_input_idx` mapping; the VLM runtime uses that mapping to expand the `<im_patch>` placeholders and additively scatter the pooled image features onto the text embeddings at the named positions before the forward pass. Wiring spans the full model flow rather than a standalone module: `molmo` model-type detection, the `ModelType::MolmoVLM` registry entry (enum variant, `metadata()` arm, `ALL_MODEL_TYPES`, capabilities), the loader in `loading/vlm_special.rs`, the VLM runtime merge path, and `generate_vlm`. Real-model parity tests in `tests/molmo_parity.rs` cover model-type detection, the processor's crop/token/`image_input_idx` shapes, and finite logits on both the text-only and image-conditioned forward passes; they are gated on a local `models/molmo-7b` checkout and stay inert without it. This batch also restores `ModelType::InternVLChatVLM` to `ALL_MODEL_TYPES`. The variant was already present in the enum and in `metadata()`, but its absence from the slice meant InternVL never appeared in `mlxcel list`, and because the slice is not compile-enforced for completeness no existing test caught the gap. Both InternVL and Molmo now show up in `mlxcel list`. The M5 Max benchmark tables flip `molmo-7b` from FAIL to a passing row (text-only 78.74 tok/s decode, VLM 84.99 tok/s decode), raise the pass count to 93, and drop it from the known-issues list.
be-free-snowboy
pushed a commit
to freestylejs/snowbrain-mlxcel
that referenced
this pull request
Oct 27, 2026
Bump version to 0.0.30. Highlights: unified pre-load memory estimator with the new mlxcel inspect subcommand and --estimate-memory preflight (lablup#64, lablup#65, lablup#66, lablup#67), Molmo v1 and InternVL VLM architectures (lablup#41, lablup#37), Gemma 3n / Phi-3.5 / Gemma / Jamba decode performance work (lablup#42, lablup#43, lablup#44, lablup#60, lablup#62), and server --ctx-size as a shared parallel context budget (lablup#57).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the Molmo v1 vision-language model (
molmo-7b) to mlxcel. The architecture pairs a CLIP-style ViT image encoder with attention pooling and a connector into an OLMo-style text decoder, loaded through the VLM special path. The multi-crop image processor emits pixel values, per-crop masks, and theimage_input_idxmapping; the VLM runtime expands the<im_patch>placeholders and additively scatters the pooled image features onto the text embeddings at the named positions before the forward pass.What's included
vision/encoders/molmo.rs(CLIP ViT + attention pooling),vision/molmo_vl.rs(additive-scatter merge keyed byimage_input_idx),vision/processors/molmo.rs(multi-crop processor), andmodels/molmo.rs(OLMo-style decoder).molmomodel-type detection, theModelType::MolmoVLMregistry entry (enum,metadata(),ALL_MODEL_TYPES, capabilities), the loader inloading/vlm_special.rs, the VLM runtime merge path, andgenerate_vlm.tests/molmo_parity.rs): model-type detection, processor crop/token/image_input_idxshapes, and finite logits on both text-only and image-conditioned forward passes. Gated on a localmodels/molmo-7bcheckout, inert in CI without it.Folded-in fix: InternVL in
mlxcel listModelType::InternVLChatVLMwas already in the enum andmetadata()but missing fromALL_MODEL_TYPES, so InternVL never appeared inmlxcel list. The slice is not compile-enforced for completeness, so no test caught it. This PR adds it (right afterYoutuVLM); both InternVL and Molmo now list correctly.Benchmarks (M5 Max)
molmo-7bflips from FAIL to a passing row — text-only 78.74 tok/s decode, VLM 84.99 tok/s decode — raising the pass count to 93 and dropping it from the known-issues list. The upstream mlx-vlm baseline for this model is a 1-token anomaly, so no percentage comparison is reported.Verification
cargo fmt --all -- --checkcleancargo clippy --all-targets --features metal,accelerate -- -D warningscleanall_model_types_covers_every_variant,metadata_round_trip_is_consistent,all_model_types_has_no_duplicates)tests/molmo_parity.rs4/4 pass against a realmolmo-7bcheckoutmlxcel listshows bothMolmo (CLIP ViT + OLMo-style text)andInternVL (InternViT + pixel-shuffle + Qwen2)