Skip to content

feat(vlm): load Hugging Face InternVL 3.5 checkpoints - #3638

Merged
inureyes merged 5 commits into
mainfrom
feat/issue-2393
Dec 1, 2026
Merged

inureyes merged 5 commits into
mainfrom
feat/issue-2393

Conversation

@inureyes

@inureyes inureyes commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Add the native Hugging Face InternVL 3.5 layout with a Qwen3 decoder to the existing InternVL image runtime. The loader maps the image tower and quantized projector tensors, fuses dense vision Q/K/V rows, and reads the checkpoint's prompt token IDs and image sequence length. The HF encoder and projector use tanh GELU.

Verification

  • Built the CLI, server, trace example and test harness for ROCm gfx1151 and for CPU. The following inference results use CPU.
  • mlxcel arch lists InternVL 3.5 HF. All 54 focused InternVL and LLM-jp-VL tests passed.
  • The trace from mlx-community/InternVL3_5-1B-4bit had the same 271 prompt IDs as the mlx-vlm 0.8.1 reference. Both scored the same 18 continuation tokens on a 336×336 photo. The tanh candidate had 0/18 top-1 disagreements and 0/3 on decided positions (reference gap ≥2.0). Forcing erf in both HF activation sites changed 1/18 top-1 predictions, at a gap of 0.125, and had 0/3 decided disagreements.
  • mlxcel generate, the CLI's in-process server client, and a POST to the mounted server router all emitted the following 64-token greedy response to “Describe this image.” The request used a local JPEG of two men on a sports field.

The image depicts two men on what appears to be a sports field, likely during a game or event. Both are dressed in formal black suits, indicating they might be part of a team or organization. The man on the left is bald and appears to be shouting or expressing strong emotions, possibly due to a critical or intense

The mounted-route check posted a base64 JPEG image_url part through the production Axum router at /v1/chat/completions with Tower’s in-process HTTP service. It returned HTTP 200. The sandbox denied binding the standalone server listener.

Closes #2393

@inureyes inureyes added status:review Under review type:enhancement New features, capabilities, or significant additions priority:medium Medium priority area:models Model architectures, weights, loading, metadata modelsize:small 4-bit checkpoint <= 10GB; fast iteration, safe for smoke tests modeltype:vlm Vision-language model arch:dense Dense transformer decoder labels Dec 1, 2026
@inureyes inureyes added status:done Completed and removed status:review Under review labels Dec 1, 2026
# Conflicts:
#	src/models/detection_tests.rs
@inureyes
inureyes marked this pull request as ready for review December 1, 2026 22:34
@inureyes
inureyes merged commit 3cabbc4 into main Dec 1, 2026
14 of 15 checks passed
@inureyes
inureyes deleted the feat/issue-2393 branch December 1, 2026 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch:dense Dense transformer decoder area:models Model architectures, weights, loading, metadata modelsize:small 4-bit checkpoint <= 10GB; fast iteration, safe for smoke tests modeltype:vlm Vision-language model priority:medium Medium priority status:done Completed type:enhancement New features, capabilities, or significant additions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(vlm): add InternVL 3.5 HF layout (internvl) support

1 participant